简体   繁体   中英

Getting this error while trying BDD cucumber Selenium when designing Page object model

线程“主要” cucumber.runtime.CucumberException中的异常:java.lang.AbstractMethodError:cucumber.runtime.java.picocontainer.PicoFactory.addClass(Ljava / lang / Class;)V atcumul.runtime.java.JavaBackend.addStepDefinition(JavaBackend .java:154)在cucumber.runtime.java.MethodScanner.scan(MethodScanner.java:68)在cucumber.runtime.java.MethodScanner.scan(MethodScanner.java:41)在cucumber.runtime.java.JavaBackend.loadGlue(黄瓜(cucumber.runtime.runtime)的JavaBackend.java:86)(黄瓜).runtime.runtime(runtime.java:69)的黄瓜.runtime.runtime。(runtime.java:65)的黄瓜.api.cli.Main.run(Main.java:35)在cucumber.api.cli.Main.main(Main.java:18)造成原因:java.lang.AbstractMethodError:cucumber.runtime.java.picocontainer.PicoFactory .addClass(Ljava / lang / Class;)V atcumul.runtime.java.JavaBackend.addStepDefinition(JavaBackend.java:149)...还有8个

The problem is that cucumber cannot find your glue libraries. The commandline runner is in the stack trace which suggests that you are not following the syntax rules for CLI. Here is an example:

mvn clean test -Dcucumber.options="--tags @search --monochrome --plugin pretty:STDOUT --plugin html:target/cucumber-html-report --plugin json:target/cucumber.json --glue steps --glue runsupport classpath:features"

Note the double dash characters before keywords. Also notice that since there are two glue paths that there are two --glue clauses. Also note that only the package name of the two -glue paths were specified.

Further note that STDOUT needed to be specified on --plugin pretty:STDOUT.

Finally note that the features keyword was dropped completely. The path specified at the end (without a keyword) tells cucumber-jvm where to find the feature files.

Be warned, if you get any of this wrong then cucumber-jvm gives you cryptic error messages with which you have first hand knowledge. The usage is explained here .

BTW, claspath: refers to, in this case, the Maven default classpath which for features is

src/test/resources/

If you want help in the future post the minimum code necessary to reproduce the problem. Remember that your brain is not a network connected device. :-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM