Reputation: 33
Can anyone guide me through the process, if it is already available in azure devops build pipeline?
I want to achieve the following tasks:
what I have accomplished is I can push back results to the repository and publish it in new pipeline, Is this process ok or there is some other way to accomplish this same task? If I pushed trx to repository a new build is triggered because of the changes in the repo and thus this is not the proper or standard way of doing this even with some custom CI trigger rules which can exclude trx file for automation.
Long question short : 1. How to publish test results for the same build event, if the software is deployed and tested on VM (through remote powershell)?
Upvotes: 1
Views: 1954
Reputation: 30313
Update:
Since copy tasks donot work out. There is a workaround to move the test results from azure vm to azure build agents.
You can create a server(azure web app) and upload the test results to the web server(using kudu api).
Then you can add a powershell task to call kudu api to download the test results to your azure agents. Please check this thread for full scripts example, and here for more information about kudu api.
In you build pipeline you can add a Remote copy task(or Copy files over SSH task) to copy the test results files from the VM to the folder (eg. $(Agent.BuildDirectory)\TestResults
) on your agent. For below example.
You need to copy all the generated result files.
Then you need to add a publish test result task to publish the test result.
You will most likely encounter below warning saying .log,.html not found when executing your publish test result task.
Above warning happens is because when you copy the test result files from remote vm to your agent, the path to those files changes. You need to change the files path in trx file to its right place($(Agent.BuildDirectory)\TestResults) in your agent.
You can replace the file path in trx file by RegEx Match & Replace.
The tasks I used in above steps is listed as below.
If all above steps are set correctly, you will then see the test results in the Tests tab after your build run is completed
Upvotes: 1