IT-SDK-SoapUI
Jump to navigation
Jump to search
Source
- src: https://www.youtube.com/playlist?list=PLhW3qG5bs-L-Bt9T_bnyflQ0Te4VgFhKF
- REST: https://restcountries.eu/
- SOAP: http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL
Properties
Properties can be accessed at following levels:
Project: ${#Project#PropertyName}
TestSuite: ${#TestSuite#PropertyName}
TestCase: ${#TestCase#PropertyName}
TestStep: ${TestStepName#PropertyName}
...
System: ${#System#PropertyName}
Env: ${#Env#PropertyName}
Global: ${#Global#PropertyName}
Rest
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");
############################################################################################
Notes: TU09
/Groovy - run request from same TestCase
def status = testRunner.runTestStepByName("TestStepName")
def result = status.getStatus().toString();
log.info (" ---- "+result)
//Groovy - run request from another TestCase or TestSuite
project = testRunner.testCase.testSuite.project ;
tcase = project.testSuites["TestSuiteName"].testCases["TestCaseName"] ;
tstep = tcase.getTestStepByName("TestStepName");
def status = tstep.run(testRunner, context)
def result = status.getStatus().toString();
log.info (" ---- "+result)
############################################################################################
Notes TU10
groovy code to run test case
=====================
def tCase = testRunner.testCase.testSuite.testCases["TestCaseName"]
runner = tCase.run(new com.eviware.soapui.support.types.StringToObjectMap(), false);
groovy code to loop test cases in a test suite
==================================
def testCases = context.testCase.testSuite.getTestCaseList()
testCases.each{
log.info(it.name)
}
command line run
==============
cd C:\Program Files\SmartBear\SoapUI-5.4.0\bin\
testrunner.bat -sTestSuite3 -cTestCase2 "C:\Users\Raghav Pal\OneDrive\Projects\SoapUIProjects\CountryInfoService-soapui-project1.xml"
############################################################################################
def tCase = testRunner.testCase.testSuite.testCases["TestCaseName"]
runner = tCase.run(new com.eviware.soapui.support.types.StringToObjectMap(), false);
...
def suite = context.testCase.testSuite.project.testSuites["TestSuiteName"]
suite.run(null,false)
...
projectName=testRunner.getTestCase().getTestSuite().getProject().getWorkspace().getProjectByName("REST Project 1")
projectName.run(null,true)
##################################
testRunner.testCase.testSuite.project.getTestSuiteByName('TestSuite1').getTestCaseByName('TestCase1').setSetupScript('log.info "setup"')
testRunner.testCase.testSuite.project.getTestSuiteByName('TestSuite1').getTestCaseByName('TestCase1').setTearDownScript('log.info "teardown"')