Data-Driven Testing Example
The test application will be the home page of Weather.com. Weather.com offers local forecasts as well as world weather information.
Test Specs:
Platform: Windows XP
Browser: Mozilla Firefox 1.0.2
Test Application: Weather.com
Objective:
The following data-driven test uses zip codes as inputs to Weather.com to verify that the website is capable of processing valid and invalid zip codes. The test application, Weather.com, upon successful recognition of a valid zip code should display the corresponding city, state, and local forecast belonging to the zip code. The test application should also be capable of realizing invalid zip codes. Therefore, the data set will also include invalid zip codes.
Test Details:
Our data-driven test will assume that the local forecast for a corresponding input is correct, and for that matter our test will not be concerned with validating the local forecast. Our test will however, validate the city and state that will be displayed after Weather.com recognizes an input as a valid/invalid zip code. Our script will accomplish this by comparing the displayed city and state with the correct information that it will obtain from an external data file. The test application, Weather.com, should not display a city or a state for an invalid zip code. Weather.com should display a message stating that no information in regard to an invalid entry could be found. Upon successful validation of a zip code our script will continue to input zip codes into Weather.com until the last zip code read from the data file is processed.
There are two conditions under which our script will log an error:
- When the city and state information displayed by Weather.com does not match the corresponding information located in the data file
- When Weather.com accepts a non-existent zip code as a valid entry and displays a city and state that should not exist.
Scripts:
The scripts used for this test will make use of the following SenseTalk features. More information on these features can be found in the corresponding documents:
- File manipulation (Sensetalk Reference: Commands and Functions: Working with Files and File Systems)
- Sensetalk Objects (Sensetalk Reference: Objects and Messages: Objects)
- Writing handlers (Sensetalk Reference: Objects and Messages: Handlers)
The scripts will assume that the test application -- the FireFox Web browser displaying the Weather.com homepage -- is present at the start of test execution.
- main.script: Test execution will commence from this script.
- parseFile.script: This script will parse the text file into a recognizable data format.
- City.script: City is the internal representation of the test data. Note: City's only handler is asText. More information on the asText handler can be found in the SenseTalk⢠reference manual.
* The "Weather.com" Web site is used here only as convenient, readily available example application. Its use here should not be construed as an endorsement of Eggplant by Weather.com nor as suggesting that Weather.com is a customer of Redstone Software, Inc.