DEV Community

Cover image for Boundary Values Beyond Numbers: Strings, Dates and Money
Muhammad Usman
Muhammad Usman

Posted on Edited on Originally published at linkedin.com

Boundary Values Beyond Numbers: Strings, Dates and Money

Testers often stop at min and max. The bugs that ship are usually in names, calendars and currency.

Every QA lead I know has lived this moment.

A quantity field has a minimum of 1 and a maximum of 99. The team writes two tests. Both pass. The ticket is done.

And we tell ourselves the field is covered.

Then a customer pastes a name with a trailing space, a booking lands on 29 February, or a three-way split of a bill is off by a cent. The numbers were never the problem.

After 10+ years in Quality Assurance, I have learned that boundary-value analysis is one of the most useful techniques we have, and one of the most narrowly applied. We treat it as min and max for integers. The real boundaries sit in strings, dates and money.

The last two editions were about flaky tests and guessed heals. This one is about calling a field covered after two numeric tests.

The mistake is stopping at the number

Boundary-value analysis says defects cluster at the edges of a range. For a number, that still means min, min-minus-one, max and max-plus-one. That part is not wrong. It is incomplete.

A name field, a date picker and a price are also ranges. If you only test 0, 1, 99 and 100, you have not tested the field the user actually types into.

I also see this when people ask an AI chat for “boundary values.” The model is quick to return integers. It is much less useful unless you tell it what kind of edge you mean, and what the spec actually allows.

Strings: empty is not the only edge

Take a display name that is required, trimmed and limited to 50 characters. The edges I want, on the page and in the API, look like this:

  • Empty, and whitespace only. " " is not a name, even if length is 3.
  • Untrimmed input. " Ada " should become "Ada" if the spec says trim. If it does not say, that is a question, not a guess.
  • Length 1, 50, 51, and a very long paste.
  • Unicode, emoji and right-to-left text. A family-emoji sequence can look like one character and count as many.
  • Newlines and tabs, if the field is supposed to be a single line.
  • In edit mode, whether a saved 50-character value can be opened and saved again without being rejected.

A passing test that types “John” and hits Save does not cover any of that. One bug I watch for: the UI counts characters one way, the API another. The form accepts 50 graphemes. The server rejects the request because it counted code units.

When I write this in Playwright, I assert the message and the stored value, not just that the click succeeded:

test('display name rejects whitespace-only input', async ({ page }) => {
  await page.getByLabel('Display name').fill('   ');
  await page.getByRole('button', { name: 'Save' }).click();
  await expect(page.getByRole('alert')).toHaveText('Enter a display name');
});
Enter fullscreen mode Exit fullscreen mode

Send the same payload to the API. If the UI trims and the API does not, you have two products.

Dates: the calendar is not a straight line

Dates look like numbers. They are not. If a booking can be made on a calendar day, I want:

  • 29 February on a leap year, accepted. 29 February on a common year, rejected.
  • The last day of the month, and the day after. Adding one month to 31 January is not “31 February.” The product has to define it, and the test has to use that definition.
  • Time zones. A meeting booked at 11:30 PM in Karachi is a different calendar day in New York. If the server stores UTC and the UI shows local time, midnight is a boundary.
  • DST. In a zone that springs forward, 2:30 AM may not exist. In a zone that falls back, 1:30 AM may exist twice.
  • End of day. Is 27 November inclusive at 23:59:59.999, or does “through 27 November” stop at midnight?

Run the same booking in two time zones, and on a known DST transition for the market you ship to. An AI will often give you “min date” and “max date,” and skip leap years, DST and time zones unless you ask. If the spec does not mention them, the honest output is a question, not a made-up rule.

Money: rounding is a product decision

Money is where a green test can still be wrong. Do not use a floating-point type for currency if you can avoid it. Totals still drift this way:

(0.1 + 0.1 + 0.1) === 0.3  // false
Enter fullscreen mode Exit fullscreen mode

The boundaries I want:

  • Zero, the smallest unit (one cent, or zero-decimal currencies like JPY), and a very large amount that still has to stay precise.
  • Rounding. How does a half-cent become a cent? Half-up, half-even (banker’s rounding), or always away from zero? Use the rule the product claims, not the rule the language uses by default.
  • Splits and tax. Three ways of $10.00 is not three times $3.33. One of those shares is $3.34, or the product is leaking or inventing a cent.
  • Currency precision. USD has two decimal places. Some currencies have zero. Some have three. A form that always allows two decimals is already a boundary bug for those.
  • Conversion and display. A stored integer of 1000 cents must still show as 10.00, not 10, and not 10.0000000002.

Assert against the stored minor units, not only the formatted string on the screen. If you only test “price = 10” and “price = 0,” you will not see this class of defect.

How I use AI on this, without trusting it

I use AI tools every week. They are fast at drafting a table of cases. They are also confident when the spec is silent.

A weak prompt looks like this:

Give me boundary values for this form.

You will get minimums and maximums, mostly for numbers.

A better prompt is specific, and it forbids invention:

From this spec only, list boundary cases for every field. Include strings (empty, whitespace, trim, length 1 / max / max+1, unicode, emoji, newline), dates (leap years, end of month, time zones, DST, inclusive end dates), and money (zero, smallest unit, rounding, splits, currency precision). Expected results must be observable in the spec. If the spec does not say what should happen, write it as a Question, not as a rule. Do not invent limits.

Then I review it the way I would any junior tester’s list: drop cases that are not in the spec, add the ones the model missed, and keep only expected results you can see: a message, a count, a stored value, a URL.

The prompt is the easy part. The judgment is deciding what “trim,” “end of month” and “round half-up” actually mean in this product.

What still needs human judgment

A model can draft the table. It cannot own the release.

Someone still has to say whether a trailing space is a typo or a different name. Someone still has to define what happens when you add a month to 31 January. Someone still has to pick a rounding rule and live with it in tax, refunds and payouts.

That is the same point I keep coming back to in this newsletter. Tools can scale the mechanical work. Quality remains a human responsibility.

The takeaway

The next time you test a field, resist the urge to stop at min and max.

Write the empty string and the untrimmed one. Write 29 February, in a leap year and out of one. Write the split that does not divide cleanly, and the currency that has no cents. If you use an AI to draft the list, ask for those edges by name, and keep the questions the spec does not answer.

SprintSynergy is an AI-based QA automation company: AI testing agents plus our QA team. We use prompts like this so our QA team can spend less time inventing the obvious numeric cases, and more time judging the edges that actually break.

Which field in your product has a passing min and max, and a bug waiting in a string, a date or a currency?

Top comments (0)