Employee.log=log Employee e1 = new Employee() log.info e1.add(1,2,3,4) // optional parameters in groovy log.info e1.add(2,3) log.info e1.add(2,3,10) class Employee { def static log public def add(a,b,c=3,d=10){ return a+b+c+d } } Run result: Tue Oct…
摘自: http://www.blogjava.net/BlueSUN/archive/2007/03/17/104391.html Groovy轻松入门--搭建Groovy开发环境 多日来,我发表了多篇关于Groovy的文章,想必大家对Groovy或多或少已经有所了解,今后我会抽空写些Groovy入门性质的文章,供大家参考. 由于时间仓促,水平有限,不足之处请各位朋友多包涵提点,谢谢. 既然是入门,我先不介绍那些IDE的东西,比如Eclipse中的Groovy插件(如果您迫不及待的话,可以先看…
groovy 访问 MongoDB 示例: shell.groovy package db import com.gmongo.GMongoClient import com.mongodb.BasicDBObject import com.mongodb.MongoCredential import com.mongodb.ServerAddress /** * 本地无密 mongodb 数据库连接 */ def connect() { GMongoClient client = new GM…
Groovy是啥? groovy是英文中的一个单词,有marvelous.wonderful和excellen的意思. groovy是轻量级的,动态的,面向对象的,并且运行在JVM上的. groovy编译为Java字节码. groovy基于Java 1.5及更高版本运行. 要部署的话,我们需要一个Groovy的Jar文件. 为什么要用动态语言? 运行时扩展,修改类型.行为和对象结构. 利用动态语言可以在运行时做一些在编译时才能做得事情. 动态语言的优势 机器速度 可用性 对单元测试的意识 杀手级…
Building test suites, Test cases and Test steps in SOAP UI Levels : test step level test case level test suite level project level Groovy script test step Write groovy code in groovy script test step log object in SOAP UI Info and error log log.error…
Various databases which are supported Drivers for database connection groovy.sql.Sql package SoapUI怎样支持对数据库的操作 Various databases which are supported Groovy可以支持各种不同的数据库:MySQL, SQLServer, Oracle Drivers for database connection 不同的数据库需要下载不同的JAR包来支持,下载后将…
def x = new String[3] x[0] = "A" x[1] = "B" x[2] = "C" log.info"XXXXXX 1" try{ x[3] = "D" // def z=9/0 }catch(Exception e){ log.info "Some error "+e.getMessage() // Use e.getMessage() to print ex…
Reading Properties file : Properties prop = new Properties() def path = "D:\\SoapUIStudy\\application.properties" FileInputStream fs = new FileInputStream(path) prop.load(fs) log.info prop.getProperty("name") Result : Tue Jun 16 15:12:…
Hashset: HashSet set = new HashSet() set.add("India") set.add("USA") set.add("China") log.info "Set size is : " + set.size() set.add("China") log.info "Set size is : " + set.size() Iterator iter…
Array: def x = new String[5] x[0] = "India" x[1] = "USA" x[2] = "Korea" x[3] = "Japan" x[4] = "China" log.info "Size of list is " + x.size() log.info "The first item in list is : "+x[0]…