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. python文本挖掘模版

    import xlrd import jieba import sys import importlib import os #python内置的包,用于进行文件目录操作,我们将会用到os.listd ...

  2. Python项目打包成exe文件

    这里我们使用pyinstaller这个软件即可,使用pip即可完美安装,在要打包的程序目录下打开cmd输入 pyinstaller -F 文件名.py 即可成功,运行成功后生成一个dict文件夹,东西 ...

  3. 建立SIP通话

    建立SIP: 点击下的出现的页面: 选择submit,只用填写用户名和密码就OK了,secret是密码,填写完以后记得应用 创建完毕以后,使用xlite去连接:xlite的配置:域名是asterisk ...

  4. 【BZOJ】2819: Nim(树链剖分 / lca+dfs序+树状数组)

    题目 传送门:QWQ 分析 先敲了个树链剖分,发现无法AC(其实是自己弱,懒得debug.手写栈) 然后去学了学正解 核心挺好理解的,$ query(a) $是$ a $到根的异或和. 答案就是$ l ...

  5. [Z]牛人林达华推荐有关机器学习的数学书籍

    1. 线性代数 (Linear Algebra): 我想国内的大学生都会学过这门课程,但是,未必每一位老师都能贯彻它的精要.这门学科对于Learning是必备的基础,对它的透彻掌握是必不可少的.我在科 ...

  6. Python学习日记(一)——IDLE、运算符

    环境:win8.1+python2.7.8 一.名词解释: 1.IDLE:经常编程的同学相信对集成开发环境(Integrated Development Environment,IDE)应该非常熟悉了 ...

  7. leetcode558

    """ # Definition for a QuadTree node. class Node(object): def __init__(self, val, isL ...

  8. log4j:WARN No appenders could be found for logger 解决办法

    转自:https://blog.csdn.net/chw0629/article/details/80567936 使用log4j时不起作用,每次执行完出现以下提示: log4j:WARN No ap ...

  9. Oracle表结构转Mysql表结构

    1. fnc_table_to_mysql 主体程序 create or replace function fnc_table_to_mysql ( i_owner in string, i_tabl ...

  10. 转 查看linux文件目录的大小和文件夹包含的文件数

    du -sh 文件夹路径 查看linux文件目录的大小和文件夹包含的文件数 统计总数大小 du -sh xmldb/ du -sm * | sort -n //统计当前目录大小 并安大小 排序 du ...