Skip to content

Instantly share code, notes, and snippets.

View rajendrapenumalli's full-sized avatar
:octocat:
Comeon we can do anything

Rajendra Prasad Reddy Penumalli rajendrapenumalli

:octocat:
Comeon we can do anything
  • Bangalore
View GitHub Profile
@rajendrapenumalli
rajendrapenumalli / Header Mgt Via Groovy in SOAPUI
Created January 30, 2017 04:29
Header Mgt Via Groovy in SOAPUI
#Getting Cookie Header from Headers:
def headerValue = testRunner.testCase.getTestStepByName("LoginOperation").httpRequest.response.responseHeaders["Set-Cookie"][1]
@rajendrapenumalli
rajendrapenumalli / File IO in Groovy
Last active January 30, 2017 07:24
File IO in Groovy
File file = new File("E:/Example.txt")
//Reading Files
1.Reading File content as a String
log.info file.text
2. Reading File content line by line
file.eachLine{
log.info it;
@rajendrapenumalli
rajendrapenumalli / Date and Time Stamp String Generation In Groovy
Created January 30, 2017 04:32
Date and Time Stamp String Generation In Groovy
#Date Time Stamp:
import java.text.*;
SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy_MM_dd_HHmmss");
SimpleDateFormat startDate = new SimpleDateFormat("MM/dd/yyyy");
Date now = new Date();
String strDate = sdfDate.format(now);
Date date = new Date();
String startDate1 = startDate.format (date)
Date prevDay = new Date()-1;
@rajendrapenumalli
rajendrapenumalli / SOAPUI -Running Specific Step in another Test Suite
Created January 30, 2017 04:34
SOAPUI -Running Specific Step in another Test Suite
import com.eviware.soapui.model.testsuite.TestRunner.Status
Running Specific Step in another Test Suite
def project = testRunner.testCase.testSuite.project
testRunner.runTestStep( project.testSuites['TESTSUITE1'].testCases['TESTCASE1'].testSteps['TESTSTEP6'] )
testRunner.runTestStep( project.testSuites['TESTSUITE1'].testCases['TESTCASE2'].testSteps['TESTSTEP8'] )
// get TestCase
def tc = testRunner.testCase.testSuite.project.testSuites["Sample Simple TestSuite"].testCases["TestCase Name"]
@rajendrapenumalli
rajendrapenumalli / Working with XAPATH in SOAPUI
Created February 1, 2017 01:50
Working with XAPATH in SOAPUI
Sample XML:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sam="http://www.example.org/sample/">
<soapenv:Header/>
<soapenv:Body>
<sam:loginResponse>
<sessionid>10873286937963711</sessionid>
</sam:loginResponse>
</soapenv:Body>
</soapenv:Envelope>
//Setting mock request headers
mockRequest.httpResponse.setHeader('MyHeader', "HiThere;")
mockRequest.httpResponse.setContentLength(456)
mockRequest.httpResponse.sendError(404)
//Setting response properties
def resp = mockOperation.getMockResponseByName('MyResponse')
resp.setResponseHttpStatus(202)
return 'MyResponse'
@rajendrapenumalli
rajendrapenumalli / gist:8c3b2779d161265de162574b2b43845a
Created June 17, 2017 04:52
Creating Test Suite to work on both Open Source and Commercial Versions Of SOAPUI
Dont Use Enviornments: Use Groovy +Peroperties Step Combination
Dont Use Envents: Manually Add headers like cookies to each step
Dont Use Data Source Step for Looping: Use Goovy Looping logic
So what you need to know:
You must be good or intermediate level coding skills in groovy
You must be familier with SOAPUI API and Its Methods to use.
@rajendrapenumalli
rajendrapenumalli / gist:f04457da438d47ed346baa382d8c687c
Created June 17, 2017 05:14
Running Multiple Test Projects via Batch file from Command Line Using testRunner
@echo off
set SOAPUI_HOME=C:\DevTools\soapui\SoapUI-Pro-5.0.0
call %SOAPUI_HOME%\bin\testrunner.bat -sUnitTesting -f Project1-soapui-project.xml
call %SOAPUI_HOME%\bin\testrunner.bat -sUnitTesting2 -f Project1-soapui-project.xml
call %SOAPUI_HOME%\bin\testrunner.bat -sotherTests -f Project2-soapui-project.xml
call %SOAPUI_HOME%\bin\testrunner.bat -sotherTests2 -f Project2-soapui-project.xml
@rajendrapenumalli
rajendrapenumalli / gist:4ea38ff3241105e7304ecd4e5b2c7ceb
Last active June 17, 2017 05:52
Optimum Care While Creating Test Suite
1. Use test Case level timeout feature
2. Use test case level maintain HTTP session feature
3. Allways implement Some time out mechanism :
-Max Time out
-Max Number of retried (With fixed retry duration or increasing or decreasing retry duration)
4. Do not repeat any HTTP step
insted testRunner
@rajendrapenumalli
rajendrapenumalli / gist:e0e366a8c95b4af7f746686212c0fcac
Created June 17, 2017 06:18
Accessing SOAPUI Env Variables in Groovy Script Editors
def java_home = context.expand('${#Env#JAVA_HOME}');
log.info java_home