After specifying the test suite name with robot -s, why are the directory levels displayed by BuiltIn.Log ${SUITE NAME} the same?

In robotframework code, after specifying the test suite name with robot -s , why does BuiltIn.Log ${SUITE NAME} display as Cases.DpCpeRoute.DpCpeRoute.DpCpeRoute when the actual structure under Cases consists of three separate directory levels? I need to retrieve the name of the first-level directory under Cases as the functional module name. How can this be achieved successfully?

SUITE NAME variable contains the full dotted path for the actual test suite. What you can do is to “filter” that value, for example, using python:

@{names}=    Evaluate    "${SUITE NAME}".split('.')
Log    ${names[1]}
1 Like