Upcoming feature “script-based object map”

Upcoming feature: Script-Based Object Map

In July 2016 two blog articles presented an alternative script-based Object Map approach for advanced management of object names. The idea is to use script language variables instead of string-based Symbolic Names for object look-up and interaction functions.

As shown in the examples below, language specific dictionaries with wildcard and regular expression support are used to define the properties of object names and since the Object Map is written in the same language as the tests, Squish IDE features like code completion, jump to definition and refactoring make usage of object names quite simple.

In one of the next Squish releases the script-based Object Map will be supported for all five script languages, including these main features:

  • Recording
  • Playback
  • Script framework for “home brewn” Object Maps

How will it look like?

Here are small examples for Ruby and JavaScript:

Ruby

objectmap.rb

Address_Book_MainWindow = ObjectName.new({:type => "MainWindow", :unnamed => "1", :visible => "1", :windowTitle => Wildcard.new("Address*Book")})
Address_Book_New_QToolButton = ObjectName.new({:text => "New", :type => "QToolButton", :unnamed => "1", :visible => "1", :window => Address_Book_MainWindow})

test.rb

def main
  startApplication("addressbook")
  clickButton(waitForObject(Address_Book_New_QToolButton))
end

JavaScript

Code completion
objectmap.js

gui.addressBookMainWindow = new ObjectName({type: "MainWindow", unnamed: 1, visible: 1, windowTitle: "Address Book"});
gui.addressBookNewQToolButton = new ObjectName({text: "New", type: "QToolButton", unnamed: 1, visible: 1, window: gui.addressBookMainWindow});

test.js

function main() {
    startApplication("addressbook");
    clickButton(waitForObject(gui.addressBookNewQToolButton));
}

Comparison to string-based Object Map

So far the Object Map repository contained a string-based mapping of Symbolic Names to Real Names. An example: the Symbolic Name

  :Address Book - Add.Forename:_Label

gets resolved to the Real Name

{container=':Address Book - Add_Window' text='Forename:' type='Label'}

All names are just plain and fixed strings however. In case the text of the label is dynamic and changes over time the map quickly fills up with new entries. The Object Map Editor supports editing of names and properties. Including usage of wildcards and regular expressions. Or dropping of unstable properties and outdated names. Still, maintenance of such a list can become cumbersome. Through tighter integration with the script language testers can make use of its features like parametrization.

Further Details

For a more detailed description on how this works and advantages of the new approach, please read the two original blog articles Improved Management Of Object Names and Improved Management Of Object Names Part 2.

0 Comments

Leave a reply

Your email address will not be published. Required fields are marked *

*