Showing posts with label Check points. Show all posts
Showing posts with label Check points. Show all posts

Monday, April 8, 2013

Bitmap check point

Bitmap check point is used to compare the bitmap files.

Script : Write a script to compare given bitmap files.

Optional Explicit
Dim filePath1,filePath2
filePath1=”D:\Vamsi\file1.bmp”
filePath2=”D:\Vamsi\file2.bmp”
Set bmpObj=CreateObject(“Mercury.FileCompare”)
compareResult=bmpObj.IsEqualBin(file1,file2,0,1)
If compareResult=0 Then
    Msgbox “not match”
    Else
        Msgbox “match”
    End If

Contributed by: Vamshi Gowtham
m.vamsigowtham@gmail.com

Text Area Check point

It is used for checking the text present in the specified area.

Navigation:

Keep the tool under record mode -> Insert menu ->check point -> Text area check point -> Select the desired text by using cross hair icon ->Click OK -> Select any options like Match case, Ignore spaces, Exact Match, Text not displayed -> Click OK

Coding Text area check point:

Script:
Ex: In Note Pad       
There is a QTP class
There is no prerequisite
There is a monitor

Now identify whether “is” exists between “class” and “no”

Option Explicit
Dim foundTxt, startPos, endPos
Dim substr, actualtxtpos

foundTxt=window("Notepad").WinEditor("Edit").GetVisibleText()

startPos=InStr(foundTxt,"class")
endPos=InStr(foundTxt,"no")

substr=mid(foundTxt,startPos,endPos + len(“no”))

actualtxtpos=InStr(substr,"is")
If  actualtxtpos<>0 Then
    Reporter.ReportEvent micPass,"text should be displayed","Text is displayed"
Else
    Reporter.ReportEvent micFail,"text should be displayed","Text is not displayed"
End If

Script: Write a script to extract file name, file path and drive letter

Option Explicit
Dim filePath,firstloc,driveName
Dim filePathVal,secondloc,filename
filePath=”D:\Vamsi\Test data\sample.xls”
    firstloc=Instr(filePath,"\")
driveName=mid(filePath,1,firstloc-2)
msgbox driveName
secondloc=InstrRev(filePath,"\")
filePathVal=mid(filePath,firstLoc+1,secondLoc-4)
msgbox filePathVal
fileName=mid(filePath,secondLoc+1,len(filePath)-secondLoc)
msgbox fileName

Contributed by: Vamshi Gowtham
m.vamsigowtham@gmail.com

Text check point

Text check point is used for checking the text present in the specified object.
Navigation :
Keep the tool under record mode ->Insert menu -> Check point -> Text check point -> select the desired object with handler pointer -> click OK -> select any option like Match, Ignore spaces, Exact Match, Text not displayed -> Click OK

Coding the Text check point:

We have to do the following for implementing text check point via code.

1.    Specify the text to be checked.
2.    Get the text visible on the application
3.    Check whether the expected text exists in the captured text.
4.    Report to QTP results.

Script: Verify “version 4.0’ text is displaying in Help

Option Explicit
Dim expText=”version 4.0”
Dim getText, txtPos
expText="Version 4.0"
getText= window("Flight Reservation").Dialog("About Flight Reservation").GetVisibleText()

txtPos=Instr(getText,expText)
If txtPos<>0 Then
    Reporter.ReportEvent micPass,"Text should be found","Text is found"
Else
    Reporter.ReportEvent micFail," Text should be found","Text is not found"
End If
   
    GetVisibleText() method: It returns the text that is visible on the object during runtime.
    InStr() function: It compare the actual text with expected text and returns the position.

    Script: Write a Script to count number of occurrences for a given string in actual string.

    Method 1
    Option Explicit
    Dim actualTxt,exptxt,indx,instCnt
actualTxt=”My name is James there is not pre-requisite for learning qtp”
    expTxt=”qtp”
    indx=0
    instCnt=0
    Do
        Indx=InStr(indx+1,actualTxt,expTxt)
        If indx > 0 Then
            instCnt=instCnt + 1
        Else
            Exit Do
        End If
    Loop While (True)
   
Method 2

Option Explicit
    Dim actualTxt,exptxt
actualTxt=”My name is James there is not pre-requisite for learning qtp”
    expTxt=”qtp”
msgbox (len(actualTxt)-len(Replace(actualTxt,expTxt,””)))/len(expTxt)


Contributed by: Vamshi Gowtham
m.vamsigowtham@gmail.com

Standard check point

It is used to test the GUI properties of the objects like : Text, Enabled, Height, width, class etc.,

Navigation: Record mode -> Insert menu -> check point -> Standard check point -> select the handler pointer -> click on the object which we want to check the properties -> specify expected values -> Click OK button -> stop recording.

Syntax: <obj hierarchy>.check checkpoint(<check point name>)

To find the status of check point:

Val=<obj hierarchy>.check (checkpoint(<check point name>))

Ex: Focus to window

-> Flight button should be disable

Open a new record

-> Flight button should be disable

Enter date

-> Flight button should be disable

Select Fly From

-> Flight button should be disable

Select Fly To

-> Flight button should be enable


Contributed by: Vamshi Gowtham m.vamsigowtham@gmail.com

Check points



Check points are used to verify the properties of GUI objects, Images, data bases…..
Check points allows us to compare the current behaviors of the application with earlier behavior of the application.
Types of check points:
1.     Standard check point
2.     Text check point
3.     Text area check point
4.     Bitmap check point
5.     Data base check point
6.     Accessibility check point
7.     XML check point from Application
8.     XML check point from Resource

Operational overview of Check point:

IT is divided into 2 phases.
1.     Pre-Execution phase :
i) Captures the expected value
ii) Generates the corresponding test script statement
2.     While Execution phase:
i) Captures the actual value
ii) Compare the actual value with expected value
iii) Display the result.

Disadvantages:
1.     It takes more time to verify and validate and hence test execution time is more
2.     It depends on the screen resolution and hence it might vary from system to system.

Note: In real time we mostly avoid use of check points.

Contributed by: Vamshi Gowtham
m.vamsigowtham@gmail.com

AI in Software Testing: How Artificial Intelligence Is Transforming QA

For years, software testing has lived under pressure: more features, faster releases, fewer bugs, smaller teams. Traditional QA has done her...