パッケージcom.course.testng.groups。 輸入org.testng.annotations.AfterGroups。 輸入org.testng.annotations.BeforeGroups。 輸入org.testng.annotations.BeforeMethod; 輸入org.testng.annotations.Test; パブリック クラスGroupsOnMethod { @Test(グループ = "サーバ" ) 公共 ボイドTEST1(){ System.out.printlnは( "这の是サーバ1测试......." )。 } @Test(グループ = "サーバ" ) 公共 ボイドTEST2(){ System.out.printlnは( "这の是サーバ2测试............."); } @Test 公共 ボイドTest3は(){ System.out.printlnは( "クライアント1 ...........でテスト" ); } @BeforeGroups( "サーバ" ) 公共 ボイドサーバ1( ){ System.out.printlnは( "試験前に行われるサーバ-----------------------" ); } @AfterGroups( "サーバ" ) 公共 ボイドサーバー2(){ System.out.printlnは(「これはテスト***********実行サーバの後に実行されます」); } }