Skip to content

kurnakovv/stryker-net-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Stryker.NET GitHub action

Visitors Stryker.NET mutation testing (latest version) Test with all params Test with all params disabled Test without params

This is a GitHub action that runs the Stryker.NET tool πŸ‘½

πŸ’‘ Features

  • 🏑 Generate a report for source branch
  • πŸ’Ύ Download the report
  • πŸ“Š Upload the report to the dashboard
  • πŸ“© Send a report message when PR is opened
  • πŸ†š Compare source and target branches

πŸš€ Quick start

1️⃣ Install dotnet-stryker (optional) | how?

2️⃣ Add a config file via terminal

dotnet stryker init --config-file ".config/stryker-config.json"

Or just create an empty file .config/stryker-config.json

3️⃣ Open .config/stryker-config.json and set minimum parameters

{
    "stryker-config": {
        "reporters": [
            "html",
            "dashboard",
            "progress",
        ],
        "project-info": {
            "name": "github.com/OWNER/YOUR_REPOSITORY_NAME"
        }
    }
}

Replace:

  • OWNER - with your GitHub username (e.g. kurnakovv)
  • YOUR_REPOSITORY_NAME - with your repository name (e.g. stryker-net-action)

4️⃣ Add GitHub secret (how?):

  • Name - STRYKER_DASHBOARD_API_KEY
  • Value - dashboard API key (how to get?)

5️⃣ Add the GitHub Action workflow at .github/workflows/stryker-net.yml

name: Stryker.NET mutation testing

on: [push, pull_request]

jobs:
  stryker_net:
    runs-on: ubuntu-latest
    # permissions.pull-request:write is required to send a report message to a pull request (when send-report-message: "true")
    permissions:
      pull-requests: write
    name: Stryker.NET GitHub action
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Setup .NET
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: 9.0.x

      - name: Stryker.NET
        uses: kurnakovv/stryker-net-action@v1.0.0
        with:
          config-path: ".config/stryker-config.json"
          dashboard-api-key: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}

6️⃣ Push all changes and open a PR on the default branch (what is it?).

Once the pipeline completes successfully, you'll see something like this: PR report

Note

If some steps do not suit you (e.g. you don't want to use the dashboard or send PR report message), you can disable/remove those options

βš™οΈ Configuration options

Input Location Description Required Default
config-path with File path where configuration is located, for example .config/stryker-config.json / docs false ---
dashboard-api-key with Stryker dashboard API key / docs false ---
report-source-branch with Run stryker report in current source branch (for default branch this parameter is always true) false true
report-source-branch-diff with Run Stryker report and compare default branch with current source branch. I do not recommend using it, as it works with bugs, this feature is waiting for a fix in this issue false false
upload-report with Upload report to GitHub cloud / what's under the hood? false true
send-report-message with Send report message when PR is opened (add permissions.pull-requests: write to action / how?) / what's under the hood? false ---

Note

if you are missing some configurations, you can add them to your configuration file .config/stryker-config.json | docs

❔ Why

  • The official docs use Azure DevOps syntax, not GitHub Action
  • The official repository doesn't work properly and has limited functionality. As the author stated (source):

    This project is a proof of concept created during a hackfest, there is no active maintainer for this project at this time

  • The unofficial repository contains no code and hasn't been updated in over 3 years
  • You can use the source code, but it is too large to duplicate it in each repository, which violates the DRY principle

That's why I decided to create this action πŸ”₯

🀝 Contributing

If you'd like to contribute and help improve this project β€” your support is very welcome ❀️

Instructions for all members are here

⭐ Give a star

If you like this project, please give it a ⭐ β€” thanks! πŸ€—