testng范围报告中的测试和步骤之间的差异

Rab*_*tha 5 java selenium-extent-report extentreports

我对testng范围报告中的测试和步骤之间的区别感到困惑.

我有2个测试用例,1次通过,1次失败.在测试范围报告中:1个测试通过1个测试失败,0个其他测试失败,步骤:1个步骤通过2个步骤失败,0个其他

那么有人会澄清两者之间有什么区别吗?

附加代码段和testng范围报告

    @Test
    public void demoTestPass()
    {
        test = extent.createTest("demoTestPass", "This test will demonstrate the PASS test case");
        Assert.assertTrue(true);
    }


    @Test
    public void demoTestFail()
    {
        test = extent.createTest("demoTestFail", "This test will demonstrate the FAIL test case");
        Assert.assertEquals("Hi", "Hello");
    }
Run Code Online (Sandbox Code Playgroud)

请点击此处查看范围报告.

任何澄清将非常感激.

Ish*_*hah 5

范围报告中测试和步骤之间的区别:

测试定义: 您在报告中创建的总测试部分: 语法如下: extentReport.createTest("name of section");

步骤定义:您在脚本中生成的日志总数,语法如下:testlog.info()OR testlog.pass()OR testlog.fail()where testlogis object of ExtentTestclass

例子: 报告图片

在此报告中,已创建 3 个部分并将其显示为测试。步骤定义了在这些测试中通过的日志数量。

你的情况:

测试:1 个测试通过 1 个测试失败,0 其他及以下步骤:1 个步骤通过 2 个步骤失败,0 个其他

测试包括 1 次通过和 1 次失败,因为它在步骤中失败。您的步骤包括 1 次通过和 2 次失败,并反映在测试中。


Mag*_*esh 3

Test(startTest("test name")) 用于在范围报告中创建新测试。

步骤表示您已记录到报告中的消息数量(test.Pass(“通过消息”)、test.Fail(“失败消息”)、test.Info(“信息消息”))。

假设您有两个测试方法,每个测试方法都有 1pass 和 1 info 消息。

因此,在范围报告中,它将显示 2 个测试,总共 4 个步骤。2 个传递步骤和 2 个信息步骤