EveryRole

Empty form submission: the cheapest test you skip

Test empty form submission: press the button with nothing typed. It finds blank records, crash pages and dead ends. What a good answer looks like.

Open the most important form in your app and submit it empty: type nothing, press the button. That is the whole test. It takes ten seconds and needs no test data.

The right answer is boring: the form stays where it is, it says which field is missing, nothing is created, and nothing you had typed elsewhere is lost.

Here it is on our practice app. An editor opens “New item” and presses “Create” straight away.

One click. The name field is required, so the browser refuses to send the form.

So far so good. But that message did not come from the app. It came from the browser, because the field is marked required. The app itself hasn’t been asked anything yet.

There are two checks, and you have tested one

A form is guarded twice. The browser checks before sending. The server checks after receiving. Pressing the button on an empty form only tests the first guard, and the first guard is a courtesy. Requests reach your server without it all the time: a script, an API client, an old cached page, a browser extension that fills and submits.

To test the second guard, take the first one away. In your browser’s developer tools, delete the required attribute from the field and press the button again. We did that to our practice app.

The practice app's answer to an empty name sent past the browser: a page titled New item with only the message "A name of 1 to 60 characters, please". The form is gone.
The server refuses the empty name, which is right. Then it shows a page with no form on it, which is not.

Half right. The server refused, and no item was created (we checked the list: “No items yet”). But look at what it answered with: a message and nothing else. The form is gone. If you had written a long note in the second field, the note is gone too. The only way forward is the back button.

That is our own practice app, and we are keeping the flaw as an example. In our experience it is what this test finds most: a server-side refusal that was written once, never looked at, and strands the person.

The wrong answers, from worst to least bad

What the app doesWhy it’s wrong
Saves a blank recordNow there is an item called "" in someone’s list, and maybe an email went out about it.
Shows a crash page or a raw errorThe server assumed the field would be there. An empty value reached code that never expected one.
Does nothing at allNo message, no change. The person presses again, harder.
Refuses, but with a dead endThe message is right, the form is gone, and what was typed is lost.
Refuses with “Something went wrong”True, and useless. Which field?

The first two are bugs you want to hear about today. The last three are the kind that never get reported. People just leave.

What a good answer to an empty form has

Four things, and you can check each by looking:

  1. The form is still there. Same page, same fields.
  2. The message names the field and sits next to it, tied to it so a screen reader says it too. “Name is required” beside the name field beats a red banner at the top.
  3. Nothing was created. Open the list and look. Don’t trust the message. A form that only shows a message is how hollow passes happen.
  4. Everything else you typed is still there. Fill the optional fields before you press the button, so you can tell.

Number three is the one that needs a second page. A form can show an error and still have saved a blank row. The only proof is the place where the row would be.

Required field validation test cases: three more

Spaces only. Type three spaces in the required field. To a person that is empty. To a lot of code it is a name three characters long.

Only the optional fields empty. Fill what is required, leave the rest. This must work. It catches the opposite bug: a field the page calls optional and the server secretly requires.

The file field with no file. An upload form sent without a file is an empty form too.

Which forms

All of them, but start with the ones a stranger meets first: sign-up, login, the first thing they create. Then search boxes and filters (an empty search should show everything or say so, never an error). Then each step of any wizard: press “Next” on an empty step.

You’ll be done with a small app in fifteen minutes. Write down what each form answered. That list is your expected results for next time.

How EveryRole runs this case

“Empty” is one of the main cases EveryRole runs at every form it finds, next to the good input. It presses the form’s button with nothing typed, and records what the page said about each field and where the person ended up.

It tests what a person gets. When the browser stops the form, that is the answer it records. It doesn’t strip the browser’s check to reach the server. That second test is still yours to do by hand, and it is the one that found the dead end above.

The first time, it shows you that result and asks if it is right. You say yes once. After that, every run compares with the answer you approved, so the day a deploy turns “Please fill out this field” into a blank page or a saved blank item, the case shows Result changed, names the form, and asks you.

You can run the same case by hand before every release. The reason to hand it to a machine is that nobody does it by hand the twentieth time.

Keep reading

Test cases

Boundary value testing, without the theory

Boundary value analysis on a real form: a field of 1 to 60 characters needs four test values, all at the edges. What to type, and what we found in our own app.

6 min read

Test cases

Happy path vs edge cases: where the bugs are

The happy path is the one route through a feature where everything goes right. Test it first, then test five edge cases per step. Which five, and why those.

5 min read