Skip to content

captain-examples/pytest

Repository files navigation

Getting Captain working with pytest

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

1. 🧪 Ensure pytest produces its reportlog output

The native pytest JUnit XML is insufficient for Captain's functionality. In place of it, we recommend installing pytest-reportlog. Once installed, ensure pytest produces compatible output with:

pytest --report-log=tmp/log.json

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-pytest \
      --test-results tmp/log.json \
      -- pytest --report-log=tmp/log.json
  env:
    RWX_ACCESS_TOKEN: ${{ secrets.RWX_ACCESS_TOKEN }}

4. 🎉 See your test results in Captain!

Take a look at the final workflow!

About

How to integrate Captain with pytest

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •  

Languages