Skip to content

Removed folder structure dependency in test utils

We found a way to remove the last compatibility problem between our execution environments (relative scenario filepath for loading scenarios in tests).

gtest offers a way to get the relative filepath to the test file. The "test_info_.file()" resolves to e.g. "external/open_scenario_engine/test/OpenScenarioEngineTest.cpp" for us. So we adjust this to get the relative path to the scenarios. We add "./" at the beginning and remove the filename at the end and instead add "data/Scenarios/". The only drawback is that test_info_ is only available in the TEST_F class and not in it's base class, so we need to construct the scenario filepath in each TEST_F.

Please check, if this also works for you with cmake. You mentioned that you need "./data/Scenarios", which would work if the "test_info_.file()" returns "myTest.cpp" in your case.

Signed-off-by: Andreas Rauschert andreas.rb.rauschert@bmw.de

Edited by Andreas Rauschert

Merge request reports

Loading