Friday, 17 May 2013

Enable and Disable test steps in SoapUI using Groovy

Hi,

If you require to get the list of of test steps in SoapUI then use the below code:

// Get the list of test steps
def oNameList = testRunner.testCase.getTestStepList().name

// Use loop to print name of every step in log
for(iNameCounter in (0..oNameList.size-1))
{
log.info oNameList[iNameCounter]
}

Example Image:













* Note: Result in sequential order as shown in above image

## Disable test steps in SoapUI using groovy

1 Get the list of test steps using the above code and use the below code:

// Code to disable test step using its name:
testRunner.testCase.getTestStepByName("TestStep1").setDisabled(true)

if require to disable all step in one go then use below code:

//Get the names of all test steps
def oNameList = testRunner.testCase.getTestStepList().name
for(iNameCounter in (0..oNameList.size-1))
{  
testRunner.testCase.getTestStepByName(oNameList[iNameCounter]).setDisabled(true)
}




## Enable test steps in SoapUI using groovy

1 Get the list of test steps using the above code and use the below code:

// Code to enable test step using its name:
testRunner.testCase.getTestStepByName("TestStep1").setDisabled(false)

if require to enable all step in one go then use below code:

//Get the names of all test steps
def oNameList = testRunner.testCase.getTestStepList().name
for(iNameCounter in (0..oNameList.size-1))
{  
testRunner.testCase.getTestStepByName(oNameList[iNameCounter]).setDisabled(false)
}


oNameList[iNameCounter]: It store the name of step.



3 comments:

  1. Saurabh can you post some blogs about selenium

    ReplyDelete
  2. Hey Viks,

    let me know what you wanna know in selenium. I will post it.

    ReplyDelete