2 minute read

janono.ado.testcase.associate

Janono.ADO.TestCase.Associate is an extension for automatic association of test methods from code to Test Cases in Azure DevOps Test Plans.

janono.ado.testcase.associate Build Status

janono.ado.testcase.associate.cli Build Status

Extension was created as current approach for association is manual activity.For each test case with can be very time consuming, susceptible to mistakes (as each manual activity), time costly in maintenance. Current approach also requires Visual Studio with is not needed in case of using extension.

Extension consists of 2 components

janono.ado.testcase.associate

Bugs Code Smells Coverage Duplicated Lines (%) Lines of Code Maintainability Rating Quality Gate Status Reliability Rating Security Rating Technical Debt Vulnerabilities

Quality gate

SonarCloud

Azure DevOps coverage Azure DevOps tests Azure DevOps builds (branch) Nuget

Getting started

  • On Test Class level add organization attribute [janono.ado.testcase.associate.Organization("janono-pub")] where replace value “janono-pub” your azure devops organization name.
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace ExampleTestProject
{
    [TestClass]
    [janono.ado.testcase.associate.Organization("janono-pub")] //<---
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            //yours test method content
            //...
            //
        }
    }
}
  • On Test Method level add test case attribute [janono.ado.testcase.associate.TestCase(5)] where replace ‘5’ with yours ‘test case id’ for with you want to associate automation.
using Microsoft.VisualStudio.TestTools.UnitTesting;

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
            //...
            //
        }
    }
}
  • Optionally add using statement namespace “using janono.ado.testcase.associate” to use short name for attributes [janono.ado.testcase.associate.Organization("janono-pub")] -> [Organization("janono-pub")] [janono.ado.testcase.associate.Organization("janono-pub")] -> [TestCase(5)]
using Microsoft.VisualStudio.TestTools.UnitTesting;
using janono.ado.testcase.associate; //<---

namespace ExampleTestProject
{
    [TestClass]
    [Organization("janono-pub")] //<---
    public class UnitTest1
    {
        [TestMethod]
        [TestCase(5)] //<---
        public void TestMethod1()
        {
            //yours test method content
            //...
            //
        }
    }
}
  • Build projects or solution for generating ddl assembly for tests

  • Download latest CLI release janono.ado.testcase.associate.cli for your platform Windwos, MacOs, Linux as cli is written in cross platform .NET Core. Extract to folder where you would like to keep it.

  • Open console with you are using, go to folder where you extract cli. Type “janono.ado.testcase.associate.cli.exe” press enter, now you will see the possible options. janono.ado.testcase.associate

    Options:
    -am, --authMethod <Basic|oAuth|PAT> (REQUIRED)  Authentication method Oauth Token, PAT,Basic
    --authValue <authValue> (REQUIRED)              The password, Personal Access Token or OAuth Token to authenticate
    --action <Associate|List> (REQUIRED)            Action
    --path <path> (REQUIRED)                        Path to dlls with tests, supporting '*' wildcards.
    --version                                       Show version information
    -?, -h, --help                                  Show help and usage information
  • Pass parameters for CLI

    • –authMethod PAT or oAuth(in coming future)
    • –authMethod “PAT” PAT (personal access token)
    • –path to dll file with test for association
    • –action “List” for scan dll test assembly and check if need to update association, or “Associate” for association test methods to test cases also cover update case
  • Example –action “List” janono.ado.testcase.associate.cli.exe --authMethod PAT --authValue [yours PAT] --path D:\ExampleTestProject\bin\Release\net6.0\ExampleTestProject.dll --action List janono.ado.testcase.associate

  • Example –action “Associate” janono.ado.testcase.associate.cli.exe --authMethod PAT --authValue [yours PAT] --path D:\ExampleTestProject\bin\Release\net6.0\ExampleTestProject.dll --action Associate janono.ado.testcase.associate

  • Result, now on test case workitem on “Associated Automation” tab you will see automatically associated automation with will be executed run automated tests from test plans. janono.ado.testcase.associate

Features planned

Communication

Gitter

Comments