Automating Tests
Pre-Conditions
- Make sure there are no certificate problems that might impede the tests.
- Currently, all versions of Chrome and Firefox up to v.12 are supported by this automation testing application.
Opening the Automated Tests Solutiuon
In Visual Studio, open TestDriver.sln in the "automation\TestDriver" subdirectory in the package. This should open with "TestDriver GUI" as the start-up project. You can run in Debug mode or build it out as an .exe.
You can open the Sample_Test.swf file in a browser to see a demonstration of an example test running.
The GUI
- Environment Selector – Used to select an environment to run the automated app in
- Iteration Selector – Used to select how many iterations to run a particular set of tests
- Test Suite Selector – Used to select a spreadsheet from which to load tests
- Spreadsheet Listbox – Populated based on the selection in Test Suite Selector
- This Listbox is automatically selected when a sheet in the Test Suite Selector is chosen
- Tests On Sheet Listbox – List of tests that are on a particular sheet
- Play Button – Button that executes tests
- Test Navigation Buttons – Buttons used to select and deselect tests
- Cancel Button – Button that exits the application
- Reset Form Button – Button to reset the form to its original state
- Excel Report Checkbox – Checkbox to generate an MS Excel report of the results
Since as shipped the only product that needs to be supported is SSD, the Product Selector is already filled in and disabled. It can be enabled by opening the solution in Visual Studio and changing the Listbox properties. Additional items can be added by adding them to the control collection. The Environment Selector and Suite Selector items are controlled by text files (Environments and Suite List respectively). To change these items merely change the items in the text files.
The Spreadsheet
The spreadsheet is located at the following location and must be there in order for the application to extract data from it:
..\Strive Testing Suite\TestDriver GUI\bin\Debug\Data Sheets\
- Database Upload – Currently non-functional. For use in case you wish to store your tests in a database
- Import Button – Button to import archived sheets
- Clear Sheet Button – Button to clear all sheets in the spreadsheet
- Export Button – Button to export this sheet to another sheet
- Required Block – All fields in this block colored orange are required
- Test Steps List – Block where test steps are placed
How It Works
This testing application is a small data-driven application that has been tailored to drive the Student Success Dashboard using the Selenium WebDriver. The code has been included to expand if you wish. The app controls the navigation through the application and takes inputs for each step and applies those to the app, so the data that you set up actually controls the behavior of the app. Each sheet in the enclosed workbook, except for the Master sheet and the two Note sheets, controls a certain aspect of navigating the application under test. Here is what they do:
- Login – Login to SSD with the specified user
- calendarControl – Enter a date using a calendar control
- chkCheckbox – Check or uncheck a checkbox
- clkButton – Click a button
- inputText – Place text into a text field
- navLinks – Click a link on a page
- selDropdown – Select an item from a dropdown button or list
- tblSelect – Select an item from a table. You can search for a specific item in a column and or search for an item in one column and select an offset column to the left or right
- Wait – Wait a prescribed amount of seconds
- vfyTableEntry – Verify a table entry
- vfyButton – Verify a button
- vfyDropdown – Verify a dropdown
- vfyField – Verify a field
- vfyImages – Verify an image
- vfyLink – Verify a link
- Logout – Logout of the application
Tests are constructed on the Master sheet of the spreadsheet in the following format: (function name)|(line number). Here's an example:
Every action taken on the application constitutes a step. There are comments in the title of each title column of each sheet to denote what that column’s data are for. The following columns are required in each sheet:
- Login – All columns required
- calendarControl - All columns required
- chkCheckbox – All columns required
- clkButton – All columns required
- inputText – All columns required
- navLinks - All columns required
- selDropdown – All except the List Tag column
- tblSelect – All except the Table List Xpath and Additional Verify String
- Wait – All columns required
- vfyTableEntry – All columns and at least one item
- vfyButton - All columns and at least one item
- vfyDropdown – All columns and at least one item
- vfyField – All columns and at least one item
- vfyImages – All columns and at least one item
- vfyLink – All columns and at least one item
- Logout – No information necessary
Example Test
In the following screenshot, the function name corresponds to a sheet on the spreadsheet which then supplies data to the function in the application.
Here’s a test with steps from the master sheet:
The test's name is Initial Login. It is a regression test from the packaged Student Success Dashboard test suite. It has three steps:
- Login|2
- vfyField|7
- Logout
Here's the data from each sheet:
Login:
So in the Login field, the function will do the navigation and take the following inputs from the sheet:
- Username – The username to log in with. This will be input into the username field in the app
- Password – The password to input into the password field
- Login Type – The type of login to use (Live, yahoo, Hotmail, etc.)
vfyField:
- Field XPath – The XPath to the field being verified
- Field Type – The type of field being verified. Currently these are limited to text field
- isPresent – Whether the present expected to be present on the screen (Y) or not (N)
- Field Name – The name of the field. Used for results
- List1 – The first list item to be verified. The function will search for each item in the List field(s)
Basically, what this step is doing is looking at the login field and verifying that the text present matches what is expected from the spreadsheet. Here's the screen that would allow this step to pass:
Logout:
A simple sheet that controls logout of the application.
Results
Results are published at the conclusion of each run, pass or fail. The results can be viewed on the GUI and in the resulting file. They give an in-depth recording of each test run and its successes or failures. Here’s an example of the results for a test:
Return to the wiki Home