Giter Club home page Giter Club logo

dotnet-tests-report's Introduction

dotnet-tests-report

GitHub Action to run .NET tests and generate reports and badges.

โญ I appreciate your star, it helps me decide to which OSS projects I should allocate my spare time.


GitHub Workflow - CI GitHub release (latest by date)


This Action can be used to execute .NET tests using unit testing frameworks such as xUnit, NUnit and MSTest within a GitHub Workflow, as well as generate a Report from the tests results and attach it to the Workflow Run as a Check Run.

Check out the usage below.

Samples

Here we see some badges generated along with some Gist-based Tests Reports as part of a GitHub Workflow associated with this project.

  • XUnit Tests
  • NUnit Tests
  • MSTest Tests

And here are some samples of the actual generated reports:

Badges:

Workflow Reports:
Gist Reports:

Usage

Check out action.yml for full usage details. Here are some samples.

This is a basic example, that just provides a path to a single test project, and specifies the report name and title.

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: use this action, test solution dir
        uses: zyborg/dotnet-tests-report@v1
        with:
          project_path: tests/My.Project.Tests
          report_name: my_project_tests
          report_title: My Project Tests
          github_token: ${{ secrets.GITHUB_TOKEN }}

In this example, a Gist-based report is generated along with the one that is attached to the Workflow Run. Additionally, we request a Badge be generated that shows the number of passed tests out of the total number of tests found. We do this for each of two separate unit test projects.

jobs:
  test:
    runs-on: ubuntu-latest
    steps:

      - name: unit tests for Contoso Business Layer
        uses: zyborg/dotnet-tests-report@v1
        with:
          project_path: tests/Contoso.Business.Tests
          report_name: contoso_business_tests
          report_title: Contos Business Tests
          github_token: ${{ secrets.GITHUB_TOKEN }}
          gist_name: contoso_business_tests.md
          gist_badge_label: 'Contoso Business: %Counters_passed%/%Counters_total%'
          gist_token: ${{ secrets.GIST_TOKEN }}

      - name: unit tests for Contoso Service Layer
        uses: zyborg/dotnet-tests-report@v1
        with:
          project_path: tests/Contoso.Service.Tests
          report_name: contoso_service_tests
          report_title: Contos Service Tests
          github_token: ${{ secrets.GITHUB_TOKEN }}
          gist_name: contoso_service_tests.md
          gist_badge_label: 'Contoso Service: %Counters_passed%/%Counters_total%'
          gist_token: ${{ secrets.GIST_TOKEN }}

Set check status based on test outcome

By default the check status is set to 'neutral'. Set the flag set_check_status_from_test_outcome: true. Note that setting this flag to true will fail the check on pull requests if at least one test fails in your project.

PowerShell GitHub Action

This Action is implemented as a PowerShell GitHub Action.

dotnet-tests-report's People

Watchers

 avatar  avatar

Forkers

jason-edstrom

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.