第一步:添加TestNg依赖库
步骤:
1.百度搜索:maven respository
2.页面搜索:testng
第二步:在线安装TestNG Eclipse插件
1. 选择菜单:Help->Install New Software,
2. 然后在弹出的窗口中的Work with后面的输入框中输入:http://beust.com/eclipse
2. 然后点击Add按钮,选中TestNG后一路点击Next下去安装即可,直到Finished之后,重启Eclipse完成安装。
生成testng配置文件testng.xml
右键项目-TestNG-Concert to TestNG-finish即可
TestNg导入的包类型:
import org.testng.annotations.Test
TestNg常见声明解读:
1:@Test
不需要main方法,直接通过testng测试
2:@Test(dependsOnMethods={"方法名"})
依赖参数中的方法执行