New in version 3.0.
See also
Please make sure to read PIO Unit Testing guide first.
test_filter
¶Process only the PIO Unit Testing tests where the name matches specified patterns. Multiple names are allowed. Please separate them using comma+space “, “.
Also, you can filter some tests using platformio test --filter
command.
Pattern |
Meaning |
---|---|
|
matches everything |
|
matches any single character |
|
matches any character in seq |
|
matches any character not in seq |
Example
[env:myenv]
test_filter = footest, bartest_*, test[13]
test_ignore
¶Ignore PIO Unit Testing tests where the name matches specified patterns. Multiple names are allowed. Please separate them using comma+space “, “.
Also, you can ignore some tests using platformio test --ignore
command.
Pattern |
Meaning |
---|---|
|
matches everything |
|
matches any single character |
|
matches any character in seq |
|
matches any character not in seq |
Example
[env:myenv]
test_ignore = footest, bartest_*, test[13]
test_port
¶This option specifies communication interface (Serial/UART) between PlatformIO PIO Unit Testing Engine and target device. For example,
/dev/ttyUSB0
- Unix-based OS
COM3
- Windows OS
If test_port
isn’t specified, then PlatformIO will try to detect it
automatically.
To print all available serial ports use platformio device list command.
test_transport
¶PIO Unit Testing engine uses different transports to communicate with a
target device. By default, it uses Serial/UART
transport provided
by a framework. For example, when
“framework = arduino
”, the first available
Serial
will be used.
Baud rate should be set to 9600
.
You can also define custom
transport and implement its interface:
unittest_uart_begin();
unittest_uart_putchar(char c);
unittest_uart_flush();
unittest_uart_end();
Custom transport for Native platform
Set
test_transport = custom
in Project Configuration File platformio.ini[env:mycustomtransport] platform = native test_transport = custom
Create
unittest_transport.h
file inproject/test
directory and implement prototypes above#ifndef UNITTEST_TRANSPORT_H #define UNITTEST_TRANSPORT_H #include <stdio.h> void unittest_uart_begin() { } void unittest_uart_putchar(char c) { putchar(c); } void unittest_uart_flush() { fflush(stdout); } void unittest_uart_end() { } #endif