TestIT.Adapter
1.0.0
See the version list below for details.
dotnet add package TestIT.Adapter --version 1.0.0
NuGet\Install-Package TestIT.Adapter -Version 1.0.0
<PackageReference Include="TestIT.Adapter" Version="1.0.0" />
paket add TestIT.Adapter --version 1.0.0
#r "nuget: TestIT.Adapter, 1.0.0"
// Install TestIT.Adapter as a Cake Addin #addin nuget:?package=TestIT.Adapter&version=1.0.0 // Install TestIT.Adapter as a Cake Tool #tool nuget:?package=TestIT.Adapter&version=1.0.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
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%}, "certValidation": {%CERT_VALIDATION%} }
Fill parameters with your configuration, where:
URL
- location of the TMS instance.USER_PRIVATE_TOKEN
- API secret key. To do that:- Go to the
https://{DOMAIN}/user-profile
profile. - Copy the API secret key.
- Go to the
PROJECT_ID
- ID of a project in TMS instance.- Create a project.
- Open DevTools > Network.
- Go to the project
https://{DOMAIN}/projects/{PROJECT_GLOBAL_ID}/tests
. - GET-request project, Preview tab, copy iID field.
CONFIGURATION_ID
- ID of a configuration in TMS instance.- Create a project.
- Open DevTools > Network.
- Go to the project
https://{DOMAIN}/projects/{PROJECT_GLOBAL_ID}/tests
. - GET-request configurations, Preview tab, copy id field.
TEST_RUN_ID
- ID of the created test-run in TMS instance.TEST_RUN_ID
is optional. If it is not provided, it is created automatically.TEST_RUN_NAME
- name of the new test-run.TEST_RUN_NAME
is optional. If it is not provided, it is created automatically.ADAPTER_MODE
- adapter mode. Default value - 0. The adapter supports following modes:- 0 - in this mode, the adapter filters tests by test run ID and configuration ID, and sends the results to the test run.
- 1 - in this mode, the adapter sends all results to the test run without filtering.
- 2 - in this mode, the adapter creates a new test run and sends results to the new test run.
AUTOMATIC_CREATION_TEST_CASES
- mode of automatic creation test cases. Default value - false. The adapter supports following modes:- true - in this mode, the adapter will create a test case linked to the created autotest (not to the updated autotest).
- false - in this mode, the adapter will not create a test case.
CERT_VALIDATION
- mode of API-client certificate validation. Default value - true.
ENV
You can use environment variables (environment variables take precedence over file variables):
TMS_URL
- location of the TMS instance.TMS_PRIVATE_TOKEN
- API secret key.TMS_PROJECT_ID
- ID of a project in TMS instance.TMS_CONFIGURATION_ID
- ID of a configuration in TMS instance.TMS_ADAPTER_MODE
- adapter mode. Default value - 0.TMS_TEST_RUN_ID
- ID of the created test-run in TMS instance.TMS_TEST_RUN_ID
is optional. If it is not provided, it is created automatically.TMS_TEST_RUN_NAME
- name of the new test-run.TMS_TEST_RUN_NAME
is optional. If it is not provided, it is created automatically.TMS_AUTOMATIC_CREATION_TEST_CASES
- mode of automatic creation test cases. Default value - false.TMS_CERT_VALIDATION
- mode of API-client certificate validation. Default value - true.TMS_CONFIG_FILE
- name of the configuration file.TMS_CONFIG_FILE
is optional. If it is not provided, it is used default file name.
Command line
You also can CLI variables (CLI variables take precedence over environment variables):
tmsUrl
- location of the TMS instance.tmsPrivateToken
- API secret key.tmsProjectId
- ID of a project in TMS instance.tmsConfigurationId
- ID of a configuration in TMS instance.tmsAdapterMode
- adapter mode. Default value - 0.tmsTestRunId
- ID of the created test-run in TMS instance.tmsTestRunId
is optional. If it is not provided, it is created automatically.tmsTestRunName
- name of the new test-run.tmsTestRunName
is optional. If it is not provided, it is created automatically.tmsAutomaticCreationTestCases
- mode of automatic creation test cases. Default value - false.tmsCertValidation
- mode of API-client certificate validation. Default value - true.tmsConfigFile
- name of the configuration file.tmsConfigFile
is optional. If it is not provided, it is used default file name.
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 -DtmsTestRunId=a17269da-bc65-4671-90dd-d3e3da92af80 -tmsTestRunName=Regress -tmsAutomaticCreationTestCases=true -tmsCertValidation=true --debug
runner
- path to vstest.console.dll or vstest.console.exetestassembly
- path to dll with testsdebug
- enable debug logs
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;
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.AddAttachment("/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 | Versions 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. |
-
.NETStandard 2.1
- Fody (>= 6.6.4)
- MethodBoundaryAspect.Fody (>= 2.0.148)
- Microsoft.TestPlatform.ObjectModel (>= 17.5.0)
- System.Text.Json (>= 7.0.2)
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 | 54 | 11/27/2024 |
1.6.5 | 153 | 10/8/2024 |
1.6.4 | 189 | 9/12/2024 |
1.6.3 | 201 | 7/5/2024 |
1.6.1 | 547 | 6/30/2024 |
1.6.0 | 112 | 5/20/2024 |
1.5.1 | 131 | 4/9/2024 |
1.5.0 | 121 | 3/29/2024 |
1.4.1 | 198 | 3/11/2024 |
1.4.0 | 104 | 3/11/2024 |
1.3.1 | 134 | 2/15/2024 |
1.3.0 | 156 | 12/20/2023 |
1.2.0 | 109 | 12/18/2023 |
1.1.1 | 122 | 12/8/2023 |
1.1.0 | 149 | 11/27/2023 |
1.0.8 | 2,728 | 7/31/2023 |
1.0.7 | 168 | 7/27/2023 |
1.0.6 | 146 | 7/27/2023 |
1.0.5 | 403 | 7/3/2023 |
1.0.4 | 155 | 7/3/2023 |
1.0.3 | 363 | 6/2/2023 |
1.0.2 | 130 | 6/1/2023 |
1.0.1 | 377 | 5/25/2023 |
1.0.0 | 188 | 4/17/2023 |