Use Rational Functional Tester ScriptAssure
technology to build test scripts that run when code
changes
Customize scripts by changing property weights and recognition
scores
Skill Level: Introductory
Naveen Kumar Bysani (naveenkumar.bysani@gmail.com)
Senior Software Engineer
Quantum India Development Center
20 Apr 2010
Frequently changing Web pages and Web applications make testing and test-script
development a frustrating challenge. With IBM® Rational® Functional Tester
ScriptAssure technology, you can develop clean test scripts that can withstand these
changes and still put your application through its paces, build after build.
Introduction
Developing automation scripts for regression testing dynamic Web pages, such as
storage domain GUI applications and gaming GUI applications, can be difficult for
IBM® Rational® Functional Tester users. Testers intend to develop resilient scripts
for testing dynamic object property values, which do not have sufficient unique
properties. Having insufficient unique properties for recognition leads to errors and
failures during script playback. By understanding the IBM ScriptAssure®, weights,
and how objects are recognized at run time in Rational Functional Tester, you can
develop scripts to withstand changes and provide informative regression test results.
Many testers who are new to Rational Functional Tester confront the difficulties of
creating resilient scripts while automating Web applications. This article provides a
clear understanding about ScriptAssure and how to use the tool efficiently.
Use Rational Functional Tester ScriptAssure technology to build test scripts that run when code changes
© Copyright IBM Corporation 2010. All rights reserved. Page 1 of 9
developerWorks® ibm.com/developerWorks
ScriptAssure
ScriptAssure helps you create resilient scripts that play back even when the
application under test has been updated. You can play back scripts in Rational
Functional Tester by using the ScriptAssure feature to control object-matching
sensitivity.
The object-matching function relies on several factors to recognize elements in the
application under test. For Rational Functional Tester to recognize an object in the
application under test, the object properties must match the properties that are
recorded in test object map. By default, Rational Functional Tester recognizes an
object if one or two properties do not match. If two properties do not match, Rational
Functional Tester evaluates the recognition as weak in a log warning. If more than
three properties do not match, Rational Functional Tester cannot recognize the
object in the application and the application fails the test.
You can use ScriptAssure two ways:
• Standard: You set object-matching sensitivity during playback with a
slider control.
• Advanced: You set thresholds for recognition scores. You can set a
maximum score to consider a test object as a candidate for recognition.
By using the ScriptAssure technology, you can create a tight or loose coupling on an
object as required.
Consider the following screen capture of a Web page:
Figure 1. A sample page shows the object that is recorded in an older build
Use Rational Functional Tester ScriptAssure technology to build test scripts that run when code changes
Page 2 of 9 © Copyright IBM Corporation 2010. All rights reserved.
ibm.com/developerWorks developerWorks®
The properties of the object on the Web page follow:
Figure 2. Object properties that are recorded
These object properties are recorded from the previous build. Assume that
developers change the properties in the latest build:
• The .text property changes to Forms and community
Use Rational Functional Tester ScriptAssure technology to build test scripts that run when code changes
© Copyright IBM Corporation 2010. All rights reserved. Page 3 of 9
developerWorks® ibm.com/developerWorks
• The tabIndex property changes from 0 to 1
• The .classIndex property changes from 11 to 10.
Figure 3. A sample page shows the object in the latest build
Rational Functional Tester cannot recognize the object at run time, because the
object properties do not match.
Property weights
Each test-object property has an associated recognition weight value, which is a
number from 0 to 100. Rational Functional Tester uses the weight value for each
recognition property to determine the importance of that property. For example, in
Figure 2 the .class .text, and .tabIndex recognition properties of the link object have
weights of 100; the .classIndex recognition property has a weight of 50.
In typical circumstances, these changes to the objects in the application under test
have cause the functional test run to fail. However, you can play back scripts in
Rational Functional Tester by using the ScriptAssure feature to control
Use Rational Functional Tester ScriptAssure technology to build test scripts that run when code changes
Page 4 of 9 © Copyright IBM Corporation 2010. All rights reserved.
ibm.com/developerWorks developerWorks®
object-matching sensitivity.
In the earlier example, Rational Functional Tester reviews the object properties at
run time and finds mismatches on .classIndex, .text and tabIndex. Figure 2 lists the
weights for these properties as 50, 100, and 100. Rational Functional Tester
calculates the penalty weight as follows: (50 + 100 + 100) x 100 = 25000. This figure
is called the recognition score in Rational Functional Tester.
However, if only two object properties change, consider the difference in the
recognition score. For example, assume that the values for .text and tabIndex
change to Forums and Community and 1. The weights of these properties are
each 100. The recognition score is calculated this way: (100+100) x 100=20000.
By default, the Maximum acceptable recognition score is 10000, but the setting for
the Last chance recognition score is 20000. The script fails when it encounters the
object with a recognition score of 25000. In the second case, Rational Functional
Tester logs a warning message.
At run time, if the recognition score meets the criteria that you set on the
ScriptAssure preference page, RFT attempts to recognize the object. If the
recognition score does not meet the criteria, the application fails the test.
If you decide, for example, that you want to accept changes like Forums &
Community to Forums and Community, you need a "loose coupling" in finding
the object. You need to increase the Maximum acceptable recognition score. If you
want closer matches, then you need a tight coupling in recognizing the object. You
decrease the Maximum acceptable recognition score according to your
requirements. In addition to the one Maximum acceptable recognition score, you can
change the weights in the object map. By changing the weights, such as 100 for the
.text value, you can fine-tune calculated recognition scores and increase script
resilience.
Change the ScriptAssure values
To help determine a match or mismatch of objects during playback, Rational
Functional Tester uses a fuzzy logic-based technology called IBM ScriptAssure. Use
the steps below to further reduce the number of warnings for weak recognition and
errors for objects not found during application playback.
1. To open the Preferences page, from the Rational Functional Tester
Eclipse integrated development environment (ID), click Window >
Preferences.
Tip:
If you are working in the Rational Functional Tester Visual Studio IDE,
click Tools > Options.
Use Rational Functional Tester ScriptAssure technology to build test scripts that run when code changes
© Copyright IBM Corporation 2010. All rights reserved. Page 5 of 9
developerWorks® ibm.com/developerWorks
2. Click Functional Test > Playback > ScriptAssure, and then click
Advanced.
3. Change these ScriptAssure values:
a. Set Maximum acceptable recognition score to 20000
b. Set Last chance recognition score to 30000
Tips for Using ScriptAssure
You can adjust ScriptAssure settings to meet changing requirements during the
development life cycle:
• If you want the script to play back faster and with fewer warnings, set the
recognition scores high. The recognition is less demanding but prone to
accept errors. This behavior might be useful in some situations.
• If recognition scores indicate that matches are weak, examine your test
object map. Have accessible names changed? For example, has Forums
& Community changed to Forums and Community? If the application
has changed permanently, update the test object map to reflect the
change. In an internationalization situation, change the label of the test
object, not its accessible name. Changing the label of the text object,
which is multi lingual, makes it easier to access the object in an
internationalization situation.
You can change the label of the text object, by selecting the link Update
the test object map.
• If the application has a dynamic object or if several versions of the
application are slightly different, correct versions of an object, replace the
recognition property with a regular expression. You can also use a
numeric range to accept more than one value of a property. For
information, see Replacing an Exact-Match Property with a Pattern.
• If you are working late in the development cycle and maintaining the
code, verify that your scripts work and have the best possible recognition
by setting the warning level to High. You will receive warnings about
possible problem areas. When you receive the warnings, fix the map to
reflect current code.
Scripts that work for you
Scripts are tools that help you test products. But if Rational Functional Tester and
Use Rational Functional Tester ScriptAssure technology to build test scripts that run when code changes
Page 6 of 9 © Copyright IBM Corporation 2010. All rights reserved.
ibm.com/developerWorks developerWorks®
the scripts are failing too many applications during testing, you might feel as though
you work for the scripts. By adjusting ScriptAssure settings, changing the recognition
score levels, and adjusting the weight of object properties, you can build scripts that
accept the inevitable changes during application development. Furthermore, you can
change the settings during different phases of the development cycle. Managing
these aspects of the script enhances your testing effectiveness and efficiency.
Use Rational Functional Tester ScriptAssure technology to build test scripts that run when code changes
© Copyright IBM Corporation 2010. All rights reserved. Page 7 of 9
developerWorks® ibm.com/developerWorks
Resources
Learn
• Find out more about Rational Functional Tester by reading this book: Software
Test Engineering with IBM Rational Functional Tester: The Definitive Resource
• Browse the Rational Functional Tester developerWorks page for links to
technical articles and many related resources. The developerWorks Rational
software landing page is also a good starting place.
• Explore the Rational Functional Tester Information Center, where you can also
take a short video tour. You can also find more information about the helper
superclass in the information center.
• Get an Introduction to IBM Rational Functional Tester 7.0. IBM Rational
Functional Tester automates testing Java, .NET, and Web-based applications.
Starting with version 7.0, Rational Functional Tester includes support
extensions for both Siebel and SAP, integration with IBM Rational ClearQuest®,
support for the Eclipse Test and Performance Tools Platform (TPTP) logs, and
support for testing HTML applications with Mozilla Firefox. This introduction
explains these new features and capabilities.
• Investigate Rational Functional Tester Plus, which is a software application
testing bundle.
• Learn about other applications in the IBM Rational Software Delivery Platform,
including collaboration tools for parallel development and geographically
dispersed teams, plus specialized software for architecture management, asset
management, change and release management, integrated requirements
management, process and portfolio management, and quality management.
You can find product manuals, installation guides, and other documentation in
the IBM Rational Online Documentation Center.
• Visit the Rational software area on developerWorks for technical resources and
best practices for Rational Software Delivery Platform products.
• Explore Rational computer-based, Web-based, and instructor-led online
courses. Hone your skills and learn more about Rational tools with these
courses, which range from introductory to advanced. The courses on this
catalog are available for purchase through computer-based training or
Web-based training. Some of the "Getting Started" courses are available free of
charge.
• Subscribe to the IBM developerWorks newsletter, a weekly update on the best
of developerWorks tutorials, articles, downloads, community activities, webcasts
and events.
Get products and technologies
Use Rational Functional Tester ScriptAssure technology to build test scripts that run when code changes
Page 8 of 9 © Copyright IBM Corporation 2010. All rights reserved.
ibm.com/developerWorks developerWorks®
• Get the free trial download for Rational Functional Tester.
• Try Rational Functional Tester free (requires registration).
• Download trial versions of other IBM Rational software.
• Download IBM product evaluation versions and get your hands on application
development tools and middleware products from DB2®, Lotus®, Tivoli®, and
WebSphere®.
Discuss
• Join the Rational Functional Tester forum to ask questions and participate in
discussions.
• Get involved in the developerWorks Functional and GUI Testing discussion
forum where you can discuss and ask questions about Rational Functional
Tester and general testing topics.
• Check out developerWorks blogs and get involved in the developerWorks
community.
About the author
Naveen Kumar Bysani
Naveen Bysani is a senior quality assurance engineer who started his career with
IBM India Software Lab. He began with the IBM WebSphere team and moved to the
IBM Rational team as a systems software engineer for the automation development
of IBM Rational Application Developer, using IBM Rational Functional Tester. He
then went to IVY, a party gaming company, as a senior software engineer, where he
was involved in the automation framework development, using Rational Functional
Tester. He currently works as a senior automation engineer for a storage domain
product of Quantum India Development Centre. Mr. Naveen is certified by IBM for
Rational Functional Tester and Rational Performance Tester, and is a Sun certified
Java professional.
Use Rational Functional Tester ScriptAssure technology to build test scripts that run when code changes
© Copyright IBM Corporation 2010. All rights reserved. Page 9 of 9