TestNG之annotation(三)

本文详细介绍了TestNG中常用的10种注解方法,包括@BeforeSuite、@AfterSuite、@BeforeTest、@AfterTest等,并解释了它们在测试生命周期中的应用。

以下是testNG在测试用例中使用的10种注解方法。

@BeforeSuite:

被此注解的方法将在所有测试运行之前运行该方法。

@AfterSuite: 

被此注解的方法将在所有测试运行之后运行该方法。
@BeforeTest:

被此注解的方法,将在测试运行之前运行。
@AfterTest: 

被此注解的方法,将在测试运行之后运行。
@BeforeGroups:

被此配置的方法,将在列表中的group前运行,这个方法保证在第一个属于这些组列表的测试方法调用前运行。

The list of groups that this configuration method will run before. This method is guaranteed to run shortly before the first test method that belongs to any of these groups is invoked.
@AfterGroups:

被此配置的方法,将在列表中的group后运行,这个方法保证在最后一个属于这些组列表的测试方法调用后运行。

The list of groups that this configuration method will run after. This method is guaranteed to run shortly after the last test method that belongs to any of these groups is invoked. 
@BeforeClass:

被此注解的方法,将在当前类的第一个测试方法调用之前运行

The annotated method will be run before the first test method in the current class is invoked. 
@AfterClass:

被此注解的方法,将在当前类的所有测试方法调用之后运行

The annotated method will be run after all the test methods in the current class have been run. 
@BeforeMethod:

被此注解的方法,将在每个测试方法调用之前运行

The annotated method will be run before each test method. 
@AfterMethod:

被此注解的方法,将在每个测试方法调用之后运行。

The annotated method will be run after each test method.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值