首页 > 代码库 > SoapUI Pro Project Solution Collection-change the JDBC Request behavior
SoapUI Pro Project Solution Collection-change the JDBC Request behavior
change the jdbc request :
1.change the driver name,connection string,query string or assert.
- the object we will 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
int totalassert=step1.getAssertionCount(); for(int k=0;k<totalassert;k++){ TestAssertion asserts=step1.getAssertionAt(k); if(asserts instanceof XPathContainsAssertion ){ 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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。