TestService s =  new TestService(log,context,testRunner)
s.xyz() class TestService{
def log
def context
def testRunner public TestService(log,context,testRunner){
this.log=log
this.context=context
this.testRunner=testRunner
} public void xyz(){
log.info "hello"
}
}

Run result:

Tue Oct 06 20:54:29 CST 2015:INFO:hello

[Training Video - 4] [Groovy] Initializing log inside class with constructor的更多相关文章

  1. [Training Video - 3] [Groovy in Detail] Non-static and Static functions, initializing log inside class

    log.info "starting" // we use class to create objects of a class Planet p1 = new Planet() ...

  2. [Training Video - 2] [Groovy Introduction]

    Building test suites, Test cases and Test steps in SOAP UI Levels : test step level test case level ...

  3. [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 ...

  4. [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 ...

  5. [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 ...

  6. [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 ...

  7. [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" ...

  8. [Training Video - 4] [Groovy] String Functions

    def x="I like to read books before bed" def temp = x.split(" ") log.info "S ...

  9. [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 ...

随机推荐

  1. php-PSR

    <?php/** * 符合psr-1,2的编程实例 */ namespace Standard; // 顶部命名空间// 空一行use Test\TestClass;//use引入类 /** * ...

  2. 适配:px与dp转换

    public class DensityUtil { /** * 根据手机的分辨率从 dp 的单位 转成为 px(像素) */ public static int dip2px(Context con ...

  3. 分布式事务之:TCC (Try-Confirm-Cancel) 模式

    在当前如火如荼的互联网浪潮下,如何应对海量数据.高并发成为大家面临的普遍难题.广大IT公司从以往的集中式网站架构,纷纷转向分布式的网站架构,随之而来的就是进行数据库拆分和应用拆分,如何在跨数据库.跨应 ...

  4. HBase之八--(3):Hbase 布隆过滤器BloomFilter介绍

    布隆过滤器( Bloom filters) 数据块索引提供了一个有效的方法,在访问一个特定的行时用来查找应该读取的HFile的数据块.但是它的效用是有限的.HFile数据块的默认大小是64KB,这个大 ...

  5. python在文件中输入整数

    a=[] b=[] for i in range(len(predicted)): b.append((int)(float(predicted[i]))) a.append(int(test_set ...

  6. Linux上面缺少rz和sz命令

    一.centos系统没有自带rz/sz命令 yum install lrzsz 搞定! 二.对于经常使用Linux系统的人员来说,少不了将本地的文件上传到服务器或者从服务器上下载文件到本地,rz / ...

  7. 编译安装x264

    网上也有相应的教程,之所以在这里重申一遍,是因为我试了网上很多的编译方法,都出现了问题,为此将此编译安装方法记录下来. 首先是 获取x264的网站:http://www.videolan.org/de ...

  8. Shift Operations on C

    The C standard doesn't precisely define which type of right shift should be used. For unsigned data, ...

  9. Deep Learning 学习笔记(9):主成分分析( PCA )与 白化( whitening )

    废话: 这博客有三个月没更新了. 三个月!!!尼玛我真是够懒了!! 这三个月我复习什么去了呢? 托福………… 也不是说我复习紧张到完全没时间更新, 事实上我甚至有时间打LOL. 只是说,我一次就只能( ...

  10. Chrome Postman及Firefox Poster使用

    Chrome浏览器跟Postman工具共用代理设置及Cookie Firefox浏览器跟Poster工具共用代理设置及Cookie   xdebug调试原理 第一次请求url通过参数XDEBUG_SE ...