Skip to main content

Creating an automated test from a manual test

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 detailed review. The Behavior Driven Development (BDD) testing feature of Squish can easily help converting manual tests to automated tests.

Use existing manual test cases as your base

Sample manual test case: Create a new address book
  1. Start the application
  2. Create a new address book using application menus
  3. Expected result: New address book is created without any entries
Each item in the test case becomes a step in the feature file of the BDD test

Feature: Testing of the addressbook example

    Scenario: Create a new address book
    
        Given addressbook application is running
         When I create a new address book
         Then address book should have zero entries
         
After creating the Feature file, start recording implementation of steps

You can start recording either by clicking the red filled circle button next to test case name or right-click in the editor and select Record Missing Steps in Scenario.

The addressbook application should launch and you should be seeing the control bar after the recording has started:

squish-recording-control-bar

Recording of the 1st step: Given addressbook application is running
  1. Once your application launches, click Finish recording this step button
Recording of the 2nd step: When I create a new address book
  1. Select File > New in the addressbook application
  2. Click Finish recording this step button
Recording of the 3rd step: Then address book should have zero entries
  1. Click Verify > Properties in the control bar
  2. When the Squish IDE appears, select Pick tool in the Application Objects toolbar
  3. Once the addressbook application reappears, click the empty table
  4. The properties of the picked object display in the Squish IDE's Properties window
  5. Check the rowCount property and click Save and Insert Verifications button
  6. When the control bar returns, click Finish recording this step button
The final implementation of steps should appear similar to the following in steps.py

import names

@Given("addressbook application is running")
def step(context):
    startApplication("addressbook")

@When("I create a new address book")
def step(context):
    activateItem(waitForObjectItem(names.address_Book_QMenuBar, "File"))
    activateItem(waitForObjectItem(names.address_Book_File_QMenu, "New"))

@Then("address book should have zero entries")
def step(context):
    test.compare(waitForObjectExists(names.address_Book_Unnamed_File_QTableWidget).rowCount, 0)
    
Read more about recording snippets and other related topics below

 

Try Squish out for free with a fully-supported and fully-functional trial of any Squish edition.

Comments

    The Qt Company acquired froglogic GmbH in order to bring the functionality of their market-leading automated testing suite of tools to our comprehensive quality assurance offering.