def x=2 def y=3 if(x == y){ log.info "equal" }else{ log.info "not equal" // print out not equal } TestService s1 = new TestService() TestService s2 = new TestService() log.info s1.is(s2) // false s1=s2 log.info s1.is(s2) // true class…
log.info "starting" // we use class to create objects of a class Planet p1 = new Planet() Planet p2 = new Planet() Planet p3 = new Planet() //Planet.name = "Pluto" illegal Planet.shape = "Circle" p1.name = "earth" /…
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…
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…
log.info "starting" // we use class to create objects of a class Planet p1 = new Planet() Planet p2 = new Planet() //Planet.name = "Pluto" illegal Planet.shape = "Circle" // static variable Planet.log = log p1.name = "ea…
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…
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]…
def x="I like to read books before bed" def temp = x.split(" ") log.info "Size of array is : "+temp.length log.info temp[0] log.info temp[1] log.info x.substring(2,8) log.info x.indexOf("t") log.info x.indexOf("…
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.in…