As you begin building your Automated GUI Testing Framework, the first set of tests you’re likely to automate are those manual test cases which while required are perhaps mundane, repetitive or require meticulous detail review.
Use existing manual test cases as your base
Sample Manual Test Case: Create New Address Book
- Open Application
- Create a new address book using application menus
- Expected result: Confirm new addressbook created without any entries
Each step in the test case becomes a comment in the script
# Create New Address Book # Open Application # Create new address book # Confirm new addressbook created without any entries
Add the main() function applicable to the scripting language you’re using
# Create New Address Book def main(): # Open Application # Create new address book # Confirm new addressbook created without any entries
Automate the test case in small sections, or snippets, using the manual test case steps as your guide
- Place the cursor on the empty line after the #Open Application comment
- Right-click and select Record Snippet
- Once your application launches, click Stop
Your script should now appear similar to the following
# Create New Address Book def main(): # Open Application startApplication("addressbook") # Create new address book # Confirm new addressbook created without any entries
Before recording the next Snippet, launch the application using Launch AUT
We’re doing this for two reasons:
- Since the startApplication step was already recorded, we do not want to duplicate that action, thus creating a duplicate step
- Using Launch AUT, instead of relying on Squish to open the AUT upon clicking Record, ensures the AUT remains open after we stop and start multiple Snippet recordings
Recording additional Snippets
- Click Launch AUT
- Place the cursor below the # Create new address book line, right-click and select Record Snippet
- Once the recording begins, select File > New in the Addressbook application
- Click Stop
Last, we’ll use Record Snippet to record the final portion of the script, confirming the new Addressbook was created without any entries
- Place the curor below the # Confirm new addressbook created without any entries line, right-click and select Record Snippet
- Once the recording begins, select Insert Object Properties Verification Point
- When the Squish IDE appears, select Scriptified Properties VP
- Next click the Pick tool in the Application Objects toolbar
- Once the Addressbook application reappears, click the empty table
- The properties of the picked object display in the Squish IDE’s Properties window
- Check the rowCount property and click Insert
- When the Control bar returns, click Stop
The script should appear similar to the following
# Create New Address Book def main(): # Open Application startApplication("addressbook") # Create new address book activateItem(waitForObjectItem (":Address Book_QMenuBar", "File")) activateItem(waitForObjectItem (":Address Book.File_QMenu", "New")) # Confirm new addressbook created without any entries waitFor("object.exists(':Address Book - Unnamed." + "File_QTableWidget')", 20000) test.compare(findObject(":Address Book - Unnamed." + "File_QTableWidget") .rowCount, 0)