Imagine you have 100 test cases but only time to run 20 before a release. Which approach best helps you choose which test cases to run first?
Think about which tests give the most value in finding important bugs quickly.
Prioritizing test cases that cover critical features and recent bug fixes helps catch important issues early, making the best use of limited testing time.
What will be the result of this test assertion in Python?
def add(a, b): return a + b result = add(2, 3) assert result == 6, f"Expected 6 but got {result}"
Check what the add function returns and what the assertion expects.
The add function returns 5 for inputs 2 and 3, but the assertion expects 6, so it raises an AssertionError with the message.
You need to select a locator for a login button on a webpage. Which locator is best for stable and maintainable tests?
Think about what makes locators less likely to break when the page changes.
Using a unique and descriptive CSS class is more stable and maintainable than absolute XPath or text that can change.
Given this test code snippet, what is the cause of the failure?
def divide(a, b): return a / b def test_divide(): result = divide(10, 0) assert result == 0, "Division by zero should return 0"
Think about what happens in Python when dividing by zero.
In Python, dividing by zero raises a ZeroDivisionError unless handled inside the divide function.
You want to run tests in parallel to speed up execution. Which framework feature is essential to avoid flaky tests?
Consider what causes tests to interfere with each other when run at the same time.
Isolating tests with independent setup and teardown prevents shared state issues and makes parallel runs reliable.