Structuring complex scripts
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. 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. Ensure there is only one test suite and all tests need to be added into it.
To organize your complex script into separate scripts, and save your scripts as a test suite, complete the following steps:
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
.sidefile, such as
For more information, see Recording a Selenium script.
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 a Selenium script 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. See Sample script tables.
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
As an example, consider the logical sequence Load_URL, Select Manage inventory, Select IBM Machine Type. When you add these test cases to the test suite, you first check Load_URL, followed by Select Manage inventory, and then Select IBM Machine Type.
You recorded a set of scripts that you can use to monitor the performance and availability of your web applications.
Sample script tables
Table 1. Sample script for opening the IBM Marketplace page (load_homepage.side)
|verifyTitle||IBM Cloud Application Performance Management|
Table 2. Sample script for opening the Details page on IBM Marketplace (load_products.side)
|clickAndWait||css=ul > #details > a|
Table 3. Sample script for opening the Purchase and trial registration pages on IBM Marketplace (load_APM.side)
|clickAndWait||css=ul > #purchase > a|