[Training Video - 5] [Groovy Script Test Step - Collections, Exceptions] Array and ArrayList
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]
for(String item:x){
log.info item
}
Result :
Tue Jun 16 14:50:08 CST 2015:INFO:Size of list is 5
Tue Jun 16 14:50:08 CST 2015:INFO:The first item in list is : India
Tue Jun 16 14:50:08 CST 2015:INFO:India
Tue Jun 16 14:50:08 CST 2015:INFO:USA
Tue Jun 16 14:50:08 CST 2015:INFO:Korea
Tue Jun 16 14:50:08 CST 2015:INFO:Japan
Tue Jun 16 14:50:08 CST 2015:INFO:China
ArrayList :
ArrayList list = new ArrayList();
list.add("India")
list.add("USA")
list.add("UK")
list.add("China") log.info "Size of list is "+list.size()
list.add("Korea") log.info "Size of list is "+list.size()
log.info "The first item in list is : " + list.get(0) for(String item:list){
log.info item
}
Result:
Tue Jun 16 14:57:43 CST 2015:INFO:Size of list is 4
Tue Jun 16 14:57:43 CST 2015:INFO:Size of list is 5
Tue Jun 16 14:57:43 CST 2015:INFO:The first item in list is : India
Tue Jun 16 14:57:43 CST 2015:INFO:India
Tue Jun 16 14:57:43 CST 2015:INFO:USA
Tue Jun 16 14:57:43 CST 2015:INFO:UK
Tue Jun 16 14:57:43 CST 2015:INFO:China
Tue Jun 16 14:57:43 CST 2015:INFO:Korea
[Training Video - 5] [Groovy Script Test Step - Collections, Exceptions] Array and ArrayList的更多相关文章
- [Training Video - 5] [Groovy Script Test Step - Collections, Exceptions] Exception Handling in groovy
def x = new String[3] x[0] = "A" x[1] = "B" x[2] = "C" log.info"X ...
- [Training Video - 5] [Groovy Script Test Step - Collections, Exceptions] HashSet and Hashtable
Hashset: HashSet set = new HashSet() set.add("India") set.add("USA") set.add(&qu ...
- Common tasks that you can perform with the Groovy Script test step
https://support.smartbear.com/readyapi/docs/soapui/steps/groovy.html Get test case object To obtain ...
- [Training Video - 2] [Groovy Introduction]
Building test suites, Test cases and Test steps in SOAP UI Levels : test step level test case level ...
- [Training Video - 4] [Groovy] Optional parameter in groovy
Employee.log=log Employee e1 = new Employee() log.info e1.add(1,2,3,4) // optional parameters in gro ...
- [Training Video - 4] [Groovy] String Functions
def x="I like to read books before bed" def temp = x.split(" ") log.info "S ...
- [Training Video - 4] [Groovy] Object equality and variable equality check
def x=2 def y=3 if(x == y){ log.info "equal" }else{ log.info "not equal" // prin ...
- [Training Video - 4] [Groovy] Initializing log inside class with constructor
TestService s = new TestService(log,context,testRunner) s.xyz() class TestService{ def log def conte ...
- [Training Video - 4] [Groovy] Constructors in groovy, this keyword
Bank.log = log Bank b1 = new Bank() b1.name = "BOA" b1.minbalance = 100 b1.city="Lond ...
随机推荐
- 【maven】mvn 命令
===========maven参数打包================== 在使用mvn package进行编译.打包时,Maven会执行src/test/java中的JUnit测试用例,有时为了跳 ...
- Redis 集群方案介绍
由于Redis出众的性能,其在众多的移动互联网企业中得到广泛的应用.Redis在3.0版本前只支持单实例模式,虽然现在的服务器内存可以到100GB.200GB的规模,但是单实例模式限制了Redis没法 ...
- zipkin:和springcloud集成过程记录
发现全是springcloudapp的名称,然后是springcloudapp(http://localhost:8080/hello/tom)工程单独调用并没有通知zipkin: 原来是因为rest ...
- EasyUI使用小常识
datagrid:1 //显示某列 $('#ListTable').datagrid('showColumn', 'ExRate'); //隐藏某列 $('#ListTable').datagrid( ...
- PAT 甲级 1009 Product of Polynomials (25)(25 分)(坑比较多,a可能很大,a也有可能是负数,回头再看看)
1009 Product of Polynomials (25)(25 分) This time, you are supposed to find A*B where A and B are two ...
- [Java.web]JSTL 使用
<%@ page import="cn.itcast.domain.Person"%> <%@ page language="java" im ...
- Javascript继承机制的设计思想
转自:http://www.ruanyifeng.com/blog/2011/06/designing_ideas_of_inheritance_mechanism_in_javascript.htm ...
- id取模分表
场景 1 假设按用户id分2个库 每个库分10张表. 分表策略 1.用户id%2 确定库 用户id%3确定表. 2.(用户id%(2*10))/ 10 取整确定库,(用户id%(2*10)%10确 ...
- 接口自动化(二)--操作Excel获取需要数据
这一部分的内容记述一下对Excel表格的操作,本实战中的测试用例是由Excel来管理的,因此操作Excel是重要的一部分. 再次贴出这张图,所有的测试用例都在这个sheet内,请求数据真实存放在jso ...
- guicorn 是什么
guicorn 是什么? 在回答问题之前我们先来看看 web服务器的典型过程[1] 1. 建立链接:如果没有连接,要建立连接 2. 接收请求:对客户端发来的请求进行解析. 3. 处理请求:转发给预定义 ...