Рет қаралды 94,539
Today we will learn:
-----------------------------
1. What is Groovy
2. How to add groovy scripts in SoapUI
3. How to do basic coding in groovy in SoapUI
4. Basic Object Oriented Programming. (Classes and Objects)
References
en.wikipedia.o...
www.soapui.org...
Code Snippets
=============
import java.io.*;
log.info (" Hello World ... ");
int a = 10 ;
int b = 20 ;
int c = a+b ;
log.info (" Result is : "+c) ;
// this is a single line comment
/*
This is
multiline comment
*/
//log
//context
//testRunner
log.info testRunner.metaClass.methods*.name.unique().sort()
======================
class Hello{
def log;
def context;
def testRunner;
def Hello(log, context, testRunner){
this.log = log
this.context = context
this.testRunner = testRunner
}
def sayHello(String name){
log.info (" Hello "+name);
}
}
context.setProperty("Hello", new Hello(log,context,testRunner))
========================
def testStep = testRunner.testCase.getTestStepByName("Hello")
testStep.run(testRunner, context)
context.Hello.sayHello("Raghav")
============================
project = testRunner.testCase.testSuite.project ;
tcase = project.testSuites["TestSuite3"].testCases["TestCase1"] ;
hello = tcase.getTestStepByName("Hello");
hello.run(testRunner, context)
context.Hello.sayHello("Raghav")
project = testRunner.testCase.testSuite.project ;
tcase = project.testSuites["TestSuite"].testCases["TestCaseName"] ;
hello = tcase.getTestStepByName("Hello");
log.info testRunner.metaClass.methods*.name.unique().sort()
context.setProperty("Hello", new Hello(log,context,testRunner))
def hello = testRunner.testCase.getTestStepByName("Hello");
hello.run(testRunner, context)
def ref = context.Hello;
ref.printHello("Raghav");
==============================================
SoapUI Playlist -
• SoapUI
Like on Facebook - / automationstepbystep
Subscribe on:
KZbin - / automationstepbystep
_______ ONLINE COURSES TO LEARN _______
Visit - automationstepb...