Boundary Value Analysis Cheat Sheet: Test Strings for QA

Master Boundary Value Analysis and Equivalence Partitioning. Use these battle-tested test strings, edge cases, and injection payloads in QA.

Boundary Value Analysis (BVA) is a black-box test design technique based on the observation that defects tend to cluster at the edges of input ranges rather than in their middle. By testing minimum values, maximum values, and their immediate neighboring transitions (min-1, min, min+1, max-1, max, max+1), QA engineers detect integer overflows, off-by-one loops, and string truncation bugs with minimal test case counts.

Equivalence Partitioning vs Boundary Value Analysis

Software inputs divide into two core test concepts defined by international testing standards (such as ISO/IEC/IEEE 29119):

  • Equivalence Partitioning (EP): Slices the input domain into partitions of valid and invalid data where the system should process any single value within that partition identically.
  • Boundary Value Analysis (BVA): Focuses directly on the boundaries separating these equivalence partitions, testing the precise edges where conditional logic (such as >= or <) executes.

If an age verification input accepts values between 18 and 65:

  • Valid Equivalence Partition: Any number between 18 and 65 (e.g., 30).
  • Invalid Partitions: Numbers below 18 and numbers above 65.
  • BVA Test Points: 17 (invalid lower), 18 (valid boundary), 19 (valid inner), 64 (valid inner), 65 (valid boundary), and 66 (invalid upper).

The QA engineer test string cheat sheet

Form fields and API endpoints that accept strings require targeted edge-case strings to test memory buffers, character encoding decoders, and database column constraints:

Test Category Test String / Input Payload Primary Failure Mode Tested
Empty & Whitespace "" (Empty), " " (Space), "\t\r\n" Missing null checks, untrimmed inputs
Exact Column Limit 255 characters of ASCII text Buffer overflow, string truncation without alert
Limit Plus One 256 characters of ASCII text Database column constraint rejection (VARCHAR)
Unicode Expansion "ß" (German eszett, expands to "SS" in upper) Buffer allocation mismatches during string casing
4-Byte UTF-8 Astral "🚀" (U+1F680, 4 bytes in UTF-8) Rejection ("Incorrect string value") or data loss in MySQL utf8mb3 columns
Right-to-Left (RTL) "\u202Ereversed_text" UI layout corruption, bidirectional spoofing
Numeric Scientific "1e308", "-1e308", "NaN", "Infinity" IEEE 754 floating point parsing exceptions
SQL Injection Probe ' OR '1'='1 --, " OR ""=" Unsanitized query concatenation
Cross-Site Scripting <script>alert(1)</script>, "><img src=x onerror=alert(1)> Raw DOM injection in client dashboards

Automating boundary test generation in JavaScript

Rather than assembling test vectors manually, QA teams can generate boundary suites programmatically:

// Test suite generator for string boundary analysis
function generateBoundarySuite(fieldName, maxLength) {
  return [
    { name: `${fieldName}_empty`, payload: "", expectedValid: false },
    { name: `${fieldName}_single_char`, payload: "A", expectedValid: true },
    { name: `${fieldName}_exact_max`, payload: "A".repeat(maxLength), expectedValid: true },
    { name: `${fieldName}_max_plus_one`, payload: "A".repeat(maxLength + 1), expectedValid: false },
    { name: `${fieldName}_utf8_multibyte`, payload: "€".repeat(Math.floor(maxLength / 3)), expectedValid: true },
    { name: `${fieldName}_trailing_whitespace`, payload: "A".repeat(maxLength - 1) + " ", expectedValid: true }
  ];
}

// Generate test vectors for a 50-character username field
const usernameTests = generateBoundarySuite("username", 50);
console.log(`Generated ${usernameTests.length} boundary test vectors.`);

Production Pro-Tip: The German Eszett casing trap

A classic boundary edge case in internationalization occurs with character case transformations that alter string length.

In German, the lowercase character "ß" (eszett) is traditionally capitalized as two letters: "SS". A capital eszett ("ẞ", U+1E9E) exists and has been officially allowed in German orthography since 2017, but the default Unicode case mapping, used by JavaScript's toUpperCase(), still turns "ß" into "SS". If your backend database defines a column as VARCHAR(10) and a user submits a ten-character string ending with "ß" (e.g., "Strasse12ß"), a naive application that converts input to uppercase via input.toUpperCase() produces "STRASSE12SS": an eleven-character string.

The resulting string violates the database length boundary, throwing an unhandled database exception during write operations.

When testing massive arrays of generated test data, eliminate repeated input vectors using a client-side duplicate remover. For rapid creation of randomized edge-case strings, high-entropy passwords, and UUID v4 tokens without server dependencies, use an in-browser random value generator.

Frequently Asked Questions (FAQ)

What is the difference between 2-value and 3-value boundary testing?

In 2-value boundary testing, you test the boundary value itself and its immediate invalid neighbor outside the boundary. In 3-value boundary testing, you test three values: the boundary, the immediate neighbor just inside the partition, and the immediate neighbor just outside the partition.

Why do boundary values produce more defects than center values?

Programmers frequently introduce off-by-one errors when writing comparison operators in conditional statements (such as using < instead of <=, or starting loop counters at index 1 instead of 0). Boundary testing targets these logical branch points directly.

How does boundary testing apply to date inputs?

Date boundary testing examines transition periods such as leap year days (February 29 in leap vs non-leap years), daylight saving time shift hours, month-end transitions (April 30 vs May 1), and millennium/epoch rollover thresholds (such as Unix Epoch boundaries).

References & Official Sources