1、TestNG介绍
官方网站:
下载地址:
eclipse插件安装:
- For Eclipse 3.4 and above, enter
- For Eclipse 3.3 and below, enter
参考文档及实例:
Maven引入:
-
<dependency>
-
<groupId>org.testng</groupId>
-
<artifactId>testng</artifactId>
-
<version>5.14</version>
-
<scope>test</scope>
-
</dependency>
2、实例
- import org.apache.commons.lang.StringUtils;
- import org.testng.annotations.Test;
-
- public class TestDemo {
-
- @Test
- public void isStringEmpty(){
- assert new String("abc").contains("a");
- }
-
- @Test
- public void isNull(){
- assert "abc".equals(new String("dabcdef").substring(1, 4));
- }
-
- @Test
- public void isEmpty()
- {
- assert StringUtils.isEmpty(null);
- assert StringUtils.isEmpty("");
- }
- @Test
- public void trim()
- {
- assert "foo".equals(StringUtils.trim(" foo "));
- }
- }
3、重要的testNG.xml
本文转自 tianya23 51CTO博客,原文链接:http://blog.51cto.com/tianya23/449381,如需转载请自行联系原作者