Orsu Suni
Orsu Suni

Reputation: 131

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?

Upvotes: 5

Views: 4649

Answers (2)

AkshayDandekar
AkshayDandekar

Reputation: 435

You can do that in-line as well.

${SUITE NAME.rsplit('.')[0]}

Upvotes: 4

Todor Minakov
Todor Minakov

Reputation: 20047

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

Upvotes: 6

Related Questions