执行多个黄瓜特征文件
execute multiple cucumber feature files
当我提交单个功能文件时,它工作得很好。我想将具有多个功能文件的功能文件夹路径传递到运行器脚本中。谁能帮忙执行多个功能文件?
所有特征文件步骤相同,但数据不同,文件名不同。
@RunWith(Cucumber.class)
@CucumberOptions(format = {"pretty"}, features =
"C:\TESTER\Execution\uidata\featurefiles\",
glue={"com.test.auto.stepdefs"},dryRun=false)
public class CucumberTest {
}
感谢您的帮助。
功能路径必须相对于您的项目类路径。例如它可以是这样的:
@CucumberOptions(features = {"classpath:features_folder1", "classpath:features_folder2"}, ...)
或
@CucumberOptions(features="src/test/resources")
您还可以使用 Cucumber 命令行界面运行器 (CLI Runner) cucumber.api.cli.Main
并将包含功能文件的文件夹的路径作为命令行选项传递。
示例:
java cucumber.api.cli.Main --glue com.my.stepdefn --plugin html:C:\testreports C:\features\
com.my.stepdefn
是具有黄瓜步骤定义的包
C:\features\
是包含特征文件的文件夹
C:\testreports
是生成 Cucumber html 报告的文件夹。
这是给 Java-Cucumber 用户的 ::
多个功能是
1.Smoketest 2.登录测试
那么你的 Junit runner java 文件应该看起来像
@RunWith(Cucumber.class)
@CucumberOptions
(features = "src/test/java/testStep/",#Path for the Feature files Folder.Given you have smoke.feature and login.feature files present in the Path#
plugin ={"pretty","html:reports/test-report"},#Path for the Reports Html Folder#
tags= {"@smoke,@login"})#Declaring multiple Feature names of files#
-- 干杯
当我提交单个功能文件时,它工作得很好。我想将具有多个功能文件的功能文件夹路径传递到运行器脚本中。谁能帮忙执行多个功能文件?
所有特征文件步骤相同,但数据不同,文件名不同。
@RunWith(Cucumber.class)
@CucumberOptions(format = {"pretty"}, features =
"C:\TESTER\Execution\uidata\featurefiles\",
glue={"com.test.auto.stepdefs"},dryRun=false)
public class CucumberTest {
}
感谢您的帮助。
功能路径必须相对于您的项目类路径。例如它可以是这样的:
@CucumberOptions(features = {"classpath:features_folder1", "classpath:features_folder2"}, ...)
或
@CucumberOptions(features="src/test/resources")
您还可以使用 Cucumber 命令行界面运行器 (CLI Runner) cucumber.api.cli.Main
并将包含功能文件的文件夹的路径作为命令行选项传递。
示例:
java cucumber.api.cli.Main --glue com.my.stepdefn --plugin html:C:\testreports C:\features\
com.my.stepdefn
是具有黄瓜步骤定义的包
C:\features\
是包含特征文件的文件夹
C:\testreports
是生成 Cucumber html 报告的文件夹。
这是给 Java-Cucumber 用户的 :: 多个功能是 1.Smoketest 2.登录测试 那么你的 Junit runner java 文件应该看起来像
@RunWith(Cucumber.class)
@CucumberOptions
(features = "src/test/java/testStep/",#Path for the Feature files Folder.Given you have smoke.feature and login.feature files present in the Path#
plugin ={"pretty","html:reports/test-report"},#Path for the Reports Html Folder#
tags= {"@smoke,@login"})#Declaring multiple Feature names of files#
-- 干杯