Forum Discussion

mpartyka's avatar
mpartyka
Contributor
6 years ago
Solved

simple groovy - how to get project name?

I'd like to get the project name (label) using groovy.  I can get testCase Name, or Test Suite Name  (see below) ... but can't seem to get project name.  I must be missing something ?  Thanks in advance for any help !

 

def TestCaseName = testRunner.testCase.getLabel()
def TestSuiteName = testRunner.testCase.testSuite.getLabel()

 

  • Try this:

     

    def ProjectName= testRunner.testCase.testSuite.project.getName();

4 Replies

  • groovyguy's avatar
    groovyguy
    Champion Level 1

    Try this:

     

    def ProjectName= testRunner.testCase.testSuite.project.getName();
  • .getName(); instead of .getLabel() ... brilliant!    Why didn't I think of that!  ;)  
    Thanks for your help!
    • groovyguy's avatar
      groovyguy
      Champion Level 1

      More than welcome, always happy to help! :) 

  • Hi mpartyka,

     

    Yo can also try 

     

    def projectName = testRunner.testCase.testSuite.project.name

     

    Thanks,

    Himanshu Tayal