import com.eviware.soapui.support.*;
import java.io.File;
import java.util.*;
import jxl.*;
import java.lang.*;
import java.io.*;
import jxl.*
import jxl.write.*
import com.eviware.soapui.model.testsuite.TestRunner.Status;
import com.eviware.soapui.impl.wsdl.WsdlInterface
def properties = testRunner.testCase.getTestStepByName("Properties");
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
properties.setPropertyValue( "projectPath", groovyUtils.projectPath);
String projectpath = properties.getPropertyValue("projectPath").trim();
Workbook workbook = Workbook.getWorkbook(new File(projectpath + "file://data.xls/"))
Sheet sheet = workbook.getSheet("MasterSheet");
rowcount = sheet.getRows();
colcount = sheet.getColumns();
String variableName;
String variableValue;
String testcasename;
String removeNode;
def counter=0;
while(colcount>1)
{
for(int i=1;i<rowcount;i++)
{
testcasename = sheet.getCell(counter+1,0).getContents();
variableName = sheet.getCell(0,i).getContents();
variableValue = sheet.getCell(1+counter,i).getContents();
if(variableValue!= null && variableValue!= "")
{
properties.setPropertyValue(variableName,variableValue );
}
}
counter++;
colcount--;
}
workbook.close()
String targetUrl = properties.getPropertyValue("targetUrl").trim();
java.util.List l1 = testRunner.testCase.getTestStepsOfType(com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep);
ArrayList al = l1.toArray();
String[] operationName1 = new String[al.size()]
Iterator itr = al.iterator();
int ii = 0;
while(itr.hasNext())
{
com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep step = (com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep)itr.next();
step.getTestRequest().setEndpoint(targetUrl);
operationName1[ii] = step.getOperationName();
log.info(operationName1[ii]);
ii++;
}
List<String> list = Arrays.asList(operationName1)
Set<String> set = new HashSet<String>(list)
operationName1 = new String[set.size()]
set.toArray(operationName1);
//operationName1[0] = "ALL";
//String[] operationArray = ["copyDocument","deleteDocument", "findDocumentsByExample","ALL"].toArray();
HashMap map = new HashMap();
def dialog = com.eviware.soapui.support.UISupport.createConfigurationDialog( "Select Operation to be invoke" );
dialog.addComboBox( "Operation Name", operationName1, null);
map.put( "Operation Name", properties.getPropertyValue("operationName"));
boolean finished = false;
while (!finished) {
if (!dialog.show(map)) {
testRunner.cancel( "Failed to capture entry!" );
return;
}
finished = true;
}
String operationName = (String) map.get("Operation Name");
properties.setPropertyValue( "operationName", map.get("Operation Name"));
if("ALL".equals(operationName))
{
for(int i = 4 ; i<operationName1.length;i++)
{
operationName = operationName1[i];
properties.setPropertyValue( "operationName", operationName);
//log.info(operationName1.length)
//log.info("OPERATION NAME:::::"+operationName);
//log.info("CALLS:::::"+i);
if(operationName != null && operationName!= "ALL" )
{ //testRunner.gotoStepByName("Delay");
testRunner.gotoStepByName("ALL");
testRunner.runTestStepByName("ALL")
}
}
}
String serviceQualorQualifiedProductRequest = null;
def serviceQualStep = testRunner.testCase.getTestStepByName(operationName);
def serviceQualStepRequest = serviceQualStep.getProperty("Request");
if( serviceQualStepRequest != null && serviceQualStepRequest != "")
{
serviceQualorQualifiedProductRequest = serviceQualStepRequest.getValue();
}
//def pname = testRunner.testCase.testSuite.project.name;
//log.info(pname)
//log.info(colcount)
//if("submitApplication".equals(operationName) || "updateStatus".equals(operationName) || "addPerson".equals(operationName))
if("ALL" != operationName)
{
testRunner.gotoStepByName("ALL");
testRunner.runTestStepByName("ALL")
}
import java.io.File;
import java.util.*;
import jxl.*;
import java.lang.*;
import java.io.*;
import jxl.*
import jxl.write.*
import com.eviware.soapui.model.testsuite.TestRunner.Status;
import com.eviware.soapui.impl.wsdl.WsdlInterface
def properties = testRunner.testCase.getTestStepByName("Properties");
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
properties.setPropertyValue( "projectPath", groovyUtils.projectPath);
String projectpath = properties.getPropertyValue("projectPath").trim();
Workbook workbook = Workbook.getWorkbook(new File(projectpath + "file://data.xls/"))
Sheet sheet = workbook.getSheet("MasterSheet");
rowcount = sheet.getRows();
colcount = sheet.getColumns();
String variableName;
String variableValue;
String testcasename;
String removeNode;
def counter=0;
while(colcount>1)
{
for(int i=1;i<rowcount;i++)
{
testcasename = sheet.getCell(counter+1,0).getContents();
variableName = sheet.getCell(0,i).getContents();
variableValue = sheet.getCell(1+counter,i).getContents();
if(variableValue!= null && variableValue!= "")
{
properties.setPropertyValue(variableName,variableValue );
}
}
counter++;
colcount--;
}
workbook.close()
String targetUrl = properties.getPropertyValue("targetUrl").trim();
java.util.List l1 = testRunner.testCase.getTestStepsOfType(com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep);
ArrayList al = l1.toArray();
String[] operationName1 = new String[al.size()]
Iterator itr = al.iterator();
int ii = 0;
while(itr.hasNext())
{
com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep step = (com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep)itr.next();
step.getTestRequest().setEndpoint(targetUrl);
operationName1[ii] = step.getOperationName();
log.info(operationName1[ii]);
ii++;
}
List<String> list = Arrays.asList(operationName1)
Set<String> set = new HashSet<String>(list)
operationName1 = new String[set.size()]
set.toArray(operationName1);
//operationName1[0] = "ALL";
//String[] operationArray = ["copyDocument","deleteDocument", "findDocumentsByExample","ALL"].toArray();
HashMap map = new HashMap();
def dialog = com.eviware.soapui.support.UISupport.createConfigurationDialog( "Select Operation to be invoke" );
dialog.addComboBox( "Operation Name", operationName1, null);
map.put( "Operation Name", properties.getPropertyValue("operationName"));
boolean finished = false;
while (!finished) {
if (!dialog.show(map)) {
testRunner.cancel( "Failed to capture entry!" );
return;
}
finished = true;
}
String operationName = (String) map.get("Operation Name");
properties.setPropertyValue( "operationName", map.get("Operation Name"));
if("ALL".equals(operationName))
{
for(int i = 4 ; i<operationName1.length;i++)
{
operationName = operationName1[i];
properties.setPropertyValue( "operationName", operationName);
//log.info(operationName1.length)
//log.info("OPERATION NAME:::::"+operationName);
//log.info("CALLS:::::"+i);
if(operationName != null && operationName!= "ALL" )
{ //testRunner.gotoStepByName("Delay");
testRunner.gotoStepByName("ALL");
testRunner.runTestStepByName("ALL")
}
}
}
String serviceQualorQualifiedProductRequest = null;
def serviceQualStep = testRunner.testCase.getTestStepByName(operationName);
def serviceQualStepRequest = serviceQualStep.getProperty("Request");
if( serviceQualStepRequest != null && serviceQualStepRequest != "")
{
serviceQualorQualifiedProductRequest = serviceQualStepRequest.getValue();
}
//def pname = testRunner.testCase.testSuite.project.name;
//log.info(pname)
//log.info(colcount)
//if("submitApplication".equals(operationName) || "updateStatus".equals(operationName) || "addPerson".equals(operationName))
if("ALL" != operationName)
{
testRunner.gotoStepByName("ALL");
testRunner.runTestStepByName("ALL")
}
No comments:
Post a Comment