TestNG (c) basic and annotation BeforeMethod AfterMethod

 

Package com.course.testng; 

Import org.testng.annotations *. ; 

public  class BasicAnnotation { 
    @Test // basic annotations, the method used to mark part of the test 
    public  void TestCase1 () { 
        System.out.println ( "this test case. 1" ); 
    } 

    @Test 
    public  void testCase2 () { 
        System.out.println ( "test case 2" ); 
    } 
    @BeforeMethod 
    public  void beforMethod () { 
        System.out.println ( "this is run "prior to testing ); 
    } 

    @AfterMethod 
    public void afterMethod () { 
        System.out.println ( "which is run after the Test Methods" ); 
    } 

    @BeforeClass 
    public  void bedorClass () { 
        System.out.println ( "This is the way to run before running class" ); 
    } 

    @AfterClass 
    public  void AfterClass () { 
        System.out.println ( "method which is performed after the operation class" ); 
    } 

}

 

 

 

Guess you like

Origin www.cnblogs.com/dwdw/p/11404765.html