Skip to content

Latest commit

 

History

History
52 lines (36 loc) · 1.96 KB

README.md

File metadata and controls

52 lines (36 loc) · 1.96 KB

Getting Captain working with xUnit

Starting from a simple workflow that runs xunit, we want to

1. 🧪 Ensure xUnit produces xUnit-xml output

Ensure your project includes the XunitXml.TestLogger test logger

dotnet add package XunitXml.TestLogger --version 3.0.70

And use it with xunit test --logger xunit. Note: you can also change the outputted filename.

dotnet test --logger "xunit;LogFileName=TestResults.xml" --results-directory "TestResults"

Note: We've specified the filename and results directory here, however TestResults/TestResults.xml is also the default result path

2. 🔐 Create an Access Token

Create an Access Token for your organization within Captain (more documentation here).

Add the new token as an action secret to your repository. Conventionally, we call this secret RWX_ACCESS_TOKEN.

3. 💌 Install the Captain CLI, and call it when running tests

See the full documentation on test suite integration.

- uses: rwx-research/setup-captain@v1
- name: Run tests
  run: |
    captain run \
      --suite-id captian-examples-xunit2 \
      --test-results TestResults/TestResults.xml \
      -- dotnet test --logger "xunit;LogFileName=TestResults.xml" --results-directory "TestResults"
  env:
    RWX_ACCESS_TOKEN: ${{ secrets.RWX_ACCESS_TOKEN }}

4. 🎉 See your test results in Captain!

Take a look at the final workflow!