Quantcast
Channel: froglogic
Viewing all articles
Browse latest Browse all 398

Squish tip of the week: Creating an automated test from a manual test

$
0
0

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
  1. Open Application
  2. Create a new address book using application menus
  3. 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
  1. Place the cursor on the empty line after the #Open Application comment
  2. Right-click and select Record Snippet
  3. 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:

  1. Since the startApplication step was already recorded, we do not want to duplicate that action, thus creating a duplicate step
  2. 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
  1. Click Launch AUT
  2. Place the cursor below the # Create new address book line, right-click and select Record Snippet
  3. Once the recording begins, select File > New in the Addressbook application
  4. 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
  1. Place the curor below the # Confirm new addressbook created without any entries line, right-click and select Record Snippet
  2. Once the recording begins, select Insert Object Properties Verification Point
  3. When the Squish IDE appears, select Scriptified Properties VP
  4. Next click the Pick tool in the Application Objects toolbar
  5. Once the Addressbook application reappears, click the empty table
  6. The properties of the picked object display in the Squish IDE’s Properties window
  7. Check the rowCount property and click Insert
  8. When the Control bar returns, click Stop
    1. 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)
      
      
      
      

      Read more about recording snippets and other related topics below

Click here to request your free 30 day Squish evaluation


Viewing all articles
Browse latest Browse all 398

Trending Articles