cumber + selenium +java自动化测试

Posted testway

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了cumber + selenium +java自动化测试相关的知识,希望对你有一定的参考价值。

1、新建一个maven项目,pom文件为:

<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.test</groupId>
  <artifactId>cucumber</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>cucumber</name>
  <url>http://maven.apache.org</url>

    <properties>  
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>  
    </properties>  
    <dependencies>  
        <dependency>  
            <groupId>info.cukes</groupId>  
            <artifactId>cucumber-core</artifactId>  
            <version>1.2.3</version>  
        </dependency>  
        <dependency>  
            <groupId>info.cukes</groupId>  
            <artifactId>cucumber-java</artifactId>  
            <version>1.2.3</version>  
        </dependency>  
        <dependency>  
            <groupId>junit</groupId>  
            <artifactId>junit</artifactId>  
            <version>4.12</version>  
        </dependency>  
        <dependency>  
            <groupId>info.cukes</groupId>  
            <artifactId>cucumber-junit</artifactId>  
            <version>1.2.3</version>  
        </dependency>  
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.48.2</version>
        </dependency> 
        <dependency>  
            <groupId>org.apache.maven.plugins</groupId>  
            <artifactId>maven-surefire-plugin</artifactId>  
            <version>2.12.4</version>  
        </dependency>  
        <dependency>  
            <groupId>org.picocontainer</groupId>  
            <artifactId>picocontainer</artifactId>  
            <version>2.14</version>  
        </dependency>  
        <dependency>  
            <groupId>info.cukes</groupId>  
            <artifactId>cucumber-picocontainer</artifactId>  
            <version>1.2.3</version>  
        </dependency>  
    </dependencies>  
    <build>  
        <plugins>  
            <plugin>  
                <groupId>org.apache.maven.plugins</groupId>  
                <artifactId>maven-surefire-plugin</artifactId>  
                <configuration>  
                    <forkMode>once</forkMode>  
                    <argLine>-Dfile.encoding=UTF-8</argLine>  
                </configuration>  
            </plugin>  
        </plugins>  
    </build>  
  
</project>  

http://blog.csdn.net/yan1234abcd/article/details/49300995

以上是关于cumber + selenium +java自动化测试的主要内容,如果未能解决你的问题,请参考以下文章

selenium+java 自动化测试中,一个报错问题求助

selenium-java想用chrome执行自动化junit需要改啥?

基于selenium+java的12306自动抢票

如何利用selenium来进行自动化页面测试

selenium+java启动Chrome

selenium第一课(selenium+java+testNG+maven)