Search code examples
cucumbercucumber-java

Set Glue Code to External Libraries in Cucumber


We have multiple testing repos, and some of the scenarios depend on the steps already created in a separate repo, so I'm trying to build the JAR file and include it in the external libraries of the other repo. Then I define my gluecode in the IntelliJ runner with two separate lines:

com.edge.automation
C:\Users\MY_NAME\.m2\repository\com\reissue-automation\2.0.3-SNAPSHOT\reissue-automation-2.0.3-SNAPSHOT-tests.jar!\com.reissue.automation.stepdefinitions

IntelliJ is able to recognize the Gherkin sentence, but when I run it, it is throwing this exception:

eissueautomationstepdefinitions'
    at io.cucumber.core.options.CucumberPropertiesParser.parseAll(CucumberPropertiesParser.java:156)
    at io.cucumber.core.options.CucumberPropertiesParser.parse(CucumberPropertiesParser.java:88)
    at io.cucumber.core.cli.Main.run(Main.java:48)
    at io.cucumber.core.cli.Main.main(Main.java:33)

Does anybody know what this error means or if it's possible to include glue code from external libraries?


Solution

  • I ended up running the following command to copy my dependencies into the target folder which added it to the classpath.

    mvn install dependency:copy-dependencies -DskipTests
    

    Then it picked up the glue no problem.

    com.edge.automation
    com.reissue.automation.stepdefinitions
    

    If anyone has a better solution feel free to post.