Create tests
Turn what an exploration saw working into tests, choose the parts yourself, or create one from the chat.
A test protects something that works today. Each time you run it, Rehearsal walks the same steps again and tells you if they stop working, which is called regression testing. You can create tests from the main journeys an exploration walked, from parts of your app you choose, or from one flow you describe in the chat. Whichever way, Rehearsal checks each test twice before it runs on its own.
Where tests come from Link to Where tests come from
While an exploration runs, its subagents check test cases, and each browser keeps the steps it took. When a case works as expected, those steps are a flow that Rehearsal can turn into a test. So an exploration can make one test for every case that passed, grouped by the part of the app the case belongs to. A case that failed, was blocked or was never checked makes no test.
Create tests from the main journeys Link to Create tests from the main journeys
Step 1: Wait for the exploration to end
Rehearsal offers tests once the exploration has ended. Its card in the chat then says what to protect, such as "Protect your 3 main journeys with tests, so we can check them on every release."
Step 2: Open Test cases
Press Review the test cases on that card. You can also open Test cases from the panel beside the chat, where Next steps offers Create tests too.
Step 3: Read the recommendation
Test cases opens on one card, such as Protect your 3 main journeys. Each row is a part of the app, with a picture of its first page, why it matters, such as "Every new account starts here." or "People pay here.", and how many tests it makes. Rehearsal recommends up to three parts where people create accounts or save things, as many as fit in one press.
Step 4: Create the tests
Press Create tests from the main journeys. One press creates up to 20 tests, so a part with more is cut short and reads 20 of 23.
Creating tests needs the Manage projects and Use Re:agent permissions. Making them is free: the card says "Free to make." and what running every test would use from your plan, such as "Running them all uses 20 test runs." When a pull request rule already covers the app, it adds that they run on pull requests.
Choose parts yourself Link to Choose parts yourself
Press Choose parts yourself to open New tests. It lists every part in three groups: the recommended parts, already ticked, then the other parts worth a test, such as the ones where people pay or where Rehearsal found bugs, then the parts that only show pages, folded into one row. Tick a whole part, or open it and tick single tests.
An open part also lists the cases that cannot become tests, with their marks and no box, so you can see what stays uncovered. The foot counts your choice, such as 12 tests in 3 parts, and Create tests creates them. Past 20 it waits and says "Choose up to 20 tests."
While the tests are made Link to While the tests are made
After the press, the card follows every test. For each one, Re:agent walks the flow again in a browser of its own and writes the test, then Rehearsal runs it twice. A test reads Waiting, Making and Checking, then Ready or Could not verify, and the card counts them, such as 9 of 20 ready.
Once every test has settled and at least one is ready, Run once now runs the ready ones. For an admin, Connect GitHub or Add a rule stands beside it, so pull requests run them too. A test that could not verify has Retry, which asks Re:agent to make it again.
Good to know
Each exploration creates tests once. After the press the card follows those tests, and pressing again says "You already asked for these tests." To protect something else later, describe it in the chat or explore the app again. While Re:agent is writing a reply in the chat, the press waits for it to finish.
Create a test from the chat Link to Create a test from the chat
When you have one flow in mind, such as inviting a teammate to Parcel, describe it to Re:agent instead. New test in Tests opens a chat with "Create a test for" and your app's address already typed, so you add what the flow does and send it. Re:agent walks the flow in a browser, saves it, and the same two runs follow. Create a test in chat shows how to describe a flow and what the card in the chat shows. Explore when you want Rehearsal to find what is worth protecting, and use the chat when you already know.
How a test is checked Link to How a test is checked
Rehearsal writes each test in TypeScript for Retest, its test runner, with one named step for each action and each check, so a run can say which step failed. It writes the test without its address, so that each run can give it the address to check, and passwords are filled in while it runs, never written into the test. If a test's code does name the address it was recorded on, a run at another address does not try it and marks it Blocked with "This test has a saved address that cannot follow the selected environment."
Rehearsal then runs the test once, and runs it again in a fresh browser that knows nothing of the first run. When both pass, the test is Ready. Only a ready test runs. A run that includes a test that is not ready ends Blocked, or Failed if another of its tests failed, rather than passing without it.
Some flows cannot become a test yet, such as one that downloads a file, opens a second tab or runs in a phone app. Rehearsal does not try to write those, and says in one sentence what stops it.
When a test could not verify Link to When a test could not verify
Could not verify means the last check of the test failed or did not finish, so the test does not run until a check passes. The test's row and page in Tests say which, and offer what to do:
- "Rehearsal ran it twice and it failed. Open the report, then fix it in the chat." Open report shows the check's run and the step where it stopped. Fix in chat opens a chat where Re:agent changes the test.
- "Rehearsal could not finish checking this test. Open the report to see why." The check ended without an answer, so nothing about your app was judged. Open report says what stopped it.
When a test changes Link to When a test changes
To change what a test does, press Edit in chat on its page and tell Re:agent. Rehearsal writes a new version and checks it the same way. Runs keep using the newest version that passed its checks, so until the new one passes, they run the one before it. To read the code of the version a run would use, run rehearsal tests code <test-id>.