对范围报告者使用测试名称而不是方法名称

问题描述 投票:0回答:1

我想使用我给出报告而不是方法名称的测试名称。

这是我命名测试的地方。

@Test(testName = "The test name is test", retryAnalyzer = RetryAnalyzer.class)

这是我获取测试名称的before方法

 @BeforeMethod
public synchronized void beforeMethod(Method method) {
    ExtentTest child = parentTest.get().createNode(method.getName());
    test.set(child);

我希望before方法在测试开始时读取测试名称。

谢谢

java testng appium-android extentreports
1个回答
0
投票

而不是@Test(testName =“测试名称是测试”)使用@Test(Description =“测试名称是测试”)

并使用下面这行。

ExtentTest child = parenttest.get()。createNode(method.getDescription()。getName());

这个有效!!

© www.soinside.com 2019 - 2024. All rights reserved.