执行多个黄瓜function文件
当我提交单个特征文件时,它可以完美地工作。 我想将具有多个function文件的function文件夹路径传递给runner脚本。 任何人都可以帮助执行多个function文件?
所有function文件都具有相同的步骤,但数据不同,文件名不同。
@RunWith(Cucumber.class) @CucumberOptions(format = {"pretty"}, features = "C:\\TESTER\\Execution\\uidata\\featurefiles\\", glue={"com.test.auto.stepdefs"},dryRun=false) public class CucumberTest { }
我感谢你的帮助。
这适用于Java-Cucumber用户::多个function是1.Smoketest 2. Logintest然后您的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#
– 干杯
function路径必须相对于项目类路径。 例如,它看起来像这样:
@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
是生成黄瓜html报告的文件夹。