Contents


Use Rational Quality Manager to modularize test scripts

Build a reusable library of scripts

Comments

Test management is a daunting task as enterprise applications grow and become more complex. It is difficult to ascertain coverage by looking at the inventory of test scripts and test cases because the flow between test scripts and cases is not obvious. Keywords in IBM® Rational® Quality Manager 4.0.1 give you the ability to modularize test scripts. A collection of modularized test scripts becomes a domain-specific framework that can be used to put together high-level scenario flows. By deferring the implementation of the detailed steps (either by using a manual script or by authoring an automated script) to a later stage, the test architect or product architect can concentrate on building high-level scenario flows by using keywords. Keywords, if defined at the beginning of the project, form a domain-specific framework that makes it possible to write scenario flows to test without having to worry about duplicating test steps.

A quick analysis of the usage of the specific keywords offers guidance on the most frequently used keywords. You can automate these keywords by using tools such as IBM® Rational® Functional Tester or Selenium for a quick first step to automation. A test planner or test architect can use this approach to get the test team started in a structured way.

Using a sample scenario in a fictitious JKE banking application, this article shows how to develop keywords and workflows for the banking application. The steps include:

Identify operations

Develop a keyword for an operation

Develop scenarios with these keywords

About Rational Quality Manager

Rational Quality Manager is a collaborative hub for test planning and managing test results. It is part of the Rational solution for Collaborative Application Lifecycle Management (CALM) platform built on the Jazz™ platform. By using Rational Quality Manager, you can maintain automated and manual test cases, implement traceability of test cases to requirements, and manage changes such as defects and development plans. As shown in Figure 1, Rational Quality Manager integrates with IBM® Rational Team Concert™ and requirement management tools such as IBM® Rational® DOORS® and IBM® Rational® Requirements Composer. Rational Quality Manager is an OSLC-enabled product. It also integrates well with products from other vendors.

Figure 1. Collaborative Lifecycle Management products
CLM manages requirements, quality, and changes
CLM manages requirements, quality, and changes

Keywords group test scripts together

Keywords are high-level abstractions, similar to subroutines that group a set of test steps in Rational Quality Manager. This sequence of test steps can be manual or automated. Keywords help you modularize the tests and create a user flow or a business script by deferring the actual implementation to a later stage. Non-technical subject-matter experts can easily read and write readable test cases that look similar to business scenarios. These test cases can be converted to automation scripts without losing the business flow representation.

To migrate the project to an automated set of tests, you can replace a keyword with a manual set of steps with an automation script.

Use a top-down approach

Usually test script authoring is done with a bottom-up approach. Test engineers write the scripts and then group them into a logical suite of tests. This approach makes it difficult to discover the coverage by looking at the script details. Usually the script name is the only indication of what the script is testing. Relying on script names alone can become cumbersome if you have to comprehend the coverage by reading a test script that is tens of hundreds of steps long. Typically, the scripts are long, as shown in Figure 2.

Figure 2. Verbose script steps
Verbose scripts can be very long
Verbose scripts can be very long

To take a top-down approach, break down the operations that can be performed in the application under test (AUT) into atomic operations and define the actions for those. The test script can be composed using these atomic operations. The test script looks similar to the script shown in Figure 3.

Figure 3. Script composed of keywords
Scripts written using keywords are concise

This approach makes the test script readable and more similar to natural language (English, German, Japanese, and other languages.)

The advantage of the top-down approach is two-fold:

  • The atomic operations are re-usable.
  • The scripts are manageable and readable.

The following sections show you how to create and re-use keywords to quickly compose new scripts.

Create an inventory of keywords

First, identify the atomic operations. These operations become the inventory of keywords that can be used to compose test scripts. In Rational Quality Manager 4.0.3 (and later), click Construction> Create >Keywords and create a keyword. In earlier releases of Rational Quality Manager, click Construction>Browse>Keywords and then click the + icon to create a keyword.

You can choose not to populate the individual steps that each keyword represents. This task can be done at a later stage. Even before the AUT is built, a subject matter expert or an architect can create the keyword inventory without adding the steps for each individual keyword. Individual developers or testers can fill in the steps later as the AUT is developed.

The list of keywords looks similar to the list in Figure 4. The keywords represent business operations in the AUT.

Figure 4. Keyword View in Script Editor
Keywords, similar to business operations

Create a manual script for a high-level scenario

Use the inventory of keywords to compose high-level test scripts. You can assemble keywords in a manual script. This manual script serves as the high-level, parent script that mimics a use case. It needs to be easy for a subject matter expert or architect to read and validate against the use case flow.

To create a manual script, click Construction>Create>Test Script. In the script, add the keywords in a sequence that reflects the use case flow, as shown in Figure 5.

Figure 5. Adding a keyword to a script
Drag and drop a keyword to your manual script
Drag and drop a keyword to your manual script

The high-level manual test script can be as elaborate as you need it to be to test one specific function. If you need to have the flow reviewed or approved, use the built-in approval mechanism. If you need to send it in email to an outside consultant or expert, you can export the script in PDF format then send the generated PDF file.

Fill in the script steps for the script stubs

Next, populate the details of the keywords using one of the following methods:

  • Manually create a sequence of steps
  • Associate automation scripts to keywords

Populate the details as a sequence of manual steps

To use manual steps, create a test script of type Manual Script and fill in the manual steps as shown in Figure 6.

Figure 6. Creating a script for a keyword
Alt=Scripts attached to keywords are smaller
Alt=Scripts attached to keywords are smaller

After you populate all of the keywords in the parent script, the parent script is ready to run. Remember that you can use these keywords to quickly put together more parent scripts using drag and drop.

Run the scenario with the manual steps

Now that the parent script is ready, you can add it to a test case and run it. When you run the test case with the parent script, all the steps that were added in sequence show up as one test script, as shown in Figure 7.

Figure 7. Run the parent script with keywords
When run, the steps in a keyword are expanded
When run, the steps in a keyword are expanded

You get the same benefit as if you had developed the script using a bottom-up approach. The script looks similar, regardless of the approach, but when you use a top-down approach, the inventory of scripts is modularized. It's easy to piece together more scenarios using existing keywords without having to write the steps for the scenario from scratch.

Populate details by associating automation scripts to keywords

Rather than creating manual steps, you can decide to build your inventory of automation scripts by using an automation tool such as Rational Functional Tester or Selenium. You do not have to build all the scripts at one time. You can incrementally add automation scripts and put them to use instead of waiting for a whole scenario to be recorded. For this example, use Rational Functional Tester to record the automation script for the keyword. In Rational Functional Tester, connect to the Rational Quality Manager server and to the project to see a list of all the keywords, as shown in Figure 8.

Figure 8. Keyword View in Rational Functional Tester or Rational Test Workbench
Keywords in Functional Tester or Test Workbench
Keywords in Functional Tester or Test Workbench

You can record a Rational Functional Tester script from the Keyword View in Rational Functional Tester. You can also see the manual steps as you record. If you have already coded the script, you can associate that script to the keyword.

Note: It is possible to use execution variables to pass data in and out of the script. See the Rational Functional Tester information center for more information.

Run the scenario with the automated script

As you incrementally automate your script, you can continue to use the parent script, which includes a combination of manual steps and automated scripts.

Note: If you are using Rational Quality Manager 4.0.3 or later, you need to go to the keyword and set the newly recorded automation script as the default.

If you run the same test case again, the automated keywords trigger the automation scripts. The keywords that have manual steps remain manual, as shown in Figure 9.

Figure 9. Run with one keyword automated
A mix of manual steps and automation scripts
A mix of manual steps and automation scripts

Conclusion

Use keywords to make test management more manageable. Keywords make it possible for you to keep the inventory of scripts tidy, create high-level scripts that are easy to review, and evolve the test plan from manual steps to automation scripts over time. With keywords, it's simpler to ensure adequate code coverage, because you can review the inventory of test scripts and test cases from the perspective of a high-level flow between test scripts and use cases.

Resources

Learn

Check the Rational Quality Manager product page on developerWorks for links to product documentation, articles, tutorials, courses, downloads, and more.

Explore the Rational Quality Manager Information Center for technical details and see the Rational Quality Manager Roadmap for links resources to help you get started.

For how-to tips, read these developerWorks articles by Michael Kelly:

Get products and technologies

Download the free trial version of Rational Quality Manager.

Evaluate other IBM software in the way that suits you best: Download it for a trial, try it online, or use it in a cloud environment.


Downloadable resources


Comments

Sign in or register to add and subscribe to comments.

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Rational
ArticleID=968941
ArticleTitle=Use Rational Quality Manager to modularize test scripts
publish-date=04222014