TestNG 使用入门

TestNG 使用入门,第1张

TestNG 使用入门


转载请保留作者信息:

Author: 88250

Blog: http:/blog.csdn.net/DL88250

MSN & Gmail & QQ: [email protected]


TestNG是一个设计用来简化广泛的测试需求的测试框架,从单元测试(隔离测试一个类)到集成测试(测试由有多个类多个包甚至多个外部框架组成的整个系统,例如运用服务器),本文以一个简单的例子展示了 TestNG 的基本运用。由于目前 NetBeans IDE 对 TestNG 目前还没有支持(不过 NetBeans 已经开始计划和实现了),所以示例工程使用 Maven 构建。

pom.xml:
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <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/maven-v4_0_0.xsd">
  3.     <modelVersion>4.0.0</modelVersion>
  4.     <groupId>cn.edu.ynu.sei</groupId>
  5.     <artifactId>HelloTestng</artifactId>
  6.     <packaging>jar</packaging>
  7.     <version>1.0.0.0</version>
  8.     <name>HelloTestng</name>
  9.     <description>A simple demo for Testng with maven.</description>
  10.     <url>http://maven.apache.org</url>
  11.     <build>
  12.         <plugins>
  13.             <plugin>
  14.                 <artifactId>maven-compiler-plugin</artifactId>
  15.                 <version>2.0.2</version>
  16.                 <configuration>
  17.                     <source>1.6</source>
  18.                     <target>1.6</target>
  19.                 </configuration>
  20.             </plugin>
  21.         </plugins>
  22.     </build>
  23.     <dependencies>
  24.         <dependency>
  25.             <groupId>org.testng</groupId>
  26.             <artifactId>testng</artifactId>
  27.             <version>5.8</version>
  28.             <scope>test</scope>
  29.             <classifier>jdk15</classifier>
  30.             <exclusions>
  31.                 <exclusion>
  32.                     <artifactId>junit</artifactId>
  33.                     <groupId>junit</groupId>
  34.                 </exclusion>
  35.             </exclusions>
  36.         </dependency>
  37.     </dependencies>
  38. </project>

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/2086389.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-07-22
下一篇 2022-07-22

发表评论

登录后才能评论

评论列表(0条)

保存