Forum Discussion

roryLIT's avatar
roryLIT
Contributor
10 years ago
Solved

Get testcase name and testsuite name via property expansion?

Is it possible to get the TestCase name/TestSuite name in the TestCase/TestSuite properties section (not the Custom Properties section) via property expansion?

Thanks
  • ${=testRunner.testCase.name}
  • You really should have a read through the documentation!
    ${=testRunner.testCase.testSuite.name}

6 Replies

  • SiKing's avatar
    SiKing
    Community Expert
    You really should have a read through the documentation!
    ${=testRunner.testCase.testSuite.name}
    • nagoorkj's avatar
      nagoorkj
      Contributor

      Hi Team,

       

      i need to access the test case level property from test suite tear down script.

       

      Tried with test runner or context.expand but which is not accessible so please advice on this.

      • Radford's avatar
        Radford
        Super Contributor

        The test suite tear down script provides a testSuite variable. Try something like this:

         

        def testCaseProprty = testSuite.getTestCaseByName('Your TestCase name').getPropertyValue('Your Property Name')
        log.info(testCaseProprty)
        

        Note: It's probably best to start a new topic with a new question rather than resurrecting a 5 year old thread, it makes it a lot less confusing for people trying to help you.

  • SiKing's avatar
    SiKing
    Community Expert
    ${=testRunner.testCase.name}
  • Thanks! Is there no way to do the testSuite property name either?