Skip to content

Test Selection

There are times when running every test within your HIL suite is not desirable. To allow running groups or individual tests, EmbedOps HIL supports two test selection mechanisms.

Specifying Test Targets

The eo hil run command takes an unlimited number of positional arguments that act as test targets. For example:

eo hil run hil/test_uart.py

will run the entire test_uart.py module. You can specify any number of test targets, separated by spaces. This allows you to run any combination of tests.

There are three different types of test targets. Note that all paths must be relative to the root of the repository:

  • Directories: hil/uart_tests
  • Modules: hil/uart_tests/test_uart_comms.py
  • Individual tests: hil/uart_tests/test_uart_comms.py::test_uart_init

Identifying individual tests is done using what PyTest calls the node ID. Each individual test has a unique node ID in the format path/to/module.py::function_name. If your tests are written within a class and not directly within a module, you must specify the class name as part of the node ID: hil/uart_tests/test_uart_comms.py::UartTestClass::test_uart_init.

Specific HIL Gateway device setups can be selected with the -d flag. Multiple devices can be selected with comma delimiter. For example:

  • eo hil run -d D-1
  • eo hil run -d D-1,D-3

Test Markers

The second option leverages a PyTest feature called test markers. You can add a marker to any individual test:

1
2
3
4
5
import pytest

@pytest.mark.uart_test
def test_uart_init():
    ...

You can run all tests with this marker with the -m option:

eo hil run -m uart_test