<?xml version="1.0" encoding="utf-8" ?> <suite name="test"> <test name="login"> <classes> <class name="com.course.testng.suite.SuiteConfig"/> <class name="com.course.testng.suite.LoginTest"/> </classes> </test> <test name="pay"> <classes> <class name="com.course.testng.suite.SuiteConfig"/> <class name="com.course.testng.suite.payment"/> </classes> </test> </suite>
package com.course.testng.suite; import org.testng.annotations.Test; public class payment { @Test public void psymentTest(){ System.out.println("支付成功"); } }
package com.course.testng.suite; import org.testng.annotations.Test; public class LoginTest { @Test public void Login(){ System.out.println("淘宝登录成功"); } }
package com.course.testng.suite; import org.testng.annotations.AfterSuite; import org.testng.annotations.BeforeSuite; public class SuiteConfig { @BeforeSuite public void beforSuite(){ System.out.println(); System.out.println("before suite 运行了"); } @AfterSuite public void afterSuite(){ System.out.println("after suite 运行了"); } }