Getting Unique String in QTP
Class clsString
Public Function fun_GetStringWithTimeStamp(strFristString)
strTime = Replace(Time(),”:”,””)
fun_GetStringWithTimeStamp = strFristString&strTime
End Function
End Class
data = RandomString(265)
WScript.Echo Len(data)
WScript.Echo data
Function RandomString( ByVal strLen )
Dim str
Const LETTERS = “abcdefghijklmnopqrstuvwxyz0123456789”
Randomize()
For i = 1 to strLen
RndNumber = Int((Len(LETTERS)- 1 + 1) * Rnd + 1)
str = str & Mid( LETTERS, RndNumber, 1 )
Next
RandomString = str
End Function
Class clsString
Public Function fun_GetStringWithTimeStamp(strFristString)
strTime = Replace(Time(),”:”,””)
fun_GetStringWithTimeStamp = strFristString&strTime
End Function
End Class
Internet Explorer Operations used in QTP
The Below code illustrate the Internet Explorer Operations
‘$Filename: clsIE.vbs
‘$Description: class consists various IE browser operations
‘$Author: Deep Routhu
Read more…QTP Connection to Access DB
The below code illustrate the connection to Access Data Base.Here we are using the class concept as it helps us to organize the code.Class clsAccess‘ @HELP‘ @description: This class is defined to handle database operations.‘ @END
Executing Soap ui from VBS file
The below code illustrate to execute the the Soap UI project to execute.It executes all the test suites in the Soap UI Project‘Calls to the functionExecuteSoapUI “127.0.0.1”‘Function to execute the soap UI ProjectPublic Function ExecuteSoapUI(IPaddress)
Load Properties from ini file
The Example code below explains how do we get the ini file located in the system. Which get the properties and saves as global properties.def loadProperties(path){//Loads the file settings.inidef properties = new java.util.Properties();properties.load( new java.io.FileInputStream( “c:/settings.ini” ))return properties
TestCase and TestStep execution with Groovy…
TestCase loopingfor( c in 0..5 )testRunner.runTestStepByName( “My Request” )
Assertions
Name = values.getPropertyValue(“UserName”);UID = values.getPropertyValue(“UserID”); Read more…
Properties
Properties
when creating a testsuite or a testcase it is required to send the properties from one step to another step for which there is an option of ‘Property Transfer’ in soap UI. Especially when you need to transfer the variable to multiple Steps there is a bit of overhead.
The Best practice is to send the properties to higher level and use them.
Approach to Automation Project
Well Automation is a separate project just like the development project. There are couple of factors to decide to go for a Automation.
Useful information on soap UI
you can browse the below link to get more information on SoapUI Tool.