Which of the following best describes the purpose of acceptance criteria in user story testing?
Think about what helps testers decide if a user story is done.
Acceptance criteria are clear, testable conditions that define when a user story is complete and meets the user's needs.
You have a user story: "As a user, I want to log in with valid credentials so that I can access my dashboard." Which assertion best tests this story?
Focus on what the user story wants to achieve.
The user story is about logging in with valid credentials, so the assertion should check if login succeeds with correct inputs.
Given this test code for a user story about adding items to a cart, what is the test result?
def test_add_item_to_cart(): cart = [] def add_item(item): if item != '': cart.append(item) add_item('apple') add_item('') assert len(cart) == 1 assert cart[0] == 'apple' return 'pass' result = test_add_item_to_cart()
Check what items are added to the cart and what the assertions check.
The function adds 'apple' and ignores empty string. The assertions check cart length is 1 and first item is 'apple', so test passes.
Consider this test for a user story: "As a user, I want to reset my password." The test fails with an AssertionError. What is the likely cause?
def test_password_reset(): user = {'email': 'user@example.com', 'password': 'oldpass'} def reset_password(email, new_pass): if email == user['email']: user['password'] = new_pass reset_password('user@example.com', 'newpass') assert user['password'] == 'oldpass'
Look at what the assertion expects versus what the function does.
The function changes the password to 'newpass', but the assertion expects it to remain 'oldpass', causing failure.
You want to automate acceptance tests for user stories that involve web UI interactions and API calls. Which test framework setup is best suited?
Think about tools that connect user stories with automated acceptance tests for UI and APIs.
BDD frameworks like Cucumber allow writing tests in user story language, Selenium automates UI, and REST-assured handles API calls, making this setup ideal.