Selenium WebDriver 4

Add data-driven test cases

Hard120 pts~45 min
  • Data-driven testing
  • Parametrisation
  • Validation
Practice app · Acme Ops

A sign-in page with field validation and an authenticated dashboard.

Test URL
/lab/selenium-add-data-driven-test-cases

Your starter code already declares TEST_URL — never hardcode a host.

Objective

Drive the sign-in form with a table of inputs and expected outcomes instead of copy-pasted tests.

Your task

  1. 1Define cases: ("", "Test@123") → #username-error “Email is required”; ("not-an-email", "Test@123") → “Enter a valid email”.
  2. 2Add ("qa@target.dev", "") → #password-error “Password is required” and ("qa@target.dev", "wrong") → #login-error “Invalid username or password”.
  3. 3Add the valid case ("qa@target.dev", "Test@123") last → #dashboard visible.
  4. 4For each case open TEST_URL, fill the form, click #login-button and assert the expected message.

Acceptance criteria

  • Cases run through parametrisation or a data loop
  • The final (valid) case reaches the dashboard
  • At least 4 assertions pass

Fixtures

username
qa@target.dev
password
Test@123

Selenium WebDriver 4 · Selenium · Page Object Model & architecture