How to Write Test Cases for Settings Page (With Examples)
How to Write Test Cases for Settings Page (With Examples)
How to Write Test Cases for Settings Page (With Examples)
A settings page is often the hub where users adjust preferences, manage accounts, toggle features, and control privacy. Because it touches almost every aspect of an application, defects here can erode trust, cause data loss, or block core workflows. Writing effective test cases for this page requires a systematic approach that captures positive verification, negative validation, edge‑condition probing, and traceability to requirements. This guide walks you through the anatomy of a solid test case, provides a concrete matrix of 20+ examples, shows how to prioritize and maintain traceability, and explains how autonomous exploration (e.g., with SUSA) complements manual design to achieve real coverage.
Understanding the Settings Page Test Scope
Before writing any test case, you need to decompose the settings page into its functional domains. Most settings pages share common categories, though the exact labels vary by product. Identifying these categories helps you ensure that no area is overlooked and gives you a natural way to group test cases.
Common UI Elements and Interaction Patterns
- Toggle switches for enabling/disabling features (e.g., notifications, dark mode).
- Input fields for text entry (e.g., display name, email, API key).
- Dropdowns or pickers for single‑selection choices (e.g., language, time zone, theme).
- Multi‑select lists for choosing several options (e.g., notification categories, allowed file types).
- Buttons that trigger actions (e.g., “Save”, “Reset to defaults”, “Delete account”).
- Links or navigation items that open sub‑screens (e.g., “Privacy”, “Security”, “About”).
- Informational banners or badges that show status (e.g., “2‑step verification enabled”, “Storage used: 3.2 GB”).
Each of these elements can be exercised with a set of generic test ideas: verify default state, verify state change persists after navigation, verify invalid input is rejected, verify required fields are enforced, and verify that the UI reflects the underlying model instantly.
Functional Areas to Cover
- Account & Profile – username, email, password, profile picture, linked social accounts.
- Preferences & Appearance – theme, language, font size, layout density, orientation lock.
- Notifications – global toggle, per‑channel switches, sound/vibration, do‑not‑disturb schedule.
- Privacy & Security – two‑factor auth, login sessions, data export/delete, app permissions, ad personalization.
- Data & Storage – cache clearing, download location, sync frequency, backup/restore.
- Advanced / Developer – API keys, webhook URLs, debug logging, feature flags, experimental options.
- Legal & About – terms of service, license attributions, version number, support contact.
By mapping each of these areas to the UI elements listed above, you create a matrix that guides test case creation. For example, the “Account & Profile” area will involve text fields (username, email), a password field with strength meter, a file picker for avatar upload, and a button to save changes.
Anatomy of a Test Case
A well‑structured test case makes it easy to review, automate, and maintain. While templates vary, the following fields are essential for settings‑page testing.
| Field | Description |
|---|---|
| ID | Unique identifier (e.g., SET-001). Use a prefix that indicates the module (SET for settings) and a sequential number. |
| Title | Concise, action‑oriented sentence that states what is being verified (e.g., “Verify that toggling ‘Dark Mode’ persists after app restart”). |
| Preconditions | Required state before execution: user logged in, specific account type, device orientation, network condition, or any feature flags that must be on/off. |
| Steps | Numbered, imperative actions the tester (or script) performs. Each step should be atomic and observable. Include any data entry values. |
| Expected Result | Clear, observable outcome after the final step. Avoid vague phrases like “the system behaves correctly”; instead state the exact UI change, API call, or database state. |
| Postconditions (optional) | Any cleanup needed to return the system to a neutral state (e.g., resetting a toggle, deleting a test‑created file). Helpful for maintaining isolation between tests. |
| Priority | Categorization (P0‑critical, P1‑high, P2‑medium, P3‑low) based on risk, user impact, and likelihood of failure. |
| Traceability | Link to the source requirement, user story, or design spec (e.g., US-1123: User can switch theme). If you use a test‑management tool, store this as a custom field or tag. |
Including postconditions is especially valuable for settings tests because many actions mutate persistent state; failing to reset can cause cascading false positives in later tests.
Positive Test Cases
Positive test cases verify that the settings page works as intended when users follow the happy path. Below is a table of 12 representative cases covering the most common functional areas. Feel free to extend or adapt them to your product’s specific UI.
| ID | Title | Preconditions | Steps | Expected Result |
|---|---|---|---|---|
| SET-001 | Verify default theme is Light on first launch | Fresh install, no prior settings saved | 1. Launch app. 2. Navigate to Settings → Appearance. | The “Theme” selector shows “Light” selected; the UI background is light. |
| SET-002 | Toggle Dark Mode persists after app restart | User logged in, currently on Light theme | 1. Open Settings → Appearance. 2. Switch “Dark Mode” toggle to ON. 3. Press Save (if applicable). 4. Close app completely. 5. Re‑launch app and navigate to Settings → Appearance. | Dark Mode toggle remains ON; UI appears in dark theme. |
| SET-003 | Change display name updates immediately in profile header | User logged in, profile shows “Old Name” | 1. Go to Settings → Account → Profile. 2. Tap the display name field. 3. Enter “New Name”. 4. Press Save. 5. Return to home screen. | The profile header now shows “New Name”. No error toast appears. |
| SET-004 | Upload a valid avatar image and see it reflected | User logged in, avatar placeholder visible | 1. Settings → Account → Profile → Change Avatar. 2. Choose a PNG file ≤2 MB from device gallery. 3. Confirm selection. 4. Wait for upload completion indicator. | The new avatar appears in the profile picture circle; no error message. |
| SET-005 | Enable two‑factor authentication (2FA) and verify prompt on next login | User logged in, 2FA disabled, phone number verified | 1. Settings → Privacy & Security → Two‑Factor Auth. 2. Toggle 2FA ON. 3. Enter the verification code sent to phone. 4. Press Confirm. 5. Log out and log back in with credentials. | After entering username/password, the app prompts for the 2FA code; successful login follows correct code entry. |
| SET-006 | Set custom notification sound and hear it on a test notification | User logged in, notification permission granted | 1. Settings → Notifications → Sound. 2. Choose “Custom” and select a short audio file from storage. 3. Save. 4. Trigger a test notification (e.g., via “Send test alert” button). | The test notification plays the selected custom sound. |
| SET-007 | Adjust font size slider and verify text scales in Settings screen itself | User logged in, default font size = Medium | 1. Settings → Appearance → Font Size. 2. Move slider to Large. 3. Observe UI elements without leaving the screen. | All readable text (labels, toggles, description) increases proportionally; no clipping or overlap. |
| SET-008 | Change language to Spanish and verify all Settings labels translate | User logged in, current language = English | 1. Settings → General → Language. 2. Select “Español”. 3. Confirm if prompted. 4. Observe the Settings screen without navigating away. | All visible labels, placeholders, and button texts appear in Spanish; no English remnants. |
| SET-009 | Set download location to external SD card and verify new files store there | Device has an mounted SD card with write permission; user logged in | 1. Settings → Data & Storage → Download Location. 2. Choose “SD Card”. 3. Save. 4. Initiate a download (e.g., save a webpage or attachment). | The downloaded file appears in the selected folder on the SD card; internal storage remains unchanged for that file. |
| SET-010 | Clear cache and confirm storage usage drops | User logged in, app shows non‑zero cache size (e.g., 150 MB) | 1. Settings → Data & Storage → Clear Cache. 2. Confirm the action when prompted. 3. Re‑open Settings → Data & Storage to view cache size. | Cache size reads 0 MB (or a negligible value); a toast confirms “Cache cleared”. |
| SET-011 | Reset all settings to defaults and verify each toggle returns to factory state | User logged in, multiple settings customized (theme, notifications, etc.) | 1. Settings → Advanced → Reset to Defaults. 2. Confirm the reset dialog. 3. Navigate through each settings subsection and observe values. | Every toggle, selector, and input returns to the documented default values; custom data (e.g., avatar, name) remains unchanged unless the reset explicitly includes profile data. |
| SET-012 | Save API key in Developer settings and verify it is masked on re‑open | User logged in, developer options enabled | 1. Settings → Developer → API Key. 2. Enter a test key abcdef123456.3. Save. 4. Leave the screen and return to Developer → API Key. | The field displays a masked value (e.g., **** or shows only the last four characters); the actual key is stored securely and usable by the app’s backend calls. |
These cases give you a solid baseline. Each one can be automated with UI‑driven tools (Appium for mobile, Playwright for web) or executed manually during exploratory sessions.
Negative Test Cases
Negative testing ensures the settings page gracefully handles invalid input, unexpected states, and misuse. The following table lists 12 negative scenarios, each with a clear expected failure mode.
| ID | Title | Preconditions | Steps | Expected Result |
|---|---|---|---|---|
| SETN-001 | Attempt to set display name with only spaces | User logged in, profile shows “ValidName” | 1. Settings → Account → Profile → Edit display name. 2. Enter five space characters. 3. Press Save. | Save button remains disabled or shows an inline error: “Name cannot be blank”. No change to the name. |
| SETN-002 | Enter display name exceeding maximum length (e.g., 150 chars) | User logged in | 1. Settings → Account → Profile → Edit display name. 2. Paste a string of 151 characters. 3. Press Save. | Input is truncated to the allowed maximum or an error appears: “Name too long (max 150)”. The name is not saved beyond the limit. |
| SETN-003 | Upload an avatar file with unsupported format (e.g., .pdf) | User logged in | 1. Settings → Account → Profile → Change Avatar. 2. Choose a PDF file. 3. Confirm. | The picker rejects the file or shows an error: “Only JPG/PNG files allowed”. No upload occurs. |
| SETN-004 | Try to enable 2FA without a verified phone number | User logged in, phone number not verified | 1. Settings → Privacy & Security → Two‑Factor Auth. 2. Toggle ON. | Toggle does not switch ON; an inline message appears: “Verify your phone number first”. The 2FA setting stays OFF. |
| SETN-005 | Set notification sound to a corrupted audio file | User logged in, permission granted | 1. Settings → Notifications → Sound → Custom. 2. Choose a file that is zero bytes or not a valid audio format. 3. Save. | Save is blocked or an error toast: “Invalid audio file”. The sound setting reverts to the previous valid selection. |
| SETN-006 | Attempt to set language to an unsupported locale (e.g., “xx-XX”) | User logged in | 1. Settings → General → Language. 2. Type or select “xx-XX” if available. 3. Confirm. | The selector reverts to the last valid language or shows an error: “Language not supported”. UI language remains unchanged. |
| SETN-007 | Set download location to a read‑only folder | User logged in, device has a folder with read‑only permission | 1. Settings → Data & Storage → Download Location. 2. Navigate to the read‑only folder and select it. 3. Save. | Save fails with a toast: “Cannot write to selected location”. The download location remains unchanged. |
| SETN-008 | Clear cache while a background download is in progress | User logged in, a large file download started | 1. Pull down notification shade to see ongoing download. 2. Settings → Data & Storage → Clear Cache. 3. Confirm. | The clear cache operation is either blocked or proceeds but the ongoing download continues unaffected; no data corruption is observed. An info message may state: “Cache cleared; active downloads continue”. |
| SETN-009 | Tap Reset to Defaults then immediately change a setting before confirmation dialog appears | User logged in, multiple settings customized | 1. Settings → Advanced → Reset to Defaults. 2. Before the confirmation dialog appears, quickly toggle Dark Mode ON. 3. Observe if the toggle change persists after the dialog is dismissed. | The reset dialog still appears; any changes made before confirmation are ignored once the user confirms the reset. All settings revert to defaults. |
| SETN-010 | Enter an API key with illegal characters (e.g., newline) in Developer settings | User logged in, developer options enabled | 1. Settings → Developer → API Key. 2. Paste a string containing a line break ( \n).3. Press Save. | Save is disabled or shows an error: strips the newline, shows a warning “Invalid characters”, or rejects the input. The stored key remains unchanged. |
| SETN-011 | Attempt to save settings while device is offline and the setting requires server sync | User logged in, airplane mode on, setting such as “Enable cloud backup” | 1. Settings → Data & Storage → Cloud Backup → Toggle ON. 2. Attempt to leave the screen. | The toggle either reverts to OFF after leaving the screen or shows a banner: “Changes will sync when online”. The setting is not persisted locally until connectivity resumes. |
| SETN-012 | Rapidly toggle a switch 20 times in 2 seconds and verify final state is correct | User logged in, switch initially OFF | 1. Settings → Notifications → Marketing Emails. 2. Toggle the switch ON/OFF repeatedly as fast as possible. 3. Stop and observe the final state. | The switch ends in the state corresponding to the parity of toggles (even number of toggles returns to original state). No UI glitches, stuck spinner, or crash occurs. |
Negative cases are crucial for uncovering validation gaps, race conditions, and UI stability issues that only manifest under stress or erroneous input.
Edge and Boundary Cases
Edge cases push the limits of data types, device capabilities, and system configurations. Boundary testing focuses on minimum/maximum values, empty states, and transitions around those limits. Below are six edge/boundary scenarios that often reveal defects missed by basic positive/negative tests.
| ID | Title | Preconditions | Steps | Expected Result |
|---|---|---|---|---|
| SETE-001 | Set font size to the minimum allowed value (e.g., 80% of default) | User logged in | 1. Settings → Appearance → Font Size. 2. Move slider to the leftmost position. 3. Observe text size on the Settings screen itself. | Text is visibly smaller but still legible; no clipping occurs; layout does not break. |
| SETE-002 | Set font size to the maximum allowed value (e.g., 200% of default) | User logged in | 1. Settings → Appearance → Font Size. 2. Move slider to the rightmost position. 3. Observe text size and layout. | Text enlarges appropriately; layout may scroll vertically if needed, but no overlapping or truncation of essential controls. |
| SETE-003 | Enter a display name consisting of a single Unicode emoji | User logged in | 1. Settings → Account → Profile → Edit display name. 2. Paste the “😀” emoji. 3. Save. | The emoji is accepted and shown correctly in the profile header; no encoding errors. |
| SETE-004 | Attempt to upload an avatar image exactly at the size limit (e.g., 2 MB) | User logged in | 1. Settings → Account → Profile → Change Avatar. 2. Choose a JPEG file that is exactly 2 000 000 bytes. 3. Confirm. | Upload succeeds; the image appears as the avatar; no “file too large” error. |
| SETE-005 | Set notification “Do Not Disturb” start time to 23:59 and end time to 00:01 (cross‑midnight) | User logged in | 1. Settings → Notifications → Do‑Not‑Disturb → Schedule. 2. Set start time to 23:59. 3. Set end time to 00:01. 4. Save. | The schedule is accepted; the system interprets it as a period that spans midnight. A test notification sent at 00:00 is suppressed; one at 23:58 is not. |
| SETE-006 | Change language while a modal dialog is open (e.g., “Are you sure you want to log out?”) | User logged in, a logout confirmation dialog is visible | 1. Trigger logout → dialog appears. 2. Without dismissing dialog, open Settings → General → Language and switch to another language. 3. Observe if the dialog text updates. | The dialog text updates to the new language instantly, demonstrating that the UI observes language changes even when a transient window is open. No crash or stale text. |
These cases test the limits of UI scaling, input validation, time‑zone handling, and dynamic localization—areas where defects often escape notice until a real‑world user hits an extreme configuration.
Data Setup and Test Data Management
Reliable test execution depends on reproducible data. For settings‑page tests you often need to control the user’s account state, device configuration, and sometimes backend feature flags. Below are practical strategies for preparing and cleaning up test data.
Using Fixtures or Factory Objects
If your application exposes a test API or a local database you can manipulate, create a fixture that puts the account into a known state before each test. For example, a pseudo‑code snippet in JavaScript (using a hypothetical test harness) might look like:
// beforeEach hook
async function resetUserSettings() {
await api.delete('/settings'); // wipe persisted settings
await api.post('/settings/defaults'); // restore factory defaults
await api.put('/user/profile', {
displayName: 'TestUser',
email: 'test@example.com',
avatarUrl: null
});
}
This ensures each test starts from a clean slate, eliminating cross‑test contamination.
Mocking External Services
Settings that trigger server calls (e.g., saving an API key, enabling cloud backup) should be mocked to avoid flakiness due to network latency or server downtime. Tools like MockServer, WireMock, or the built‑in networking stubs in Playwright allow you to intercept requests and return predefined responses.
// Playwright example: mock the API key endpoint
await page.route('https://api.example.com/v1/user/apikey', route => {
route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({ masked: '****abcd' })
});
});
Handling Device‑Specific Resources
For tests that involve file uploads (avatars, custom sounds) or storage location changes, push the required files onto the device/emulator as part of the test setup. Using adb for Android:
# Push a 1.5 MB test avatar to /sdcard/Pictures/
adb push test_avatar.jpg /sdcard/Pictures/test_avatar.jpg
# Push a short audio clip for notification sound
adb push test_sound.ogg /sdcard/Notifications/test_sound.ogg
Then reference those absolute paths in your test steps. After the test, you can clean up with adb shell rm to keep the storage state consistent.
Versioning Test Data
Keep a version‑controlled directory (e.g., testdata/settings/) containing:
- CSV files for bulk user creation (username, email, preset settings).
- Binary assets (images, audio) used in upload tests.
- JSON payloads for API mock responses.
Tag each dataset with the corresponding test case IDs so that auditors can see exactly what data drove each verification.
Prioritization and Risk‑Based Testing
Not all settings carry equal risk. A mis‑configured dark‑mode toggle is annoying but rarely catastrophic; a flawed password‑change flow could lead to account takeover. Use a simple risk matrix to assign priority levels.
| Impact \ Likelihood | Rare (1) | Unlikely (2) | Possible (3) | Likely (4) | Almost Certain (5) |
|---|---|---|---|---|---|
| Critical (data loss, security breach) | P1 | P1 | P0 | P0 | P0 |
| High (core workflow blocked, major UX degradation) | P2 | P2 | P1 | P1 | P0 |
| Medium (minor inconvenience, cosmetic) | P3 | P3 | P2 | P2 | P1 |
| Low (rarely noticed, no functional effect) | P3 | P3 | P3 | P2 | P1 |
After scoring each test case, you can sort by priority and allocate automation effort accordingly. For example:
- P0 cases (e.g., password change, 2FA enabling, API key storage) should be automated first and run on every commit.
- P1 cases (theme persistence, language change, notification sound) merit automation but may be executed nightly.
- P2/P3 cases (edge‑case font sizes, emoji names) can be executed manually or as part of a weekly exploratory run.
Document the rationale for each priority in a spreadsheet or test‑management tool; this aids stakeholder communication and helps justify test‑suite size.
Traceability to Requirements
Traceability links each test case to a source artifact—user story, design spec, or regulatory requirement. This connection serves two purposes: it shows coverage and facilitates impact analysis when requirements change.
Creating a Traceability Matrix
A simple two‑column table works well:
| Test Case ID | Linked Requirement(s) |
|---|---|
| SET-001 | US-1123: Default theme is Light on first install |
| SET-002 | US-1124: Dark mode toggle persists across app launches |
| SET-003 | US-1125: User can change display name and see change instantly |
| SETN-001 | US-1126: Display name must not be blank or whitespace only |
| SETE-005 | US-1127: Do‑Not‑Disturb schedule can cross midnight |
| ... | ... |
If you use a tool like Jira with the Xray or Zephyr add‑ons, you can add a custom field “Test Case ID” to issues and then generate a traceability report directly.
Maintaining Traceability Over Time
When a user story is updated, locate all linked test cases and review them for relevance. If a requirement is removed, either retire the associated tests or mark them as “obsolete”. Conversely, when a new story is added, create test cases early—ideally during sprint planning—so that the test base grows in lockstep with the product.
Combining Manual Test Cases with Autonomous Exploration (SUSA)
Manual test cases give you intentional, requirement‑driven coverage. Autonomous exploration tools like SUSA add a complementary layer that discovers unexpected behavior, edge cases, and regressions that scripted tests might miss.
How SUSA Works in the Context of a Settings Page
- Upload the APK or provide the web URL – SUSA starts with no prior knowledge of the app.
- Persona‑driven navigation – It simulates multiple user profiles (curious, impatient, novice, accessibility‑aware, power user, adversarial, etc.). Each persona has distinct interaction patterns: a power user may rapidly toggle switches, an accessibility user may rely on screen‑reader navigation, and an adversarial user may attempt invalid inputs.
- State‑aware exploration – SUSA remembers which screens it has visited, which actions led to crashes or ANRs, and which UI elements are dead ends. Over successive runs it builds a model of the app’s state graph and focuses on unexplored transitions.
- Real‑flow validation – While exploring, SUSA attempts to complete common flows (login, signup, changing a setting) and marks them PASS/FAIL based on observable criteria (e.g., does a toggle persist after navigation?).
- Regression script generation – After a run, SUSA can export the discovered sequences as Appium (Android) or Playwright (web) scripts, giving you a starting point for automated tests.
Practical Example: Using SUSA to Find a Hidden Settings Bug
Suppose your app has a “Developer Options” screen that is only revealed after tapping the build number seven times. A manual tester might forget to include this path in their test matrix. SUSA’s curious persona, which repeatedly taps visible elements, will eventually uncover the hidden toggle. During that exploration it may also try to enter an excessively long string into the newly exposed API‑key field, triggering a buffer‑overflow‑like crash that would be hard to anticipate manually.
To integrate SUSA findings into your test suite:
- Run SUSA on a nightly basis against a staging build.
- Export the generated Appium script for any flow that resulted in a FAIL.
- Review the script; if the failure represents a legitimate bug, convert it into a proper test case with clear ID, preconditions, and expected result.
- Add the test case to your regression suite and prioritize it based on the observed impact (e.g., crash → P0).
This approach ensures that your manual test cases remain the backbone of requirement validation while SUSA continuously expands coverage into the “unknown unknowns” space.
Automation Strategies
Turning the test cases from the tables above into automated scripts provides fast feedback and enables continuous integration. Below are concrete snippets for both mobile (Appium) and web (Playwright) contexts. Adjust selectors, URLs, and credentials to match your application.
Mobile Automation with Appium (Android)
// Example: SET-002 – Dark Mode persists after restart
@Test
public void testDarkModePersists() {
// Precondition: user logged in, theme Light
loginUser("test@example.com", "Password123");
SettingsPage settings = new SettingsPage(driver);
settings.openAppearance();
// Step: enable Dark Mode
settings.toggleDarkMode(true);
settings.saveIfNeeded();
// Step: restart app
driver.resetApp(); // equivalent to close + launch
// Re‑login if required by your app
loginUser("test@example.com", "Password123");
settings.openAppearance();
// Verification
assertTrue(settings.isDarkModeEnabled(), "Dark Mode should stay ON after restart");
assertTrue(settings.isUiInDarkTheme(), "UI should reflect dark theme");
}
Key points:
- Use Page Object Model to encapsulate locators (
By.id("toggle_dark_mode"), etc.). - Call
driver.resetApp()to simulate a full cold start; if your app maintains session via tokens, you may need to re‑login explicitly. - Assertions should check both the UI toggle state and a visual cue (e.g., background color) to catch sync bugs.
Web Automation with Playwright (TypeScript)
// Example: SETN-001 – Display name cannot be blank
test('display name cannot be only spaces', async ({ page }) => {
await login(page, 'test@example.com', 'Password123');
await page.goto('/settings/profile');
const nameInput = page.locator('input#displayName');
await nameInput.fill(' '); // five spaces
await page.locator('button#save').click();
// Expect inline error message
const error = page.locator('text=Name cannot be blank');
await expect(error).toBeVisible();
// Ensure the name field still contains the spaces (no change)
await expect(nameInput).toHaveValue(' ');
});
Tips:
- Leverage Playwright’s auto‑waiting and built‑in locators for resilient selectors.
- Use
test.use({ storageState: 'auth.json' })to persist
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