TestIT.Adapter 1.7.0

dotnet add package TestIT.Adapter --version 1.7.0                
NuGet\Install-Package TestIT.Adapter -Version 1.7.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TestIT.Adapter" Version="1.7.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TestIT.Adapter --version 1.7.0                
#r "nuget: TestIT.Adapter, 1.7.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install TestIT.Adapter as a Cake Addin
#addin nuget:?package=TestIT.Adapter&version=1.7.0

// Install TestIT.Adapter as a Cake Tool
#tool nuget:?package=TestIT.Adapter&version=1.7.0                

Test IT TMS Adapter for MsTest/NUnit

Getting Started

Installation

Requirements
  • MethodBoundaryAspect.Fody 2.0.148+
  • Microsoft.NET.Test.Sdk 17.5.0+
  • MSTest.TestAdapter 3.0.2 (only for MSTest)
  • MSTest.TestFramework 3.0.2 (only for MSTest)
NuGet CLI
Install-Package TestIt.Adapter
.NET CLI
dotnet package add TestIt.Adapter

Usage

Configuration

Description File property Environment variable CLI argument
Location of the TMS instance url TMS_URL tmsUrl
API secret key How to getting API secret key? privateToken TMS_PRIVATE_TOKEN tmsPrivateToken
ID of project in TMS instance How to getting project ID? projectId TMS_PROJECT_ID tmsProjectId
ID of configuration in TMS instance How to getting configuration ID? configurationId TMS_CONFIGURATION_ID tmsConfigurationId
ID of the created test run in TMS instance.<br/>It's necessary for adapterMode 0 or 1 testRunId TMS_TEST_RUN_ID tmsTestRunId
Parameter for specifying the name of test run in TMS instance (It's optional). If it is not provided, it is created automatically testRunName TMS_TEST_RUN_NAME tmsTestRunName
Adapter mode. Default value - 0. The adapter supports following modes:<br/>0 - in this mode, the adapter filters tests by test run ID and configuration ID, and sends the results to the test run<br/>1 - in this mode, the adapter sends all results to the test run without filtering<br/>2 - in this mode, the adapter creates a new test run and sends results to the new test run adapterMode TMS_ADAPTER_MODE tmsAdapterMode
It enables/disables certificate validation (It's optional). Default value - true certValidation TMS_CERT_VALIDATION tmsCertValidation
Mode of automatic creation test cases (It's optional). Default value - false. The adapter supports following modes:<br/>true - in this mode, the adapter will create a test case linked to the created autotest (not to the updated autotest)<br/>false - in this mode, the adapter will not create a test case automaticCreationTestCases TMS_AUTOMATIC_CREATION_TEST_CASES tmsAutomaticCreationTestCases
Mode of automatic updation links to test cases (It's optional). Default value - false. The adapter supports following modes:<br/>true - in this mode, the adapter will update links to test cases<br/>false - in this mode, the adapter will not update link to test cases automaticUpdationLinksToTestCases TMS_AUTOMATIC_UPDATION_LINKS_TO_TEST_CASES tmsAutomaticUpdationLinksToTestCases
List of labels for filtering tests (Optional). It will only work with adapter mode 2. - - tmsLabelsOfTestsToRun
File

Create Tms.config.json file in the project directory:

{
  "url": "URL",
  "privateToken": "USER_PRIVATE_TOKEN",
  "projectId": "PROJECT_ID",
  "configurationId": "CONFIGURATION_ID",
  "testRunId": "TEST_RUN_ID",
  "testRunName": "TEST_RUN_NAME",
  "adapterMode": ADAPTER_MODE,
  "automaticCreationTestCases": AUTOMATIC_CREATION_TEST_CASES,
  "automaticUpdationLinksToTestCases": AUTOMATIC_UPDATION_LINKS_TO_TEST_CASES,
  "certValidation": CERT_VALIDATION
}
Examples

NOTE: To run tests, you must use the TmsRunner utility.

TmsRunner --runner "/usr/local/share/dotnet/sdk/6.0.302/vstest.console.dll" --testassembly "/tests/MsTest.dll" --tmsUrl=http://localhost:8080 --tmsPrivateToken=Token --tmsProjectId=f5da5bab-380a-4382-b36f-600083fdd795 --tmsConfigurationId=3a14fa45-b54e-4859-9998-cc502d4cc8c6
-tmsAdapterMode=0 --tmsTestRunId=a17269da-bc65-4671-90dd-d3e3da92af80 --tmsTestRunName=Regress --tmsAutomaticCreationTestCases=true --tmsAutomaticUpdationLinksToTestCases=true --tmsCertValidation=true --tmsLabelsOfTestsToRun smoke,regress --debug
  • runner - path to vstest.console.dll or vstest.console.exe
  • testassembly - path to dll with tests
  • debug - enable debug logs

Attributes

Use attributes to specify information about autotest.

Description of attributes:

  • WorkItemIds - a method that links autotests with manual tests. Receives the array of manual tests' IDs
  • DisplayName - internal autotest name (used in Test IT)
  • ExternalId - unique internal autotest ID (used in Test IT)
  • Title - autotest name specified in the autotest card. If not specified, the name from the displayName method is used
  • Description - autotest description specified in the autotest card
  • Labels - tags listed in the autotest card
  • Links - links listed in the autotest card
  • Step - the designation of the step

Description of methods:

  • Adapter.AddLinks - add links to the autotest result.
  • Adapter.AddAttachments - add attachments to the autotest result.
  • Adapter.AddMessage - add message to the autotest result.

Examples

Simple test
using Tms.Adapter;
using Tms.Adapter.Attributes;
using Tms.Adapter.Models;
using Atr = Tms.Adapter.Attributes;

public class SampleTests {

    [Step]
    public void CreateProject()
    {
        Assert.IsTrue(true);
    }

    [Step]
    [Title("Enter project title")]
    [Atr.Description("Enter project description")]
    public void EnterProject()
    {
        Assert.IsTrue(true);
    }

    [Step]
    public void CreateSection() 
    {
        Assert.IsTrue(true);
        Adapter.AddAttachments("/Users/user/screen.json");
    }

    [TestMethod]
    [WorkItemIds("1523344")]
    [ExternalId("all_annotations_test")]
    [Title("All Annotations Test Title")]
    [DisplayName("All Annotations Test Display Name")]
    [Labels("tag01", "tag02")]
    [Atr.Description("All Annotations Test Description")]
    [Links(url: "https://testit.ru/", LinkType.Related, "TestTitle", "TestDescr")]
    [Links(url: "https://testit.ru/", LinkType.Defect)]
    public void AllAnnotationsTest()
    {
        Adapter.AddLinks("https://testit.ru/", "Test 4", "Desc 4", LinkType.Related);
        CreateProject();
        EnterProject();
        CreateSection();
    }
}
Parameterized test
using Tms.Adapter.Attributes;

public class ParameterizedTests {

    [Parameterized]
    [DataRow(MsTest.TestType.Parameter)]
    [DataRow(MsTest.TestType.Simple)]
    [ExternalId("TestType_{testType}")]
    [Title("Title {testType}")]
    [DisplayName("Display Name {testType}")]
    [TestMethod]
    public async Task TestType(TestType testType)
    {
        Assert.AreEqual(testType, testType);
    }

    [Parameterized]
    [DataRow(1,1,2)]
    [DataRow(2,2,4)]
    [ExternalId("Sum_{a}_{b}_{c}")]
    [Title("Title {a} {b} {c}")]
    [DisplayName("Display Name {a} {b} {c}")]
    [TestMethod]
    public async Task Sum(int a, int b, int c)
    {
        Assert.AreEqual(c, a + b);
    }
}

Contributing

You can help to develop the project. Any contributions are greatly appreciated.

  • If you have suggestions for adding or removing projects, feel free to open an issue to discuss it, or create a direct pull request after you edit the README.md file with necessary changes.
  • Make sure to check your spelling and grammar.
  • Create individual PR for each suggestion.
  • Read the Code Of Conduct before posting your first idea as well.

License

Distributed under the Apache-2.0 License. See LICENSE for more information.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.7.0 48 11/27/2024
1.6.5 151 10/8/2024
1.6.4 187 9/12/2024
1.6.3 199 7/5/2024
1.6.1 500 6/30/2024
1.6.0 110 5/20/2024
1.5.1 129 4/9/2024
1.5.0 119 3/29/2024
1.4.1 196 3/11/2024
1.4.0 102 3/11/2024
1.3.1 132 2/15/2024
1.3.0 154 12/20/2023
1.2.0 107 12/18/2023
1.1.1 120 12/8/2023
1.1.0 147 11/27/2023
1.0.8 2,719 7/31/2023
1.0.7 166 7/27/2023
1.0.6 144 7/27/2023
1.0.5 401 7/3/2023
1.0.4 153 7/3/2023
1.0.3 361 6/2/2023
1.0.2 128 6/1/2023
1.0.1 375 5/25/2023
1.0.0 186 4/17/2023