How to get package name from Robot Frame Work

I used the tag ${SUITE NAME}. He gives the name Suitealong with "Robotframework.TestSuites.foldername.testsuitename". I only need the package name. How can i get this?

+4
source share
2 answers

You can also do this in a line.

${SUITE NAME.rsplit('.')[0]}
+3
source
${the name}=    Set Variable    ${SUITE NAME}

# split the output on every . character
${the name}=    Split String    ${the name}     separator=.

# get the last member of the split
${the name}=    Set Variable    @{the name}[-1]

Log To Console      ${the name}    # prints testsuitename in your example

PS It will be unpleasant if you use periods in the names of your packages.

+5
source

Source: https://habr.com/ru/post/1676472/


All Articles