我在 cucumber 试验执行和报告方面有一些常见错误,但我的前提条件之前没有提到:我在子目录和包中构建了 cucumber 测试-现在JUnit Runner只能在IDE中工作,而不能在maven build中工作,并且没有编写 cucumber 报告。
[ERROR] Failed to execute goal net.masterthought:maven-cucumber-reporting:5.7.0:generate (execution) on project aec-s1-desktop-ui-testing: Execution execution of goal net.masterthought:maven-cucumber-reporting:5.7.0:generate failed: basedir /data/disk1/workspace/aec-s1-desktop-ui-testing/target/json-reports does not exist -> [Help 1]
pom.xml:
<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>5.7.0</version>
<executions>
<execution>
<id>execution</id>
<phase>verify</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<projectName>cucumber-jvm-example</projectName>
<!-- optional, per documentation set this to "true" to bypass generation
of Cucumber Reports entirely, defaults to false if not specified -->
<skip>false</skip>
<!-- output directory for the generated report -->
<outputDirectory>${project.build.directory}</outputDirectory>
<!-- optional, defaults to outputDirectory if not specified -->
<inputDirectory>${project.build.directory}/json-reports</inputDirectory>
<jsonFiles>
<!-- supports wildcard or name pattern -->
<param>**/*.json</param>
</jsonFiles>
<!-- optional, defaults to outputDirectory if not specified -->
<classificationFiles>
<!-- supports wildcard or name pattern -->
<param>sample.properties</param>
<param>other.properties</param>
</classificationFiles>
<!--parallelTesting>false</parallelTesting-->
<!-- optional, set true to group features by its Ids -->
<mergeFeaturesById>false</mergeFeaturesById>
<!-- optional, set true to get a final report with latest results of the
same test from different test runs -->
<mergeFeaturesWithRetest>false</mergeFeaturesWithRetest>
<!-- optional, set true to fail build on test failures -->
<checkBuildResult>true</checkBuildResult>
</configuration>
</execution>
</executions>
</plugin>
Smoke1TestRunner.java:
package runners.smoketests;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(
plugin = {"pretty",
"html:target/default-cucumber-reports.html",
"json:target/json-reports/cucumber2.json",
"junit:target/xml-report/cucumber2.xml"},
features = "src/test/resources/features",
glue = "stepdefinitions",
tags = "@smoketest1",
dryRun = false
)
public class Smoke1TestRunner {
}
1条答案
按热度按时间ruarlubt1#
runners.smoketests.Smoke1TestRunner.java 现在看起来像这样: