Forum Discussion
I assume you only want REST test steps, so this would work:
import com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep for (step in testRunner.testCase.getTestStepsOfType(RestTestRequestStep.class)) // do stuff
after adding above script in to my groovy script, error is gone and create excel file but not write REST test step request/response into excel file.
any though?
- cmende9 years agoNew Contributor
How are you trying to write the request/response? I can see RestTestRequestStep#getTestRequest() that gives you a RestTestRequest object which you can use for further processing. The RestTestRequest also gives you AbstractHttpRequest#getResponse(), RestTestRequestStep#getResponseContentAsString() and RestRequest#getResponseContentAsXml() to get the response.
- codehausss9 years agoContributor
my script like this
import com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep; for (test = 0; test < testSuite.getTestCaseCount(); test++) { suite = testSuite.getTestCaseAt(test); for (a = 0; a < suite.getTestStepCount(); a++) { b = suite.getTestStepAt(a); log.info b.getName(); for (step in testRunner.testCase.getTestStepsOfType(RestTestRequestStep.class)) { Label name = new Label(0, row, b.getName()); sheet.addCell(name); Label desc = new Label(1, row, b.getDescription()); sheet.addCell(desc); Label uri = new Label(2, row, getRequestURI(b)); sheet.addCell(uri); Label resp = new Label(4, row, b.getProperty("Response").getValue()); sheet.addCell(resp); row++; } } } workbook.write(); workbook.close();
i can see read every test step from the log.info and create the excel file.
but it only create excel file, doesn't write each test step into the excel row.
am i doing right here?
ps: i just lost my previous account, so please ignore my userid :)
- kondasamy9 years agoRegular Contributor
I can understand that this is not the complete code! If you don't mind, could you please attach the code; so, that we will help you with a solution.
Also, for your reference - here are links for few existing sample implementations which would assist you further,
- https://learnsoapui.wordpress.com/2011/07/04/groovy-8-%E2%80%93-creating-and-manipulating-excel-file-using-groovy-script-in-soapui/
- http://stackoverflow.com/questions/19681273/soap-ui-data-driven-testing-for-web-requests
- http://www.vogella.com/tutorials/JavaExcel/article.html
Thanks,
Samy