Structuring complex scripts

Organize a complex script into multiple scripts; then, save scripts together in a collection of scripts called a test suite.

About this task

If you create a complex script, you can organize that script into simple scripts that represent different business or user processes on your web application. Save the scripts together as a test suite. You can then use these scripts to monitor the performance and availability of your web application in response to specific user actions in the Application Performance Dashboard.

There should be only one test suite and all tests should be added into it.

Important: It is good practice to organize complex scripts into separate scripts, where each script represents a typical user or business process that you want to monitor. For example, create separate scripts that record when a user logs in to a website, or searches for an item. If you organize your scripts according to user or business processes, you can then monitor the response of your web application to these specific processes in the Application Performance Dashboard.

Procedure

To organize your complex script into separate scripts, and save your scripts as a test suite, complete the following steps:

  1. To create a separate script for each user process that is recorded in your script, click Tests > + in Selenium IDE. Give each script a meaningful name that describes the user process and save each script as a .side file, such as load_homepage.side.
    For more information, see Recording synthetic scripts.
    Important: The name that you give to your script in Selenium IDE is the name that identifies the recorded business or user process that you monitor in the Application Performance Dashboard.
  2. In Selenium IDE, open a complex script that you recorded previously. Organize your script commands into separate scripts, according to different user actions. Cut commands from the original complex script in the Test Case window and Paste commands into the different Test Case window.

    For example, the complex script example in Recording synthetic scripts contains Selenium IDE commands for three different user processes.

    • Open the Cloud APM home page on the IBM® Marketplace website.
    • Open the Details page on IBM Marketplace.
    • Open the Pricing page and record when the user opens the registration page for a free trial.

    The user actions are then organized into three different scripts.

    Table 1. Sample script for opening the IBM Marketplace page (load_homepage.side)
    Command Target Value
    open /  
    verifyTitle IBM Cloud Application Performance Management  
    Table 2. Sample script for opening the Details page on IBM Marketplace (load_products.side)
    Command Target Value
    clickAndWait css=ul > #details > a  
    verifyText css=h2.heading--TERTIARY Feature spotlights
    Table 3. Sample script for opening the Purchase and trial registration pages on IBM Marketplace (load_APM.side)
    Command Target Value
    clickAndWait css=ul > #purchase > a  
    click link=Try Free  
  3. To put individual test cases into a test suite, change to the Test suite window and add tests to the test suite according to the business logic sequence. Finally, click the Save Project tool to save the test suite and all tests in the test suite to a .side file.
    As an example, consider the logical sequence Load_URL, Select Manage inventory, Select IBM Machine Type. When we add these test cases to the test suite, we first check Load_URL, followed by Select Manage inventory, then Select IBM Machine Type

Results

You recorded a set of scripts that you can use to monitor the performance and availability of your web applications. Use the Synthetic Script Manager to upload your .side test suite of scripts to a new or existing synthetic transaction. For more information, see Creating and editing a synthetic transaction.