How to Write Test Cases for Onboarding Flow (With Examples)
How to Write Test Cases for Onboarding Flow (With Examples)
How to Write Test Cases for Onboarding Flow (With Examples)
How to Write Test Cases for Onboarding Flow (With Examples): Core Principles
Writing test cases for an onboarding flow starts with a clear definition of what onboarding means for the product under test. Onboarding is the sequence of screens, forms, permissions, and optional tutorials that a new user encounters from the moment they launch the app or visit the site until they reach the first “core” screen where they can accomplish a primary task. Because onboarding sets expectations, any friction here directly impacts activation, retention, and brand perception. Therefore, test cases must verify not only that each step works as designed but also that the flow gracefully handles invalid input, interruptions, and varied user contexts.
A test case is a single, executable verification that maps to one or more requirements. Its anatomy consists of:
- Test Case ID – a unique, stable identifier (e.g., ONB‑001).
- Title – a short, descriptive phrase that can be read in a test‑run report.
- Preconditions – the state of the system, device, or account before the first step (e.g., “fresh install, no existing user data, network available”).
- Steps – an ordered list of actions the tester or automation script performs. Each step should be atomic and unambiguous (e.g., “Tap the ‘Get Started’ button”).
- Expected Result – the observable outcome after the final step, expressed as a pass/fail criterion (e.g., “Welcome screen displays with the user’s name pre‑filled from the OAuth token”).
- Postconditions (optional) – the state left behind that may affect subsequent tests (e.g., “User is logged in and redirected to the home dashboard”).
When you write test cases, keep each one focused on a single verification point. Avoid bundling multiple assertions into a single case; instead, split them so that a failure points directly to the offending step. This practice improves traceability, simplifies root‑cause analysis, and makes maintenance easier when the UI changes.
How to Write Test Cases for Onboarding Flow (With Examples): Building the Test Matrix
A test matrix is a tabular view of all test cases that lets you see coverage at a glance. The matrix should include the columns described above plus any metadata that helps prioritization (e.g., priority, risk level, associated requirement IDs). Below is a worked example that contains more than twenty test cases for a typical mobile‑app onboarding flow that includes:
- Welcome screen with a “Get Started” button.
- Permission request for push notifications.
- Email/phone entry with password sign‑up form (email, password, confirm password).
- Optional social‑login buttons (Google, Apple).
- Terms of service checkbox.
- Final “Create Account” button that leads to a tutorial carousel.
- Skip tutorial option).
| ID | Preconditions | Steps | Expected Result |
|---|---|---|---|
| ONB‑001 | Fresh install, no network | 1. Launch app. 2. Observe welcome screen. | Welcome screen is displayed; “Get Started” button is enabled but shows a toast “No internet connection”. |
| ONB‑002 | Fresh install, network available Launch app app.. 2 2. . Tap Tap the the ““Get Get Started Started”” button button.. | Permission Permission dialog dialog for for push push notifications notifications appears appears.. | |
| ONB‑003 | App launched, permission dialog shown | 1. Tap “Allow” on the push‑notification prompt. | Permission is granted; app proceeds to the email/phone entry screen. |
| ONB‑004 | App launched, permission dialog shown | 1. Tap “Deny” on the push‑notification prompt. | Permission is denied; app proceeds to the email/phone entry screen (no push‑notification feature enabled). |
| ONB‑005 | Email/phone entry screen displayed, no prior data | 1. Enter a valid email address “user@example.com”. 2. Tap “Next”. | Password field becomes visible and enabled; email address is retained in the field. |
| ONB‑006 | Email field contains a valid email, password field visible | 1. Enter a password that meets policy (≥8 chars, 1 upper, 1 lower, 1 digit). 2. Tap “Next”. | Confirm‑password field becomes visible; password is masked. |
| ONB‑007 | Confirm‑password field visible | 1. Re‑enter the same password. 2. Tap “Next”. | Terms of service screen appears with checkbox unchecked. |
| ONB‑008 | Terms of | 1. Scroll to read the full terms (if scrollable). 2. Tap the checkbox to select it. 3. Tap “Create Account”. | Account is created; backend returns a 201 response; user is redirected to the tutorial carousel. |
| ONB‑009 | Terms screen, checkbox unchecked | 1. Tap “Create Account” without checking the box. | Inline validation error appears: “You must accept the terms of service”. |
| ONB‑010 | Email entry screen | 1. Enter an email with missing “@” (e.g., “userexample.com”). 2. Tap “Next”. | Inline error: “Please enter a valid email address”. |
| ONB‑011 | Email entry screen | 1. Enter an email longer than 254 characters. 2. Tap “Next”. | Inline error: “Email address is too long”. |
| ONB‑012 | Password field | 1. Enter a password with only lowercase letters (e.g., “password”). 2. Tap “Next”. | Inline error: “Password must contain at least one uppercase letter, one digit, and be 8+ characters”. |
| ONB‑013 | Password field | 1. Enter a password with leading/trailing spaces (e.g., “ Abcdef1 ”). 2. Tap “Next”. | System trims spaces and accepts the password if it meets policy after trimming; otherwise shows appropriate error. |
| ONB‑014 | Confirm‑password field | 1. Enter a password that differs from the first password entry. 2. Tap “Next”. | Inline error: “Passwords do not match”. |
| ONB‑015 | Any screen with a network call | 1. Enable airplane mode before launching the app. 2. Attempt to proceed through the flow. | At the first network‑dependent step (usually after “Create Account”), an offline‑friendly message appears and the user can retry when connectivity returns. |
| ONB‑016 | Account created successfully, tutorial carousel shown | 1. Swipe left on the first tutorial card. 2. Swipe left on the second card. 3. Tap “Got It” on the final card. | Tutorial carousel dismisses; user lands on the home dashboard. |
| ONB‑017 | Tutorial carousel shown | 1. Tap the skip link (usually top‑right) on the first card. | Tutorial carousel dismisses immediately; user lands on the home dashboard. |
| ONB‑018 | Home dashboard reached | 1. Press the device back button. | App shows a confirmation dialog: “Are you sure you want to exit? Your progress will be saved.” |
| ONB‑019 | Confirmation dialog shown | 1. Select “Stay”. | Dialog dismisses; user remains on the home dashboard. |
| ONB‑020 | Confirmation dialog shown | 1. Select “Exit”. | App closes; no data is lost because the account was already created on the server. |
| ONB‑021 | Fresh install, language set to Spanish (via device settings) | 1. Launch app. 2. Observe all onboarding screens. | All text appears in Spanish; placeholders and validation messages are correctly localized. |
| ONB‑022 | Fresh install, TalkBack enabled (Android) or VoiceOver enabled (iOS) | 1. Launch app. 2. Navigate using swipe gestures and listen to spoken hints. | Every interactive element announces its purpose, state, and value; focus order follows visual order; no trapped focus. |
| ONB‑023 | Fresh install, font size set to largest accessibility setting | 1. Launch app. 2. Verify that all text scales without clipping or overflow. | UI elements resize gracefully; no horizontal scrolling is required; all buttons remain tappable. |
| ONB‑024 | Fresh install, low‑end device (≤1 GB RAM, Android 8) | 1. Launch app. 2. Complete the onboarding flow. | Flow completes within 15 seconds; no dropped frames; memory usage stays below 200 MB. |
| ONB‑025 | Fresh install, high latency network (simulated 200 ms RTT) | 1. Launch app. 2. Proceed through each step, observing spinner behavior. | Network‑dependent steps show a spinner; timeout is not reached; retry mechanism works if a request fails. |
| ONB‑026 | Fresh install, date set to a future date (e.g., +1 year) | 1. Launch app. 2. Attempt to create an account. | If the backend validates birth‑date or expiration fields, appropriate error is shown; otherwise account creation proceeds normally. |
| ONB‑027 | Fresh install, device locale uses right‑to‑left language (e.g., Arabic) | 1. Launch app. 2. Observe layout direction. | All layouts mirror correctly; text is right‑aligned; icons that have directional meaning are mirrored. |
| ONB‑028 | Fresh install, user has an existing account (data cleared from app but not server) | 1. Launch app. 2. Enter credentials for the existing account on the sign‑in screen (if offered). | Sign‑in succeeds; user is taken directly to home dashboard, bypassing the sign‑up flow. |
| ONB‑029 | Fresh install, user attempts to sign up with an email already registered | 1. Enter an email that exists in the backend. 2. Complete password fields and terms. 3. Tap “Create Account”. | Backend returns a 409 conflict; app shows error: “An account with this email already exists. Please sign in or use a different email.” |
| ONB‑030 | Fresh install, user enables “Hide password” toggle (if provided) | 1. Enter a password. 2. Tap the eye‑icon to hide/show. 3. Verify masking behavior. | Password characters are replaced with dots when hidden; visible when shown; toggle state persists across screen rotations. |
How to use the table
- Each row represents a single test case that can be executed manually or automated.
- The Preconditions column captures the exact device, network, and state setup required.
- The Steps column is written in imperative mood, avoiding ambiguous pronouns.
- The Expected Result column is observable and measurable (UI text, toast, dialog, network response, screen transition).
- For automation, you can map each step to a command in your test framework (see the snippets later in this article).
How to Write Test Cases for Onboarding Flow (With Examples): Negative and Edge Cases
While the matrix above already contains a number of negative scenarios (invalid email, missing terms, network loss), it is useful to categorize them explicitly so that reviewers can see the balance between positive and negative coverage.
Negative Test Cases (validation & error handling)
| ID | Description | Expected Result |
|---|---|---|
| ONB‑N01 | Submit email without “@” character | Inline error: “Please enter a valid email address”. |
| ONB‑N02 | Submit email with multiple “@” characters | Inline error: “Please enter a valid email address”. |
| ONB‑N03 | Submit password shorter than 8 characters | Inline error: “Password must be at least 8 characters”. |
| ONB‑N04 | Submit password lacking an uppercase letter | Inline error: “Password must contain at least one uppercase letter”. |
| ONB‑N05 | Submit password lacking a digit | Inline error: “Password must contain at least one digit”. |
| ONB‑N06 | Submit password containing only spaces | Inline error: “Password cannot be empty”. |
| ONB‑N07 | Submit confirm‑password that does not match password | Inline error: “Passwords do not match”. |
| ONB‑N08 | Attempt to create account without accepting terms of service | Inline error: “You must accept the terms of service”. |
| ONB‑N09 | Attempt to create account with an email already registered (case‑insensitive) | Error dialog: “An account with this email already exists”. |
| ONB‑N10 | Submit form while device is in airplane mode (network unavailable) | Friendly offline message; option to retry when connectivity returns. |
| ONB‑N11 | Submit form with a future birth‑date (if collected) | Validation error: “Birth date must be in the past”. |
| ONB‑N12 | Submit form with special characters that could lead to injection (e.g., ) | Input is sanitized; no script executes; appropriate error or sanitized storage. |
Edge & Boundary Cases (data limits, timing, device states)
| ID | Description | Expected Result |
|---|---|---|
| ONB‑E01 | Email length = 254 characters (maximum allowed by RFC 5321) | Accepted; proceeds to password screen. |
| ONB‑E02 | Email length = 255 characters | Rejected with “Email address is too long”. |
| ONB‑E03 | Password length = 8 characters (minimum) | Accepted if meets complexity rules. |
| ONB‑E04 | Password length = 128 characters (if no upper limit defined) | Accepted; backend stores hash; UI does not truncate. |
| ONB‑E05 | Password length = 129 characters (if backend enforces 128‑char limit) | Rejected with “Password is too long”. |
| ONB‑E06 | Rapid double‑tap on “Get Started” button | Only one navigation event occurs; no duplicate screens. |
| ONB‑E07 | Orientation change (portrait ↔ landscape) mid‑flow | UI re‑layouts correctly; entered data persists. |
| ONB‑E08 | Interrupt flow with an incoming call, then return | App resumes on the same screen; no data loss. |
| ONB‑E09 | Low memory simulation (via adb shell am send-msg) | Flow continues; no crashes; memory warnings handled gracefully. |
| ONB‑E10 | Battery level < 5 % while completing onboarding | App continues; if a critical operation fails, user is notified to charge device. |
These cases ensure that the onboarding flow is robust against malformed input, environmental interruptions, and platform‑specific quirks that often surface only after release.
Data Setup and Test Data Management
Reliable test execution depends on reproducible data. For onboarding, the most common data elements are:
- User identifiers (email, phone number) – must be unique per test run unless you are testing duplicate‑detect logic.
- Passwords – should conform to the policy you are validating; keep a set of valid and invalid samples.
- Device state – network condition, language, locale, accessibility settings, battery level, memory pressure.
- Backend stubs – if you isolate the client, you need mock responses for account creation, validation, and error codes.
A practical approach is to create a test‑data JSON file that the test runner reads before each scenario. Example (pytest‑style):
{
"users": [
{
"email": "user+001@example.com",
"password": "ValidPass1!",
"confirmpassword": "ValidPass1!",
"termsAccepted": true,
"expected": "success"
},
{
"email": "bademail",
"password": "ValidPass1!",
"confirmpassword": "ValidPass1!",
"termsAccepted": true,
"expected": "email_error"
}
],
"network": {
"airplane": false,
"latency_ms": 0,
"bandwidth_kbps": 10000
},
"device": {
"language": "en",
"fontScale": 1.0,
"talkback": false
}
}
Your test harness can iterate over the users array, applying each set to the UI, then asserting against the expected field. For network manipulation, tools like adb shell emulator (Android) or Network Link Conditioner (iOS) let you programmatically adjust latency and bandwidth before launching the app.
When testing duplicate‑email scenarios, you must first provision the conflicting account via an API call or a manual sign‑up, then mark that email as “used” in the test data so subsequent runs know to expect a conflict error. Clean‑up scripts (DELETE /api/users/{email}) keep the test environment idempotent.
Prioritization and Risk‑Based Testing
Not all test cases carry equal weight. Use a simple risk matrix that multiplies impact (how severe a failure would be for the user or business) by likelihood (how probable the defect is given code complexity and historical data). Assign each test case a priority score (P1‑P4) and order execution accordingly.
| Priority | Definition | Example Test Cases |
|---|---|---|
| P1 | High impact, high likelihood – blocker for release | ONB‑001 (welcome screen), ONB‑003 (permission allow), ONB‑008 (terms acceptance), ONB‑N09 (duplicate email) |
| P2 | High impact, medium likelihood – should be run in every smoke suite | ONB‑005‑ONB‑007 (valid email/password flow), ONB‑015 (offline handling), ONB‑E07 (orientation change) |
| P3 | Medium impact, low likelihood – good for nightly or weekly runs | ONB‑E01‑ONB‑E06 (boundary lengths), ONB‑N01‑ONB‑N07 (validation errors) |
| P4 | Low impact, low likelihood – optional, can be executed before major releases | ONB‑E08‑ONB‑E10 (interruptions, low memory, battery), localization cases (ONB‑021, ONB‑022) |
When you integrate the test suite into CI, configure the pipeline to run P1 and P2 on every commit, P3 on nightly builds, and P4 on release‑candidate branches. This strategy gives rapid feedback on the most critical paths while still exercising edge cases regularly enough to catch regressions.
Traceability to Requirements
Each test case should be linked to one or more requirement identifiers from your specification or user story. This traceability enables impact analysis when a requirement changes and helps auditors verify coverage.
Assume the following requirement IDs from the onboarding epic:
- REQ‑ONB‑001 – App shall display a welcome screen with a call‑to‑action button on first launch.
- REQ‑ONB‑002 – App shall request push‑notification permission after the welcome screen.
- REQ‑ONB‑003 – App shall collect a valid email address and password, enforcing complexity rules.
- REQ‑ONB‑004 – App shall require explicit acceptance of the terms of service before account creation.
- REQ‑ONB‑005 – App shall handle gracefully the loss of network connectivity during account creation.
- REQ‑ONB‑006 – App shall provide a skip‑able tutorial carousel after successful sign‑up.
- REQ‑ONB‑007 – App shall support accessibility features (TalkBack/VoiceOver, dynamic font scaling, RTL layout).
You can add a column to your test matrix titled Requirement IDs and fill it in:
| ID | Requirement IDs |
|---|---|
| ONB‑001 | REQ‑ONB‑001 |
| ONB‑002 | REQ‑ONB‑002 |
| ONB‑003 | REQ‑ONB‑002 |
| ONB‑004 | REQ‑ONB‑002 |
| ONB‑005 | REQ‑ONB‑003 |
| ONB‑006 | REQ‑ONB‑003 |
| ONB‑007 | REQ‑ONB‑003 |
| ONB‑008 | REQ‑ONB‑004 |
| ONB‑009 | REQ‑ONB‑004 |
| ONB‑010 | REQ‑ONB‑003 |
| ONB‑011 | REQ‑ONB‑003 |
| ONB‑012 | REQ‑ONB‑003 |
| ONB‑013 | REQ‑ONB‑003 |
| ONB‑014 | REQ‑ONB‑003 |
| ONB‑015 | REQ‑ONB‑005 |
| ONB‑016 | REQ‑ONB‑006 |
| ONB‑017 | REQ‑ONB‑006 |
| ONB‑018 | REQ‑ONB‑006 (exit flow) |
| ONB‑019 | REQ‑ONB‑006 |
| ONB‑020 | REQ‑ONB‑006 |
| ONB‑021 | REQ‑ONB‑007 (localization) |
| ONB‑022 | REQ‑ONB‑007 (screen‑reader) |
| ONB‑023 | REQ‑ONB‑007 (font scaling) |
| ONB‑024 | REQ‑ONB‑007 (performance) |
| ONB‑025 | REQ‑ONB‑005 (latency) |
| ONB‑026 | REQ‑ONB‑003 (date validation) |
| ONB‑027 | REQ‑ONB‑007 (RTL) |
| ONB‑028 | REQ‑ONB‑003 (existing account) |
| ONB‑029 | REQ‑ONB‑003 (duplicate email) |
| ONB‑030 | REQ‑ONB‑003 (password visibility) |
When a requirement changes (e.g., the password policy is updated to require a special symbol), you can instantly locate all test cases that reference REQ‑ONB‑003 and update them accordingly.
Manual vs Automated Approaches: A Comparison
Both manual exploratory testing and automated scripted testing have roles in onboarding verification. The table below contrasts them across several dimensions relevant to a fast‑moving product team.
| Aspect | Manual Testing | Automated Testing |
|---|---|---|
| Speed | Slower per run; depends on tester dexterity. | Fast execution; can run dozens of cases in seconds. |
| Feedback Latency | Immediate visual observation; good for UX feel. | Delayed until script finishes; requires good logging. |
| Coverage | Excellent for ad‑hoc, usability, and accessibility checks. | Excellent for regression, data‑driven, and boundary validation. |
| Maintenance | Low test‑artifact overhead; high human‑time cost when UI changes. | High script‑maintenance cost; mitigated by page‑object models. |
| Tooling | Requires only a device and test‑case document. | Needs a framework (Appium, Espresso, XCUITest, Playwright) and CI. |
| Exploratory Power | High – tester can follow hunches, try unexpected gestures. | Limited to scripted paths unless combined with AI‑driven exploration. |
| Cost | Salary of tester; no licensing fees (unless using test‑management tools). | Initial investment in framework, device lab, and ongoing script upkeep. |
| Best Use | Early‑stage UI validation, accessibility walkthroughs, ad‑hoc bug bashes. | Regression suites, CI gating, performance and load testing, data‑driven validation. |
A balanced strategy uses manual testing for the first few onboarding iterations to uncover UX issues, then encodes the stable, high‑value paths into automated scripts. As the flow matures, increase the proportion of automated cases while retaining a manual exploratory session each sprint to catch regressions that scripts might miss (e.g., a new animation that blocks a button).
Worked Example: 20+ Test Cases Table (Full Detail)
Below is the complete test matrix introduced earlier, now expanded with Priority, Requirement IDs, and Automation Hint columns. This version can be copied directly into a test‑management tool or a spreadsheet.
| ID | Priority | Requirement IDs | Preconditions | Steps | Expected Result | Automation Hint |
|---|---|---|---|---|---|---|
| ONB‑001 | P1 | REQ‑ONB‑001 | Fresh install, no network | 1. Launch app. 2. Observe welcome screen. | Welcome screen displayed; “Get Started” button enabled; toast “No internet connection” appears. | Use adb shell svc wifi disable before launch; assert toast text. |
| ONB‑002 | P1 | REQ‑ONB‑002 | Fresh install, Wi‑Fi available | 1. Launch app. 2. Tap “Get Started”. | Push‑notification permission dialog appears. | Mock the system permission dialog; verify dialog is shown. |
| ONB‑003 | P1 | REQ‑ONB‑002 | Permission dialog shown | 1. Tap “Allow”. | Permission granted; app proceeds to email/phone entry screen. | Click “Allow” via UIAutomator; assert next screen is email entry. |
| ONB‑004 | P1 | REQ‑ONB‑002 | Permission dialog shown | 1. Tap “Deny”. | Permission denied; app proceeds to email/phone entry screen (push‑notification feature disabled). | Click “Deny”; verify that push‑notification toggle in settings remains off. |
| ONB‑005 | P2 | REQ‑ONB‑003 | Email/phone entry screen displayed, no prior data | 1. Enter “user@example.com”. 2. Tap “Next”. | Password field becomes visible and enabled; email retained. | Send keys to email field; assert password field visibility. |
| ONB‑006 | P2 | REQ‑ONB‑003 | Email field contains valid email, password field visible | 1. Enter “ValidPass1!”. 2. Tap “Next”. | Confirm‑password field appears; password masked. | Send keys; assert confirm‑password field visible. |
| ONB‑007 | P2 | REQ‑ONB‑003 | Confirm‑password field visible | 1. Re‑enter “ValidPass1!”. 2. Tap “Next”. | Terms of service screen appears with checkbox unchecked. | Send keys; assert terms screen visible. |
| ONB‑008 | P1 | REQ‑ONB‑004 | Terms screen, checkbox unchecked | 1. Scroll to read terms (if needed). 2. Tap checkbox. 3. Tap “Create Account”. | Account created; backend returns 201; user redirected to tutorial carousel. | Click checkbox; click button; assert 201 response via network interceptor; assert carousel visible. |
| ONB‑009 | P1 | REQ‑ONB‑004 | Terms screen, checkbox unchecked | 1. Tap “Create Account” without checking box. | Inline error: “You must accept the terms of service”. | Click button; assert error text appears. |
| ONB‑010 | P2 | REQ‑ONB‑003 | Email entry screen | 1. Enter “userexample.com”. 2. Tap “Next”. | Inline error: “Please enter a valid email address”. | Send keys; assert error message. |
| ONB‑011 | P2 | REQ‑ONB‑003 | Email entry screen | 1. Enter a 255‑character email. 2. Tap “Next”. | Inline error: “Email address is too long”. | Generate long string; assert error. |
| ONB‑012 | P2 | REQ‑ONB‑003 | Password field | 1. Enter “pass”. 2. Tap “Next”. | Inline error: “Password must be at least 8 characters”. | Send short password; assert error. |
| ONB‑013 | P2 | REQ‑ONB‑003 | Password field | 1. Enter “ Abcdef1 ”. 2. Tap “Next”. | System trims spaces; if password meets policy after trimming, proceed; else show appropriate error. | Send keys with spaces; assert trimmed behavior. |
| ONB‑014 | P2 | REQ‑ONB‑003 | Confirm‑password field | 1. Enter “DifferentPass1!”. 2. Tap “Next”. | Inline error: “Passwords do not match”. | Send mismatched password; assert error. |
| ONB‑015 | P2 | REQ‑ONB‑005 | Any screen with a network call | 1. Enable airplane mode. 2. Launch app and attempt to proceed through flow. | At first network‑dependent step (usually after “Create Account”), offline message appears; user can retry when connectivity returns. | Toggle airplane mode; assert offline toast; disable airplane and assert retry works. |
| ONB‑016 | P2 | REQ‑ONB‑006 | Account created, tutorial carousel shown | 1. Swipe left on first card. 2. Swipe left on second card. 3. Tap “Got It” on final card. |
Test Your App Autonomously
Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.
Try SUSA Free