Using parameterized tests with unity

Hi,

To make it easier to write, maintain and check unittests, I would like to use the parameterized testing feature of unity (see unity documentation on github). By default parameterized testing is disabled and to use it, it needs to be enabled by adding :use_param_tests: true to the :unity element in the unity.cfg.yaml file.

When building unittests (based on the examples) the file is generated as part of the test_runner_generate(src/my_test.c) command in CMakeLists.txt. It is generated from a template file in the nRF SDK (~/ncs/v2.5.0/nrf/tests/unity/unity_cfg.yaml.template in my case). If I add the configuration option to this file I can use the parameterized test feature, but changing one of the sdk files is not a good and/or workable option.

So, how can I enable this option without overriding the sdk file?

I've looked at the cmake functions, but I can't figure out a way to override its behavior and/or provide my own template, other then rolling my own version of the test_runner_generate function; which is far from ideal too.

Any help is appreciated.

Kind regards,

Rhyaldir

Related