如何从Robot Frame Work获取套件名称

Ors*_*uni 4 robotframework

我用过${SUITE NAME}标签.它将Suite名称与路径一起 给出"Robotframework.TestSuites.foldername.testsuitename".我只需要套件名称.我怎么能得到它?

Tod*_*kov 5

${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
Run Code Online (Sandbox Code Playgroud)

PS如果你在套件名称中使用圆点,它会变得很糟糕.


Aks*_*kar 4

您也可以在线执行此操作。

${SUITE NAME.rsplit('.')[0]}
Run Code Online (Sandbox Code Playgroud)