Source: https://everyrole.dev/blog/role-based-testing

# 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.

Nov 22, 2026  5 min read  by the EveryRole team

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.

![One address, three right answers. At the new item form an editor gets the form and can create an item. A viewer's button to get there is disabled and the address answers "Viewers can't create items." A visitor is sent to the login page.](https://everyrole.dev/s/blog/role-based-testing/one-address.webp)

The same address has three correct answers. A test that knows only the first one can’t fail for the other two.

## 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.

![The practice app's list as a viewer: the heading "Your items", a greyed-out "New item" button, and "No items yet".](https://everyrole.dev/s/blog/role-based-testing/viewer-list.webp)

What the viewer is shown: the button is there, and disabled.

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.

![The practice app answering a viewer who typed the new item form's address: a page headed "Not allowed" that says "Viewers can't create items."](https://everyrole.dev/s/blog/role-based-testing/viewer-refused.webp)

What the viewer gets at the address itself: a refusal, with a 403 status.

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](https://everyrole.dev/blog/how-to-write-test-cases). 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](https://everyrole.dev/blog/exploratory-testing), 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](https://everyrole.dev/blog/permission-testing-access-matrix) 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](https://everyrole.dev/blog/hollow-passes) 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.

## Try it on your own app

EveryRole tests your app’s real user journeys for each kind of user, from the live site, and runs them after every deploy. Paste your app’s address to see what it finds.

[Start with your app](https://everyrole.dev/signup) [How it works](https://everyrole.dev/docs#start)

## Keep reading

Roles and permissions

### [Permission testing: build an access matrix for your app](https://everyrole.dev/blog/permission-testing-access-matrix)

Permission testing starts with a table: pages down, kinds of user across. Fill in every cell, then test every cell. The ones you can’t fill are the risk.

Nov 22, 2026  5 min read

Roles and permissions

### [Test accounts for each role, kept safe](https://everyrole.dev/blog/test-accounts-for-each-role)

Test accounts for QA: one per kind of user, made for testing, never a real person’s, with the least rights that do the job.

Nov 22, 2026  5 min read

Roles and permissions

### [IDOR testing: open another user’s item by its URL](https://everyrole.dev/blog/idor-testing)

IDOR testing in one move. Log in as a second user, type the address of the first user’s item, and the app must answer not found. How to run it on every deploy.

Nov 22, 2026  6 min read
