创建TestNG项目

2.测试 
尝试运行官网的一个示例 http://testng.org/doc/index.html 
1)新建一个 “Java Project”,右键 “Build Path” -> “Add Libraries” -> “TestNG”

这里写图片描述

2)新建 “SimpleTest.java”, 写入官网示例。

import org.testng.annotations.*;

public class SimpleTest {

     @BeforeClass
     public void setUp() {
       // code that will be invoked when this test is instantiated
     }

     @Test(groups = { "fast" })
     public void aFastTest() {
       System.out.println("Fast test");
     }

     @Test(groups = { "slow" })
     public void aSlowTest() {
        System.out.println("Slow test");
     }   
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19

3) 运行,得到结果报告

这里写图片描述


猜你喜欢

转载自blog.csdn.net/weixin_41585557/article/details/80766201
今日推荐