简体   繁体   English

如何从功能文件-黄瓜中提取Java类文件?

[英]How can I extract java class files from features files - cucumber?

I want to extract the test classes from this feature file: 我想从此功能文件中提取测试类:

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 

and this is the Run class with cucumber 这是黄瓜跑课

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{

}

The step definition, ie the translation from Gherkin to running your system is something you have to write yourself. 步骤定义,即从Gherkin到运行系统的转换,是您必须自己编写的内容。 There is no magic class generation happening that you can piggy back on. 没有发生任何神奇的事情,您可以重新使用。

This blog post may get you started: http://www.thinkcode.se/blog/2015/01/30/bdd-with-cucumberjvm-at-geecon-tdd-2015 此博客文章可能会帮助您入门: http : //www.thinkcode.se/blog/2015/01/30/bdd-with-cucumberjvm-at-geecon-tdd-2015

Another good source could be this getting started project from the Cucumber Team: https://github.com/cucumber/cucumber-java-skeleton 另一个好的来源可能是黄瓜团队的这个入门项目: https//github.com/cucumber/cucumber-java-skeleton

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM