Forum Discussion

mpartyka's avatar
mpartyka
Contributor
5 years ago
Solved

Is it possible to update a test suite property from groovy step that is in another test suite?

In Test Suite A

  •   Test Case A
    • I have a groovy test step (in test suite A) that I want to update the value in a property of Test Suite B.

Test Suite B

 

Is this possible with groovy ? 

  • Thanks jsheph01 ... this is exactly what I was looking for !    

8 Replies

  • This will update a test suite property from a groovy step. This must be run as a groovy step and not a groovy assertion as you do not have access to test runner.

     

    def project = testRunner.testCase.testSuite.project
    project.getTestSuiteByName("Test Suite Name").setPropertyValue("propertyName", "Property Value")
  • nmrao's avatar
    nmrao
    Champion Level 3
    Thumb rule is to be able to execute each and every testcase independent.
    Not sure of your use case, but better avoid dependency the way currently you have if at possible.
    • richie's avatar
      richie
      Community Hero

      nmrao 

       

      I remember you saying before that testRunner isn't available in a script assertion - the Groovy Step snippet you provided is as follows:

      def project = testRunner.testCase.testSuite.project
      project.getTestSuiteByName("Test Suite Name").setPropertyValue("propertyName", "Property Value")

      if I wanted this in a script assertion - would the following work?

       

      def project = messageExchange.modelItem.testStep.testCase.testSuite.project
      project.getTestSuiteByName("Test Suite Name").setPropertyValue("propertyName", "Property Value")

       

      UPDATE TO TICKET: -  I confirmed the above does work in a script assertion, so I was going to delete this post - but there's no facility to delete my message  - so nmrao - no need to answer the question fella - cheers.

       

      Thanks man,

       

      rich

       

      • Olga_T's avatar
        Olga_T
        SmartBear Alumni (Retired)

        Thanks everyone for your participation!
        mpartyka, have you managed to find a solution? Did any of the replies help?