我正在使用以下技术开发一个自动化测试:
cucumber
测试
范围报告
对于所有这些技术之间的集成,我很高兴看到java注解。
我的目标是运行一个testng套件,其中包含一组testng测试,并配置了cucumber特性文件。
套件结束后,我需要重新运行所有失败的场景。目前,这不起作用,我的测试打包取决于测试屏幕在我们的产品ui上的显示方式。还具有与测试类打包相同的功能文件。
cucumberoption注解的设计方式是假设所有的功能文件都出现在同一个包中。因此rerun.txt不包括每个功能文件的完整路径,它只包括文件名。
在下面的屏幕截图中,我将展示一个来自测试、功能文件和步骤定义类的示例。
测试类的外观示例。
@CucumberOptions(strict = false,
plugin = { "pretty", "html:test-output/cucumber",
"json:test-output/cucumber/cucumber.json", "pretty:test-output/cucumber/cucumber-pretty.txt",
"usage:test-output/cucumber/cucumber-usage.json", "junit:test-output/cucumber/cucumber-results.xml",
"com.webAutomation.webInfra.utils.reporting.Report:test-output/cucumber/cucumber-extent-reports/testsResults.html" ,
"rerun:test-output/rerun.txt"},
tags = {"~@KnownBug"},
monochrome = true,
features = "src/main/java/com/mycompany/test/ACategory/BCategory/donationsTests/marketingCampaignsTest",
glue = {"com.mycompany.test.ACategory.BCategory.donationsTests.marketingCampaignsTest", "com.mycompany.test.generalStepsDefinition"})
public class MarketingCampaignsTest extends TestInfra {
}
该类重新运行rerun.txt文件中出现的失败场景
@CucumberOptions(strict = false,
plugin = { "pretty", "html:test-output/cucumber",
"json:test-output/cucumber/cucumber.json", "pretty:test-output/cucumber/cucumber-pretty.txt",
"usage:test-output/cucumber/cucumber-usage.json", "junit:test-output/cucumber/cucumber-results.xml",
"com.webAutomation.webInfra.utils.reporting.Report:test-output/cucumber/cucumber-extent-reports/failedTestsRerunResults.html" },
monochrome = true,
features = "@target/rerun.txt",
glue = {"com.mycompany.test.ACategory.BCategory.donationsTests.marketingCampaignsTest", "com.mycompany.test.generalStepsDefinition"})
public class FailedTestsRunner extends TestInfra{
}
testng套件包括以下测试包:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
<test thread-count="5" name="Test">
<packages>
<package name="com.mycompany.test.ACategory.BCategory.donationsTests.marketingCampaignsTest"/>
<package name="com.mycompany.test.ACategory.BCategory.donationsTests.marketingDocumentsTest"/>
</packages>
</test> <!-- Test -->
</suite> <!-- Suite -->
failedtestsrunner引发此异常:
[Utils] [ERROR] [Error] java.lang.IllegalArgumentException: Neither found on file system or on classpath: Not a file or directory: D:\projects\abc\uiAutomation\Test\marketingCampaignsTest.feature, No resource found for: classpath:marketingCampaignsTest.feature
at cucumber.runtime.model.CucumberFeature.loadFromFileSystemOrClasspath(CucumberFeature.java:84)
at cucumber.runtime.model.CucumberFeature.loadFromRerunFile(CucumberFeature.java:67)
at cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:52)
at cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:34)
rerun.txt文件上显示的功能文件路径:
marketingCampaignsTest.feature:49
处理这个问题有什么帮助吗?
暂无答案!
目前还没有任何答案,快来回答吧!