大佬教程收集整理的这篇文章主要介绍了Groovy in SOAP UI,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
Posted by: devakara on: October 17,2008
Groovy provides very robust methods with sql instance to retrieve and manipulate the ResultSet.
There are methods for retrieving the first row, the ResultSet of some sql query,directly execuTing insert/update/delete queries.
Prerequisite: Obtain sql instance using
Below are some comprehensive examples which use the above sql instance.
firstRow( sqlQuery ) : This method returns the first row entity out of the ResultSet that is obtained by execuTing the query passed to it as argument.
Result can accessed from res as
eachRow( sqlQuery,{ClosurE} ) : This method is generally used to retain/modify the whole ResultSet based on some condition. The second argument of this method i.e., clousure actually consists as set of statements to be executed for each of the result set’s entity. For example
The println statements (present as a clousurE) above are executed for each entity while iterating over the ResultSet,and it refers to the entity of ResultSet that is currently being iterated over. Clousure can have any number of statements.
execute( sqlQuery ) : Generally this method is used to INSERT/updatE/deletE records,as it doesn’t return any ResultSet as such.
Second type of usage is to some extent SIMILAR TO PreparedStatement right? and the query Could also be a INSERT/updatE statement,if Developer wants to log some value(s) to database during execution of the TestStep.
Posted by: devakara on: October 8,2008
Property transfers become crucial steps in scenarios where validations are done mostly using derived data.
Lets say after some Groovy script execution we end up setTing a property value in Properties step while tesTing an application’s functionality. And most of the times we would be in need of the obtained result out of that groovy step. As we have it in Properties Step we can access it using Property Expansion technique and also using Property Transfer Step.
Property Transfer Step shall be in between the Properties Step and SOAP request Step,but before placing the Transfer Step have Properties and SOAP request Steps in place. Property Transfer window would something like this:
After creaTing a new Property Transfer in the above window say ‘RefNumTransfer‘,SELEct source,in this case it would be the ‘Properties’ Step,this inturn provides the list of all properties defined under that Step,SELEct the property you wish to transfer.
Now come to Target block,where we would have our SOAP request to catch the property transfer. Initially declare all the namespaces that your request would use,separating each of them with ‘;’ and then provide the XPath of the target node which should capture the transfered value.
For example if the SOAP request as is below
then the target block of Property Transfer should contain details like this:
Try running the Property Transfer step,you see the ‘Transfer Name’ and ‘Transfered Value’ in the Transfer Log,and also correspondingly that value is reflected in the SOAP request at the target XPath.
以上是大佬教程为你收集整理的Groovy in SOAP UI全部内容,希望文章能够帮你解决Groovy in SOAP UI所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。