2. 2 TestNG之注释说明与testng.xml标签说明

2. 2 TestNG之注释说明与testng.xml标签说明_第1张图片

2. 2 TestNG之注释说明与testng.xml标签说明_第2张图片

package com.testng.base;

import org.testng.annotations.Test;

public class NewTest {
    
  @Test
  public void f1() {
    System.out.println("NewTest---测试类函数 f1()---被Test装饰");
  }
  
  @Test
  public void f2() {
    System.out.println("NewTest----函数f2()-----被Test装饰");
  }
}

2. 2 TestNG之注释说明与testng.xml标签说明_第3张图片

2. 2 TestNG之注释说明与testng.xml标签说明_第4张图片

2. 2 TestNG之注释说明与testng.xml标签说明_第5张图片



 
    
    
      
      
    
   
  
    
          
                   
    
  
 

2. 2 TestNG之注释说明与testng.xml标签说明_第6张图片

2. 2 TestNG之注释说明与testng.xml标签说明_第7张图片

package com.testng.base;

import org.testng.annotations.Test;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.AfterSuite;

public class NewTest {
	
  @Test
  public void f1() {
    System.out.println("NewTest---测试类函数 f1()---被Test装饰");
  }
  
  @Test
  public void f2() {
    System.out.println("NewTest----函数f2()-----被Test装饰");
  }
  
  @BeforeMethod
  public void beforeMethod() {
	  System.out.println("NewTest----beforeMethod---被beforeMethod装饰");

  }

  @AfterMethod
  public void afterMethod() {
	  System.out.println("NewTest---afterMethod----被afterMethod装饰");

  }

  @BeforeClass
  public void beforeClass() {
	  System.out.println("NewTest----beforeClass---被beforeClass装饰");

  }

  @AfterClass
  public void afterClass() {
	  System.out.println("NewTest---afterClass---被afterClass装饰");

  }

  @BeforeTest
  public void beforeTest() {
	  System.out.println("NewTest---beforeTest---被beforeTest装饰");

  }

  @AfterTest
  public void afterTest() {
	  System.out.println("NewTest---afterTest---被afterTest装饰");

  }

  @BeforeSuite
  public void beforeSuite() {
	  System.out.println("NewTest---beforeSuite---被beforeSuite装饰");

  }

  @AfterSuite
  public void afterSuite() {
	  System.out.println("NewTest---afterSuite---被afterSuite装饰");

  }

}
package com.testng.base;

import org.testng.Assert;
import org.testng.annotations.Test;

public class NoNG {
	@Test
	public void test_001() {
		System.out.println("NoNG测试类--- 用例test001--- Test!");
		Assert.assertEquals(true, true);
	}
	
	@Test
	public void test_002() {
		System.out.println("NoNG测试类--- 用例test002--- Test!");
		Assert.assertEquals(true, true);
	}

}

2. 2 TestNG之注释说明与testng.xml标签说明_第8张图片

你可能感兴趣的:(JAVA自动化测试)