简体   繁体   English

何时在testng中执行数据提供者注释

[英]When will a data provider annotation will be executed in testng

I am running a Testng xml in selenium. 我正在硒中运行Testng xml。 It has 它有

@BeforeSuite
@BeforeTest
@Dataprovider
@Test(2 methods)
@AfterTest
@AfterSuite

When will the data provider method will be executed, at which phase. 数据提供者方法何时在哪个阶段执行。 Will it execute before BeforeSuite or BeforeTest ? 它会在BeforeSuite或BeforeTest之前执行吗? will it be executed fully ? 会完全执行吗?

You can call the @Dataprovider(name="testdata") from your @test annotation and not from other annotations like @beforesuite etc. You need to call the dataprovider from the @test annotation like @Test(dataProvider="testdata") 您可以从@test注释中调用@Dataprovider(name="testdata") ,而不能从其他注释(如@beforesuite等)中调用。您需要从@test注释中调用dataprovider,例如@Test(dataProvider="testdata")

The @dataprovider will be executed whenever you call from your @test method @dataprovider每当从您的通话将被执行@test方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM