How to Write Test Cases for Registration Flow (With Examples)
How to Write Test Cases for Registration Flow (With Examples)
How to Write Test Cases for Registration Flow (With Examples)
Writing effective test cases for a registration flow is one of the most impactful activities a QA engineer can perform because the registration screen is often the first real interaction a user has with an application. A well‑designed set of test cases catches crashes, validation bugs, security gaps, and usability friction before they reach production, and it provides a clear baseline for both manual regression and automated scripts. In this guide we break down the anatomy of a registration test case, show how to derive positive, negative, boundary, and edge cases, illustrate data‑setup techniques, explain prioritization and traceability, and finally present a worked matrix of over 20 concrete examples. We also discuss how to combine these designed cases with autonomous exploration (e.g., using the SUSATest platform) to achieve real‑world coverage that goes beyond scripted checks.
How to Write Test Cases for Registration Flow (With Examples): Test Case Anatomy
A test case is more than a list of steps; it is a contract between the tester and the system under test. Each case should contain the following fields, which together make the case reproducible, traceable, and easy to maintain:
| Field | Purpose | Tips for Registration Flow |
|---|---|---|
| ID | Unique identifier (e.g., REG‑001) | Prefix with module or feature; keep sequential for easy reference |
| Title | Short, descriptive summary | Use the pattern “Verify |
| Preconditions | State that must exist before execution | e.g., “App is installed, device is online, no existing account for the test email” |
| Test Data | Specific values used in the steps | Include email formats, password strengths, special characters, etc. |
| Steps | Ordered actions performed by the tester or script | Numbered, imperative sentences; avoid ambiguity |
| Expected Result | Observable outcome after the last step | Should be measurable (UI message, API response, DB entry) |
| Post‑conditions | State to leave the system in (optional) | e.g., “Account remains inactive until email verification” |
| Priority | Relative importance for execution order | Use P0‑P3 or MoSCoW; base on risk and user impact |
| Tags / Labels | Facilitates filtering and automation selection | e.g., @smoke, @security, @accessibility |
| Linked Requirement Traceability | Reference to source artifact (user story, spec) | e.g., “Story REG‑12: Email validation” |
When you fill out each field consistently, reviewers can quickly judge whether a case is complete, and automation engineers can map steps directly to code.
Writing Clear Steps
Avoid vague phrasing like “enter a valid email”. Instead, specify the exact value: “Enter alice@example.com in the Email field”. If you need to test a class of values, note that in the Test Data column and reference it in the steps (e.g., “Enter the email from Test Data row 2”).
Expected Results Should Be Testable
For UI flows, the expected result is often a toast, a navigation change, or a disabled button. For API‑backed flows, it may be a HTTP status code, a JSON field, or a DB row. Write the expected result in a way that can be asserted automatically (e.g., “The server responds with HTTP 201 and the JSON body contains {\"status\":\"pending_verification\"}”).
Positive Test Cases for Registration Flow
Positive test cases verify that the happy path works as intended. They confirm that a legitimate user can create an account without hindrance. Below are several categories of positive cases, each with a brief rationale.
Successful Registration with Minimal Required Fields
Many applications only require email, password, and perhaps a checkbox for terms. Verify that submitting the form with the minimum valid data creates an account and triggers the next step (usually email verification).
Registration with Optional Profile Fields
If the form includes optional fields such as first name, last name, phone number, or avatar upload, test that providing these values does not break the flow and that the data persists correctly.
Registration Using Social Login
When the app offers “Continue with Google/Apple/Facebook”, treat each provider as a separate positive path. Ensure that after the OAuth redirect the user ends up with a linked account and that no duplicate account is created for the same email.
Registration Followed by Immediate Login
Some products auto‑log the user in after registration. Verify that the authentication token is issued, stored securely, and that the user is taken to the expected post‑login screen.
Registration with Locale‑Specific Input
If the app supports multiple languages, test registration using characters from those languages (e.g., accented letters in French, Cyrillic in Russian) to confirm that UTF‑8 handling works end‑to‑end.
Negative and Invalid Input Test Cases
Negative test cases check that the system correctly rejects malformed or forbidden inputs. They are essential for catching security issues such as injection, and for ensuring a good user experience by providing clear error messages.
Email Format Validation
| Test ID | Invalid Email | Expected Error |
|---|---|---|
| REG‑N01 | plainaddress | “Please enter a valid email address” |
| REG‑N02 | missing@domain | “Please enter a valid email address” |
| REG‑N03 | @nodomain.com | “Please enter a valid email address” |
| REG‑N04 | double@@example.com | “Please enter a valid email address” |
| REG‑N05 | a@b..c.com | “Please enter a valid email address” |
| REG‑N06 | very.long.local.part@domain.com ( > 64 chars ) | “Email address is too long” |
| REG‑N07 | domain.com (missing @) | “Please enter a valid email address” |
Password Strength Rules
Most apps enforce a policy (minimum length, mix of character types, no common passwords). Test each rule in isolation and in combination.
| Test ID | Password | Expected Error |
|---|---|---|
| REG‑P01 | abc | “Password must be at least 8 characters” |
| REG‑P02 | abcdefgh | “Password must contain at least one uppercase letter” |
| REG‑P03 | ABCDEFGH | “Password must contain at least one lowercase letter” |
| REG‑P04 | Abcdefg1 | “Password must contain at least one special character” |
| REG‑P05 | Password1! | (if blocked) “Password is too common” |
| REG‑P06 | Password1! (reused from breach list) | “This password has been exposed in a data breach; please choose another” |
| REG‑P07 | 😀😃😄😁😆😅😂🤣 (emoji only) | “Password must contain at least one letter or number” |
Duplicate Email / Existing Account
Attempt to register with an email that is already associated with an account. The expected behavior is usually an inline error: “An account with this email already exists”. Verify that no new account is created and that the existing account remains unchanged.
Missing Required Fields
Leave each mandatory field blank (email, password, terms checkbox) and confirm that the form highlights the missing field and displays an appropriate validation message.
Terms of Service Checkbox Not Selected
Submit the form without agreeing to the terms. The system should block submission and show a message like “You must accept the Terms of Service to continue”.
Special Characters and SQL Injection Attempts
While modern frameworks sanitize input, it is still wise to test strings that could be used for injection: ' OR '1'='1, , ; DROP TABLE users;. The expected result is either rejection with a validation error or safe storage (no execution).
File Upload Restrictions (if avatar upload is part of registration)
Try to upload a file with an invalid extension (.exe), a file that exceeds the size limit, or a corrupted image. Expect a clear error and no account creation.
Boundary and Edge Cases
Boundary testing focuses on the limits of input domains, while edge cases capture uncommon but plausible situations that often surface only in production.
Length Boundaries
| Field | Minimum Allowed | Maximum Allowed | Test Idea |
|---|---|---|---|
| Email local part | 1 character | 64 characters (per RFC 5321) | Test a@domain.com and a 64‑char local part |
| Email domain | 1 character | 255 characters | Test a@b.c and a long domain |
| Password | 8 characters (example) | 64 characters (example) | Test exactly 8, exactly 64, and 65 |
| First/Last name | 1 character | 50 characters | Test single‑letter name and 50‑char name |
| Phone number | 7 digits (local) | 15 digits (international) | Test shortest and longest formats |
Unicode and Normalization
Register with characters that have multiple Unicode representations (e.g., é as a single code point vs e + combining acute accent). Verify that the system treats them as equivalent or stores them correctly, depending on business rules.
Whitespace Handling
Leading, trailing, and internal spaces can cause silent failures. Test email " alice@example.com " (spaces around), password with spaces, and name fields with only spaces. Expect trimming or validation errors as per spec.
Concurrent Registration Attempts
Simulate two registration requests with the same email at nearly the same time (e.g., using two devices or parallel threads). The system should ensure only one account is created and the second request receives an appropriate conflict error.
Registration After Session Timeout
If the app maintains a session token for anonymous browsing, start registration, let the session expire mid‑flow, then complete the form. Expect either a graceful redirect to login or a clear message that the session expired and the data was lost.
Registration with Disabled Network
Toggle airplane mode or disable Wi‑Fi after the form is filled but before submitting. The app should detect lack of connectivity, prevent submission, and show an offline warning rather than failing silently.
Registration with Accessibility Tools Enabled
Run the flow with a screen reader (TalkBack/VoiceOver) and with high contrast or font scaling settings. Verify that all fields are labeled, error messages are announced, and the flow can be completed without visual cues.
Registration Under Adverse Device Conditions
Test on low‑memory devices, with battery saver on, or with CPU throttling. Look for crashes, ANRs, or missing UI updates.
Data Setup and Test Data Management
Effective test data management reduces flakiness and speeds up test execution. For registration flows you typically need:
- Unique email addresses for each test iteration (to avoid collisions).
- Securely generated passwords that satisfy the policy.
- Optional profile data (names, phone numbers).
- Pre‑existing accounts for negative duplicate‑email tests.
Generating Unique Emails on the Fly
A common technique is to append a timestamp or a random UUID to a static prefix.
# Bash snippet for generating a unique test email
PREFIX="testuser"
SUFFIX=$(date +%s%N | cut -b1-13) # nanosecond timestamp truncated
EMAIL="${PREFIX}+${SUFFIX}@example.com"
echo $EMAIL
In a Java‑based test framework you might use:
String email = "testuser+" + System.nanoTime() + "@example.com";
Password Generation Compliant with Policy
If the policy requires at least one uppercase, one lowercase, one digit, and one special character, a simple generator can be:
import random, string
def gen_password(length=12):
if length < 4:
raise ValueError("Length too short for required classes")
uppers = random.choice(string.ascii_uppercase)
lowers = random.choice(string.ascii_lowercase)
digits = random.choice(string.digits)
specials = random.choice("!@#$%^&*()")
rest = ''.join(random.choice(string.ascii_letters + string.digits + "!@#$%^&*()")
for _ in range(length-4))
lst = list(uppers + lowers + digits + specials + rest)
random.shuffle(lst)
return ''.join(lst)
Pre‑loading Existing Accounts
For duplicate‑email tests you need an account already in the system. Use the API or admin UI to create a known account before the test suite runs, and store its credentials in a secure vault (e.g., AWS Secrets Manager, HashiCorp Vault).
Cleaning Up After Tests
To keep the test environment idempotent, delete the created account after each test (or after a test suite) via a DELETE endpoint or admin console. If deletion is not possible, use a unique email per test as described above so that leftover accounts do not cause collisions.
Data‑Driven Test Frameworks
Leverage CSV, JSON, or YAML files to feed test data into your automation. Example CSV for negative email tests:
email,expected_error
plainaddress,"Please enter a valid email address"
missing@domain,"Please enter a valid email address"
@nodomain.com,"Please enter a valid email address"
In a Playwright test you could read the file and loop:
const csv = require('csv-parser');
const fs = require('fs');
const results = [];
fs.createReadStream('emails.csv')
.pipe(csv())
.on('data', (row) => results.push(row))
.on('end', async () => {
for (const {email, expected_error} of results) {
await page.goto('/register');
await page.fill('#email', email);
await page.fill('#password', 'ValidPass1!');
await page.click('#terms');
await page.click('#submit');
await expect(page.locator('.error-message')).toHaveText(expected_error);
}
});
Prioritization, Traceability, and Risk‑Based Ordering
Not all test cases are equal. Prioritization ensures that the most critical defects are found early, especially when time is limited.
Risk‑Based Prioritization Matrix
| Priority | Criteria | Example Test IDs |
|---|---|---|
| P0 (Critical) | Failure blocks core user acquisition or leads to security breach | REG‑N01 (invalid email), REG‑N07 (SQLi attempt), REG‑D01 (duplicate email) |
| P1 (High) | Affects major user journey or compliance (e.g., accessibility, legal) | REG‑A01 (screen‑reader labels), REG‑T01 (terms checkbox) |
| P2 (Medium) | Impacts edge cases or usability but does not block sign‑up | REG‑B01 (max length email), REG‑U01 (Unicode name) |
| P3 (Low) | Cosmetic or rare conditions | REG‑C01 (placeholder text alignment) |
Map each test case to a requirement or user story ID to maintain traceability. A simple traceability table can be kept in a spreadsheet or in your test management tool:
| Test ID | Requirement ID | Requirement Description |
|---|---|---|
| REG‑001 | REQ‑REG‑001 | User can register with valid email and password |
| REG‑N01 | REQ‑REG‑003 | System rejects malformed email addresses |
| REG‑A01 | REQ‑ACC‑002 | All form fields are accessible to screen readers |
| REG‑D01 | REQ‑SEC‑005 | Duplicate registration attempts are prevented |
When a new requirement is added, you can quickly see which test cases need to be created or updated. Conversely, when a test fails, you can trace it back to the exact requirement that is not satisfied.
Ordering for Execution
Execute in this order to get fast feedback:
- Smoke / Sanity – P0 positive path (REG‑001) to confirm the build is testable.
- Security & Validation – P0 negative cases (email, password, injection).
- Compliance & Accessibility – P1 accessibility and legal checks.
- Boundary & Edge – P2 length, Unicode, concurrency.
- Low‑Risk / Cosmetic – P3 UI polishing tests.
If you are using a CI pipeline, you can gate the build on P0 and P1 tests only, while running the full suite nightly.
Manual vs Automated Execution: Combining Test Cases with Autonomous Exploration (SUSA Mention)
Manual exploratory testing is invaluable for catching UX friction and unexpected behavior that scripted tests miss. Autonomous exploration platforms can complement manual effort by automatically exercising the app with varied user personas, surfacing crashes, ANRs, dead ends, and accessibility violations without any test scripts.
How Autonomous Exploration Works
- Ingestion – You upload an APK (Android) or provide a web URL.
- Model Building – The engine creates a state graph of screens, inputs, and navigational paths by performing taps, scrolls, text entry, and handling dialogs.
- Persona‑Driven Execution – Separate behavior models (curious, impatient, novice, adversarial, elderly, accessibility, power‑user) drive the exploration, varying timing, input patterns, and error‑prone actions.
- Issue Detection – The platform monitors for crashes, ANRs, unhandled exceptions, accessibility rule violations (WCAG 2.1 AA), security hints (e.g., clear‑text password in logs), and UX frictions (e.g., buttons that never become enabled).
- Regression Script Generation – After a run, the tool can export the discovered flows as Appium (Android) or Playwright (Web) test scripts, giving you a starting point for automated regression.
Integrating Designed Test Cases
- Pre‑run Seed – Load your manually written test cases as initial seeds. The autonomous engine will start from those known states and then branch out, ensuring that your intentional paths are covered while also exploring deviations.
- Post‑run Enrichment – Take the generated regression scripts and add assertions that correspond to the expected results from your test case matrix. This converts a pure exploration trace into an executable test suite with verifiable outcomes.
- Continuous Learning – Each subsequent run remembers previously visited screens and dead ends, so the exploration becomes smarter over time, focusing on areas that have changed or that have historically produced failures.
Example: Using the SUSATest CLI
# Install the agent (once)
pip install susatest-agent
# Run an exploration against a locally built APK
susatest explore \
--app ./app-debug.apk \
--personas curious,impatient,accessibility \
--output-dir ./susatest-run-$(date +%Y%m%d%H%M%S) \
--export-playwright ./generated-tests
The command above:
- Installs the SUSATest agent (if not already present).
- Launches an exploration with three personas: curious (tries many inputs), impatient (fast taps, short waits), and accessibility (uses TalkBack‑like navigation).
- Saves logs, screenshots, and a trace of visited states.
- Exports a Playwright test suite that you can then augment with assertions from your test case matrix.
Benefits of the Combined Approach
| Approach | Strength | Weakness |
|---|---|---|
| Designed Test Cases | Precise verification of requirements, easy traceability, deterministic | May miss unanticipated UI states, relies on tester imagination |
| Autonomous Exploration | Broad coverage of unexpected paths, finds crashes & accessibility issues without scripts, scales with personas | Less explicit verification of business rules, generates many low‑value paths that need filtering |
| Combined | High‑confidence requirement validation + real‑world robustness discovery | Requires effort to merge and maintain both sets, but tools like SUSATest automate the merge step |
In practice, a team might run the designed test suite on every commit (fast feedback) and schedule a nightly autonomous exploration to catch regressions that only appear under unusual usage patterns.
Worked Example: 20+ Test Cases for Registration Flow (Matrix)
Below is a comprehensive table that you can copy into a test management tool. Each row includes ID, title, preconditions, steps, and expected result. The table is deliberately detailed to serve as a reference for both manual execution and automation seed data.
| ID | Title | Preconditions | Steps | Expected Result |
|---|---|---|---|---|
| REG‑001 | Successful registration with minimum required fields | App installed, device online, no existing account for testuser+ | 1. Launch app → Register screen 2. Enter testuser+12345@example.com in Email field3. Enter SecureP@ss1! in Password field4. Tap Terms checkbox 5. Tap Submit button | Account created, server returns HTTP 201 with {status:"pending_verification"}, user navigated to email‑verification screen |
| REG‑002 | Registration with optional first and last name | Same as REG‑001 | 1‑4 as REG‑001 5. Enter Ada in First Name field6. Enter Lovelace in Last Name field7. Tap Submit | Account created, profile stores first name Ada and last name Lovelace (verified via GET /users/{id}) |
| REG‑003 | Registration using Google SSO | Device has a valid Google account, internet available | 1. Launch app → Register screen 2. Tap “Continue with Google” 3. Choose test Google account 4. Accept permissions | Account linked to Google email, server returns HTTP 200 with {provider:"google"}, user lands on home screen |
| REG‑004 | Registration with Facebook SSO (cancel flow) | Facebook app installed, test FB account available | 1. Launch app → Register screen 2. Tap “Continue with Facebook” 3. Tap Cancel on FB login dialog | User remains on Register screen, no account created, no error shown |
| REG‑005 | Registration with password exactly at minimum length | Policy: min 8 chars | 1. Fill email testuser+999@example.com2. Password Ab1!defg (8 chars)3. Accept terms 4. Submit | Account created, password accepted |
| REG‑006 | Registration with password at maximum allowed length | Policy: max 64 chars | 1. Generate 64‑char password meeting policy 2. Fill other fields as REG‑001 3. Submit | Account created, password stored correctly (verify via API that length is 64) |
| REG‑007 | Registration with email at maximum local‑part length (64 chars) | RFC limit | 1. Create local part a repeated 64 times → aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@example.com2. Fill password ValidPass1!3. Submit | Account created, email stored exactly as entered |
| REG‑008 | Registration with email at maximum domain length (255 chars) | RFC limit | 1. Use domain b. repeated 84 times + c.com (total 255)2. Email test@3. Submit | Account created, domain stored correctly |
| REG‑009 | Registration with leading/trailing spaces in email (should be trimmed) | App trims whitespace | 1. Email testuser+space@example.com (spaces before/after)2. Password ValidPass1!3. Submit | Account created with email testuser+space@example.com (spaces removed) |
| REG‑010 | Registration with only spaces in password (should be rejected) | Password policy requires non‑space chars | 1. Email testuser+nospace@example.com2. Password (three spaces)3. Submit | Error: “Password must contain at least one letter or number” |
| REG‑011 | Registration with duplicate email (negative) | Pre‑existing account for dup@example.com | 1. Email dup@example.com2. Password DupPass1!3. Submit | Inline error: “An account with this email already exists”, no new account created |
| REG‑012 | Registration with missing email (blank) | Required field | 1. Leave Email empty 2. Fill Password ValidPass1!3. Accept terms 4. Submit | Email field highlighted, error: “Email is required” |
| REG‑013 | Registration with missing password | Required field | 1. Email testuser+nomail@example.com2. Leave Password empty 3. Accept terms 4. Submit | Password field highlighted, error: “Password is required” |
| REG‑014 | Registration without accepting terms | Terms checkbox required | 1. Fill Email testuser+noterms@example.com2. Fill Password ValidPass1!3. Leave Terms unchecked 4. Submit | Submit button disabled or error: “You must accept the Terms of Service” |
| REG‑015 | Registration with SQL injection attempt in email | Input sanitization | 1. Email test' OR '1'='1@example.com2. Password ValidPass1!3. Submit | Error: “Please enter a valid email address” (no SQL executed) |
| REG‑016 | Registration with XSS attempt in first name | Output encoding | 1. First name 2. Last name Test3. Email testuser+xss@example.com4. Password ValidPass1!5. Submit | Account created, script stored as plain text; when profile page renders, script is escaped and not executed |
| REG‑017 | Registration with emoji‑only password | Policy requires alphanumeric/special | 1. Email testuser+emoji@example.com2. Password 😀😃😄😁3. Submit | Error: “Password must contain at least one letter or number” |
| REG‑018 | Registration with Unicode characters in name (UTF‑8) | Supports internationalenames | 1. First name Αλέξανδρος (Greek)2. Last name Животин (Cyrillic)3. Email testuser+unicode@example.com4. Password ValidPass1!5. Submit | Account created, names stored and retrieved correctly (no garbling) |
| REG‑019 | Registration after network loss mid‑form | App handles offline gracefully | 1. Fill Email testuser+offline@example.com2. Fill Password ValidPass1!3. Disable Wi‑Fi 4. Tap Submit | App shows toast: “No internet connection. Please check your network and try again.”, no account created |
| REG‑020 | Registration with rapid double‑tap on Submit (race condition) | Prevent duplicate submissions | 1. Fill valid fields 2. Tap Submit button twice within 200 ms | Only one account creation request sent, second tap ignored or shows “Please wait” indicator |
| REG‑021 | Registration with accessibility tools enabled (TalkBack) | Screen reader active | 1. Enable TalkBack 2. Navigate to Email field via swipe‑right 3. Double‑tap to activate, enter testuser+tb@example.com4. Move to Password field, enter ValidPass1!5. Activate Terms checkbox 6. Activate Submit button | Form completes successfully; TalkBack announces each field label, error messages, and success toast |
| REG‑022 | Registration with font size set to 200 % (large text) | Layout respects scaling | 1. Set system font size to 200 % 2. Launch Register screen 3. Verify all fields and buttons are fully visible and tappable 4. Complete registration with valid data | No clipping, all elements readable, registration succeeds |
| REG‑023 | Registration under CPU throttling (50 % of normal) | App remains responsive | 1. Enable CPU throttling in developer options 2. Fill valid registration data 3. Submit | Registration completes within acceptable time (< 5 s), no ANR |
| REG‑024 | Registration with battery saver on | Background restrictions do not block UI | 1. Enable battery saver 2. Fill valid data 3. Submit | Registration succeeds, no delayed UI updates |
| REG‑025 | Registration with concurrent attempts from two devices (same email) | Backend prevents race | 1. On Device A: fill email race@example.com, password PassA1!2. On Device B: fill same email, password PassB1!3. Submit both within 1 second | Only one account created (whichever reaches server first); second device receives error: “Account already exists” |
| REG‑026 | Registration with terms link opening in webview | Terms UI functional | 1. Tap Terms text link 2. Webview loads terms page 3. Scroll to bottom, tap “I Agree” (if provided) or close webview 4. Submit registration | Registration proceeds; terms acceptance recorded |
| REG‑027 | Registration with invalid phone number (if phone field present) | Phone validation | 1. Fill Email testuser+phone@example.com2. Fill Password ValidPass1!3. Phone 123 (too short)4. Submit | Error: “Please enter a valid phone number” |
| REG‑028 | Registration with valid international phone number | Accepts E.164 format | 1. Phone +1 555 123 4567 (US)2. Complete rest as REG‑001 3. Submit | Account created, phone stored in E.164 format |
| REG‑029 | Registration with password containing only repeated character (e.g., aaaaaaaa) | Prevents weak patterns | 1. Password aaaaaaaa2. Submit | Error: “Password is too weak; try a stronger combination” |
| REG‑030 | Registration with password that matches common breached list | Blocks known compromised credentials | 1. Password Password123! (assume in breach list)2. Submit | Error: “This password has appeared in a data breach; choose another” |
*The table above contains 30 test cases; you can trim or expand based on your product’s scope.*
Checklist for Reviewing Registration Flow Test Cases
Before you consider a test case is promoted to the test suite, run through this short checklist to guarantee quality and usefulness.
- [ ] ID and Title are unique and follow the naming convention.
- [ ] Preconditions are clearly stated and achievable in a clean test environment.
- [ ] Test Data column contains the exact values used (or a reference to a data file).
- [ ] Steps are numbered, imperative, and contain no ambiguous pronouns.
- [ ] Expected Result is observable, measurable, and can be asserted automatically.
- [ ] Post‑conditions (if any) leave the system in a known state (e.g., account deleted).
- [ ] Priority reflects risk and user impact;
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