【问题标题】:How can I extract java class files from features files - cucumber?如何从功能文件中提取 java 类文件 - 黄瓜?
【发布时间】:2017-03-13 15:24:52
【问题描述】:

我想从这个特性文件中提取测试类:

Feature: Access seleniumframework.com website
Use selenium java with cucumber-jvm and navigate to website
Scenario: Print title, url
When I open seleniumframework website
Then I validate title and URL 

这是带有黄瓜的 Run 类

package step_definitions;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(
    features = "classpath:features",
    plugin = {"pretty", "html:target/cucumber-html-report"},
    tags = {}
)
public class RunCukesTest{

}

【问题讨论】:

  • 您能解释一下您要达到的目标吗?如果您是自动化新手,可以参考stackoverflow.com/questions/41340252/…
  • 是的,我是新的自动化,实际上我正在尝试从功能文件中提取类步骤定义代码

标签: java junit cucumber cucumber-jvm


【解决方案1】:

步骤定义,即从 Gherkin 到运行系统的转换是您必须自己编写的。没有发生你可以捎带的魔法类生成。

这篇博文可能会让您入门:http://www.thinkcode.se/blog/2015/01/30/bdd-with-cucumberjvm-at-geecon-tdd-2015

另一个好的来源可能是 Cucumber 团队的这个入门项目:https://github.com/cucumber/cucumber-java-skeleton

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-06-25
    • 2019-11-06
    相关资源
    最近更新 更多