Forum Discussion

vpachpute1's avatar
vpachpute1
Frequent Contributor
8 years ago

How to set TestSuite Properties for specific suite name from Groovy

Hi   Currently I am using this testRunner.testCase.testSuite.setPropertyValue("SpendLimit_Mon", spendlimit_mon);   But this only sets for the current test suite.   I want to specify name of te...
  • HKosova's avatar
    8 years ago

    Hi Vishal,

     

    You are almost there. You need to get the project object and then use any of this:

    project.getTestSuiteByName("name")
    project.testSuites["name"]
    project.testSuites."name"

     

    So inside a test case you would use:

    testRunner.testCase.testSuite.project.testSuites["SpendLimits"].setPropertyValue("SpendLimit_Trans", spendlimit_Trans);
    // or
    testCase.testSuite.project.testSuites["SpendLimits"].setPropertyValue("SpendLimit_Trans", spendlimit_Trans);

    From a test suite script:

    testSuite.project.testSuites["SpendLimits"].setPropertyValue("SpendLimit_Trans", spendlimit_Trans);

    From a project script:

    project.testSuites["TestSuite"].setPropertyValue("SpendLimit_Trans", spendlimit_Trans);