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…
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…
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…
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…
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 = 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("…
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…
Employee.log=log Employee e1 = new Employee() Employee e2 = new Employee() e1.name = "A" e1.salary = 100 e2.name = "B" e2.salary = 200 e1.printName() e2.printName() def newSalary = e1.increaseSalary(100) log.info "New salary of A…
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" /…
log.info "starting" // we use class to create objects of a class Planet p1 = new Planet() Planet p2 = new Planet() Planet p3 = new Planet() p1.name = "earth" p1.shape = "circle" p2.name = "jupiter" p2.shape = "…
Car c= new Car(log); c.print() class Car{ def log public Car(log){ this.log=log } public void print(){ log.info "hello world" } }…
Reading Properties file : Properties prop = new Properties() def path = "D:\\SoapUIStudy\\application.properties" FileInputStream fs = new FileInputStream(path) prop.load(fs) log.info prop.getProperty("name") Result : Tue Jun 16 15:12:…
Various databases which are supported Drivers for database connection groovy.sql.Sql package SoapUI怎样支持对数据库的操作 Various databases which are supported Groovy可以支持各种不同的数据库:MySQL, SQLServer, Oracle Drivers for database connection 不同的数据库需要下载不同的JAR包来支持,下载后将…
try, catch and finally in db connection Forming groovy connection string and obtaining Connection Object Firing Select Query and obtaining results Foreach and rows functions Finding number of rows in result import groovy.sql.Sql // obtain the connect…
Code example : package com.file.properties; import java.io.FileInputStream; import java.util.Properties; public class ReadProperties { Properties prop; public ReadProperties(String path) { prop = new Properties(); try{ FileInputStream fs = new FileIn…
Selenium IDE Training List…
What is a web service? http://webservicex.net/ws/default.aspx WebService是一种跨编程语言和跨操作系统平台的远程调用技术. 跨编程语言 : 服务端程序采用java编写,客户端程序则可以采用其他编程语言编写,反之亦然! 跨操作系统平台 : 服务端程序和客户端程序可以在不同的操作系统上运行. 远程调用 : 一台计算机a上的一个程序可以调用到另外一台计算机b上的一个对象的方法. 譬如,银联提供给商场的pos刷卡系统,商场的POS机转…
Static and non-Static :  非静态方法(不带static)可以访问静态变量和方法(带static),但是反过来就不行. 类的静态成员(变量和方法)属于类本身,在类加载的时候就会分配内存,可以通过类名直接去访问. 非静态成员(变量和方法)属于类的对象,只有在类的对象产生(创建实例)的时候才会分配内存,然后通过类的对象去访问. 在一个类的静态成员中去访问非静态成员之所以会出错是因为在类的非静态成员不存在的时候静态成员就已经存在了,访问一个内存中不存在的东西会出错. 静态变量和方…
Operator : While Loop : For Loop :  Arrays : Code : public class FirstJavaClass { public static void main(String[] args) { int arr[] = new int[5]; arr[0]=78; arr[1]=980; arr[2]=98; arr[3]=9; arr[4]=765; System.out.println(arr[2]); System.out.println(…
Download Java : https://java.com/en/download/ Download Eclipse : https://www.eclipse.org/downloads/ Code : public class FirstJavaClass { // function public static void main(String[] args) { System.out.println("hello world"); // syso -> cntrl+…
FirePath Press F12, you will see :…
Selenium IDE (Only support in Firefox): - Record and Run - UI interface - User extensions - Conversion of code Selenium RC: Multiple Browsers : IE, Chrome, Firefox, Opera, Safari Multiple Languages : Java, PHP, Ruby, Python, C#, Perl Multiple OS : Wi…
Download Selenium Jars Configure jars in eclipse Webdriver http://docs.seleniumhq.org/download/ Selenium RC http://code.google.com/p/selenium/downloads/detail?name=selenium-remote-control-1.0.3.zip&can=2&q=…
What is Selenium? Browser Automation Testings Tool: Mozilla IE 6,7,8 Google Chrome Opera 8,9,10 Safari Multiple Operating Systems: Windows Mac Linux/Unix Many More Mutiple Languages: Java (Famous) C# Ruby Python Perl Php Components of Selenium:…
package com.file.properties; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.Has…
读取以下两种格式的Excel : *.xls  and *.xlsx 用Apache POI API来实现,需要用到 HSSF 和 XSSF 的类库 HSSF is the POI Project's pure Java implementation of the Excel '97(-2007) (.xls) file format. XSSF is the POI Project's pure Java implementation of the Excel 2007 OOXML (.xls…