zoukankan      html  css  js  c++  java
  • maven+testng+eclipse

    1.安装maven

    2.安装testng

    3.配置maven的dependency,和build

    <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>testnggroup</groupId>
      <artifactId>testngartifact</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <packaging>jar</packaging>
    
      <name>testngartifact</name>
      <url>http://maven.apache.org</url>
    
      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      </properties>
    
      <dependencies>
        <!-- https://mvnrepository.com/artifact/org.testng/testng -->
    	<dependency>
        	<groupId>org.testng</groupId>
        	<artifactId>testng</artifactId>
        	<version>6.14.3</version>
        	<scope>test</scope>
    	</dependency>
    
      </dependencies>
      <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.1</version>
                    <configuration>
                        <source>1.7</source>
                        <target>1.7</target>
                        <compilerArgs>
                            <arg>-Xlint:unchecked</arg>
                            <arg>-Xlint:deprecation </arg>
                            <!--<arg>endorseddirs=${endorsed.dir}</arg>-->
                        </compilerArgs>
                    </configuration>
                </plugin>
                 <!--添加插件 关联testNg.xml  -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.5</version>
                    <configuration>
                        <testFailureIgnore>true</testFailureIgnore>
                        <suiteXmlFiles>
                            <file>res/testNG.xml</file>
                        </suiteXmlFiles>
                        <!--<workingDirectory>target/</workingDirectory>-->
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </project>
    

      

    4.创建res文件夹,创建testNG.xml

    <?xml version="1.0" encoding="utf-8" ?>
    <suite name="testproj" parallel="false">
        <test name="testDemo1">
            <classes>
                <class name="SimpleTest.java"></class>
            </classes>
        </test>
    </suite>
    

     

    5.在eclipse中打开命令行,输入:mvn -f pom.xml clean test -DxmlFileName=testNG.xml

  • 相关阅读:
    『转』VC 工具使用和调试方法
    『轉』WINCE下如何实现发短信
    『转』Fatal error: Call to undefined function curl_init
    『转』WinCE驱动程序的分类
    『轉』Windows CE下的串口通讯类
    『轉』VC 6.0 “fatal error LNK1104: cannot open file "mfc42u.lib"”问题解决
    水晶报表乱码中文乱码问题(收藏)
    水晶报表如何完美导出一个Excel表格(收藏)
    ASP.NET AJAX(开发代号Atlas)重要参考资源大收集
    表格排序
  • 原文地址:https://www.cnblogs.com/zhizhiyin/p/9002262.html
Copyright © 2011-2022 走看看