Когда я запускаю сборку Maven, используя pom.xml
для вызова testng.xml
, я обнаруживаю 0 сценариев и 0 шагов 0m0.000s. Кто-нибудь может мне помочь? Спасибо!
Команда для выполнения сборки Maven:
mvn clean test -Dsurefire.suiteXmlFiles="C:\Users\User\eclipse-workspace\project\src\test\resources\testng.xml"
Код работает нормально, когда я запускаю тесты отдельно с testrunner.class
или testng.xml
. Но невозможно запустить весь проект с помощью теста Maven.
Каталог файлов
pom.xml
4.0.0 проект проект 1.0-SNAPSHOT jar проект http://maven.apache.org UTF-8 org. apache .maven.plugins maven-compiler-plugin 3.1 1,7 1,7 org. apache .maven.plugins maven-resources-plugin 3.1.0 org. apache .maven.plugins maven-surefire-plugin 3.0.0-M5 $ {suiteXmlFile} true jcenter bintray http://jcenter.bintray.com io.cucumber cucumber-jvm-deps 1.0.6 net .mastergotit огурец-отчетный 1.0.0 info.cukes gherkin 2.12.2 предоставляется info.cukes огурец-тестнг 1.2.5 компилировать юнит юнит io.cucumber огурец-пикоконтейнер 2.4.0 io. огурец огурец- html 0,2,7 net .sourceforge.cobertura cobertura 1.9.4.1 org.hamcrest hamcrest-core 1.3 org.testng testng 6,10 org.seleniumhq.selenium selenium- java 3.141.59 com.google. api-client google-api-client 1.28.0 io.cucumber cucumber-testng 2.0.0 io.appium java -клиент 5.0.0-BETA6 org. apache .poi пои-оо xml 3,17 инф. Огурцы огурец- java 1.2.5 info.cukes огурец-юнит 1.2.5 юнит юнит 4,12 info.cukes огурец-пикоконтейнер 1.2.5 com.aventstack extensionreports-cucumber4-adapter 1.0.6 com.aventstack extensionreports 3.1.2 org.freemarker freemarker 2.3.28 org.mongodb mon go - java -драйвер 3.10.2 io.cucumber огурец-корнишон 5.6.0 релевантные коды отчеты о степени 2.41.2 com.vimalselvam cucumber-extentsreport 3.0.2
testng. xml
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" verbose="1" parallel="tests" thread-count="1" configfailurepolicy="continue">
<test name="Test" annotations="JDK" preserve-order="true">
<classes>
<class name="Cucumber.testRunner"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
testrunner. java
@CucumberOptions(
features="src/test/java/feature/",
glue= {"teststeps"},
format = {"pretty","html:target/cucumber-reports/cucumber-pretty","json:target/cucumber-reports/CucumberTestReport.json", "rerun:target/cucumber-reports/rerun.txt"},
plugin = {"json:target/cucumber-reports/CucumberTestReport.json"}
)
public class testRunner {
private TestNGCucumberRunner testNGCucumberRunner;
@BeforeClass(alwaysRun = true)
public void setupclass() throws Exception {
testNGCucumberRunner = new TestNGCucumberRunner(this.getClass());
}
@Test(groups = "cucumber", description = "Runs Cucumber Feature", dataProvider ="feature")
public void feature(CucumberFeatureWrapper cucumberFeature) {
testNGCucumberRunner.runCucumber(cucumberFeature.getCucumberFeature());
}
@DataProvider(name="feature")
public Object[][] getFeatures()
{
if(testNGCucumberRunner == null){
testNGCucumberRunner = new TestNGCucumberRunner(this.getClass());
}
return testNGCucumberRunner.provideFeatures();
}
@AfterClass(alwaysRun = true)
public void teardownclass() throws Exception{
testNGCucumberRunner.finish();
}
}
Проблема сборки Maven
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running TestSuite
Feature: test property feature
Scenario Outline: Customer checks the value of housing property # zooproperty.feature:3
Given acustomer on the home page
When aI type search "<propertysearch>"
And aI click on submit
Then aI see the properties value
Examples:
0 Scenarios
0 Steps
0m0.000s
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.114 s <<< FAILURE! - in TestSuite
[ERROR] Cucumber.testRunner.feature[test property feature](1) Time elapsed: 0.09 s <<< FAILURE!
java.lang.AbstractMethodError: cucumber.runtime.java.JavaStepDefinition.matchedArguments(Lgherkin/formatter/model/Step;)Ljava/util/List;
at Cucumber.testRunner.feature(testRunner.java:44)
[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR] testRunner.feature:44 » AbstractMethod cucumber.runtime.java.JavaStepDefinitio...
[INFO]
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
[INFO]
[ERROR] There are test failures.
Please refer to C:\Users\User\Desktop\project\target\surefire-reports for the individual test results.
Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.882 s
[INFO] Finished at: 2020-08-06T22:12:28+08:00
[INFO] ------------------------------------------------------------------------