Wednesday, July 2, 2008

Data Driven Testing with ATF test automation tool.

#
#_Test Case: Validating login to an application.
#
#_Version: 2.0
#
#_Author: Testing Garage
#
#_Description: Login to application with user names and password present in Data Table. The application name present in the below script is for an example. The respective AUT will have its unique name, while writing the script. AUT, is the abbreviation for Application Under Test.



CONNECT 'Quality' # establishing a connecting to the machine (agent).

DECLARE STRING @A, @B

DECLARE INTEGER @i, @len
@len = TableGetLen("E:\smokeTestScripts\userdetalis.DTB")

FOR @i = 1 TO @len

@a= TableGetValue("userdetalis.DTB", "userid", @i)
ECHO "ID is",@a
@B= TableGetValue("userdetalis.DTB", "password", @i)
ECHO "PW is",@B

WinSetActive ('TL_AUT')
WinMouseClick ('TL_AUT', 279, 460)
WinSetFocus ('TL_AUT')
PLAY KEYS @A

WinMouseClick ('TL_AUT', 282, 488)
PLAY KEYS @b
WinMouseClick ('TL_AUT', 248, 588)
WAIT 20

WinSetActive ('TL_AUT_administrator')
WinSetFocus ('TL_AUT_administrator')
PLAY KEYS ' x'

WinMouseClick ('TL_AUT_administrator', 18, 33)
WinMouseClick ('SunAwtCanvas', 28, 28)
PLAY KEYS ""

NEXT @i

Saturday, June 21, 2008

Script for Data Driven test with Rational Robot's Datapool.

'The script can be used or modified as needed after creating appropriate Datapool in Rational Robot.


'$include "sqautil.sbh"

Sub Main

Dim Result As Integer
DIM dp_result as long
'DIM dp_result as long
Dim dp_agentName as string
Dim dp_password as string
Dim dp_fetchResult as long
Dim dp_result1 as long
Dim dp_flight as long



'Script Name: dataPoolLogin

dp_flight=SQADatapoolOpen("E:\myTesting\rationalRobotTest\TestAssets\DataPools\logininfo",FALSE,SQA_DP_SEQUENTIAL,FALSE)


FOR I=1 TO 2
dp_Fetchresult = SQADatapoolFetch(dp_flight)
Window SetContext, "Class=Shell_TrayWnd", ""
Toolbar Click, "Text=Quick Launch;\;ItemText=Flight", "Coords=16,8"

Window SetContext, "Caption=Login", ""
EditBox Click, "ObjectIndex=1", "Coords=7,8"
dp_result = SQADatapoolValue(dp_flight,1,dp_agentName)
' InputKeys "mercury"
InputKeys dp_agentName

EditBox Click, "ObjectIndex=2", "Coords=10,2"
dp_result1 = SQADatapoolValue(dp_flight,2,dp_password)
'InputEncKeys "CAAAAM4AAAAICaEYwet4JA=="
InputKeys dp_password
PushButton Click, "Text=OK"

' closing flight reservation
Window SetContext, "Caption=Flight Reservation", ""
Window Click, "", "Coords=39,-34"
MenuSelect "File->Exit"


NEXT

End Sub