java自动化框架 cucumber+webdriver
搭建ui自动化测试框架
开发工具:intellij
一、intellij上要先安装插件 cucumber for java
二、新建一个Maven工程
三、pom中添加所需依赖
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.6.0</version>
</dependency>
四、新建一个feature文件
@tag1
Scenario: my first test case
Given I navigate to bokeyuan
Then The home page load success
然后用代码实现步骤
五、执行用例
import
cucumber.api.CucumberOptions;
import
cucumber.api.junit.Cucumber;
import
org.junit.runner.RunWith;
@RunWith
(Cucumber.
class
)
@CucumberOptions
(plugin={
"pretty"
}, features={
"src/test/features"
})
public
class
AppTest {
}