Foresight Test Kit Action
A GitHub Action to analyze test and/or coverage results. Foresight’s Test Kit action integrates with your Github Actions pipelines.
- It makes simple to see failed tests, visualize performance of your tests and see their logs. It is the fastest way to access a failed test results in your workflow runs.
- It correlates the changes to the codebase with the test coverage reports to determine how much of the changes are covered by the tests.
You need to integrate Test Kit action to your CI pipeline in order to use Test Monitoring and Change Impact Analysis features.
You'll need to have a reasonably modern version of node
. This won't work with versions older than 9, for instance.
Prerequisites
Foresight analyzes your test and coverage report artifacts.
Available test framework and report pairs
Test framework | Report format | Flaky support |
---|---|---|
CYPRESS1 | JSON | Yes |
CYPRESS1 | JUNIT | No |
JUNIT | JSON | Yes |
JUNIT | TXT | No |
JEST | JSON | Yes |
JEST | JUNIT | No |
PYTEST | JSON | Yes |
PYTEST | JUNIT | No |
XUNIT2 | n/a* | No |
XUNIT2 | TRX | No |
GOLANG | JSON | Yes |
GOLANG | TEXT | No |
ELIXIR | JUNIT | No |
TESTNG | n/a* | No |
You don't need to fill report format fields marked as n/a.
1 Cypress test report generation example
"e2e:junit": "cypress run --reporter junit --reporter-options 'mochaFile=results/foresight-test-[hash].xml'",
See detailed information on Cypress docs
Available coverage formats
Coverage formats |
---|
JACOCO/XML |
COBERTURA/XML |
GOLANG |
LCOV/TXT |
Usage
To use the action, add the following step after your test execution step. Please fill the test_format
, test_framework
and coverage_format
fields by checking the supported options above.
You can get your api_key
after sign up to Foresight.
- name: Foresight Test / Coverage Results
uses: runforesight/foresight-test-kit-action@v1
if: success() || failure()
with:
# api_key is optional if you add on public repository
api_key: <your_api_key>
# following 3 options are required if you want to use test monitoring features
test_format: <test_format>
test_framework: <test_framework>
test_path: <test_results_path>
# following 2 options are required if you want to use change impact analysis
coverage_format: <coverage_format>
coverage_path: <coverage_results_path>
# if you want to add multiple tags, add | before the first key
tags: <key:value>
Configuration
Option | Requirement | Description |
---|---|---|
api_key | Optional - Required | Foresight Api Key. Optional if you are adding test kit to an open-source project |
github_token | Optional | An alternative GitHub token, other than the default provided by GitHub Actions runner. |
test_framework | Optional | Runtime test framework name(jest, pytest, junit etc.) |
test_format | Optional | Runtime test format name(trx, junit etc.) |
test_path | Optional | Test results directory/file path. |
coverage_format | Optional | Runtime coverage format name(jacoco/xml, cobertura/xml, golang etc.) |
coverage_path | Optional | Coverage results directory/file path. |
cli_version | Optional | Installed Foresight cli version. Default is latest. |
disable_action | Optional | Disable Foresight test kit action without removing from yml. |
tags | Optional | Add tag(s) to your test runs |
Tagging your test runs
You can tag your test runs through test kit. This helps you to identify the test run you want to investigate in a quicker way.
Example
tags: |
node_version:${{ matrix.node }}
event_name:${{github.event_name}}
tag_tryer1:"tryer_value1"
After you add your test tags, you are able to filter them on the test runs page.