Web Dependent Test Case
Overview
The DEPENDANT_TEST_CASE
feature in web automation allows the reuse of a set of pre-defined test steps from one test case within another. This enables the execution of common setup steps without duplicating code, saving time, and increasing the maintainability of test suites.
How It Works
DEPENDANT_TEST_CASE
is used within a test script to call and execute steps from an existing test case. When called, it runs all steps from the dependent test case up to, but not including, the validation steps. This feature is designed to set up a test environment by reusing actions from a reliable, previously executed test.
Implementation
To implement a DEPENDANT_TEST_CASE
, you should:
Identify the common steps that are used across multiple test cases.
Create a base test case script with these steps.
Call this base test case at the beginning of other test scripts using the
DEPENDANT_TEST_CASE
action.
Example Implementation
Base Test Case: search_sanity.csv
Dependent Test Case: fillUserDetails_Sanity.csv
Usage
When creating a new test script that requires steps from an existing test case, use the DEPENDANT_TEST_CASE
in the first step of the CSV file to call the necessary base test case.
Benefits
Reduces Redundancy: Eliminates the need to rewrite common steps for each test.
Saves Time: Decreases the overall test script development and maintenance time.
Increases Reliability: Utilizes steps from stable test cases, ensuring consistency across tests.
Considerations
When a dependent test case is called, validations are not executed to allow for different validations in the new test case.
If the base test case is modified, all dependent test cases must be reviewed to ensure they function as expected.
Troubleshooting
Issue: Dependent test case does not execute.
Resolution: Check the reference to the dependent test case name for accuracy and ensure it is correctly placed in the CSV file.
Issue: Validation steps from the dependent test case are being executed.
Resolution: Ensure that the dependent test case is structured to end before validation steps, or that the calling test case properly handles the flow.
Reports
Demo
Conclusion
The DEPENDANT_TEST_CASE
feature is a key element in creating efficient and maintainable web automation tests. By leveraging this feature, testers can construct robust test suites that are easier to manage and scale.
Tutorial
Last updated
Was this helpful?