2
votes

I'm trying to add a 'Publish Test Results' task into my Azure DevOps release pipeline, however, it looks like when I try to publish the .trx file, it's not looking in the correct folder and tries to parse an invalid file format (I'm assuming this is because it can't find the TestResults folder). I can see my file being created here in the Visual Studio Test task logs:

2020-02-19T21:28:57.6557476Z Vstest.console.exe exited with code 0.

2020-02-19T21:28:57.6557819Z:Completed test execution

2020-02-19T21:28:57.6640479Z Test results files: C:\agents\vm1-1_work_temp\TestResults\vm1$_vm1_2020-02-19_21_28_31.trx

However, in my Publish Test Results task logs, I get this error:

2020-02-19T21:28:59.7249456Z [command]C:\agents\vm1-1_work_tasks\PublishTestResults_0b0f01ed-7dde-43ff-9cbb-e48954daf9b1\2.164.3\modules\TestResultsPublisher.exe @C:\agents\vm1-1_work_temp\d793cb80-535e-11ea-9ab4-8f1d738f183d.txt

2020-02-19T21:29:00.5600855Z ##[warning]Failed to parse result files: Invalid file format.

This is what my Test Run and Publish Test Results tasks look like....can anyone point out what I am doing wrong here? I've seen people say that I don't need to add this task, but I am unable to see the Test Results tab in the pipeline, I can only see the .trx file attached to the task (see below).

Visual Studio Test Task

Publish Test Results Task

Pipeline screenshot

1
I suspect there is an issue with the .trx file or in the test run itself. That's why you are not getting test results from the VSTest task (you should) and that is why the Publish Test task is complaining. Can you open the .trx file in Visual Studio? Is it a valid format. Would also check that your tests are actually executing when you look at the logs. Turn on debug output for more info. docs.microsoft.com/en-us/azure/devops/pipelines/…Eric Smith
Hey Eric, tests are definitely running, I can see them in the log (apologies for not including this). I can also open the .trx file that is attached to the VS Test step and it opens fine. This is what has my stumped, because I can actually download and open the file with no issues. Unfortunately I can't attach it as there is some information in there that I can't share.benm912
Gotcha, when you look at the log run for the VSTest step at the end of your logs, are you seeing this line? Test results files: see any line with Publishing test results: ? Also would be interested if you get any additional hints to the issue if you ran it with debug on.Eric Smith

1 Answers

4
votes

TestResultsFormat is an alias for the testRunner input name. It seems you are using VSTest testRunner, so in Publish Test Results task, you should choose VSTest in TestResultsFormat.