Test options

See also

Please make sure to read Unit Testing guide first.

test_framework

New in version 6.0.

Type: String | Multiple: No | Default: unity

A Unit Testing framework name. Please follow to the Testing Frameworks for the available frameworks.

test_filter

Type: String (Pattern) | Multiple: Yes

Process only test suites whose path relative to the test_dir matches the specified pattern. See Test Hierarchy for more details.

Also, you can override this option using the pio test --filter command.

Pattern

Meaning

*

matches everything

?

matches any single character

[seq]

matches any character in seq

[!seq]

matches any character not in seq

Example

[env:myenv]
platform = native
test_filter =
  test_common
  native/*

test_ignore

Type: String (Pattern) | Multiple: Yes

Ignore test suites whose path relative to the test_dir matches the specified pattern. See Test Hierarchy for more details.

Also, you can override this option using the pio test --ignore command.

Pattern

Meaning

*

matches everything

?

matches any single character

[seq]

matches any character in seq

[!seq]

matches any character not in seq

Example

[env:myenv]
platform = embedded
test_ignore =
  embedded/*
  test_suite[13]

test_port

Type: String (Pattern) | Multiple: No

This option specifies communication interface between PlatformIO Unit Testing Test Runner and the target device. The possible values are the same as documented for monitor_port option.

If test_port isn’t specified, the PlatformIO Unit Testing runner will try to detect it automatically.

To print all available serial ports use the pio device list command.

test_speed

Type: Number | Multiple: No | Default: 115200

A connection speed (baud rate) to communicate with a target device.

test_build_src

Type: Bool (yes or no) | Multiple: No | Default: no

Setting test_build_src to yes will force Unit Testing engine to build the main source code from src_dir in pair with a test code. See Shared Code for details.

Example

[env:myenv]
platform = ...
test_build_src = yes

test_testing_command

Type: String | Multiline Arguments: Yes

A custom testing command that executes test cases and returns results to the standard output.

Typically, a default value for the Native is equal to:

[env:myenv]
platform = native
test_testing_command =
  ${platformio.build_dir}/${this.__env__}/program

You can override the default command and pass extra program arguments:

[env:myenv]
platform = native
test_testing_command =
  ${platformio.build_dir}/${this.__env__}/program
  arg1
  --option2
  option2_value

Please note that you can pass extra arguments to the program using CLI and pio test --program-arg option.

See Simulators examples.