Forum Discussion

krogold's avatar
krogold
Regular Contributor
6 years ago

Is it possible to set a tag programmatically ?

Hello,

I have defined tags for my tests, and I would like to know if it is possible to set them programmatically.

The aim of that would be to tag wit ERROR the tests that fail, in order to be able to play only the tests with this tag on the next run.

 

thank you for any help

 

Alexandre

    • krogold's avatar
      krogold
      Regular Contributor

      Well, for instance I have manually declared a tag "ERROR" at project level.

      At the end of each test, in my teardown script I have a small processing to display the test result and I would like, depending on the test result, to set or unset this ERROR tag. This, in order to launch the next run with the tag ERROR and replay only the failing test cases.

      So far, in my teardown script, I can get the tag id (with getTagId("ERROR")) and I can check if it is assigned to the current test (isTagAssigned), what I would like to do is :

      - if the test fails, set the ERROR tag to the current test

      - if the test passes and the tag ERROR is set, unset this tag

       

      do you think it is possible with groovy ?

       

      thanks

      • nmrao's avatar
        nmrao
        Champion Level 3
        All you are trying to do is to find the test cases error out?