diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml index 8a28e771e..48ec28d22 100644 --- a/.github/actions/test/action.yml +++ b/.github/actions/test/action.yml @@ -25,6 +25,10 @@ inputs: description: "A comma-separated list of specs to be tested. Accepts a spec (test only this spec), a +spec (test also this immature spec), or a -spec (do not test this mature spec)." required: false default: "" + skips: + description: "A json array of regexp to skip tests." + required: false + default: "" args: description: "[DANGER] The `args` input allows you to pass custom, free-text arguments directly to the Go test command that the tool employs to execute tests." required: false @@ -33,6 +37,16 @@ runs: steps: - id: github uses: pl-strflt/docker-container-action/.github/actions/github@v1 + - id: prepare-args + shell: bash + env: + SKIPS: ${{ inputs.skips }} + run: | + SKIPS_ARGS="" + if [ -n "$SKIPS" ]; then + SKIPS_ARGS=$(echo "$SKIPS" | jq -r '.[]' | sed -e 's/^/--skip="/' -e 's/$/"/' | paste -s -d ' ' -) + fi + echo "SKIPS_ARGS=$SKIPS_ARGS" >> $GITHUB_OUTPUT - name: Run the test uses: pl-strflt/docker-container-action@v1 env: @@ -40,12 +54,13 @@ runs: SUBDOMAIN: ${{ inputs.subdomain-url }} JSON: ${{ inputs.json }} SPECS: ${{ inputs.specs }} + SKIPS: ${{ prepare-args.outputs.SKIPS_ARGS }} with: repository: ${{ steps.github.outputs.action_repository }} ref: ${{ steps.github.outputs.action_sha || steps.github.outputs.action_ref }} dockerfile: Dockerfile opts: --network=host - args: test --url="$URL" --json="$JSON" --specs="$SPECS" --subdomain-url="$SUBDOMAIN" -- ${{ inputs.args }} + args: test --url="$URL" --json="$JSON" --specs="$SPECS" ${SKIPS} --subdomain-url="$SUBDOMAIN" -- ${{ inputs.args }} build-args: | VERSION:${{ steps.github.outputs.action_ref }} - name: Create the XML diff --git a/CHANGELOG.md b/CHANGELOG.md index fc2788da3..dea4d4030 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased ### Added - `--version` flag shows the current version +- `--skip` parameter to skip one or more tests. - Metadata logging used to associate tests with custom data like versions, specs identifiers, etc. ## [0.3.0] - 2023-07-31 diff --git a/README.md b/README.md index 97aaea155..edca23b58 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ The `test` command is the main command of the tool. It is used to test a given I | html | GitHub Action | The path where the one-page HTML test report should be generated. | `./report.html` | | markdown | GitHub Action | The path where the summary Markdown test report should be generated. | `./report.md` | | specs | Both | A comma-separated list of specs to be tested. Accepts a spec (test only this spec), a +spec (test also this immature spec), or a -spec (do not test this mature spec). | Mature specs only | +| skip | Both | Run only the those tests that do not match the regular expression. Similar to golang's skip, the expression is split by slash (/) into a sequence and each part must match the corresponding part in the test name, if any | empty | | args | Both | [DANGER] The `args` input allows you to pass custom, free-text arguments directly to the Go test command that the tool employs to execute tests. | N/A | ##### Specs @@ -79,6 +80,7 @@ A few examples: markdown: report.md html: report.html args: -timeout 30m + skips: '["TestGatewaySubdomains", "TestGatewayCar/GET_response_for_application/.*/Header_Content-Length"]' ``` ##### Docker