【问题标题】:Testing using TestNG Annotations使用 TestNG 注解进行测试
【发布时间】:2011-07-26 17:23:05
【问题描述】:

有人可以帮助我使用注释 (org.testng.annotations.Test) 测试 JAVA 类的用法...我正在处理一个不使用 Junit 的程序(由其他人编写) “org.testng.annotations.Test”被使用了,我不知道

【问题讨论】:

标签: java unit-testing annotations testng


【解决方案1】:

您肯定想阅读有关 TestNG here 的文档,因为与 JUnit 存在一些差异。不过,有些注释是相似的。

这里有一些亮点:

@BeforeSuite@BeforeClass@BeforeTest 分别标记将在测试套件、测试类和单个测试方法之前运行的方法(如您所料)。

@Test 将方法注释为测试方法。

这些与 JUnit 最相似。文档对其他文档有很好的解释。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-07-03
    • 1970-01-01
    • 2022-01-23
    • 2020-05-21
    • 2021-10-22
    • 2012-10-17
    • 2018-01-24
    相关资源
    最近更新 更多