Cucumber工程创建,selenium使用。
Maven功能搭建cucumber环境,主要涉及到maven的中央仓库配置,配置好中央仓库后,创建一个maven工程。
目录结构如下:
主要注意首先需要使用IntelliJ IDEA ,然后配置java1.8版本jdk。
然后这个工程的模块设置(右键工程,module settings)。需要配置为如下:
目录特别注意RunCucumberTest这个类,需要是com.ping目录下,主类不能丢step包中,不然扫描不到features。
再下面就是pom文件
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ping</groupId>
<artifactId>cucumberdemo</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>2.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>2.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>io.rest-assu