TestIT.Adapter.XUnit 1.0.8

There is a newer version of this package available.
See the version list below for details.
dotnet add package TestIT.Adapter.XUnit --version 1.0.8                
NuGet\Install-Package TestIT.Adapter.XUnit -Version 1.0.8                
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.XUnit" Version="1.0.8" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TestIT.Adapter.XUnit --version 1.0.8                
#r "nuget: TestIT.Adapter.XUnit, 1.0.8"                
#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.XUnit as a Cake Addin
#addin nuget:?package=TestIT.Adapter.XUnit&version=1.0.8

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

Test IT TMS Adapter for XUnit

Getting Started

Installation

NuGet CLI
Install-Package TestIT.Adapter.XUnit
Install-Package TestIT.Adapter.Core
.NET CLI
dotnet package add TestIT.Adapter.XUnit
dotnet package add TestIT.Adapter.Core

Usage

Configuration

Description Property Environment variable
Location of the TMS instance url TMS_URL
API secret key How to getting API secret key? privateToken TMS_PRIVATE_TOKEN
ID of project in TMS instance How to getting project ID? projectId TMS_PROJECT_ID
ID of configuration in TMS instance How to getting configuration ID? configurationId TMS_CONFIGURATION_ID
ID of the created test run in TMS instance. testRunId TMS_TEST_RUN_ID
It enables/disables certificate validation (It's optional). Default value - true certValidation TMS_CERT_VALIDATION
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
Enable debug logs (It's optional). Default value - false isDebug -
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",
    "automaticCreationTestCases": false,
    "certValidation": true,
    "isDebug": true
}

How to run

If you specified TestRunId, then just run the command:

dotnet test

To create and complete TestRun you can use the Test IT CLI:

$ export TMS_TOKEN=<YOUR_TOKEN>
$ testit \
  --mode create
  --url https://tms.testit.software \
  --project-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
  --testrun-name "New test run" \
  --output tmp/output.txt

$ export TMS_TEST_RUN_ID=$(cat output.txt)  

$ dotnet test

$ testit \
  --mode finish
  --url https://tms.testit.software \
  --testrun-id $(cat tmp/output.txt) 

Attributes

Use attributes to specify information about autotest.

Description of attributes:

  • WorkItemIds - linking an autotest to a test case.
  • DisplayName - name of the autotest in Test IT.
  • ExternalId - ID of the autotest within the project in Test IT.
  • Title - title in the autotest card and the step.
  • Description - description in the autotest card and the step.
  • Labels - tags in the autotest card.
  • Links - links 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.Core.Attributes;
using Tms.Adapter.XUnit.Attributes;
using Tms.Adapter.Core.Models;

public class SampleTests : IDisposable {

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

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

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

    [TmsFact]
    [WorkItemIds("1523344", "54321")]
    [ExternalId("all_annotations_test")]
    [Title("All Annotations Test Title")]
    [DisplayName("All Annotations Test Display Name")]
    [Labels("tag01", "tag02")]
    [Description("All Annotations Test Description")]
    [Links("https://test01.example", "Example01", "Example01 description", LinkType.Issue)]
    [Links("https://test02.example")]
    public void AllAnnotationsTest()
    {
        Adapter.AddLinks("https://test01.example", "Example01", "Example01 description", LinkType.Issue);
        Adapter.AddLinks("https://test02.example");
        CreateProject();
        EnterProject();
        CreateSection();
    }
    
    [After]
    public void Dispose()
    {
    }
}
Parameterized test
using Tms.Adapter.Core.Attributes;
using Tms.Adapter.XUnit.Attributes;
using Tms.Adapter.Core.Models;

public class ParameterizedTests {

    [InlineData(1, "string1")]
    [InlineData(2, "string2")]
    [InlineData(3, "string3")]
    [ExternalId("ParametrizedTest_Success_{number}_{str}")]
    [Title("ParametrizedTest_Success Title {number} {str}")]
    [DisplayName("ParametrizedTest_Success DisplayName {number} {str}")]
    [TmsTheory]
    public void ParametrizedTest_Success(int number, string str)
    {
        Assert.True(true);
    }
}

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.6.5 83 10/8/2024
1.6.4 141 9/12/2024
1.6.3 119 7/5/2024
1.6.1 106 6/30/2024
1.6.0 88 5/20/2024
1.5.1 120 4/9/2024
1.5.0 117 3/29/2024
1.4.1 142 3/11/2024
1.4.0 127 3/11/2024
1.3.1 132 2/15/2024
1.3.0 151 12/20/2023
1.2.0 147 12/18/2023
1.1.1 135 12/8/2023
1.1.0 140 11/27/2023
1.0.8 172 7/31/2023
1.0.7 155 7/27/2023
1.0.6 136 7/27/2023
1.0.5 123 7/3/2023
1.0.4 129 7/3/2023
1.0.3 132 6/2/2023
1.0.2 146 6/1/2023