我想从此功能文件中提取测试类:
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{
}
答案 0 :(得分:-1)
步骤定义,即从Gherkin到运行系统的翻译是您必须自己编写的。没有神奇的一代可以发生,你可以捎带。
此博文可能会帮助您入门:http://www.thinkcode.se/blog/2015/01/30/bdd-with-cucumberjvm-at-geecon-tdd-2015
另一个好的来源可能是黄瓜团队的这个入门项目:https://github.com/cucumber/cucumber-java-skeleton