Forum Discussion
Working through a Proof of concept i have come up with the below solution:
- A groovy script goes to each testcase as per the testcase Identifier in the data source.
Datasource excel
Groovy to decide on which step to go to:
import com.eviware.soapui.support.XmlHolder
def testcaseNo = context.expand('${Data Source#TestcaseId}')
log.info (testcaseNo)
if (testcaseNo=="test001")
{
log.info ("go to test step: " + testcaseNo)
testRunner.gotoStepByName (testcaseNo)
}
else if (testcaseNo=="test002")
{
log.info ("go to test step: " + testcaseNo)
testRunner.gotoStepByName (testcaseNo)
}
else if (testcaseNo=="test003")
{
log.info ("go to test step: " + testcaseNo)
testRunner.gotoStepByName (testcaseNo)
}
else if (testcaseNo=="test004")
{
log.info ("go to test step: " + testcaseNo)
testRunner.gotoStepByName (testcaseNo)
}
else if (testcaseNo=="test005")
{
log.info ("go to test step: " + testcaseNo)
testRunner.gotoStepByName (testcaseNo)
}
Groovy after each step to move to the loop and start again on next row:
import com.eviware.soapui.support.XmlHolder
testRunner.gotoStepByName ("Data Source Loop")
log.info ("moved to the Data Source Loop")
It will work for myself but there may be better solutions out there.
Hi Dave,
You have Datasource's which I guess means you have the licensed version of SoapUI.
Datasources and datasource loops are for data driven (aka functional) tests whereby you exercise one or more service calls using the datasource values as parameters for the service call(s).
The most simplest example might look like
Assuming the data source content looks like this....
Customer ID | Customer Name |
1 | John |
2 | Paul |
3 | George |
4 | Ringo |
The Datasource would look like this....
The service call being exercised then needs to pick up the Customer Id to use in this iteration. E.g.
The $ syntax above reads the current customerId value from the datasource.
You can type this directly, or use the nifty Get Data option. Click in the Value cell and ensure the cursor is there. Sometimes you have to double-click. Then right-mouse click to open the context menu. Select Get Data.
The Get Data screen allows you to navigate around your Workspace to select the value you want to pull in. E.g.
If you've followed this far, you'll see that using the datasource and 'Get Data' you can exercise one service call with almost unlimited values. You don't need separate service call test steps per row in the datasource.
You could then extend the test to call additional services to form sort of use case. E.g. Get Customer, Amend Customer, Customer places order. Each step would be called once per iteration...
IMHO, the data-driven tests are the best feature of ReadyAPI and are definitely worth persevering with.
Here is a link to SMartBears own guide... https://support.smartbear.com/readyapi/docs/testing/data-driven/index.html?sbsearch=Data%20Driven%20Tests
Related Content
- 4 years ago
- 4 years ago
Recent Discussions
- 19 days ago