import jxl.*; import jxl.write.*; import com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep; //path file = "C://soap//result.xls"; WritableWorkbook workbook = Workbook.createWorkbook(new File(file)); WritableSheet sheet = workbook.createSheet("REST", 0); //excel file header Label col1 = new Label(0, 0, "Name"); sheet.addCell(col1); Label col2 = new Label(1, 0, "Desc"); sheet.addCell(col2); Label col3 = new Label(2, 0, "URL"); sheet.addCell(col3); Label col4 = new Label(3, 0, "Request"); sheet.addCell(col4); Label col5 = new Label(4, 0, "Response"); sheet.addCell(col5); //Loop testSuite = testRunner.testCase.testSuite; row = 1; for (tc = 0; tc < testSuite.getTestCaseCount() - 1; tc++) { testCase = testSuite.getTestCaseAt(tc); for (ts = 0; ts < testCase.getTestStepCount(); ts++) { props = testCase.getTestStepAt(ts); log.info props.getName(); for (step in testRunner.testCase.getTestStepsOfType(RestTestRequestStep.class)) { Label col00 = new Label(0, row, props.getName()); sheet.addCell(col00); Label col01 = new Label(1, row, props.getDescription()); sheet.addCell(col01); Label col02 = new Label(2, row, getRequestURI(props)); sheet.addCell(col02); Label col03 = new Label(3, row, props.getProperty("Request").getValue()); sheet.addCell(cold04); Label label05 = new Label(4, row, props.getProperty("Response").getValue()); sheet.addCell(label05); } row++; } } workbook.write(); workbook.close(); log.info file + " created successfully..."; def getRequestURI(props){ requestPath = props.getRestMethod().getMethod().toString() + " " + props.getResourcePath(); requestParams = props.testRequest.getRequestParts(); requestString = ""; for (param in requestParams) { pName = param.getName(); if (pName && (pName != "access_token")) { pValue = context.expand(props.getProperty(pName).getValue()); if (pValue){ requestString = requestString + pName + " = " + pValue + "\n"; log.info pName + " = " + pValue; } } } return requestPath + "\n" + requestString; }