org.testng.annotations.Configuration无法解析

时间:2018-02-21 11:36:09

标签: java testng

我已经从testng 6.3.1升级到6.14.2,之后我在org.testng.annotations.Configuration上遇到错误,因为该类不存在。 我只是想知道如何替换它?。我检查了已弃用的API,发现它在6.9.x中已弃用。

由于

1 个答案:

答案 0 :(得分:0)

TLDR; 改为使用dedicated annotations,例如:@BeforeTest代替@Configuration(beforeTest = true)

TBH我从未使用它,我一直使用the dedicated @BeforeTest, @AfterTest等注释,但出于好奇,我做了一些研究:

  • 根据change log(目前第1129行),自2009/04/01 v 5.0以来已被弃用:已添加:已弃用@Configuration and已引入@BeforeSuite/Test/Class/TestMethod
  • 它已被this commit
  • 删除
  • 在删除之前(直到v6.11)它是javadoc读取:
      

    TestNG类的配置信息   的已过时。
      使用@BeforeSuite@AfterSuite@BeforeTest@AfterTest@BeforeGroups@AfterGroups@BeforeClass@AfterClass,{ {1}},@BeforeMethod

  • usage samples
@AfterMethod

总之,只需使用newer individual annotations