Sunday, 31 July 2011

Dot Net factory


Working with Dot net factory or .Net classes

      Working with Dot net factory Or .net classes in QTP looks very difficult  to understand or its giving an impression that to use those classes we should have .net experience or this class will only help us on .net applications but my dear friends this is just a myth .You will come to know all in and out of using dot net factory as you go on with this article .

v  .net Date and time formatting

Using tostring

''create a data and time object
Set dateTime  = DotnetFactory ("System.DateTime")
Print "Time ( hh:mm tt MM/dd/yy) - " & DateTime.now.TouniversalTime.toString("hh:mm tt MM/dd/yy")
Set datetime =Nothing
So whatever format we can just give over here with the simple brackets after tostring and we can  get the required output .
Check the following QTP screen shots for more details.  

Using parse

Dim SystemDate , DateTime
Set SystemDate = Dotnetfactory.CreateInstance("System.DateTime")
Set DateTime = SystemDate.Parse("Fri, 9 Oct 2009 12:12")
FormattedDate = DateTime.Day & "/" & DateTime.Month & "/" & DateTime.Year &"/"& DateTime.hour&"/"& DateTime.minute
msgbox FormattedDate
Set SystemDate = Nothing
Set DateTime = Nothing




Saturday, 30 July 2011

Get Character value and their count from a string


Dim str
dim inttemp

str = "7pankaj7868PANKAJ"
i=1
k=0
Do
            temp = mid(str,i,1)
If  temp="" Then
            Exit do
End If
ascii = asc(temp)
            If  (ascii >=97 and ascii <=122) or (ascii >=65 and ascii <=90)Then
                        k=k+1
inttemp = inttemp&temp
            End If

i=i+1
Loop
msgbox K
msgbox inttemp

Wednesday, 20 July 2011

Reverse the String without using StrReverse


Dim i
Dim iStrLen
Dim strOut
Dim strTmp
Dim strMyString
strString=("Please enter the string to be reversed:")
iStrLen = Len(strString)
For i = 0 To Len(strString) - 1
         strOut = Mid(strString, iStrLen - i, 1)
         strTmp = strTmp & strOut
Next
strMyString = strTmp
msgbox strMyString

Wednesday, 6 July 2011

Automation testing lifecycle


  1.  Selection of tool : The first question which raises when we start the automation of any application is that which tool we should ,weather the tool is fulfilling all our requirements or not Under this section we use to check compatibility of tool with the AUT, resource availability for that tool, Cost and time benefits by using the automation tool.  
  2. Check the scope of tool with application: In this use to check that up to what extend we can test the application. 
  3. Select the test cases to be automated: Then we use to check what are all the test cases which should be automated. 
  4. Design the frame work for the Suite: Then design the framework where we can increase the re-usability and maintainability. 
  5. Develop the automation test scripts:Then we develop the test scripts as the frame wor
  6. Maintain the scripts: In the end we have to maintain the scripts as per the new updates in AUT. 
  7. Synchronize the scripts: Then we have to synchronize the test scripts very carefully. 
  8. Add recovery scenarios:  If the test scripts are stacking any where we have to add expected recovery scenarios over there.    
  9. Execution of scripts: Execution of test scripts and verification of test results.
  10. Maintain the scripts: In the end we have to maintain the scripts as per the new updates in AUT.