Forum Discussion

Abascal's avatar
Abascal
New Contributor
4 years ago
Solved

Overwrite a TestSuite / TestCase property in the loadtestrunner.sh from command line

Hello everybody,

 

I have been some time trying to overwrite a test suite parameter through command line but I never figured out how to achieve it. Currently, I know it is possible to pass a property from command line with the -P option.

 

For example: 

 

testrunner.sh -r -f report -s ATP VALIDATION.xml -P property1=false 

 

When we execute it, the property1 will be set up as false at the project level. But...How about overwrite a property when the property is located at the test suite level? How can it be done? 

 

Thanks in advance. 

  • Abascal : If you know the desired Test Suite Name than you can write code in Load Script of Project as below:

     

    prop = project.getPropertyValue("Property1")
    project.getTestSuiteByName("TS1").setPropertyValue("Property1",prop)

    Also, you can find help in this link about command line arguments.

     

3 Replies

  • Abascal : If you know the desired Test Suite Name than you can write code in Load Script of Project as below:

     

    prop = project.getPropertyValue("Property1")
    project.getTestSuiteByName("TS1").setPropertyValue("Property1",prop)

    Also, you can find help in this link about command line arguments.

     

    • Abascal's avatar
      Abascal
      New Contributor

      Hi, thanks for the hint. I followed your approach and worked like a charm. However, I have implemented it in different way. I will leave it below just in case someone can find it useful.

       

      def prop = context.expand('${#Project#Property1}')
      testRunner.testCase.testSuite.setPropertyValue("PROP1TS", prop )

       

      Where Property1 is at project level and PROP1TS at Test Suite level.