是否可以更改 Allure 时间线,以便为每个 Selenium 节点显示不同的时间线?

Is it possible to change Allure timeline, so that it will show a different timeline for each Selenium Node?

我正在 运行使用由 Selenium 网格管理的几个 Selenium 节点对 Jenkins 进行一些 Selenium 测试。对于报告,我使用 Allure 插件。之后很难看到测试在哪个 selenium 节点上有 运行(目前我使用 Step info 执行此操作,但那样我首先必须单击测试详细信息才能看到它)。

所以我认为更改 Allure Report 中的时间线可能是个好主意,这样就不会在执行 Jenkins master 下列出所有测试,每个 Selenium 节点可以有不同的时间线。我没有找到执行此操作的方法,也没有找到生成时间线的位置,所以我只是想问这是否可能,如果可以的话我在哪里可以实现?或者您有任何其他想法如何使测试浏览器在哪个节点上执行得更清楚?

确实可以更改时间轴页面的标题。也可以有多个标题。

为每个测试用例创建一个文件。在测试用例描述部分有标签。可以使用多个名称制作标签,但对于时间线,有两个名称会影响您要查找的内容:

  • 线程
  • 主机

为每个找到的主机生成一个标题栏,为每个找到的唯一线程生成一个线程行。对于每个找到的具有该线程的测试用例,都会在测试用例的持续时间内添加一个块。

XML 文件中的测试用例部分如下所示:

<test-case severity="None" start="1483868031834" status="passed" stop="1483868031840">
  <description>Test 1</description>
  <name>Test 1</name>
  <labels>
    <label name="thread" value="28216"/>
    <label name="host" value="Apple"/>
    </labels>
  <attachments/>
  ...

文件的其余部分包含我相信您已经熟悉的步骤。

-- 编辑--

您可以通过调用

来实现
  Allure.LIFECYCLE.fire(new CustomTestCaseEvent(host));

CustomTestCaseEvent 可能如下所示(可能有更优雅的方法):

public class CustomTestCaseEvent implements TestCaseEvent {
final private String host;
public CustomTestCaseEvent(final String host) {
    this.host = host;
}
@Override
public void process(final TestCaseResult context) {
    for (final Label label : context.getLabels()) {
        if ("host".equals(label.getName())) {
            label.setValue(host);
        }
    }
}
}