What is the main purpose of acceptance criteria in software testing?
Think about what helps decide if the software is ready for the user.
Acceptance criteria clearly state what the software must do to be accepted by the user or customer. They guide testing and development to meet user needs.
Given the acceptance criteria: "The login button must be visible and clickable." A test script checks the button visibility and click action. What is the expected test result if the button is visible but not clickable?
def test_login_button(): visible = True clickable = False assert visible, "Login button should be visible" assert clickable, "Login button should be clickable"
Both visibility and clickability must be true to pass.
The test asserts both visibility and clickability. Since clickable is False, the assertion fails and the test fails.
Which assertion correctly verifies the acceptance criteria: "The user profile page loads within 2 seconds"?
load_time = 1.8 # seconds
The page must load faster than 2 seconds.
The acceptance criteria require the page to load within 2 seconds, so load_time must be less than 2. Option A correctly asserts this.
Test code below is meant to verify acceptance criteria: "Search results display at least 5 items." The test fails unexpectedly. What is the cause?
results = ['item1', 'item2', 'item3', 'item4', 'item5'] assert len(results) > 5, "Less than 5 search results displayed"
Check the comparison operator in the assertion.
The acceptance criteria require at least 5 items, so length should be >= 5. Using > 5 fails when exactly 5 items are present.
In an automated test framework, which approach best ensures acceptance criteria are clearly verified and reported?
Think about clarity and traceability in automated tests.
Separating acceptance criteria into individual test cases with clear assertions helps identify failures precisely and improves test reports.