azure-devops 管道测试通过报告使用了错误的数学

标签 azure-devops

我有一个 Azure DevOps 管道,其中 40% 的测试处于非事件状态。该报告显示 60% 的通过率,而在我看来,它应该显示 100%,因为通常通过率是根据执行的测试而不是编写的测试范围来定义的。

我搜索了 Microsoft 文档,其中唯一的答案是检查 stackoverflow,但我没有看到此问题的报告。

有人可以告诉我如何从报告中过滤掉不活动的测试吗?谢谢!

最佳答案

The report shows 60% pass rate when it should (in my opinion) show 100%, because usually the pass rate is defined against tests executed not the universe of tests that were written.

场景:

我有五个测试方法,其中 3 个会成功,其中 1 个会失败,第五个测试方法标记有 Ignore 属性。

重现相同问题:

对于 VSTest 任务的测试报告,忽略的测试将被标记为other。总测试是 Passed+Failed+Others 而不是 Passed+Failed 的摘要,因此您得到的是 60%,而不是 100%。

enter image description here

这是one discussion关于类似的问题,据我所知,团队已经进一步调查是否在汇总计算中使用忽略的测试来积压。您可以在那里发表评论以请求更新。

Would someone please tell me how I can filter the inactive tests out of the report? Thanks!

我的工作方法是使用 TestCategory 而不是 Ignore 属性。从 Ignore 更改为 TestCategory:

来自:

[Ignore]
[TestMethod]
public void TestMethod5()
{
    bool value = true;
    if (value.Equals(true))
    {
        Console.WriteLine("True");
    }
}

致:

[TestCategory("TestsToBeIgnored")]
[TestMethod]
public void TestMethod5()
{
    bool value = true;
    if (value.Equals(true))
    {
        Console.WriteLine("True");
    }
}

配置 VSTest 测试过滤器,添加过滤器 TestCategory!=TestsToBeIgnored

enter image description here

enter image description here

这样总测试确实排除了我需要忽略的测试,并且百分比可以准确。 (测试过滤器选项适用于 Azure Devops 管道、本地 vstest 命令行和 VS 测试管理器)

关于azure-devops 管道测试通过报告使用了错误的数学,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63347385/

相关文章:

azure-devops - 发布管道 Azure Devops 代码覆盖率报告

sql-server - 如何在 VSTS 中克隆 SQL Azure 数据库 - 服务器 'A' 中的数据库 'sql01' 和服务器 'B' 中的数据库 'sql01' 已经处于复制关系中

Azure Pipelines 为 helm 升级提供超时

azure - 使用 Azure CLI 将 VMSS 添加到应用程序网关的后端池

azure-devops - 如何停止先前排队的发布而不必一次取消它们?

azure - 托管在 Windows Azure 上的 Team Foundation 服务

azure-devops - 如何完全清空或删除 VSTS 包提要?

tfs - Team Foundation Service checkin 时的强制性评论

api - 通过 DevOps API 安排发布等待批准

powershell - 无法读取文件内容