Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow multiple runners to be defined for one target #12

Merged
merged 5 commits into from
Mar 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,21 @@ The `template_dir` field is used to define the directory that contains the templ

See [templates documentation](./templates.md) for more information on the expected contents of these files and available variables.

## custom_target.\<CUSTOM_TARGET_NAME>.runner
## custom_target.\<CUSTOM_TARGET_NAME>.runner.\<RUNNER_NAME>

`runner` is a table that defines how to run the test suites and parse the results.
`runner` is a table that defines how to run the test suites and parse the results. There can be multiple runners defined for one target (for example, testing multiple platforms).

Each runner will inherit the fields of the previously-defined runner if they are not defined.

### Fields

#### command

The `command` field is used to define the command to run the test.
The `command` field is used to define the command to run the tests.

#### work_dir

The `work_dir` field is used to define the working directory for the runner. If not defined, the `out_dir` of the target will be used.

#### fail_regex_template

Expand Down Expand Up @@ -182,6 +188,16 @@ The variables available for use in the template. See [templates documentation](.
* `group_name` - The name of the group that contains the test (i.e. for `group.some_group`, `some_group` )
* `test_name` - The name of the test (i.e. for `test.some_test`, `some_test` )

### Example

```toml
[custom_target.minitest_unit.runner."rake test"]
command = "bundle exec rake test A='--verbose'"

fail_regex_template = "Test{{ suite_name | convert_case('Pascal') }}#test_{{ test_name }} = \\d+\\.\\d+ s = (F|E)"
pass_regex_template = "Test{{ suite_name | convert_case('Pascal') }}#test_{{ test_name }} = \\d+\\.\\d+ s = \\."
```

## document.\<DOCUMENT_NAME>

A document is a generated file that is regenered each time `polytest generate` is ran.
Expand Down
6 changes: 3 additions & 3 deletions examples/shapes/polytest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ test_regex_template = "def test_{{ name | convert_case('Snake') }}"

template_dir = "./templates/minitest_unit"

[custom_target.minitest_unit.runner]
[custom_target.minitest_unit.runner."rake test"]
command = "bundle exec rake test A='--verbose'"

fail_regex_template = "Test{{ suite_name | convert_case('Pascal') }}#test_{{ test_name }} = \\d+\\.\\d+ s = (F|E)"
pass_regex_template = "Test{{ suite_name | convert_case('Pascal') }}#test_{{ test_name }} = \\d+\\.\\d+ s = \\."

command = "bundle exec rake test A='--verbose'"

# Custom Document

[document.test_cases_csv]
Expand Down
Loading