In ACCELQ, browser is initialized with given URL in the Initialize step that you typically place at the top of your Scenario. This step is available for all entry-point Contexts 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 application environment. Provide appropriate URL values for each environment.
Step 2.a: Click the entry point URL in the Context side bar and point to the just created Global Property.
Note: When you are updating the entry-point URL in the Context, this change is applied only for Scenarios created after this modification. Existing Scenarios continue to point to existing URL and may need to be manually updated.
Step 2.b: 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 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 various test parameters.
You can achieve this by writing an Action with 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.
And now, the Scenario will look somewhat like this:
Note:
- Step 2 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.
- URL supplied in the Step 1 is overwritten by the logic in Step 2.
Comments
0 comments
Please sign in to leave a comment.