Forum Discussion

itaykaldi's avatar
itaykaldi
Contributor
11 years ago

Get all test step properties from groovy

Hey,
How can I get all test step properties from groovy?

10x.
  • Cizo89's avatar
    Cizo89
    Frequent Contributor
    Oh ok, try this script:

    //Get properties from all TestSteps in current TestCase
    for (testStep in testRunner.testCase.getTestStepList()){
    if (testStep.getPropertyCount() > 0){
    for (prop in testStep.getPropertyList()){
    log.info(testStep.getName() + " has property " + prop.getName())
    }
    } else{
    log.info(testStep.getName() + " doesn't have properties!")
    }
    }


    //Get properties from one specific TestStep
    def testStep = testRunner.testCase.testSteps["XXX"]

    if (testStep.getPropertyCount() > 0){
    for (prop in testStep.getPropertyList()){
    log.info(testStep.getName() + " has property " + prop.getName())
    }
    } else{
    log.info(testStep.getName() + " doesn't have properties!")
    }


    Regards,
    Marek
  • Cizo89's avatar
    Cizo89
    Frequent Contributor
    Hi,

    could you be, please, more specific?
    You mean all properties in all TestSteps in your project/TestSuite/TestCase or all properties in your Properties TestStep?

    Regards,
    Marek
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    It should work with loadTestRunner, check the soapui log it should be logged there. Also make sure you have the option for do not disable groovy, File > Preferences > UI setting .

    You can add the following script in set up script

    for (testStep in loadTestRunner.getLoadTest().getTestCase().getTestStepList()){
    if (testStep.getPropertyCount() > 0){
    for (prop in testStep.getPropertyList()){
    log.info(testStep.getName() + " has property " + prop.getName())
    }
    } else{
    log.info(testStep.getName() + " doesn't have properties!")
    }
    }




    Thanks,
    Jeshtha