Change the JDBC Request:
1.change the driver name,connection string,query string or assert.
- The object we'll use here Is:jdbcrequestteststep
TestCase newcase=testrunner.gettestcase (); Jdbcrequestteststep Step1= (jdbcrequestteststep) newcase.getteststepbyname (""); String driver=step1.getdriver (); String constr=step1.getconnectionstring (); String password=Step1.getpassword (); Step1.setdriver (//If there ' s no driver should set as step1.setdriver (null) step1.setconnectionstring (""); Step1.setpassword ("");
- Change the JDBC SQL statement:
Step1.setquery (""); Step1.setquerytimeout ("");
- Change the assertion behavior (like XPath string,jquery string):
Http://www.soapui.org/apidocs/com/eviware/soapui/model/testsuite/TestAssertion.html
Http://www.soapui.org/apidocs/com/eviware/soapui/impl/wsdl/teststeps/assertions/basic/XPathContainsAssertion.html
Http://www.soapui.org/apidocs/com/eviware/soapui/impl/wsdl/teststeps/assertions/basic/GroovyScriptAssertion.html
inttotalassert=Step1.getassertioncount (); for(intk=0;k<totalassert;k++) {Testassertion asserts=Step1.getassertionat (k); if(assertsinstanceofxpathcontainsassertion) { if(Asserts.getname (). Contains ("Check count") ) {String Originalxpath=((xpathcontainsassertion) asserts). GetPath (); String Newxpath=originalxpath.replaceall ("Row", "Row2"); ((xpathcontainsassertion) asserts). SetPath (Newxpath); } } }
SoapUI Pro Project Solution Collection-change the JDBC Request behavior