maven 依赖
1、cucumber 依赖
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-spring</artifactId>
<version>1.2.4</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.4</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
<version>1.2.4</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.4</version>
</dependency>
<dependency>
2、testng 依赖
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.11</version>
</dependency>
3、cucumber-testng 依赖
<dependency>
<groupId> info.cukes</groupId>
<artifactId> cucumber-testng</artifactId>
<version> 1.2.4</version>
</dependency>
Runner
package com.test.zfj.qa;
import cucumber.api.CucumberOptions;
import cucumber.api.testng.AbstractTestNGCucumberTests;
import cucumber.api.testng.TestNGCucumberRunner;
@CucumberOptions(
features ={"src/test/resources/Feature/testController.feature"},
plugin={"pretty", "html:target/cucumber", "json:target/cucumber/cucumber.json", "junit:target/junit"})
public class RunnerName extends AbstractTestNGCucumberTests {
private TestNGCucumberRunner testNGCucumberRunner;
}
testng.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="All Test Suite" parallel="tests" thread-count="9">
<test name="随便自己取个名字" >
<classes>
<class name="com.test.zfj.qa.RunnerName"></class>
</classes>
</test>
</suite>
feature 及 steps 按 cucumber 格式