How to Write Test Cases for Voice Messages (With Examples)

How to Write Test Cases for Voice Messages (With Examples):

January 14, 2026 · 15 min read · How-To Guides

How to Write Test Cases for Voice Messages (With Examples):

This guide gives you a complete, practical method for creating high‑value test cases for voice‑message features in mobile or web applications. You will learn the anatomy of a test case, how to derive positive, negative, edge, and boundary scenarios, how to set up test data, prioritize effort, and trace each case to requirements. A worked matrix of 20+ concrete examples is provided, followed with a checklist and a short takeaway section you can bookmark for future reference.

How to Write Test Cases for Voice Messages (With Examples) – Test Case Anatomy

A test case is a structured artifact that tells a tester *what* to do, *under what conditions*, and *what to expect*. For voice messages the artifact must capture audio‑specific dimensions such as file format, duration, encoding, and transmission path.

Elements of a test case

ElementDescriptionVoice‑message specific notes
IDUnique identifier (e.g., VM‑001)Use a prefix that indicates the feature area
TitleShort, readable summary“User can record and send a 5‑second voice note”
PreconditionsState that must exist before executionApp installed, microphone permission granted, user logged in, network available
StepsOrdered actions to perform1. Open chat, 2. Tap voice‑record button, 3. Speak for 5 s, 4. Release button, 5. Confirm send
Test dataValues or files used as inputSample audio file, duration value, file size limit
Expected resultObservable outcome after stepsVoice note appears in conversation, playable, correct waveform displayed
Post‑conditionsState after test (optional)Voice note stored on server, notification sent to recipient
TagsLabels for filteringpositive, boundary, security, accessibility

When you write the steps, use imperative verbs and keep each action atomic. Avoid bundling multiple UI interactions into a single step; this makes failures easier to locate. For voice messages, include a step that explicitly checks the audio payload (e.g., “Verify that the uploaded file is a valid Opus‑encoded .ogg file”).

Writing steps for voice interactions

Because voice input is temporal, you must specify how the tester will produce the audio. Options:

Document the exact method in the “Steps” column so that another engineer can reproduce the test without ambiguity.

Expected result details

For voice messages the expected result often has multiple facets:

  1. UI – the message bubble appears, waveform or play button is shown.
  2. Metadata – duration, timestamp, sender ID are correct.
  3. Media – the file can be downloaded, played back without distortion, and matches the original input (bit‑for‑bit or perceptually similar).
  4. Side effects – push notification sent, recipient sees unread badge, storage quota updated.

List each facet as a bullet under “Expected result” to avoid missing any during execution.

How to Write Test Cases for Voice Messages (With Examples) – Positive Test Cases

Positive tests verify that the happy path works as intended. They form the baseline confidence that the core voice‑message flow is functional.

Successful recording and sending

  1. Navigate to a one‑on‑one chat with User B.
  2. Press and hold the voice‑record button.
  3. Speak the phrase “Positive test message” for approximately three seconds.
  4. Release the button.
  5. Tap the send icon that appears.

Playback controls

  1. Tap the voice‑message bubble to open the playback UI.
  2. Press the play button.
  3. After two seconds, press the pause button.
  4. Press the seek bar to jump to five seconds.
  5. Press play again.

Receiving and downloading

  1. User B comes online and opens the chat.
  2. Wait for the message to appear (may require pull‑to‑refresh).
  3. Tap the download icon (if the app does not auto‑download).

These three cases cover the core loop: record → send → receive → play. They are usually automated first because they have deterministic outcomes.

How to Write Test Cases for Voice Messages (With Examples) – Negative and Invalid Input Cases

Negative tests confirm that the app handles erroneous conditions gracefully, without crashing or corrupting data.

Missing microphone permission

  1. Open a chat and tap the voice‑record button.

Exceeding maximum file size

  1. Use adb to push the 300 KB file to /sdcard/Download/big.ogg.
  2. In the chat, choose “Attach file” → select the big.ogg file as a voice message (if the UI allows file attachment for voice).

Unsupported file format

  1. Start recording.
  2. While recording, rename the temporary file on the filesystem to .txt (using a root shell or a test harness that can intercept the file‑file:///

(If the app writes, you may attempt to send after recording.)

Expected result:

Network loss during upload

  1. Begin recording a five‑second message.
  2. After two seconds of recording, disable Wi‑Fi (or enable airplane mode).
  3. Finish recording and attempt to send.

These negative cases protect against common failure modes: permission problems, size limits, format mismatches, and intermittent connectivity.

How to Write Test Cases for Voice Messages (With Examples) – Edge and Boundary Cases

Edge cases push the system to its limits, often revealing bugs that only appear under unusual but realistic conditions.

Zero‑duration (tap‑and‑release instantly)

  1. Tap the voice‑record button and release it immediately (less than 0.1 s).

Maximum allowed duration

  1. Press and hold the record button.
  2. Speak continuously for 60 seconds (use a metronome app to keep steady speech).
  3. Release the button exactly at 60 s.

Exceeding maximum duration

  1. Record for 65 seconds (continue speaking after the UI indicates limit).

Silent audio (noise floor)

  1. Cover the microphone with a finger to produce near‑silence.
  2. Record for three seconds.
  3. Send the message.

Background noise and music

  1. Record a spoken phrase while music continues.
  2. Send the message.

Concurrent recordings (fast double‑tap)

  1. Tap the record button twice in quick succession (< 200 ms between taps).

Interrupt handling (incoming call)

  1. Start recording a voice message.
  2. After two seconds, simulate an incoming call (using adb shell am broadcast -a android.intent.action.PHONE_STATE).
  3. End the call.

Locale‑specific characters in voice‑message transcription (if applicable)

  1. Record a phrase containing kana and kanji: “こんにちは、テストです”.
  2. Send the message.

These edge cases help you uncover timing, resource, and concurrency bugs that often slip through basic positive/negative suites.

How to Write Test Cases for Voice Messages (With Examples) – Data Setup and Test Environment

Reliable voice‑message testing depends on reproducible audio artifacts and controlled device states.

Generating test audio files

Use command‑line tools to create predictable files:


# 1‑second silent PCM wav (16‑bit, 44.1kHz)
silence=$(ffmpeg -f lavfi -i anullsrc=r=44100:cl=mono -t 1 -qscale:a 0 -ar 44100 -ac 1 -f wav silence.wav 2>/dev/null)

# 5‑second sine wave at 440 Hz (A4)
ffmpeg -f lavfi -i "sine=frequency=440:duration=5" -ar 44100 -ac 1 -f wav tone_440hz.wav

# White noise 10 seconds
ffmpeg -f lavfi -i "anoisesrc=color=white:duration=10" -ar 44100 -ac 1 -f wav white_noise.wav

Store these files in a version‑controlled test-data/audio/ directory. Reference them by relative path in your test‑management tool or test script.

Device preparation


# Limit to 100 kbps uplink, 200 ms latency
tc qdisc add dev wlan0 root netem rate 100kbit delay 200ms

Test‑data versioning

Because audio files can be large, store them in Git LFS or an internal artifact repository. Tag each set with a version (e.g., audio-set-v1.2) and reference that version in the test case’s “Test data” field. This makes it trivial to reproduce a failure months later.

Mock server for upload/download

If you want to avoid hitting a real backend during CI, spin up a lightweight mock using Node.js and Express:


const express = require('express');
const multer  = require('multer');
const upload = multer({ dest: 'uploads/' });
const app = express();

app.post('/api/voice', upload.single('voice'), (req, res) => {
  // Echo back file metadata
  res.json({ size: req.file.size, mimetype: req.file.mimetype });
});

app.get('/api/voice/:id', (req, res) => {
  // Serve a pre‑stored file
  res.sendFile(__dirname + `/uploads/${req.params.id}.ogg`);
});

app.listen(3000, () => console.log('Mock voice API listening on :3000'));

Point the app under test to http://10.0.2.2:3000 (Android emulator host alias) via a DNS override or API‑endpoint configuration flag.

How to Write Test Cases for Voice Messages (With Examples) – Prioritization and Traceability

Not all test cases carry equal weight. Use a risk‑based matrix to decide which to automate first, which to keep manual, and which to de‑prioritize.

Prioritization criteria

FactorWeight (1‑5)Rationale for voice messages
Frequency of use5Core communication feature; used daily by most users.
Failure impact4A broken voice message can block conversation flow and cause user frustration.
Defect history3Past releases showed occasional permission‑related bugs.
Regulatory / accessibility2Some regions require accessible audio controls; lower but still relevant.
Test cost2Automating audio playback/check is moderate effort; manual listening adds time.

Calculate a priority score = Σ (factor rating × weight). Cases scoring ≥ 15 are high priority, 10‑14 medium, < 10 low.

Traceability to requirements

Create a simple requirements‑to‑test matrix. Example requirement IDs from a hypothetical spec:

Req‑IDDescriptionRelated test case IDs
V‑REQ‑001User can record and send a voice noteVM‑001, VM‑002, VM‑003
V‑REQ‑002Voice message must not exceed 60 sVM‑021, VM‑022
V‑REQ‑003App handles missing microphone permission gracefullyVM‑010
V‑REQ‑004Voice messages are playable after network lossVM‑013
V‑REQ‑005UI shows waveform and duration correctlyVM‑001, VM‑002, VM‑003
V‑REQ‑006Accessible controls for play/pause (talkback)VM‑030 (see accessibility section below)

Maintain this matrix in a spreadsheet or a test‑management tool (e.g., TestRail, Zephyr). When a requirement changes, you can instantly see which test cases need review.

How to Write Test Cases for Voice Messages (With Examples) – Manual and Automated Approaches

Combining manual exploratory testing with automated regression yields the best coverage for voice messages.

Manual exploratory testing

Manual testing shines for discovering UX friction, unexpected audio clipping, and accessibility issues that automated scripts may miss because they rely on deterministic assertions.

Automated regression with scripting

For repeatable validation of the happy path and defined negative cases, write scripts that drive the UI and verify audio artifacts.

#### Appium (Android) example


@Test
public void testSendVoiceMessage() throws Exception {
    // Assume driver is set up and user is logged in
    MobileElement recordBtn = driver.findElementById("com.example.app:id/voice_record");
    recordBtn.click(); // start recording (long press simulated by TouchAction)
    new TouchAction(driver)
        .press(recordBtn)
        .waitAction(Duration.ofMillis(3000))
        .release()
        .perform();

    MobileElement sendBtn = driver.findElementById("com.example.app:id/voice_send");
    sendBtn.click();

    // Wait for message bubble to appear
    WebDriverWait wait = new WebDriverWait(driver, 10);
    MobileElement bubble = wait.until(
        ExpectedConditions.visibilityOfElementLocated(By.id("com.example.app:id/voice_bubble"))
    );

    // Verify duration text
    assertEquals("0:03", bubble.findElementById("com.example.app:id/duration").getText());

    // Pull the uploaded file from device storage for bit‑check
    String remotePath = "/sdcard/Android/data/com.example.app/files/voice/msg_123.ogg";
    String localPath = "build/voice/msg_123.ogg";
    PullFile pull = driver.pullFile(remotePath);
    Files.write(Paths.get(localPath), pull.getContent(), StandardOpenOption.CREATE);
    // Compare with original tone file (pre‑generated)
    assertTrue(Files.mismatch(Paths.get(localPath), Paths.get("src/test/resources/tone_440hz.wav")) == -1);
}

*The script records by holding the button for three seconds, sends, then pulls the resulting file from the device to compare with a reference.*

#### Playwright (Web) example

If your product also offers a web client, you can automate voice capture via the MediaRecorder API using a fake stream:


test('can send voice message on web', async ({ page }) => {
  await page.goto('https://app.example.com/chat');
  await page.click('#voice-record');

  // Provide a fake audio stream (silence) to the page
  await page.evaluate(() => {
    const fakeStream = new MediaStream([
      new AudioTrack({ enabled: true, label: 'fake', kind: 'audio' })
    ]);
    // Override getUserMedia to return our fake stream
    navigator.mediaDevices.getUserMedia = () => Promise.resolve(fakeStream);
  });

  await page.waitForTimeout(3000); // record 3 s
  await page.click('#voice-send');

  const bubble = page.locator('.voice-bubble');
  await expect(bubble).toBeVisible();
  await expect(bubble.locator('.duration')).toHaveText('0:03');

  // Optionally, intercept the upload request and validate the blob
  await page.route('**/api/voice', route => {
    const request = route.request();
    const form = new FormData();
    form.append('voice', new Blob([new Uint8Array(0)], { type: 'audio/ogg' }));
    return route.fulfill({ status: 200, body: JSON.stringify({ok:true}) });
  });
});

Leveraging SUSA for autonomous exploration

SUSA can be pointed at the APK or the web URL and will autonomously generate interaction sequences that include voice‑message actions. After a run, SUSA outputs:

To incorporate SUSA into your workflow:


# Install the agent
pip install susatest-agent

# Run against an Android APK
susatest run --app ./app-release.apk \
    --device emulator-5554 \
    --output ./susa-report \
    --formats appium,playwright

# For a web target
susatest run --url https://chat.example.com \
    --browser chrome \
    --output ./susa-report \
    --formats playwright

The generated Appium/Playwright scripts can be merged with the manual test cases you wrote earlier, giving you a hybrid suite that benefits from both directed verification and exploratory discovery.

How to Write Test Cases for Voice Messages (With Examples) – Worked Test Matrix (20+ Examples)

Below is a consolidated table that you can copy into a test‑management tool. Each row includes ID, preconditions, steps, and expected result. Feel free to add columns for priority, tags, or linked requirement IDs as needed.

IDPreconditionsStepsExpected Result
VM‑001User A logged in, mic granted, Wi‑Fi1. Open chat with User B 2. Long‑press voice‑record 3. Speak “Hello test” (~3 s) 4. Release 5. Tap sendVoice bubble appears, duration 0:03, message delivered to B within 2 s, playable without distortion
VM‑002Existing voice message (0:07) in chat1. Tap bubble 2. Press play 3. Pause at 2 s 4. Seek to 5 s 5. Press playAudio plays, pauses, resumes from seek position, finishes; UI updates elapsed time
VM‑003User A sent voice msg; User B offline1. B comes online 2. Opens chat 3. Wait for message (pull‑to‑refresh if needed) 4. Tap download (if not auto)Message downloads fully, file size matches server (±5 %), playback identical to sender
VM‑010Mic permission denied1. Open chat 2. Tap voice‑recordPermission dialog shown or app shows rationale; no recording starts; button returns to idle
VM‑011Max file size 256 KB; 300 KB test file ready1. Push big.ogg to device 2. In chat, choose Attach → File → select big.ogg 3. Attempt to sendInline error: “Voice message too large (max 256 KB)”; message not sent; UI stable
VM‑012Mic granted1. Start recording 2. While recording, rename temporary file to .txt (via adb) 3. Finish and send

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