gpt4 book ai didi

java - 在测试报告中跳过测试方法结果

转载 作者:行者123 更新时间:2023-11-30 04:43:05 25 4
gpt4 key购买 nike

我有一个关于 testng 的问题。

我有类似的东西:

@Test
public initializeMethod() {
//here I do something that is needed before my real test method
}

@Test (depends on initializeMethod)
public myRealTest1{
//my test 1
}

@Test (depends on myRealTest1)
public myRealTest2{
//my test 2
}

是否可以在testng报告中跳过initializeMethod(我的意思是在报告中我想查看测试的实际数量(2但不是3))?

最佳答案

@Test 注解专门用于测试。您必须使用非测试 annotation 正确注释方法 initializeMethod() 。几个选项是:

@BeforeTest
@BeforeClass

其他可能的注释:

@BeforeSuite
@BeforeGroups
@BeforeMethod // if you want `initializeMethod()` run before every test.

关于java - 在测试报告中跳过测试方法结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11778277/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com