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 the Unit Testing tests where the name matches specified patterns.

Also, you can override this option using 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]
test_filter =
  footest
  bartest_*
  test[13]

test_ignore

Type: String (Pattern) | Multiple: Yes

Ignore Unit Testing tests where the name matches specified patterns.

Also, you can override this option using 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]
test_ignore =
  footest
  bartest_*
  test[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.