Role-based testing: your app is several apps
Role based testing means running each journey as every kind of user, each with its own expected result. One suite run as admin tests one of your apps.
Role based testing means running the same journeys as each kind of user your app has, and expecting a different answer for each. A visitor, a viewer and an editor each see another app at the same addresses. If your tests log in once, as the account you built the app with, you have tested one of those apps and guessed the others.
The way to do it: take each stop in a journey, and write one expected result per kind of user. Most of the work is in the refusals.

Why testing as admin tests the wrong app
The account you develop with can do everything. Every page opens, every button is there. So nothing in your daily work ever shows you:
- the page a viewer gets where your “New” button would be,
- the empty state of someone who has no data yet,
- what a signed-out visitor sees at an address they were sent by a colleague.
Those are the views your users have. The admin’s view is the one that gets tested, because it is the one the builder sees.
It runs the other way too. A feature that only works because you are an admin passes every test you run as an admin.
One stop, a result per kind of user
Our practice app has three kinds of user: a visitor (signed out), a viewer and an editor. Take one stop, the new item form, and fill in the row for each.
| Kind of user | What they do | What must come out |
|---|---|---|
| Editor | Opens “New item”, types a name and a note, presses “Create” | The item’s page opens with its name and note |
| Viewer | Looks for “New item” on the list | The button is there and disabled |
| Viewer | Types /items/new in the address bar | “Viewers can’t create items.” No form, no item |
| Visitor | Types /items/new in the address bar | The login page. After logging in as an editor, the form they asked for |
Four rows, three kinds of user, and only the first row is the one a single admin suite would hold.
The viewer has two rows on purpose. Here is the first.

A disabled button is something the page shows. It says nothing about what the server does with the address behind it. So the second row goes around the button.

Both passed here. They are still two separate facts, kept by two separate pieces of code, and either one can be lost in a refactor without the other noticing.
Test cases per role: what to write down
For each kind of user, three sorts of case cover it.
What they can do. Their journeys with good input, like any other test case. For a viewer in our app: log in, see the list, open an item.
What they are not shown. Controls that must be missing or disabled. Write the control’s exact words, so “the page looks right” can’t pass by accident.
What they must not reach. The address typed by hand, and the answer it must give. Decide what a good refusal is in your app and write it into the case: a clear message, the right status, a way back, and nothing of the page they were refused.
The third sort is where the bugs are. It is also the one that never gets tested by hand, because the person testing would have to log out, log in as someone else and type an address. That is the fourth leg of our exploring route, and it is the leg people skip.
How to test different user roles without drowning
Three kinds of user times every page is a lot of cells. Some ways to keep it small:
- One test account per kind of user, made for testing. Not a colleague’s account, and not yours with a flag flipped.
- Start from the stops, not the pages. A page nobody acts on needs one check: does it open or not. A stop needs the full row.
- Write the refusal once per kind of stop. If every refused page in your app looks the same, the expected result is the same sentence each time.
- Add a second account of the same kind. Two editors. The first editor’s item must not open for the second. Roles are not the only wall in an app: there is also the wall between two people with the same role.
- Run the whole table after every deploy. Permissions break in refactors, and a permission that broke shows no error to anyone. The viewer who suddenly can create items won’t file a bug.
What a pass must mean in role based testing
A role test goes hollow very easily. “Logged in as viewer, opened the list, no error” passes on an app where the viewer has every right an editor has. The check has to name the refusal: the button is disabled, the address answers the refusal page, and the list has no new item afterwards.
How EveryRole does it
This is the idea EveryRole is named for. You give it a test login for each kind of user. It explores the app signed out and as each of them, and it checks which kind of user can open which page.
In a journey, each stop is run with its cases as the kind of user the journey belongs to. Then the other kinds of user are checked at the same stop: does the page open for them, and do they get its button. The first answer waits for your yes, and after that every run compares with it. If a viewer one day gets the “Create” button, the result changes and you are asked.
One limit, said plainly: for the other kinds of user it opens the page and looks. It doesn’t send the form as a viewer past a missing button. A server that hides the button and still accepts the request needs that request sent by hand, with the browser’s developer tools, and that test is still yours.


