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. MFC消息循环

    MFC消息循环 MFC应用程序中处理消息的顺序 1.AfxWndProc()  该函数负责接收消息,找到消息所属的CWnd对象,然后调用AfxCallWndProc. 2.AfxCallWndProc ...

  2. 关于PIPELINE,也许你应该知道

    所谓流水线(pipeline)设计,通常来说是流水生产线. 同样,组合逻辑路径可以看作是一条生产线,路径上的每个逻辑单元都可以看作是一个阶段,都会产生时延. 如果不采用流水设计,前后级组合逻辑依次工作 ...

  3. 将新浪博客里的表情包存入MySQL数据库不完整版本一堆可能用到的散乱代码

    header = {'Cookie': 'SINAGLOBAL=7368591819178.463.1491810091070; ALF=1558832450; SCF=Ajrc1sxuwynVIu_ ...

  4. 【学步者日记】C#反射中NonPublic和Instance需要一起使用

    完整链接请看: http://note.youdao.com/noteshare?id=f378d9a414e46893b0e300b017ed3655 ——————————————————————— ...

  5. 高效网页去重算法-SimHash

    记得以前有人问过我,网页去重算法有哪些,我不假思索的说出了余弦向量相似度匹配,但如果是数十亿级别的网页去重呢?这下糟糕了,因为每两个网页都需要计算一次向量内积,查重效率太低了!我当时就想:论查找效率肯 ...

  6. 基于RabbitMQ的跨平台RPC框架

    RabbitMQRpc protocobuf RabbitMQ 实现RPC https://www.cnblogs.com/LiangSW/p/6216537.html 基于RabbitMQ的RPC ...

  7. 1.docker学习之简介

    什么是Docker Docker是一个开源的应用容器引擎.通俗来说:所谓开源,就是指Docker是开放源代码的,比如用户可以免费使用该源代码, 并在该源代码的基础上自由修改或传播.所谓引擎,指的是程序 ...

  8. 深入浅出 Java Concurrency (7): 锁机制 part 2 AQS

      在理解J.U.C原理以及锁机制之前,我们来介绍J.U.C框架最核心也是最复杂的一个基础类:java.util.concurrent.locks.AbstractQueuedSynchronizer ...

  9. 有关Zedgraph的功能扩展的笔记

    1.坐标轴范围.刻度调整后需要加上下面的语句才能刷新:     zedGraphControl1.AxisChange();     zedGraphControl1.Refresh(); 2.坐标范 ...

  10. Arduino UNO 键盘记录器中时钟接到2口或3口,其它接口不行。马上就要放弃了。要修改例子中时钟的引脚。