In ACCELQ, browser is initialized with given URL in the Invoke Browser Action that you typically place at the top of your Scenario. This Action is available for all Scenarios by default, and takes application URL as a parameter. However, there may be situations where you need to pass dynamic URL to open the browser. Consider following examples:
- Application URL is different for each environment you are testing
- App URL is entirely dynamic and it is not possible to specify the URL until the test is kicked off
- Or your URL has parameterized components such as server name and port number.
ACCELQ provides multiple facilities to address these situations.
Passing environment-specific URL
This can be handled simply by pointing the URL in the Initialize step to a Global Property. Here are the steps:
Step 1: Define a Global Property under Resources section of ACCELQ and mark the property as sensitive to the application environment. Provide appropriate URL values for each environment.
Step 2: If the URL needs to be updated to a Global Property just for specific Scenarios, click on the URL in the Initialize step of the Scenario and point to Global Property.
Passing URL at Run-time
If the URL cannot be hard coded at design time, but can only be passed during test execution, you can override the URL in the Initialize step with a Run Property. This will allow the user to pass the URL when the test is kicked off.
Parameterizing the URL
There may be situations, where the application URL is completely dynamic and is based on business logic. For example, the port number of the application URL is a variable and may need to be set based on various test parameters.
You can achieve this by writing an Action with the necessary parameters and incorporating the URL loading logic. This approach provides complete flexibility in terms of accommodating even the most complex business logic for URL calculation. Insert this step right after the standard Initialize step in the Scenario.
Here is an example of such an Action:
Note:
- Server Name and Port Number are parameters to this Action.
- You need to configure your Action as an Init Action from Action settings to add it as initialization step in the scneario. Here is a detailed article about Init Action
And now, the Scenario will look somewhat like this:
Note:
- Step 1 above is parameterized and values for these parameters can be passed either in the Test Case or overriden at the Scenario parameter level, as needed.
Comments
0 comments
Please sign in to leave a comment.