GUI Test Automation Using Squish and BDD

Desktop or Tablet based GUI app testing can be automated with Squish. The syntactic sugar of BDD makes the tests modular and reusable

3 months Work at Wingtra
Python Squish Test Automation

Use Case:

Automating GUI test cases by using Squish GUI software and wrote Behavioural Driven Test, using Gherkin language.

Role: QA Software Engineer | Project Size: 3 person-months

Feature

  • Fully automated GUI testing pipeline, including a data dashboard
  • Used Behavior-Driven Design principles for coding the test cases
  • Fully integrated into CI/CD pipeline
  • Modular and reusable test cases and step functions
  • Technology: Python, Squish, Jenkins, Google Cloud, Docker, C++

Code Examples

Feature File is where business logics are written by combining different steps. Steps are categorised using

  • "Given...",
  • "When...",
  • "Then..."
  • "And..."
  • "But..."
  Feature: Tablet Navigation
    Scenario: Navigate using touch gestures
      Given the tablet app is running
      When I tap the "Menu" button
      And I swipe left on the gallery
      Then I should see the next image

Then each step functions are written as Python function with a fixture that's the name of the step function

 @given('the tablet app is running')
  def step_impl(context):
      squish.startApplication("TabletApp")
      squish.waitForObject(":Tablet.MainWindow")

Using these feature from python and Gherkin language, steps can be modularly coded and modeled, and combined freely into different business logic.

 @given('the tablet app is running')
  def step_impl(context):
      squish.startApplication("TabletApp")
      squish.waitForObject(":Tablet.MainWindow")

  @when('I tap the "{button}" button')
  def step_impl(context, button):
      element = squish.waitForObject(f":Tablet.{button}")
      squish.tap(element)

  @when('I swipe left on the gallery')
  def step_impl(context):
      gallery = squish.waitForObject(":Gallery")
      squish.swipe(gallery, squish.Left)

  @then('I should see the next image')
  def step_impl(context):
      next_image = squish.waitForObject(":Gallery.Image_2")
      test.verify(next_image.visible)

Squish also provides a GUI where these steps can be individually debugged.