TFS 2013 related to test automation environment with xUnit criteria

I am wondering if it is possible to associate Test Cases in TFS 2013 with xUnit tests. It currently works great for msTest tests, but as soon as I change the method attribute from “TestMethod” to “Fact” and rebuilding the test no longer appears when I click “Linked Automation” in the test case to link the two.

Does anyone have any experience or answers for this?

thanks

+6
source share
1 answer

This is possible using the TFS API. This PowerShell script shows you how to do this (see https://blogs.msdn.microsoft.com/gautamg/2012/01/01/how-to-associate-automation-programmatically/ for reference).

# Get TC $tfsTpc = [Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory]::GetTeamProjectCollection($TPC_URL) $tms = $tfsTpc.GetService([Microsoft.TeamFoundation.TestManagement.Client.ITestManagementService]) $tp = $tms.GetTeamProject($TP_NAME) $tc = $tp.TestCases.Find($tcId) # Compute Automation Guid $sha1Crypto = new-object System.Security.Cryptography.SHA1CryptoServiceProvider [Byte[]] $bytes = New-Object Byte[] 16 [Array]::Copy($sha1Crypto.ComputeHash([System.Text.Encoding]::Unicode.GetBytes($testName)), $bytes, $bytes.Length) # Create association $tc.Implementation = $tp.CreateTmiTestImplementation($testName, $AUTOMATION_TYPE, $AUTOMATION_STORAGE_NAME, $automationGuid) $tc.Save() $automationGuid = New-Object -TypeName Guid -ArgumentList @(,$bytes) 

But you cannot link execution with a test case in TFS.

The test must be run with MSTest V1 to register the results as valid TRX for publication in TFS through TCM.exe. Even with vstest.console.exe and the TRX log parameter, the xml result is not understood by TCM.exe.

For reference see: http://bugsareinthegaps.com/uploading-automated-test-results-to-mtm-made-easy/

0
source

Source: https://habr.com/ru/post/979333/


All Articles