如何在 Eclipse 调试配置中将黄瓜标签指定为调用参数?
how to specify cucumber tags as invocation param in eclipse debug configuration?
我有一个 Spring 引导项目。我在其中有一个 java class BookTests,其中包含:
@RunWith(Cucumber.class)
@CucumberOptions(
plugin = {
"pretty",
"html:target/acceptance-test-report",
"json:target/cucumber/cucumber.json"
},
glue = {
"com.my.sdk.test",
"com.my.book.test"
}
,tags = {"@findConsideringGrants"}
)
public class BookTests {
// No implementation required. The Cucumber annotations drive the test execution.
}
我正在使用 Junit 4。当我 "Debug As JUnit Test" 这个 class 它只运行用“@findConsideringG运行ts 注释的特征文件(它应该)
有没有一种方法我不必在 java class 中硬编码此标记注释,而是将标记指定为程序参数或 VM 参数?
我尝试使用程序参数配置它,但在接下来的所有尝试中它都忽略了参数和 运行 我所有 features/tags:
的测试
--tags findConsideringGrants
-tags findConsideringGrants
--tags @findConsideringGrants
-tags @findConsideringGrants
所以为了总结,我正在寻找一种方法来
1) 在eclipse中调试某个特性
2) 无需将功能名称硬编码到 java 源代码中。不知何故只需配置调试配置。
这可能吗?
如果您使用的是 maven,则可以使用 -- mvn test -Dcucumber.options="--tags @findConsideringGrants"
.
或者您可以使用 cucumber cli 命令 运行 -- Main.main(new String[]{"-g", "classpath to step definition file","-t", "tags to use", "-p", "plugins to use", "Full path to feature file"})
。功能文件路径必须是最后一个选项。
运行来自 eclipse --
转到 "Debug Configurations" 或 "Run Configurations" window 的 "Environment" 选项卡。单击 "New" 按钮。对于 "Name" 添加“cucumber.options
”,对于 "Value" 添加“--tags @findConsideringGrants
”。申请并运行。如果要添加特定的功能文件路径,请仅将路径添加到此末尾。
我有一个 Spring 引导项目。我在其中有一个 java class BookTests,其中包含:
@RunWith(Cucumber.class)
@CucumberOptions(
plugin = {
"pretty",
"html:target/acceptance-test-report",
"json:target/cucumber/cucumber.json"
},
glue = {
"com.my.sdk.test",
"com.my.book.test"
}
,tags = {"@findConsideringGrants"}
)
public class BookTests {
// No implementation required. The Cucumber annotations drive the test execution.
}
我正在使用 Junit 4。当我 "Debug As JUnit Test" 这个 class 它只运行用“@findConsideringG运行ts 注释的特征文件(它应该)
有没有一种方法我不必在 java class 中硬编码此标记注释,而是将标记指定为程序参数或 VM 参数?
我尝试使用程序参数配置它,但在接下来的所有尝试中它都忽略了参数和 运行 我所有 features/tags:
的测试--tags findConsideringGrants
-tags findConsideringGrants
--tags @findConsideringGrants
-tags @findConsideringGrants
所以为了总结,我正在寻找一种方法来
1) 在eclipse中调试某个特性
2) 无需将功能名称硬编码到 java 源代码中。不知何故只需配置调试配置。
这可能吗?
如果您使用的是 maven,则可以使用 -- mvn test -Dcucumber.options="--tags @findConsideringGrants"
.
或者您可以使用 cucumber cli 命令 运行 -- Main.main(new String[]{"-g", "classpath to step definition file","-t", "tags to use", "-p", "plugins to use", "Full path to feature file"})
。功能文件路径必须是最后一个选项。
运行来自 eclipse --
转到 "Debug Configurations" 或 "Run Configurations" window 的 "Environment" 选项卡。单击 "New" 按钮。对于 "Name" 添加“cucumber.options
”,对于 "Value" 添加“--tags @findConsideringGrants
”。申请并运行。如果要添加特定的功能文件路径,请仅将路径添加到此末尾。