esaruoho
esaruoho

Reputation: 946

Displaying Tags via the console with "Log To Console"

I'm attempting to take the defined test.robot file content of [Tags] and display it on the Console. Here's what I have:

[Tags]  cat  dog

Now, I'm wondering how to have Log To Console output the tags?

I have, thus far, tried the following:

    ${TagVariable}=    Tags
    ${TagVariable1}=    Tags[0]
    ${TagVariable2}=    Tags[1]
    ${TagVariable3}=    [Tags]
    ${TagVariable4}=    [Tags][0]
    ${TagVariable5}=    [Tags][1]
    Log To Console  Tags
    Log To Console  [Tags]
    Log To Console  [Tags][0]
    Log To Console  [Tags][1]
    Log To Console  ${TagVariable}
    Log To Console  ${TagVariable1}
    Log To Console  ${TagVariable2}
    Log To Console  ${TagVariable3}
    Log To Console  ${TagVariable4}
    Log To Console  ${TagVariable5}

I just can't seem to grasp it.

Upvotes: 1

Views: 384

Answers (1)

AntonioMJ
AntonioMJ

Reputation: 134

Robot Provides several automatic variables. You can find all of them here

The one that you need is this one

  • @{TEST TAGS} : Contains the tags of the current test case in alphabetical order. Can be modified dynamically using Set Tags and Remove Tags keywords.

You may need to print it as \n@{TEST TAGS}, in the .robot file, depending on your context.

Upvotes: 3

Related Questions