Sunday, August 31, 2008

TestComplete's Data Driven Test

TestComplete is a test automation tool from AutomatedQA. It provides several features as other automation tool does provide and supports for various technologies on Windows platform. Let us see a code snippet which is in VBScript, used for a Data Driven Test using Microsoft Excel sheet.

TestComplete's Data Driven Test


Below written is a VBScript for Data Driven Test using automation tool, TestComplete 6. The script automates for booking a flight ticket using Mercury/HP's QTP sample flight application. The excel file will have the data, which is used during Data Driven Test.


' The script starts from here.

Option Explicit

Sub openForm(w1)
Call w1.MainMenu.Click("File|New Order")
End Sub

Sub insertOrder(p1,w1,w2,Driver)
Call w2.Window("MSMaskWndClass").Keys(Driver.Value(0))
Set w3 = w2.Window("ComboBox", "", 1)
Call w3.ClickItem(Driver.Value(1))
Set w3 = w2.Window("ComboBox", "", 2)
Call w3.ClickItem(Driver.Value(2))
w2.Window("Button", "FLIGHT").ClickButton
Set w3 = p1.Window("#32770", "Flights Table")
Call w3.Window("ListBox").ClickItem(Driver.Value(5))
w3.Window("Button", "OK").ClickButton
Set w3 = w2.Window("Edit", "", 1)
Call w3.Click(55, 11)
Call w3.Keys(Driver.Value(3))
w2.Window("Button", Driver.Value(4)).ClickButton
Call clickInsert(w2)
End Sub

Sub closeApplication(w1)
Call w1.MainMenu.Click("File|Exit")
End Sub

Sub clickInsert(w2)
w2.Window("Button", "&Insert Order").ClickButton
End Sub


Sub Main ' point of starting the script execution.
Dim p1
Dim w1
Dim w2
Dim w3
' creating a Excel driver object.
Set Driver =
DDT.ExcelDriver("G:\RAVI\TESTING\testComplete\sampleProject\flightDDT.xls","flightDDT",false)
Call TestedApps.flight4a.Run ' Application Under Test (AUT/SUT).
Set p1 = Sys.Process("flight4a")
Set w1 = p1.Window("#32770", "Login")
Call w1.Click(55, 6)
Set w2 = w1.Window("Edit", "", 1)
Call w2.Click(24, 8)
Call w2.Keys("mercury")
Set w2 = w1.Window("Edit", "", 2)
Call w2.Click(16, 11)
Call w2.Keys("mercury")
w1.Window("Button", "OK").ClickButton
Set w1 = p1.Window("Afx:400000:b*", "Flight Reservation")
Call w1.Click(50, 7)

While Not Driver.EOF
Call openForm(w1)
Set w2 = w1.Window("#32770")
If Driver.EOF Then
Call DDT.CloseDriver(Driver) ' closing the Excel Driver object created.
Call closeApplication(w1) ' closing the AUT/SUT.
End If
Call insertOrder(p1,w1,w2,Driver) ' call to a procedure to insert the data from excel sheet.
Call Driver.Next ' moving to the next row in the excel sheet.
Wend
Call closeApplication(w1)
End Sub ' End of a "Main" procedure.
' The script ends here.
*************************************************************************************


Learning's:

  • To begin, Data Driven Test from the above script, makes use of Excel Driver, which creates a object for an Excel sheet.
  • Syntax or declaration of driver:
DDT.ExcelDriver(Filename, Sheet, UseAceDriver)
  • Filename: is the name of excel file being used.
  • Sheet: is the excel sheet which has the data, that will be used for test.
  • UseAceDriver: a Boolean value. If True, TestComplete makes use of ACE driver to connect an excel sheet. If it is False, TestComplete connects to the excel sheet via the Microsoft Excel ODBC driver. ACE driver lets us to connect Excel 2007 sheets together with earlier version of Microsoft Excel.
  • Driver.Value(n), carries the data from excel sheet. The first column of the excel sheet is read as zeroth column.

The GUI which takes data from the user, can be fed with the relevant or irrelevant data which we want to test with, for 'n' number of times or for the desired iterations of tests run. The content format of the excel file is as below:


DATE FLY FROM FLY TO NAME CLASS FLIGHT
091108 Denver London Testing Garage First 20263 DEN 11:12 AM LON 06:23 PM AA $112.20
010109 Frankfurt Los Angeles Ravisuriya Business 20324 FRA 09:12 AM LAX 04:23 PM AA $112.20

End of topic "TestComplete's Data Driven Test"


Off-Topic note learning:

Finally to conclude, the automation is not a solution for busy and challenging test execution process. It provides the supporting hand to repeat the tests for test conditions which needs to be executed repeatedly. But, the 'Manual Testing' or a Tester testing sitting in front of the SUT/AUT is much result oriented and provides information regarding the quality measure of AUT/SUT; because tool only does the task scripted but the tester (human) has the intelligence & capability to identify the risks from doing things repeatedly with her/his thinking capability, which are uncovered by test tools.


Love Testing !


Wednesday, August 6, 2008

Bug - Exception “Illegal Argument/java/lang” displayed on Nokia 6080




-->
Mobile phones are used by people of different category, right from person who does not know to read & write to the person who can read & write. Where as, people will come into different category who cannot understand technical description and to the people who can know the cause of the technical description.
Here where the usability comes into picture. The most needed one, for today’s competitive technology to reach the customers market is Usability. Usability is not only the screen of a computer or a laptop, but it is also in handling the electronic gadgets.
Lot of research and innovation needs to be carried out and being conducted in this part of the testing i.e., “Usability Testing”. Salute to all those thinkers & testers who worked and being working on Usability.

Picture: Usability of Mobile Phone

No doubt, Nokia has good usability where a laymen can operate very easily with any models of it within a short span of hours.

The date was not 19th of the month. Few months ago tried it for 3 days i.e., on date 5th, 6th and 7th , to find why the "19" was displayed; but all what I got was more and more curiosity. The date set on the mobile phone was very correct for the day's calendar date.

Navigation through Menu > Application > Collection > World clock, displays the Java exception “Illegal Argument java/lang/IllegalArgumentException illegal month 19”. Just think of a laymen who does not any Java stuff and wants the time of cities she/he desires when the above written exception displayed. Also, think of the person who does not know to read and write in the above situation.
Picture: Snap of the error and exception thrown


Video of the navigation and exception thrown
video


Auto-update of date & time was turned on with option “Confirm first”. The other two options were “On” and “Off”.
Work Around, for the above issue:
On choosing the different date format, the exception was not thrown. The World Clock showed the time of the selected cities.
* Note:
Irrespective of the date format, the message displayed should tell the cause in laymen language.
----------
Few more bugs were seen with this model. One among them was, unable to open the Message’s Inbox (the work around is to switch off and switch on the mobile). Messages were not overflown in the size/content.
It is very happy and pleasant time for me, when I have Nokia 6080 in my hand as it is showing many new things to improve my little sand dust testing skills.