Test Automation Engineer study guide
Setup and Tear-down Scripts
Setup scripts (Pre-conditions) configure the environment and create necessary test data before an automated test executes. Tear-down scripts (Post-conditions) clean up the environment, deleting data and closing connections to return the system to its original pristine state.
Practical example
If a test is verifying the "Delete Account" function, the Setup script must create an account first. If the test fails in the middle, the Tear-down script should be set up to execute even after a failure (e.g., using finally blocks in Java/Python); abrupt termination can still prevent cleanup to ensure the database isn't left cluttered with garbage data that could break subsequent tests.
Exam scenario and common trap
Scenario: You have a suite of 50 UI tests. To save time, you write one massive Setup script that logs into the application via the UI once, and all 50 tests share that session. The Trap: "This is a great optimization strategy." The Correct Answer: This creates severe Test Dependency. If Test #3 crashes the browser, Tests #4 through #50 will automatically fail. Tests must be atomic and independent.
Related syllabus material covers the broader concept; this page includes additional context. Reference sections: 3.1.3, 4.3.1. See the official ISTQB syllabus for exam scope. Examples are independent; QA-ace is not affiliated with ISTQB.