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 = 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…
https://support.smartbear.com/readyapi/docs/soapui/steps/groovy.html Get test case object To obtain the object which refers to the containing test case, use the following code snippet: Groovy   def case = testRunner.testCase;   By using the testCase …
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…
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("…
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…
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…
Bank.log = log Bank b1 = new Bank() b1.name = "BOA" b1.minbalance = 100 b1.city="London" Bank b2 = new Bank() b2.name = "HSBC" b2.minbalance = 100 b2.city="LA" Bank b3 = new Bank("A",100,"X") log…