Skip to content

This repository contains a Typescript GitHub action for parsing trx files and creating status check for each trx file based on its test outcome

License

Notifications You must be signed in to change notification settings

NasAmin/trx-parser

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

0b39570 Â· Mar 15, 2021
Jan 2, 2021
Oct 20, 2020
Jan 8, 2021
Feb 9, 2021
Nov 6, 2020
Oct 21, 2020
Feb 9, 2021
Jan 8, 2021
Oct 28, 2020
Oct 19, 2020
Oct 19, 2020
Oct 19, 2020
Oct 19, 2020
Oct 19, 2020
Nov 3, 2020
Nov 6, 2020
Nov 3, 2020
Oct 19, 2020
Oct 21, 2020
Mar 15, 2021
Mar 15, 2021
Oct 28, 2020

Repository files navigation

trx-parser 🧹

This Action was inspired by https://github.com/zyborg/dotnet-tests-report

Build Test GitHub release (latest by date)

This GitHub Action provides a way of parsing dotnet test results from trx files in a given directory. The action will find trx files specified in the TRX-PATH input variable. This path must be accessible to the action.

It will read each individual .trx file. Loads up its data and converts it to a typed json object to make it easier to traverse through the data. For each TRX, it will create a Github Status check and generate a markup report for each trx. The report name and title are derived from the trx file using the data.TestRun.TestDefinitions.UnitTest[0]._storage

Reports

The following reports show a failing and a passing check generated by this action.

Workflow Reports:

Usage

To make trx-parser a part of your workflow, just add the following to your existing workflow file in your .github/workflows/ directory in your GitHub repository.

name: Test
on: [pull_request]

jobs:
  Build:
    runs-on: ubuntu-latest
    steps:
      # Replace this whichever way you build your code
      - name: Build & Test dotnet code
        run: |
          dotnet restore
          dotnet build -c Release no-restore
          dotnet test -c Release --no-restore --no-build --loger trx --results-directory ./TestResults
      # Using the trx-parser action
      - name: Parse Trx files
        uses: NasAmin/trx-parser@v0.0.3
        id: trx-parser
        with:
          TRX_PATH: ${{ github.workspace }}/TestResults #This should be the path to your TRX files
          REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}          

Contributing

Anyone is welcome to contribute and make this action better. Please fork the repository and create a pull request with proposed changes.

Development

  • Clone this repository
  • Run npm run build and npm run test
  • Run npm run all to regenerate the dist directory.