static>suite>test>class>method testng

来源:互联网 发布:淘宝店铺怎么改所在地 编辑:程序博客网 时间:2024/06/06 08:45

public class TestOne {


static{
System.out.println("test");
}


@BeforeClass
public void beforeClass() {
System.out.println("beforeClass");
}


@BeforeSuite
public void beforeSuite() {
System.out.println("beforeSuite");
}




@BeforeTest
public void before() {
System.out.println("beforeTest");
}


@Test
public void f1() {
System.out.println("method 1 in testone");
}


@Test
public void f2() {
System.out.println("method 2 in testone");
}

}



public class TestTwo {




static{
System.out.println("test2");
}




@BeforeClass
public void beforeClass() {
System.out.println("beforeClass2");
}




@BeforeSuite
public void beforeSuite() {
System.out.println("beforeSuite2");
}


@BeforeTest
public void before() {
System.out.println("beforeTest2");
}


@Test
public void f1() {
System.out.println("method 1 in test two");
}


@Test
public void f2() {
System.out.println("method 2 in test two");
}
}



test
test2
[TestNG] Running:
  D:\workspace\rpool\testng.xml


beforeSuite
beforeSuite2
beforeTest
beforeTest2
beforeClass2
method 1 in test two
method 2 in test two
beforeClass
method 1 in testone
method 2 in testone