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…
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 = "…
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…
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…
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…
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…
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…
不多说,直接上干货! 牛客网Java刷题知识点之关键字static static代表着什么 在Java中并不存在全局变量的概念,但是我们可以通过static来实现一个“伪全局”的概念,在Java中static表示“全局”或者“静态”的意思,用来修饰成员变量和成员方法,当然也可以修饰代码块和内部类. Java把内存分为栈内存和堆内存,其中栈内存用来存放一些基本类型的变量.数组和对象的引用变量,堆内存主要存放一些引用类型的变量.在JVM加载一个类的时候,若该类存在static修饰的成员变量和成员方法…
1.包 三级命名:公司的尾缀(com).公司名字(baidu).业务(Sale) java.lang:默认包:String.Math,Object,System java.util:工具包 java.io:输入输出包 java.net:网络开发包 java.awt:图形界面开发包 java.swing:也是图形界面开发包 2.访问控制 private:私有的:只能在自己的类中使用 default: 默认的:同包中可以使用.当子类继承父类,实例化子类后,跨包不可以使用. protected:保护的…
1)const定义的常量在超出其作用域之后其空间会被释放,而static定义的静态常量在函数执行后不会释放其存储空间 void f1() { ; cout<<x<<endl; } void f2() { ; cout<<y<<endl; y++; } int main() { f1(); f1();//1 const定义的常量在超出其作用域之后其空间会被释放 f2(); f2();//3 static定义的静态常量在函数执行后不会释放其存储空间 } 2)st…
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包来支持,下载后将…
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:…
Car c= new Car(log); c.print() class Car{ def log public Car(log){ this.log=log } public void print(){ log.info "hello world" } }…
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…
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+…
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=…
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…
What is a web service? http://webservicex.net/ws/default.aspx WebService是一种跨编程语言和跨操作系统平台的远程调用技术. 跨编程语言 : 服务端程序采用java编写,客户端程序则可以采用其他编程语言编写,反之亦然! 跨操作系统平台 : 服务端程序和客户端程序可以在不同的操作系统上运行. 远程调用 : 一台计算机a上的一个程序可以调用到另外一台计算机b上的一个对象的方法. 譬如,银联提供给商场的pos刷卡系统,商场的POS机转…
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…
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 FileInputStream(path)…