简体   繁体   English

有没有办法将 Selenium 测试与 Azure DevOps 测试用例相关联?

[英]Is there a way to associate Selenium test with an Azure DevOps test case?

What I'm aiming for is closing the loop on test coverage.我的目标是关闭测试覆盖率的循环。

My goal would be:我的目标是:

  1. Define test cases with PM and list them out under a Test Plan in Azure DevOps.使用 PM 定义测试用例,并在 Azure DevOps 中的测试计划下列出它们。
  2. Associate Selenium tests in Visual Studio with specific test case(s).将 Visual Studio 中的 Selenium 测试与特定测试用例相关联。
  3. When the release pipeline runs the UI test, I would expect to see on the dashboard the % of test cases that passed/failed or were not even associated.当发布管道运行 UI 测试时,我希望在仪表板上看到通过/失败或什至未关联的测试用例的百分比。

Is that even possible?这可能吗?

Check the following link:检查以下链接:

https://docs.microsoft.com/en-us/azure/devops/test/associate-automated-test-with-test-case?view=azure-devops https://docs.microsoft.com/en-us/azure/devops/test/associate-automated-test-with-test-case?view=azure-devops

Coded UI test, Selenium tests, and unit tests written using Version 1 of the MSTest framework can be associated with a test case.编码的 UI 测试、Selenium 测试和使用 MSTest 框架版本 1 编写的单元测试可以与测试用例相关联。

The process to associate an automated test with a test case is:将自动化测试与测试用例相关联的过程是:

  1. Create a test project containing your automated test.创建一个包含自动化测试的测试项目。
  2. Check your test project into an Azure DevOps repository.将您的测试项目签入 Azure DevOps 存储库。
  3. Create a build pipeline for your project, ensuring that it contains the automated test.为您的项目创建构建管道,确保它包含自动化测试。
  4. Use Visual Studio Enterprise or Professional 2017 or a later version to associate the automated test with a test case.使用 Visual Studio Enterprise 或 Professional 2017 或更高版本将自动化测试与测试用例相关联。 The test case must have been added to a test plan that uses the build you just defined.测试用例必须已添加到使用您刚刚定义的构建的测试计划中。

在此处输入图像描述

Check this extension that I have created https://github.com/JanuszNowak/janono.ado.testcase.associate.cli .检查我创建的这个扩展https://github.com/JanuszNowak/janono.ado.testcase.associate.cli It allows associating in automatic manner.它允许以自动方式关联。 So if yours selenium test are using xunit, nunit or mstest you can associate them automatically .因此,如果您的 selenium 测试使用的是 xunit、nunit 或 mstest,您可以自动关联它们

Code sample:代码示例:

namespace ExampleTestProject
{
    [TestClass]
    [janono.ado.testcase.associate.Organization("janono-pub")]
    public class UnitTest1
    {
        [TestMethod]
        [janono.ado.testcase.associate.TestCase(5)] //<---
        public void TestMethod1()
        {
            //yours test method content
            //...
            //
        }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM