【问题标题】:How to change behavior of Azure Devops to report tests run with DataTestMethod attribute as seperate tests如何更改 Azure Devops 的行为以将使用 DataTestMethod 属性运行的测试报告为单独的测试
【发布时间】:2023-04-01 16:53:02
【问题描述】:

我有一个 MSTest 测试,它使用 DataTestMethod 属性动态生成一个值矩阵来测试一个函数。我可以这样描述它

例子:

[DataTestMethod]
[DynamicData(nameof(DynamicTestData), DyanmicDataSourceType.Property]
public void Run_test_on_function_xzy(int input, int expected)
{
    // Run test using the to input values.
}

出于讨论的目的,我会说 DyanmicTestData 返回 10 个值,这会导致运行 10 个测试。

现在在 Azure Devops 方面,当我在 Azure Pipeline 中运行测试时,Azure Devops 只报告一个测试结果,而不是 10 个。有没有办法,我可以在 MSTest 或 Azure DevOps 中修改此行为以报告每个测试结果根级别的子测试?

【问题讨论】:

    标签: azure-devops mstest


    【解决方案1】:

    Azure Devops 只报告一个测试结果,而不是 10 个。有没有办法,我可以在 MSTest 或 Azure DevOps 中修改此行为,以便在根级别为每个子测试报告一个结果?

    查看下图,在构建摘要页面中,我们可以看到测试运行,扩展它,我们可以看到测试结果。我们不能在根级别报告每个子测试的结果,根级别显示的是测试运行而不是测试结果。

    【讨论】:

    • 感谢 Vito 的回复。我期望看到的更像 Just a test.IndexPageTest Just a test.AboutPageTest Just a test.ContactPageTest 等。这有一些好处。例如,如果 ContactsPageTest 中存在错误,则可以对该测试进行错误关联。在当前逻辑中,错误关联只是一个测试!
    • 嗨@loganwol,我们现在似乎不能这样做,您可以在我们的UserVoice site 上添加您对该功能的请求,这是我们产品建议的主要论坛。感谢您帮助我们构建更好的 Azure DevOps。
    猜你喜欢
    • 2020-12-15
    • 1970-01-01
    • 2020-08-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多