Bird
Raised Fist0
Testing Fundamentalstesting~10 mins

Acceptance criteria verification in Testing Fundamentals - Test Execution Trace

Choose your learning style10 modes available
Test Overview

This test checks if the login page meets the acceptance criteria by verifying the presence of username and password fields, and the login button. It then verifies that a successful login message appears after submitting valid credentials.

Test Code - Selenium
Testing Fundamentals
import unittest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

class TestLoginAcceptance(unittest.TestCase):
    def setUp(self):
        self.driver = webdriver.Chrome()
        self.driver.get('https://example.com/login')

    def test_login_acceptance_criteria(self):
        driver = self.driver
        wait = WebDriverWait(driver, 10)

        # Verify username field is present
        username = wait.until(EC.presence_of_element_located((By.ID, 'username')))
        self.assertTrue(username.is_displayed())

        # Verify password field is present
        password = wait.until(EC.presence_of_element_located((By.ID, 'password')))
        self.assertTrue(password.is_displayed())

        # Verify login button is present
        login_button = wait.until(EC.presence_of_element_located((By.ID, 'loginBtn')))
        self.assertTrue(login_button.is_displayed())

        # Enter valid credentials
        username.send_keys('validUser')
        password.send_keys('validPass123')

        # Click login button
        login_button.click()

        # Verify successful login message
        success_msg = wait.until(EC.presence_of_element_located((By.ID, 'successMessage')))
        self.assertEqual(success_msg.text, 'Login successful')

    def tearDown(self):
        self.driver.quit()

if __name__ == '__main__':
    unittest.main()
Execution Trace - 8 Steps
StepActionSystem StateAssertionResult
1Test starts and Chrome browser opensBrowser opened at https://example.com/login showing login page—PASS
2Waits for username field to be present and visibleUsername input field is visible on the pageAssert username field is displayedPASS
3Waits for password field to be present and visiblePassword input field is visible on the pageAssert password field is displayedPASS
4Waits for login button to be present and visibleLogin button is visible on the pageAssert login button is displayedPASS
5Enters 'validUser' into username fieldUsername field contains 'validUser'—PASS
6Enters 'validPass123' into password fieldPassword field contains 'validPass123'—PASS
7Clicks the login buttonLogin form submitted, page processing login—PASS
8Waits for success message to appearSuccess message 'Login successful' is visible on the pageAssert success message text equals 'Login successful'PASS
Failure Scenario
Failing Condition: If any of the required elements (username, password, login button) are missing or the success message text is incorrect
Execution Trace Quiz - 3 Questions
Test your understanding
What does the test verify first on the login page?
APassword strength
BSuccessful login message
CPresence of username field
DPage title
Key Result
Always verify all acceptance criteria elements are present and functional before asserting final success conditions to ensure comprehensive test coverage.

Practice

(1/5)
1. What is the main purpose of acceptance criteria in software testing?
easy
A. To write code for the feature
B. To define what 'done' means for a feature
C. To design the user interface
D. To create test automation scripts

Solution

  1. Step 1: Understand acceptance criteria role

    Acceptance criteria specify the conditions that must be met for a feature to be considered complete.
  2. Step 2: Differentiate from other tasks

    Writing code, designing UI, and creating automation are separate activities, not the main purpose of acceptance criteria.
  3. Final Answer:

    To define what 'done' means for a feature -> Option B
  4. Quick Check:

    Acceptance criteria = Definition of done [OK]
Hint: Acceptance criteria define 'done' clearly [OK]
Common Mistakes:
  • Confusing acceptance criteria with coding tasks
  • Thinking acceptance criteria are test scripts
  • Mixing acceptance criteria with UI design
2. Which of the following is the correct way to write an acceptance criterion?
easy
A. Users might be able to reset passwords sometimes.
B. Reset password feature is cool and works well.
C. The system shall allow users to reset their password via email.
D. Password reset should be fast and secure.

Solution

  1. Step 1: Identify clear, testable criteria

    The system shall allow users to reset their password via email. clearly states a specific, testable behavior: users can reset passwords via email.
  2. Step 2: Evaluate other options for clarity and testability

    The other options are vague or subjective and cannot be directly tested.
  3. Final Answer:

    The system shall allow users to reset their password via email. -> Option C
  4. Quick Check:

    Clear and testable = The system shall allow users to reset their password via email. [OK]
Hint: Look for clear, testable statements [OK]
Common Mistakes:
  • Choosing vague or subjective statements
  • Ignoring testability of criteria
  • Confusing feature description with acceptance criteria
3. Given the acceptance criterion: The login button must be disabled until both username and password fields are filled. Which test case will verify this criterion correctly?
medium
A. Check if login button is disabled when username is filled but password is empty.
B. Check if login button is enabled when both fields are empty.
C. Check if login button is disabled when both fields are filled.
D. Check if login button is enabled when username is filled but password is empty.

Solution

  1. Step 1: Understand the criterion condition

    The login button should be disabled until both fields have values.
  2. Step 2: Identify the correct test case

    Check if login button is disabled when username is filled but password is empty. tests that the button is disabled when only username is filled, which matches the criterion.
  3. Final Answer:

    Check if login button is disabled when username is filled but password is empty. -> Option A
  4. Quick Check:

    Button disabled until both fields filled = Check if login button is disabled when username is filled but password is empty. [OK]
Hint: Test partial inputs to check button state [OK]
Common Mistakes:
  • Testing button enabled when fields are empty
  • Expecting button disabled when both fields filled
  • Ignoring partial input cases
4. You have this acceptance criterion: The search results must display within 2 seconds after submitting a query. Which of the following is the best way to debug a failing test that shows results after 5 seconds?
medium
A. Check network speed and server response times.
B. Ignore the delay since results eventually appear.
C. Change the acceptance criterion to 5 seconds.
D. Remove the timer from the test case.

Solution

  1. Step 1: Analyze the cause of delay

    Since results take 5 seconds, check network and server performance to find bottlenecks.
  2. Step 2: Avoid ignoring or changing criteria improperly

    Ignoring delay or changing criteria without cause is incorrect; removing timer hides the problem.
  3. Final Answer:

    Check network speed and server response times. -> Option A
  4. Quick Check:

    Debug performance issues first = Check network speed and server response times. [OK]
Hint: Investigate environment before changing criteria [OK]
Common Mistakes:
  • Ignoring the delay problem
  • Changing acceptance criteria without reason
  • Removing test validations
5. A feature has these acceptance criteria:
1. Users can add items to the cart.
2. Cart updates total price correctly.
3. Cart shows an error if quantity exceeds stock.

During testing, you find the cart updates price but does not show an error when quantity is too high. What should you do next?
hard
A. Change acceptance criteria to remove error message requirement.
B. Mark the feature as complete since price updates correctly.
C. Ignore the error message since it is not critical.
D. Report a bug for missing error message and retest after fix.

Solution

  1. Step 1: Verify all acceptance criteria

    The feature meets price update but fails to show error for quantity exceeding stock.
  2. Step 2: Take appropriate action

    Since one criterion fails, report a bug and plan to retest after the fix.
  3. Final Answer:

    Report a bug for missing error message and retest after fix. -> Option D
  4. Quick Check:

    Failing criteria means report bug = Report a bug for missing error message and retest after fix. [OK]
Hint: Failing any criterion means report bug [OK]
Common Mistakes:
  • Ignoring failed criteria
  • Marking incomplete features as done
  • Changing acceptance criteria to hide bugs
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard