Skip to main content
A Failed result means one of two things. Either your app or agent did something wrong, and the fix belongs there. Or the test or scenario itself is wrong, and the fix belongs in TrustAI. This page shows how to tell which, how to fix the test or scenario, and how to check the fix with a new run.

Before you start

In TrustAI
  • A test or scenario that has run and didn’t pass. To practise, write one that fails on purpose: for example, a test that creates an Account named Example One but checks for the name Example Two. Give the Account a name no other record has, and check that the test’s Teardown deletes it.
  • The Editor or Admin project role in the project.
  • Credits in your workspace. Runs use them.
Run tests and read results explains a result’s screens. This page builds on it.

Find out why it failed

A test: read Why it failed

  1. On Runs, click the run. You should see: the test’s result, with its header: for example Failed. The result has a Why it failed card.
  2. Read Why it failed from top to bottom. You should see: on its top line, who or what it thinks is at fault, as a badge (such as App or Test), then how sure it is and how it decided (such as “Medium confidence · Rules”). Under that, What happened says what went wrong in one sentence, and Reasoning says why it blames that cause.
  3. Click Go to step with its number, such as Go to step 5, to read that step in the replay. You should see: the Replay, with that step marked Failed and the check that didn’t pass.
Why it failed counts steps in two ways. What happened can name a step of your test’s definition, such as “Act step 2”, while Go to step uses the replay’s own numbers, such as Go to step 16. Both point at the same place. Follow Go to step. Why it failed can blame the app when the test is wrong. In our walkthrough, a test checked the wrong part of the page for a list view’s name. Why it failed showed App and “Medium confidence · Rules”. What happened said the check expected “Select a List View: Accounts” to contain “All Partner Accounts”, but the page showed “Select a List View: Accounts”: the app was right, and the fix belonged in the test. An AI-assisted cause can be wrong too. Its Reasoning says: “Check the evidence before relying on it.” Always compare what the check expected with what the page showed before you change your app.

A scenario: read each check

Open the scenario’s result. On the Verdict tab, click the words of each check marked Fail to read Why it fails, with Show in transcript. Checks can also be marked Not determined. Then read the conversation on the left. Test an Agentforce agent explains both. Ask yourself: did the agent do the wrong thing, or is the check asking for the wrong thing? If the agent is wrong, fix the agent and run again. If the check is wrong, change the verdict and improve the scenario, as below.

Change a verdict and improve the scenario

Agent evaluation only. Functional test results have no way to change the verdict. When you disagree with how TrustAI graded a check, change the verdict with your reason. Then use that reason to improve the scenario, so later runs are graded the way you meant.
  1. On the Verdict tab, click the check’s verdict, such as Fail. Choose the other verdict (“Override the system, with a reason.”), write why under Why does this pass?, and click Change to Pass. Run tests and read results shows this step by step. You should see: the check shows your verdict, with the system’s grade and its reason above yours. The count at the top is worked out again: in our walkthrough it went from Fail, “1 of 7 failed, 2 not checked”, to Not checked, “2 of 7 not checked”, with “Changed from fail by 1 override from you”. At the bottom: “1 override not used to improve the scenario yet”, “Later runs are graded the old way until you do.”, and Improve scenario.
  2. Click Improve scenario. You should see: a dialog with a What should change? box. Under Reviewed run results to address, your reason and the check it’s about.
  3. Optional: say more in What should change?. Then click Improve scenario at the bottom of the dialog to draft the change. While it works, the button says Drafting. You should see: Review the improved draft, which says what saving replaces and that closing changes nothing. Click Show changes to mark new words in green and strike out the old ones. A part that didn’t change says No changes.
  4. Click Save changes. You should see: Saved the improved definition, and “This run’s verdicts stay as they are.” To read the new definition, click View definition.

Fix a test with Improve with AI

Improve with AI rewrites a test’s definition. It does what you ask, so say exactly what’s wrong and what the test should check instead. Create a test or scenario introduces it.
  1. Open the test. On its Definition tab, click Improve with AI (the sparkle at the top right). You should see: Improve with AI: “The agent drafts an improved definition. You review what changes before anything is saved.” It has a What should change? box. Improve definition can’t be clicked until you write something.
  2. In What should change?, say what the result showed and what you want instead. Name the check and the value. For example: “The list view Docs Platinum Partners does not exist in this org. Use the existing list view All Partner Accounts instead, and check that its title All Partner Accounts is shown. Keep everything else.” Click Improve definition. You should see: “Drafting an improved definition. Nothing is saved yet.” Then Review the improved draft: “Saving replaces the saved test plan with this draft. Closing this changes nothing.” It counts what changed, such as “1 document changed”, and has a short note from the agent on what it changed, then the new test plan. Click Show changes to see new words in green and old ones struck out. Hide changes shows the plain text again.
  3. Read the draft. Click Save changes, or Discard if it changed something you didn’t ask for. To reword your instruction, click Back to instruction. You should see: “Saved just now” on the Definition tab, with the agent’s note and the new definition.
The Definition tab may also show advice about the test, such as “1 piece of advice” (“These don’t stop the test.”).

Run it again and compare

  1. Click the run button (▷) at the top right of the test or scenario, and start the run as before: Run 1 test for a test, Run & evaluate for a scenario. You should see: the run starts. A test shows that it “is running”, with View run details. A scenario opens the run’s page.
  2. When it ends, open the result and compare it with the last one. You should see: a new result. On a test, the Runs tab lists every run with its result and the first line of Why it failed, newest first. In the list, the requirement shows how many of its tests passed, such as “1 of 1 passed”, and the test shows its latest result, such as Passed. After a run that ended Needs review, the test shows Blocked and the requirement Run blocked.
In our walkthrough, the list view test went from Failed (it asked for a list view the org doesn’t have) to Needs review after one Improve with AI: the new check’s text showed more than once on the page. Each new result’s Why it failed said what to fix next, so read it again after every run. Improving a test can take more than one round. After we improved a scenario in an earlier walkthrough, the reworded check came back Pass without an override. The agent still failed two other checks in that run, so read every check in the new result, not only the one you changed.

If something goes wrong

Next