PowerShell script to extract Passed & Failed Data from a .trx file

Here is the powershell code that would allow you to extract Passed and Failed Data from a .trx file

This would enable to extract the data in a AzureDevops Task

<!-- wp:code -->
<pre class="wp-block-code"><code>
foreach($line in Get-Content $(System.DefaultWorkingDirectory)\TestResults$(Build.BuildId).trx) {
if($line -match '<Counters total="(?<total>.+)" executed="(?<executed>.+)" passed="(?<passed>.+)" error="(?<error>.+)" failed="(?<failed>.+)" ' )
Write-Host "##vso[task.setvariable variable=result]$total"

<!-- /wp:code -->

10 Responses

  1. Pretty! This has been an incredibly wonderful post. Thank you for providing this information. adreamoftrains web hosting providers

  2. website host says:

    Good day I am so happy I found your blog page, I really found you by error,
    while I was researching on Askjeeve for something else, Nonetheless
    I am here now and would just like to say many thanks for a marvelous post and a all round exciting blog (I also love the theme/design), I don’t have time to browse it
    all at the minute but I have bookmarked it and also added your RSS feeds, so when I have time I will be back to read a great deal more, Please do keep up the great work.

  3. We’re a group of volunteers and starting a new scheme in our community.
    Your website provided us with valuable information to work on.
    You’ve done a formidable job and our whole community will
    be grateful to you.

  4. My programmer is trying to persuade me to move to .net from PHP.
    I have always disliked the idea because of the costs.
    But he’s tryiong none the less. I’ve been using
    Movable-type on several websites for about a year and am anxious about switching to another
    platform. I have heard good things about blogengine.net.
    Is there a way I can import all my wordpress content into
    it? Any kind of help would be greatly appreciated! 31muvXS cheap flights

  5. After I initially left a comment I seem to have clicked on the -Notify me
    when new comments are added- checkbox and from now on whenever a comment is
    added I get 4 emails with the exact same comment.
    Perhaps there is an easy method you are able to remove me from that service?

    Cheers! cheap flights 34pIoq5

  6. Your style is unique compared to other folks I’ve read stuff from.
    Thank you for posting when you’ve got the opportunity, Guess I will just book mark this site.

  7. Wow, that’s what I was searching for, what a data!

    present here at this website, thanks admin of
    this website.

  8. We’re a group of volunteers and starting a new scheme in our community.
    Your web site offered us with valuable information to work on.
    You have done an impressive job and our entire community will be thankful to you.

  9. This article gives clear idea designed for the new visitors of blogging, that actually
    how to do running a blog.

  10. Hey there! This is my first visit to your blog! We are a team of volunteers and starting
    a new initiative in a community in the same niche. Your
    blog provided us beneficial information to work
    on. You have done a outstanding job!

Leave a Reply

Your email address will not be published.

sixteen − five =