标签:按钮 脚本语言 load log read dia 适用于 hang 保存
脚本可以在了SoapUI以下地方使用:
Groovy Script TestStep
运行测试之前和之后运行一个TestCase或TestSuite的初始化或清理。
当启动/停止MockService时初始化或清理MockService状态
打开/关闭项目,用于初始化或清理项目相关的设置
def test = context.expand( ‘${#Project#test}‘ )
它得到了项目级“test”参数。
脚本库,可以使用如下;
首先,创建一个目录(如C:\ GroovyLib),然后在目录中添加Callee.groovy文件包含以下内容:
package readyapi.demo
//Callee.groovy
class Callee {
String hello() {
return "Hello world! "
}
def static salute( who, log ) { log.info "Hello again $who!" }
}
//Caller.groovy
c = new Callee()
log.info c.hello()
Tue MONTH 29 10:56:08 EST YEAR:INFO:Hello world!
package readyapi.demo
//Callee.groovy
class Callee {
String hello() {
return "Hello world! "
}
String hello(String who) {
return "Hello $who"
}
def static salute( who, log ) { log.info "Hello again $who!" }
}
Tue MONTH 29 10:56:08 EST YEAR:INFO:C:\GroovyLib\Callee.groovy is new or has changed, reloading...
We also change the script:
//Caller.groovy
c = new Callee()
log.info c.hello("Mike")
And we get:
Tue MONTH 29 10:56:08 EST YEAR:INFO:Hello, Mike!
readyapi.demo.Callee.salute( "Mike", log )
Tue MONTH 29 10:56:08 EST YEAR:INFO:Hello again Mike!
标签:按钮 脚本语言 load log read dia 适用于 hang 保存
原文地址:http://www.cnblogs.com/zerotest/p/6934747.html