How to Write Test Cases for Screen Sharing (With Examples)

How to Write Test Cases for Screen Sharing (With Examples)

June 17, 2026 · 19 min read · How-To Guides

How to Write Test Cases for Screen Sharing (With Examples)

Screen sharing is a feature that lets a user broadcast the contents of their display—or a selected window—to one or more remote participants in real time. It appears in video‑conferencing apps, remote‑support tools, collaborative whiteboards, and live‑streaming platforms. Because the interaction touches the operating system’s graphics stack, network stack, permission model, and UI layer, defects can surface as crashes, black frames, lag, permission prompts that never disappear, or accessibility barriers. Writing high‑signal test cases for screen sharing therefore requires a clear understanding of the feature’s contracts, the environments in which it runs, and the ways users actually invoke it.

This guide walks you through a complete process: from dissecting the feature into test‑able units, to crafting positive, negative, edge, and boundary cases, to organizing them in a traceable matrix, to prioritizing effort, and finally to augmenting manual design with autonomous exploration. Each section contains concrete examples, a ready‑to‑use test table, and snippets you can copy into your test repository. By the end you will have a repeatable method for building screen‑sharing test suites that catch both obvious regressions and the subtle production‑only bugs that evade scripted checks.

Understanding Screen Sharing Functionality

Before writing any test case you must know what the system under test (SUT) promises to do. Screen sharing typically involves three logical phases:

  1. Initiation – the user selects a share source (entire screen, application window, or browser tab) and confirms the action, often after granting a system‑level capture permission.
  2. Transmission – the captured frames are encoded, packetized, and sent over a network channel (WebRTC, RTMP, proprietary SDK) to one or more receivers.
  3. Rendering – the remote participant decodes the stream and paints it into a view, optionally with controls for pausing, stopping, or annotating.

Each phase yields observable outcomes that can be verified: correct UI state, permission dialog handling, frame integrity, latency bounds, and resource consumption. Identify the requirements that govern these outcomes—often found in product specifications, API contracts, or accessibility guidelines (WCAG 2.1 AA for contrast and keyboard operability). For example, a requirement might state: “When the user clicks ‘Share Screen’, the system must display the OS permission prompt within 2 seconds and, upon user approval, begin transmitting frames at no less than 10 fps.” Such a statement becomes the basis for a test case.

Next, enumerate the variables that affect behavior:

By listing these dimensions you create a combinatorial space that drives the selection of test cases. Not every permutation needs a dedicated script; instead, you apply equivalence partitioning and boundary value analysis to pick representative values that maximize defect detection while keeping the suite maintainable.

Anatomy of a Good Test Case

A test case is more than a list of steps; it is a contract between the tester and the system. A well‑structured case contains the following fields:

FieldPurposeExample
IDUnique identifier for traceability (e.g., TS‑SS‑001)TS‑SS‑001
TitleShort, readable summaryVerify screen sharing starts when permission is granted
PreconditionsState that must be true before executionUser is logged in, no active share, OS permission prompt not shown
StepsOrdered actions the tester performs1. Click “Share Screen”. 2. Select “Entire Screen”. 3. Click “Allow” in OS prompt
Expected ResultObservable outcome that determines pass/failSharing toolbar appears, remote participant sees live screen within 3 s
PostconditionsState left after test (useful for chaining)Share session active, permission granted flag set
PriorityRelative importance (P0‑P3)P0
Requirement IDLink to spec or user storyREQ‑SS‑07
TagsCategorization for filtering (e.g., smoke, regression, accessibility)smoke, accessibility

When you write steps, use imperative mood and avoid ambiguity. Instead of “check that the video looks okay”, say “verify that the remote view updates at least once every 200 ms (5 fps) for a period of 10 seconds”. Quantifiable expectations reduce guesswork and make automation easier.

Keep each test case focused on a single verification point. If you find yourself needing to assert multiple unrelated outcomes, split the case. This practice improves fault isolation: when a test fails, you know exactly which contract broke.

Positive Test Cases for Screen Sharing

Positive cases validate that the feature works as intended under normal conditions. Below is a representative set; you can expand it based on your product’s specific flows.

IDPreconditionsStepsExpected Result
TS‑SS‑001User logged in, no active share, OS not showing permission prompt1. Open share menu. 2. Choose “Entire Screen”. 3. Click system “Allow” prompt.Sharing toolbar appears; remote view shows live screen within 3 s.
TS‑SS‑002Same as TS‑SS‑0011. Open share menu. 2. Choose “Application Window”. 3. Select a non‑minimized window (e.g., Notepad). 4. Click “Allow”.Only the selected window’s content is transmitted; other desktop areas are obscured.
TS‑SS‑003User logged in, share active, remote participant connected1. While sharing, click “Pause” on toolbar. 2. Wait 5 s. 3. Click “Resume”.Remote view freezes on pause, resumes live update after resume; no crash.
TS‑SS‑004User logged in, share active, network Wi‑Fi1. Start share. 2. Simulate 150 ms latency via traffic‑shaping tool. 3. Observe for 20 s.Frame rate stays ≥ 8 fps; no noticeable stutter reported by remote user.
TS‑SS‑005User logged in, share active, accessibility mode enabled (screen reader)1. Start share. 2. Navigate share toolbar using Tab key. 3. Activate “Stop Share” via Enter.Screen reader announces each toolbar button; Stop Share ends session and announces “Screen sharing stopped”.
TS‑SS‑006User logged in, no active share, OS permission previously denied1. Open share menu. 2. Choose “Entire Screen”. 3. System shows permission prompt (already denied). 4. Click “Allow” (if OS allows re‑prompt) or note that sharing fails gracefully.If OS permits re‑prompt, sharing starts; otherwise, an inline error toast appears: “Screen capture permission required”.
TS‑SS‑007User logged in, share active, multiple receivers1. Start share. 2. Have three remote peers join. 3. Verify each receives identical frame timestamp within 100 ms.All peers see synchronized video; no divergence > 100 ms.
TS‑SS‑008User logged in, share active, device orientation change (mobile/tablet)1. Start share in portrait. 2. Rotate device to landscape. 3. Observe for 5 s.Shared content adapts to new orientation without black bars or cropping; remote view updates instantly.
TS‑SS‑009User logged in, share active, annotate tool enabled1. Start share. 2. Select pen tool, draw a line. 3. Clear annotation.Line appears in remote view in real time; clearing removes it for all participants.
TS‑SS‑010User logged in, share active, low‑bandwidth simulation (50 kbps)1. Start share. 2. Apply bandwidth limit. 3. Observe for 30 s.Sharing degrades gracefully to ≤ 2 fps but does not disconnect; remote view shows placeholder “low bandwidth” indicator.
TS‑SS‑011User logged in, share active, incoming call (VoIP)1. Start share. 2. Receive an incoming call. 3. Accept call while share continues.Share continues uninterrupted; call audio mixes; remote view remains stable.
TS‑SS‑012User logged in, share active, system sleep triggered1. Start share. 2. Wait for OS to initiate sleep (set timer to 30 s). 3. Wake device via power button.Sharing pauses automatically on sleep; resumes after wake with no data loss; remote view shows frozen frame then resumes.
TS‑SS‑013User logged in, share active, multiple monitors1. Start share. 2. Choose “Screen 2” (secondary monitor). 3. Drag a window from Screen 1 to Screen 2 during share.Remote view shows content only from Screen 2; window movement on Screen 2 is reflected; Screen 1 changes are ignored.
TS‑SS‑014User logged in, share active, recording enabled1. Start share with local recording toggle on. 2. Share for 10 s. 3. Stop share and locate recording file.File exists, contains captured frames with audio (if enabled), playable without corruption.
TS‑SS‑015User logged in, share active, keyboard shortcut used1. Ensure shortcut Ctrl+Shift+S is mapped to “Start/Stop Share”. 2. Press shortcut. 3. Press again to stop.Share starts on first press, stops on second; toolbar reflects state; no extra clicks needed.
TS‑SS‑016User logged in, share active, permissions revoked mid‑session (Android/iOS)1. Start share. 2. Go to OS settings and revoke “Screen Capture” permission. 3. Observe.Sharing stops immediately; a toast informs user “Screen capture permission denied”; remote view shows last frame then placeholder.
TS‑SS‑017User logged in, share active, hovering over toolbar tooltip1. Start share. 2. Hover mouse over each toolbar button for 2 s.Tooltip appears with concise description (e.g., “Pause sharing”).
TS‑SS‑018User logged in, share active, right‑click context menu on shared area1. Start share. 2. Right‑click inside the shared view (remote participant). 3. Verify menu options (e.g., “Save image”, “Copy”).Context menu appears with relevant actions; selecting an action performs expected function.
TS‑SS‑019User logged in, share active, concurrent file download1. Start share. 2. Initiate large file download in background. 3. Monitor share for 20 s.Share maintains ≥ 5 fps; download proceeds; no buffer underrun errors.
TS‑SS‑020User logged in, share active, end‑to‑end encryption enabled1. Start share with E2EE toggle on. 2. Verify that encryption handshake completes (log shows TLS 1.3). 3. Share for 15 s.No plain‑frame data visible in network sniffers; remote view decrypts and displays correctly.

These twenty cases cover the core happy‑path, typical interruptions, accessibility, multi‑monitor, recording, and security aspects. Adjust the IDs, preconditions, and expected results to match your product’s terminology and requirement numbers.

Negative and Invalid Input Test Cases

Negative cases verify that the system handles erroneous or unexpected input gracefully, without crashing or leaking data. They also confirm that improper states are blocked early.

IDPreconditionsStepsExpected Result
TS‑SS‑N01User logged in, no active share1. Attempt to start share while OS permission dialog is already shown for another app (e.g., a different screen‑capture tool). 2. Click “Allow” in the existing prompt.Share does not start; an inline message appears: “Another app is using screen capture; please close it or try later”.
TS‑SS‑N02User logged in, share active1. While sharing, attempt to start a second share session from the same instance (e.g., click “Share Screen” again).Second share request is ignored or blocked; UI shows toast: “Already sharing screen”.
TS‑SS‑N03User logged in, no active share1. Open share menu. 2. Rapidly click “Share Screen” ten times within 1 second.Only one share session initiates; no duplicate toolbars or crashes.
TS‑SS‑N04User logged in, share active1. Simulate a corrupted frame injection (e.g., via MITM tool that flips random bits in video packets). 2. Observe for 5 s.Remote view shows visual artifact or freeze but does not crash the sharing component; error is logged and recoverable after next keyframe.
TS‑SS‑N05User logged in, share active1. Disable network interface completely while sharing. 2. Wait 10 s. 3. Re‑enable network.Sharing pauses; after network returns, sharing resumes automatically or prompts user to reconnect; no data corruption.
TS‑SS‑N06User logged in, share active (mobile)1. Start share. 2. Lock device screen (press power button). 3. Unlock after 5 s.Sharing stops on lock; upon unlock, sharing does not auto‑restart unless user explicitly resumes; a notification informs user that sharing was stopped.
TS‑SS‑N07User logged in, share active1. Attempt to share a window that is minimized or hidden (e.g., a background service UI).Share menu grays out the minimized window; selecting it does nothing or shows tooltip: “Cannot share minimized window”.
TS‑SS‑N08User logged in, share active1. Change system DPI/scaling to 200 % while sharing. 2. Observe for 10 s.Shared content scales correctly; remote view does not appear stretched or clipped; UI elements remain readable.
TS‑SS‑N09User logged in, share active1. Open developer console and set video bitrate to an impossibly low value (e.g., 10 bps). 2. Observe.Sharing either rejects the value with validation error or defaults to minimum supported bitrate; stream does not break.
TS‑SS‑N10User logged in, share active1. Simulate a sudden CPU spike (run a stress‑test app at 100 % usage). 2. Observe share for 15 s.Frame rate may drop but sharing component does not crash; recovery occurs when load decreases; logs show “encoder overload”.
TS‑SS‑N11User logged in, no active share1. Attempt to start share via accessibility API without user gesture (programmatic call).OS or browser blocks the call; sharing does not start; security error logged.
TS‑SS‑N12User logged in, share active1. While sharing, change the system theme to high contrast. 2. Verify toolbar contrast.Toolbar meets WCAG AA contrast ratio (≥ 4.5:1) in high‑contrast mode; no loss of functionality.
TS‑SS‑N13User logged in, share active1. Attempt to share a DRM‑protected video playback window (e.g., Netflix).Share either blacks out the protected region or shows a placeholder; no copy of protected content is transmitted.
TS‑SS‑N14User logged in, share active1. Simulate packet loss of 5 % via network tool. 2. Observe for 20 s.Sharing continues with occasional freeze or blur; no disconnect; PLC (packet loss concealment) mitigates visual impact.
TS‑SS‑N15User logged in, share active1. Attempt to start share while another participant is already sharing their screen and the app only allows one share at a time.Second share request is denied with message: “Only one screen share allowed per session”.
TS‑SS‑N16User logged in, share active1. Rotate device rapidly (multiple 90° turns) while sharing. 2. Observe for 10 s.Share handles orientation changes without tearing; remote view updates correctly after each turn.
TS‑SS‑N17User logged in, share active1. Open OS accessibility settings and enable “Reduce Motion”. 2. Verify that any animated toolbar transitions respect the setting.Animations are disabled or reduced; no motion‑sickness triggers.
TS‑SS‑N18User logged in, share active1. Simulate a sudden change in audio sample rate while sharing audio‑with‑screen. 2. Observe.Audio stream gracefully resamples or drops frames; no crash; continuity maintained.
TS‑SS‑N19User logged in, share active1. Attempt to share a virtual machine’s console window that is hosted inside a nested hypervisor.Share captures the VM window correctly; no hypervisor conflict; performance remains within expected bounds.
TS‑SS‑N20User logged in, share active1. Leave share running for 12 hours (soak test). 2. Periodically check memory usage and frame drops.Memory growth stays within ≤ 50 MB; no crashes; frame rate remains above 5 fps after initial warm‑up.

These negative cases stress error handling, resource limits, concurrency restrictions, and platform‑specific safeguards. They often surface defects that only appear under load or when the system is pushed outside its nominal envelope.

Edge and Boundary Test Cases

Edge cases explore the limits of input domains, state transitions, and timing windows. Boundary cases focus on values just inside and just outside acceptable ranges.

IDPreconditionsStepsExpected Result
TS‑SS‑E01User logged in, no active share1. Attempt to start share with zero‑second delay after login (immediate).Share initiates successfully; no race condition with auth token refresh.
TS‑SS‑E02User logged in, share active1. Set share frame rate to the minimum supported value (e.g., 5 fps). 2. Verify remote view updates at ≥ 4 fps.Stream respects minimum; no forced upscale causing excessive CPU.
TS‑SS‑E03User logged in, share active1. Set share frame rate to the maximum supported value (e.g., 60 fps). 2. Verify remote view does not exceed device’s refresh rate.Stream caps at hardware limit; no dropped frames due to overload.
TS‑SS‑E04User logged in, share active1. Share a window whose dimensions are 1 × 1 pixel (minimum possible). 2. Verify remote view shows a single pixel.Sharing works; remote view displays a 1 × 1 region (may be upscaled for visibility).
TS‑SS‑E05User logged in, share active1. Share a window that spans the full virtual desktop across multiple monitors (e.g., 7680 × 2160). 2. Verify remote view scales without clipping.Sharing handles ultra‑wide resolution; remote view shows full canvas, possibly letterboxed if aspect ratio mismatched.
TS‑SS‑E06User logged in, share active1. Begin share, then immediately lock workstation (Win+L) and wait 2 s, then unlock.Share pauses on lock; resumes after unlock with no lost frames; remote view shows freeze then continuation.
TS‑SS‑E07User logged in, share active1. Change system time zone while sharing (e.g., from PST to EST). 2. Observe timestamps in any embedded clock overlay.Overlay updates to reflect new zone; no discontinuity in media timestamps.
TS‑SS‑E08User logged in, share active1. Set network jitter to 200 ms (random delay) while sharing. 2. Observe for 30 s.Playback buffer absorbs jitter; occasional freeze ≤ 1 frame; no disconnect.
TS‑SS‑E09User logged in, share active1. Enable “Share computer audio” toggle. 2. Play a 20 kHz tone (near Nyquist limit). 3. Verify remote audio reproduces tone without aliasing.Audio pipeline preserves high frequency; no distortion beyond expected codec limits.
TS‑SS‑E10User logged in, share active1. Disable all video codecs except a legacy one (e.g., H.263). 2. Start share. 3. Verify connection falls back gracefully.Sharing uses fallback codec; remote view shows video albeit lower quality; no failure to connect.
TS‑SS‑E11User logged in, share active1. Rotate device through all four orientations in rapid succession (portrait → landscape → reverse portrait → reverse landscape) within 2 seconds. 2. Observe.Sharing updates orientation each time; no tearing; remote view aligns correctly after each change.
TS‑SS‑E12User logged in, share active1. Set screen resolution to a non‑standard value (e.g., 1280 × 720 on a 1080p monitor). 2. Start share. 3. Verify remote view matches logical resolution.Sharing respects the logical framebuffer size; no stretching or black bars added by OS.
TS‑SS‑E13User logged in, share active1. Simulate a DNS resolution failure for the signaling server mid‑share. 2. Observe for 10 s.Sharing continues using existing ICE candidates; signaling loss does not tear down media path; reconnection attempts logged.
TS‑SS‑E14User logged in, share active1. Change the default audio output device while sharing audio‑with‑screen. 2. Verify audio continues on new device.Audio stream switches without click or drop; latency stays within expected bounds.
TS‑SS‑E15User logged in, share active1. Launch a second instance of the app under a different user account (fast user switching). 2. Attempt to start share from the background instance.Background instance is blocked from accessing capture devices; foreground instance continues unaffected.
TS‑SS‑E16User logged in, share active1. Set power plan to “Battery saver” (Windows) or Low Power Mode (macOS/iOS). 2. Start share. 3. Observe for 10 min.Sharing remains active; frame rate may be reduced to conserve power but does not drop below usable threshold (e.g., 4 fps).
TS‑SS‑E17User logged in, share active1. Open OS accessibility magnifier (zoom to 200 %). 2. Start share. 3. Verify remote view shows un‑magnified content (as per spec).Sharing captures the logical screen, not the magnified view; remote user sees actual UI at 1× scale.
TS‑SS‑E18User logged in, share active1. Simulate a Bluetooth audio device disconnect while sharing audio‑with‑screen. 2. Observe for 5 s.Audio falls back to default device; no crash; user notified of audio route change.
TS‑SS‑E19User logged in, share active1. Attempt to share a window that is set to “Always on Top” and has WS_EX_LAYERED style. 2. Verify remote view includes the layered content correctly.Sharing captures layered windows; remote view shows translucent or shaped regions as intended.
TS‑SS‑E20User logged in, share active1. Leave share idle (no UI changes) for 1 hour. 2. Periodically check for memory leaks via profiling tool.Memory growth stays within ≤ 20 MB; no increasing GDI/handle leaks.

These cases push the system to its limits—minimum/maximum values, rapid state flips, unusual configurations, and resource‑constrained modes. They often reveal bugs in encoder configuration, resolution scaling, permission re‑prompt logic, or power‑management interactions that would stay hidden in typical functional testing.

Data Setup and Environment Preparation

Reliable test execution depends on reproducible data and a controlled environment. For screen sharing you need:

  1. User accounts – at least two distinct accounts (sender and receiver) to verify end‑to‑end flow. If your app supports guest links, create a temporary guest token.
  2. Devices/VMs – a matrix covering the OS/browser combinations you intend to support. Use virtualization (VMware, VirtualBox, Hyper‑V) for desktop OS, and real devices or emulators for mobile.
  3. Network conditioning toolstc on Linux, Network Link Conditioner on macOS, Clumsy on Windows, or cloud‑based throttling (e.g., AWS Toxiproxy) to simulate latency, jitter, packet loss, and bandwidth limits.
  4. Permission simulators – scripts that toggle OS-level screen‑capture grants via adb shell appops set (Android), tccutil reset (macOS), or registry changes (Windows). For web browsers, use the navigator.mediaDevices.getUserMedia prompt and accept/deny via test harness.
  5. Frame capture verification – a lightweight receiver that logs timestamps, frame size, and optionally computes PSNR against a known source (e.g., a scrolling color bar). Tools like ffprobe, gst-launch-1.0, or a custom WebRTC stats collector work.
  6. Accessibility validators – axe-core, pa11y, or platform‑specific accessibility inspectors to confirm WCAG compliance of share UI.
  7. Logging and tracing – enable verbose logs from the SUT (often via a debug flag or environment variable) to capture encoder decisions, permission state changes, and network events. Centralize logs with ELK or a simple file aggregator for post‑run analysis.

A typical CI pipeline step might look like this:


# Install SUSA agent for autonomous exploration (optional)
pip install susatest-agent

# Start emulator with API level 33
emulator -avd Pixel_4_API33 -no-window &

# Install app under test
adb install -r app-release.apk

# Launch SUSA in exploratory mode
susatest explore \
  --app-id com.example.screenShare \
  --personas curious impatient accessibility \
  --output ./susartifacts/run_$(date +%s) \
  --max-depth 5 \
  --network-profile "lte"

The command above installs the SUSA CLI, boots an Android emulator, installs the APK, and runs an autonomous session that exercises screen sharing while simulating an LTE network. The artifacts folder contains screenshots, logs, and generated Appium scripts you can later add to your regression suite.

For web‑based screen sharing, a Playwright test harness can condition the network:


import { test, expect } from '@playwright/test';

test.describe('Screen sharing – positive flow', () => {
  test.use({ viewport: { width: 1280, height: 720 } });

  test('starts sharing when permission granted', async ({ page }) => {
    await page.goto('https://app.example.com/meeting');
    await page.click('button#share-screen');
    // Handle the browser permission dialog
    await page.waitForFunction(() => 
      navigator.mediaDevices.getUserMedia !== undefined);
    await page.click('text=Allow'); // custom selector for the OS prompt
    const toolbar = await page.locator('div#share-toolbar');
    await expect(toolbar).toBeVisible({ timeout: 5000 });
    const remoteView = await page.locator('video#remote-stream');
    // Expect at least one frame within 3 seconds
    await expect(remoteView).toHaveAttribute('readyState', '>= 2', { timeout: 3000 });
  });
});

This snippet demonstrates how to automate the happy‑path using Playwright, including handling the OS‑level permission prompt via a custom selector (you may need to use the page.evaluate hook to interact with native dialogs depending on the browser).

Prioritization and Traceability to Requirements

Not all test cases carry equal weight. Use a simple risk‑based matrix that plots Impact (how severe a failure would be) against Likelihood (how probable the defect is given code complexity and historical data). Assign each test case a priority label (P0‑P3) accordingly.

PriorityImpactLikelihoodTypical Cases
P0Crash, data loss, security breach, major UX blockerHighPermission handling, encoder crash, black‑screen on start, denial‑of‑service via malformed input
P1Noticeable degradation (lag, low FPS), accessibility violation, intermittent flakinessMediumFrame‑rate boundaries, network throttling, UI contrast, keyboard navigation
P2Cosmetic issue, minor inconvenience, edge‑case rarely hit in productionLowTooltip text, rare orientation change, specific DPI scaling
P3Nice‑to‑have, experimental feature, low‑risk validationVery lowLong‑run soak, legacy codec fallback, obscure window style

Link each test case to a requirement identifier from your specification document. For example:

Test IDRequirement IDRequirement Statement
TS‑SS‑001REQ‑SS‑07“When the user clicks ‘Share Screen’ and grants OS permission, the sharing toolbar must appear within 2 seconds and the remote participant must see live content within 3 seconds.”
TS‑SS‑N02REQ‑SS‑12“The system must prevent initiation of a second concurrent screen‑share session from the same client instance.”
TS‑SS‑E04REQ‑SS‑03“Screen sharing must support a minimum capture region of 1 × 1 pixel without causing encoder failure.”
TS‑SS‑E09REQ‑SS‑19“If the ‘Share computer audio’ option is enabled, audio frequencies up to 20 kHz must be transmitted with ≤ 3 dB attenuation.”

Maintain a traceability matrix (like the table above) in a spreadsheet

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