How to Write Test Cases for File Sharing (With Examples)
How to Write Test Cases for File Sharing (With Examples)
How to Write Test Cases for File Sharing (With Examples)
How to Write Test Cases for File Sharing (With Examples): Foundations
File sharing is a core capability in many applications, ranging from simple drag‑and‑drop uploads in a web portal to peer‑to‑peer transfers in a mobile messenger. Because the feature touches storage, networking, permissions, and UI, defects can surface as silent data loss, corrupted files, or security leaks. A well‑crafted test case set gives you repeatable evidence that each of those dimensions works as intended, and it provides a baseline for regression when the underlying service changes.
The first step is to decompose the feature into observable behaviors: upload initiation, transfer progress, completion notification, download, deletion, versioning, and sharing‑link handling. For each behavior you identify the relevant inputs (file size, type, metadata), the system states (authenticated vs. guest, quota remaining, network condition), and the observable outputs (HTTP status, UI toast, file checksum). By mapping those elements to a structured test case you create a artifact that can be reviewed, prioritized, and automated.
In the sections that follow we will walk through the anatomy of a test case, then populate a concrete matrix of positive, negative, boundary, performance, security, and accessibility scenarios. Each example includes preconditions, step‑by‑step actions, and an expected result that can be verified manually or with an automation framework.
How to Write Test Cases for File Sharing (With Examples): Test-Case Structure
A test case is more than a list of steps; it is a contract between the tester and the system under test. The minimal viable contract contains the following fields:
| Field | Purpose | Example |
|---|---|---|
| ID | Unique identifier for traceability | TS-FS-001 |
| Title | Short, readable summary | “Upload a 5 MB PNG file via drag‑and‑drop” |
| Precondition | System state required before execution | User logged in, quota ≥ 10 MB, network stable |
| Steps | Ordered actions the tester performs | 1. Open file‑share page 2. Drag test.png onto drop zone 3. Release mouse button |
| Expected Result | Observable outcome that defines pass/fail | Upload progress bar reaches 100 % and a toast “File uploaded successfully” appears |
| Post‑condition (optional) | State after the test, useful for chaining | File test.png appears in the user’s file list |
| Priority | Relative importance for execution order) | |
| Requirement ID | Link to spec or user story | REQ-FS-03 |
| Tags | Free‑form labels for filtering | positive, ui, dragdrop |
When you write a test case, start with the ID and title, then list preconditions that are *necessary* and *sufficient* to isolate the behavior under test. Steps should be imperative, using the same terminology as the UI or API (e.g., “click”, “POST /files”). The expected result must be unambiguous—avoid vague phrases like “the file should appear”. Instead, specify the exact UI element text, HTTP status code, or checksum value.
If you are automating the case, map each step to a command in your test framework (Appium, Playwright, REST‑Assured). Keep the automation script thin; let the test case document the *what* while the script encodes the *how*.
How to Write Test Cases for File Sharing (With Examples): Positive Test Cases
Positive cases verify that the happy path works under normal conditions. Below is a subset of the full matrix; the complete table appears later in this article.
| ID | Precondition | Steps | Expected Result |
|---|---|---|---|
| TS-FS-001 | User logged in, quota ≥ 10 MB | 1. Navigate to upload page 2. Click “Choose File” 3. Select a 2 MB JPEG 4. Press “Upload” | File appears in list with correct thumbnail, size 2 MB, status “Uploaded” |
| TS-FS-002 | User logged in, network Wi‑Fi | 1. Drag a 50 MB MP4 onto drop zone 2. Wait for upload to finish | Upload completes, progress bar shows 100 %, toast “Large file uploaded” |
| TS-FS-003 | User logged in, versioning enabled | 1. Upload report.docx (v1) 2. Upload same name again 3. Confirm version dialog appears | System creates v2, both versions accessible via version dropdown |
| TS-FS-004 | Guest user, public share link enabled | 1. Open share link for file image.png 2. Click download button | File downloads, SHA‑256 matches original, no auth prompt |
| TS-FS-005 | User logged in, admin rights | 1. Navigate to admin panel 2. Set global quota to 5 GB 3. Upload 4 GB file | Upload succeeds, quota shows 1 GB remaining |
These cases exercise the primary upload flow, large‑file handling, versioning, share‑link download, and admin quota adjustment. Each includes a concrete file size and type to avoid ambiguity.
How to Write Test Cases for File Sharing (With Examples): Negative and Invalid Input Cases
Negative cases confirm that the system rejects malformed input and behaves predictably when something goes wrong.
| ID | Precondition | Steps | Expected Result |
|---|---|---|---|
| TS-FS-006 | User logged in, quota = 0 MB | 1. Attempt to upload any file | Upload button disabled, tooltip “Insufficient storage” appears |
| TS-FS-007 | User logged in | 1. Select a file with extension .exe 2. Press upload | Upload rejected, error modal “File type not allowed” |
| TS-FS-008 | User logged in | 1. Attempt to upload a 0‑byte file | System shows error “Empty file not permitted” |
| TS-FS-009 | User logged in, network throttled to 50 KB/s | 1. Start upload of 5 MB file 2. Disconnect network after 2 s | Upload fails, retry button appears, error “Network unavailable” |
| TS-FS-010 | User logged in | 1. Paste a malformed URL into share‑link field 2. Press “Create Link” | Inline validation shows “Invalid URL format” |
| TS-FS-011 | User logged in, file already exists with same name | 1. Upload notes.txt 2. Immediately upload another notes.txt without versioning | System prompts “File exists. Replace, keep both, or cancel?” |
| TS-FS-012 | User logged in, admin disabled sharing | 1. Right‑click a file → “Share” → “Create link” | Share button disabled, hover text “Sharing disabled by policy” |
Each negative case targets a specific validation layer: client‑side UI, server‑side business rule, or network guard. The expected result is an explicit error message or UI state that tells the user why the action failed.
How to Write Test Cases for File Sharing (With Examples): Boundary and Edge Cases
Boundary tests push the limits of accepted values; edge tests combine unusual states that rarely appear in everyday use but can cause failures in production.
| ID | Precondition | Steps | Expected Result |
|---|---|---|---|
| TS-FS-013 | User logged in, quota = 10.00 MB (exact) | 1. Upload a file sized exactly 10.00 MB | Upload succeeds, quota shows 0 MB remaining |
| TS-FS-014 | User logged in, quota = 10.00 MB | 1. Upload a file sized 10.01 MB | Upload rejected, error “Exceeds available quota” |
| TS-FS-015 | User logged in, file‑name length limit 255 chars | 1. Create a file name of 255 characters (all valid) 2. Upload | Upload succeeds, file name displayed fully |
| TS-FS-016 | User logged in, file‑name length limit 255 chars | 1. Create a file name of 256 characters 2. Upload | Upload rejected, error “File name too long” |
| TS-FS-017 | User logged in, system clock set to past | 1. Upload a file 2. Check file’s “modified” timestamp | Timestamp reflects upload time, not system clock (server‑side correction) |
| TS-FS-018 | User logged in, concurrent uploads | 1. Open three browser tabs 2. In each, start upload of a 3 MB file simultaneously | All three uploads complete, no data corruption, each file appears once |
| TS-FS-019 | User logged in, offline mode enabled | 1. Attempt to upload while device shows “No internet” | Upload queue shows “Pending”, retry automatically when connectivity restored |
| TS-FS-020 | User logged in, file contains Unicode emojis in name | 1. Upload file named 😀📁.txt 2. Verify download | File downloads successfully, name preserved, content unchanged |
These cases test quota boundaries, filename limits, clock handling, concurrency, offline queuing, and Unicode support—areas where defects often slip through basic functional testing.
How to Write Test Cases for File Sharing (With Examples): Performance and Load Cases
Performance testing ensures that the sharing service remains responsive under expected and peak loads. While full load tests belong in a dedicated performance suite, you can embed lightweight checks in your test case repository to catch regressions early.
| ID | Precondition | Steps | Expected Result |
|---|---|---|---|
| TS-FS-021 | User logged in, network 5 Mbps | 1. Upload ten 1 MB files sequentially 2. Measure total time | Total upload time ≤ 30 s (≈ 3 s per file) |
| TS-FS-022 | User logged in, network 50 Mbps | 1. Upload a single 100 MB file 2. Record average throughput | Throughput ≥ 4 Mbps (accounting for protocol overhead) |
| TS-FS-023 | User logged in, server at 80 % CPU | 1. Initiate upload of 5 MB file 2. Observe UI | Upload progress bar updates smoothly, no UI freeze > 200 ms |
| TS-FS-024 | User logged in, 50 concurrent users | 1. Simulate 50 users each uploading a 2 MB file via script 2. Monitor error rate | Error rate < 1 %, average latency < 5 s |
| TS-FS-025 | User logged in, after 12 h uptime | 1. Perform a single upload of 500 KB file 2. Check for memory leak indicators | No increase in server memory > 5 % over baseline, upload succeeds |
When you automate these cases, use a tool like JMeter or k6 to drive the load, but keep the test case description focused on the observable client‑side outcome (time, throughput, UI smoothness).
How to Write Test Cases for File Sharing (With Examples): Security and Privacy Cases
Security testing for file sharing covers authentication, authorization, data integrity, and leakage prevention.
| ID | Precondition | Steps | Expected Result |
|---|---|---|---|
| TS-FS-026 | User A logged in, file secret.pdf owned by A | 1. User B (different account) attempts to download via direct URL https://app/files/secret.pdf | Server returns 403 Forbidden, no file content |
| TS-FS-027 | User logged in, share link with expiration | 1. Create share link for data.zip set to expire in 5 min 2. Wait 6 min 3. Attempt download | Link returns 410 Gone or 404 Not Found |
| TS-FS-028 | User logged in, encryption‑at‑rest enabled | 1. Upload sensitive.doc 2. Retrieve raw storage object via admin API 3. Inspect bytes | Object appears encrypted (high entropy), not plaintext |
| TS-FS-029 | User logged in, audit logging enabled | 1. Delete a file 2. Query audit log for delete event | Log entry includes user ID, file ID, timestamp, action “DELETE” |
| TS-FS-030 | User logged in, ransomware‑like behavior test | 1. Attempt to upload a file with a known malicious signature (e.g., EICAR test string) 2. Observe system response | Upload blocked, antivirus alert logged, user notified |
| TS-FS-031 | User logged in, CORS misconfiguration test | 1. From external domain evil.com attempt XHR to /upload endpoint 2. Check response headers | Response lacks Access-Control-Allow-Origin: * or contains specific origin; request blocked by browser |
| TS-FS-032 | User logged in, file‑type spoofing | 1. Rename a .exe to image.jpg and upload 2. Verify server‑side validation | Server rejects based on content inspection, not extension; error “Invalid file type” |
Each case isolates a security control: access control, link expiration, encryption at rest, auditability, malicious content detection, CORS, and server‑side MIME verification.
How to Write Test Cases for File Sharing (With Examples): Accessibility and Usability Cases
Accessibility ensures that users with disabilities can perceive, operate, and understand the sharing flow. Usability checks catch friction that may not break the spec but harms adoption.
| ID | Precondition | Steps | Expected Result |
|---|---|---|---|
| TS-FS-033 | User logged in, screen reader active (NVDA) | 1. Navigate to upload page 2. Focus on drop zone 3. Activate file picker via keyboard | Screen reader announces “Drop zone, button, drag files here or click to browse” |
| TS-FS-034 | User logged in, high‑contrast mode enabled | 1. Open share‑link dialog 2. Verify text contrast ratio | All text meets WCAG AA (≥ 4.5:1) against background |
| TS-FS-035 | User logged in, keyboard‑only navigation | 1. Tab through upload form 2. Attempt to submit without selecting a file | Focus stays on file input, validation message “Please choose a file” appears |
| TS-FS-036 | User logged in, motion sensitivity | 1. Trigger an upload that initiates an animated progress bar 2. Reduce animation scale in OS settings | Animation respects reduced‑motion preference; progress still conveyed via text percentage |
| TS-FS-037 | User logged in, touch device | 1. Perform a long‑press on a file item 2. Verify context menu appears with “Share”, “Delete”, “Rename” | Menu appears, touch targets ≥ 48 dp, no accidental activation |
| TS-FS-038 | User logged in, low‑vision user | 1. Increase system font size to 200 % 2. Verify upload button label remains readable | Text scales, layout does not overflow, button remains tappable |
| TS-FS-039 | User logged in, cognitive load test | 1. Present user with upload flow containing three optional steps (add description, set expiration, notify teammates) 2. Measure time to complete | Average completion time ≤ 15 s, no more than one help tooltip triggered |
These cases exercise ARIA labels, color contrast, keyboard operability, reduced‑motion, touch target size, font scaling, and progressive disclosure—key contributors to an inclusive experience.
How to Write Test Cases for File Sharing (With Examples): Worked Test Matrix (20+ Cases)
Below is the complete test matrix that combines the examples above into a single reference table. Use this as a starting point for your own test‑case repository; you can add, remove, or rename IDs to match your project’s convention.
| ID | Type | Precondition | Steps | Expected Result | Priority | Requirement |
|---|---|---|---|---|---|---|
| TS-FS-001 | Positive | Logged in, quota ≥ 10 MB | Choose file → upload 2 MB JPEG | File listed, size correct, toast “Uploaded” | P1 | REQ-FS-01 |
| TS-FS-002 | Positive | Logged in, Wi‑Fi | Drag 50 MB MP4 → drop | Upload completes, progress 100 %, toast “Large file uploaded” | P1 | REQ-FS-02 |
| TS-FS-003 | Positive | Logged in, versioning | Upload report.docx twice | v1 and v2 accessible via dropdown | P2 | REQ-FS-03 |
| TS-FS-004 | Positive | Guest, public link | Open share link → download | File downloads, SHA‑256 matches, no auth | P1 | REQ-FS-04 |
| TS-FS-005 | Positive | Admin, quota set | Set quota 5 GB → upload 4 GB file | Upload succeeds, quota shows 1 GB | P2 | REQ-FS-05 |
| TS-FS-006 | Negative | Quota = 0 MB | Attempt upload | Button disabled, tooltip “Insufficient storage” | P1 | REQ-FS-06 |
| TS-FS-007 | Negative | Logged in | Upload .exe | Error “File type not allowed” | P1 | REQ-FS-07 |
| TS-FS-008 | Negative | Logged in | Upload 0‑byte file | Error “Empty file not permitted” | P2 | REQ-FS-08 |
| TS-FS-009 | Negative | Throttled 50 KB/s | Start upload → disconnect after 2 s | Upload fails, retry button appears | P2 | REQ-FS-09 |
| TS-FS-010 | Negative | Logged in | Paste malformed URL → create link | Inline validation “Invalid URL format” | P2 | REQ-FS-010 |
| TS-FS-011 | Negative | Logged in, versioning off | Upload notes.txt twice | Prompt “File exists. Replace, keep both, or cancel?” | P2 | REQ-FS-011 |
| TS-FS-012 | Negative | Admin disabled sharing | Right‑click → Share → Create link | Share button disabled, hover “Sharing disabled by policy” | P2 | REQ-FS-012 |
| TS-FS-013 | Boundary | Quota = 10.00 MB | Upload exactly 10.00 MB file | Upload succeeds, quota = 0 MB | P1 | REQ-FS-13 |
| TS-FS-014 | Boundary | Quota = 10.00 MB | Upload 10.01 MB file | Error “Exceeds available quota” | P1 | REQ-FS-14 |
| TS-FS-015 | Boundary | Filename limit 255 | Upload 255‑char name | Upload succeeds, name displayed fully | P2 | REQ-FS-15 |
| TS-FS-016 | Boundary | Filename limit 255 | Upload 256‑char name | Error “File name too long” | P2 | REQ-FS-16 |
| TS-FS-017 | Edge | System clock past | Upload file → check timestamp | Timestamp reflects upload time (server‑corrected) | P3 | REQ-FS-17 |
| TS-FS-018 | Edge | Concurrent uploads | Three tabs × 3 MB upload | All complete, no corruption | P2 | REQ-FS-18 |
| TS-FS-019 | Edge | Offline mode | Attempt upload while offline | Queue shows “Pending”, auto‑retry on reconnect | P2 | REQ-FS-19 |
| TS-FS-020 | Edge | Unicode name | Upload 😀📁.txt | Download succeeds, name preserved | P2 | REQ-FS-20 |
| TS-FS-021 | Performance | 5 Mbps network | Upload ten 1 MB files sequentially | Total time ≤ 30 s | P2 | REQ-FS-21 |
| TS-FS-022 | Performance | 50 Mbps network | Upload 100 MB file | Throughput ≥ 4 Mbps | P2 | REQ-FS-22 |
| TS-FS-023 | Performance | Server 80 % CPU | Upload 5 MB file | Progress bar smooth, UI freeze < 200 ms | P3 | REQ-FS-23 |
| TS-FS-024 | Performance | 50 concurrent users | Scripted 2 MB uploads | Error rate < 1 %, latency < 5 s | P1 | REQ-FS-24 |
| TS-FS-025 | Performance | 12 h uptime | Upload 500 KB file | Memory increase < 5 %, upload succeeds | P3 | REQ-FS-25 |
| TS-FS-026 | Security | User A owns file | User B attempts direct download | 403 Forbidden | P1 | REQ-FS-26 |
| TS-FS-027 | Security | Expiring link | Create link 5 min → wait 6 min → download | 410 Gone / 404 Not Found | P1 | REQ-FS-27 |
| TS-FS-028 | Security | Encryption‑at‑rest | Upload → inspect raw storage | Object appears encrypted (high entropy) | P2 | REQ-FS-28 |
| TS-FS-029 | Security | Audit logging | Delete file → query audit log | Log entry includes user, file ID, timestamp, DELETE | P2 | REQ-FS-29 |
| TS-FS-030 | Security | Malicious content | Upload EICAR test string | Upload blocked, antivirus alert, user notified | P1 | REQ-FS-30 |
| TS-FS-031 | Security | CORS test | External domain XHR to /upload | Response lacks wildcard ACAO, request blocked | P2 | REQ-FS-31 |
| TS-FS-032 | Security | MIME sniffing | Rename .exe to .jpg → upload | Server rejects based on content, error “Invalid file type” | P2 | REQ-FS-32 |
| TS-FS-033 | Accessibility | Screen reader | Focus drop zone → keyboard file picker | Announces “Drop zone, button, drag files here or click to browse” | P2 | REQ-FS-33 |
| TS-FS-034 | Accessibility | High‑contrast mode | Open share‑link dialog | Text contrast ≥ 4.5:1 | P2 | REQ-FS-34 |
| TS-FS-035 | Accessibility | Keyboard‑only | Tab through form → submit without file | Validation message “Please choose a file” | P2 | REQ-FS-35 |
| TS-FS-036 | Accessibility | Reduced motion | Animate progress → reduce OS animation scale | Animation respects setting, progress shown via text | P3 | REQ-FS-36 |
| TS-FS-037 | Accessibility | Touch device | Long‑press file item | Context menu appears, targets ≥ 48 dp | P2 | REQ-FS-37 |
| TS-FS-038 | Accessibility | Font scaling 200 % | Increase font size → verify upload button | Text scales, layout intact, button tappable | P2 | REQ-FS-38 |
| TS-FS-039 | Usability | Cognitive load | Three optional steps in upload flow | Avg completion ≤ 15 s, ≤ 1 help tooltip | P3 | REQ-FS-39 |
How to read the table
- Type groups the case into Positive, Negative, Boundary, Edge, Performance, Security, Accessibility, or Usability.
- Priority follows a simple P1/P2/P3 scheme where P1 is “must run on every build”, P2 is “run nightly or on release candidates”, and P3 is “run weekly or before major changes”.
- Requirement links each case to a traceable artifact (user story, spec clause, or design document).
You can import this CSV into most test‑management tools (Zephyr, TestRail, Xray) and then generate automation skeletons directly from the ID and steps columns.
How to Write Test Cases for File Sharing (With Examples): Prioritization and Traceability
A large test suite can become unwieldy if you treat every case equally. Prioritization ensures that the most critical paths receive frequent execution while lower‑risk scenarios are validated less often but still retained for regression.
Prioritization matrix (impact vs. likelihood)
| Impact \ Likelihood | High | Medium | Low |
|---|---|---|---|
| High | P1 (run on every commit) | P1/P2 (run nightly) | P2 (run weekly) |
| Medium | P1/P2 | P2 | P3 (run pre‑release) |
| Low | P2 | P3 | P3 (run monthly) |
To assign a priority, ask:
- *What is the business impact if this fails?* (data loss, security breach, compliance violation → High)
- *How likely is the defect to appear given current code churn?* (frequently touched upload logic → High, rarely changed quota logic → Low)
Plot each test case on the matrix; the resulting quadrant gives you a baseline priority. Adjust based on release risk (e.g., a upcoming GDPR audit may bump all security‑related cases to P1).
Traceability
Maintain a bidirectional link:
- From requirement to test case(s): store the Requirement ID in the test case field (as shown in the matrix).
- From test case to requirement: generate a report that lists all test cases covering a given requirement ID; empty lists reveal gaps.
Many test‑management platforms support custom fields for “Requirement ID” and can auto‑generate a coverage heatmap. If you use a lightweight approach, keep a simple spreadsheet with two sheets: *Requirements* (ID, description, source) and *Test Cases* (ID, steps, linked Requirement IDs). Use VLOOKUP or Power Query to detect orphaned entries.
How to Write Test Cases for File Sharing (With Examples): Combining Designed Cases with Autonomous Exploration
Manual test‑case design gives you deterministic coverage of known risks, but production systems often exhibit behaviors that only appear under unpredictable user patterns. Autonomous exploration tools can complement your suite by exercising the application without pre‑written scripts, surfacing edge cases that were not anticipated during requirement drafting.
How it works
An autonomous QA agent (e.g., the SUSATest platform) starts from a known entry point (login page or API endpoint) and then systematically interacts with the UI: tapping buttons, scrolling lists, typing into fields, handling dialogs, and following navigation paths. The agent builds a state graph of visited screens and transitions, logging any crashes, ANRs, or validation failures. Because it explores with multiple personas (curious, impatient, novice, adversarial, elderly, accessibility‑focused, power user), it can discover issues such as:
- A share‑link dialog that becomes inaccessible when the user zooms the page to 200 % (accessibility persona).
- A race condition where rapid successive uploads from an impatient persona overwhelm the upload queue, causing silent file drops.
- An adversarial persona that attempts to upload a file with a pathological name (e.g., many
../sequences) and triggers a path‑traversal error that was missed in the negative test set.
When the agent finishes a run, it exports the discovered flows as reproducible scripts—Appium for Android native apps and Playwright for web interfaces. You can then add those scripts to your regression suite, assigning them a P2 priority because they represent *learned* risks rather than *specified* ones.
Practical steps to integrate
- Baseline run – Point the agent at your staging URL or upload an APK. Allow it to explore for 15‑20 minutes; capture the video and the generated test scripts.
- Triaging – Review the agent’s output: flag any new crash or validation failure that does not map to an existing test case. For each, create a manual test case using the structure from Section 2, then automate using the exported script as a starting point.
- Feedback loop – Add the newly created test case IDs to your test‑management tool, link them to the relevant requirement (or create a new “exploratory‑found” requirement tag), and schedule them in the next release cycle.
- Continuous learning – Enable cross‑session learning so the agent remembers previously visited dead ends; each subsequent run becomes smarter and
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