Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get suite name from Robot Frame Work

I have used ${SUITE NAME} tag. It is giving the Suite name along with the path as "Robotframework.TestSuites.foldername.testsuitename". I need suite name only. How can I get that?

like image 430
Orsu Suni Avatar asked May 05 '17 12:05

Orsu Suni


2 Answers

${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

P.S. It'll get nasty if you use dots in your suite names.

like image 188
Todor Minakov Avatar answered Oct 13 '22 22:10

Todor Minakov


You can do that in-line as well.

${SUITE NAME.rsplit('.')[0]}
like image 36
AkshayDandekar Avatar answered Oct 13 '22 22:10

AkshayDandekar