Skip to main content

Reports Linked to the Plan

Why This Matters

A test report says test_totals_two_products FAILED. Is that bad? It depends on what the test was supposed to prove, and the report doesn’t say. Somebody has to open the code, find the plan, and work out which agreed behaviour is now broken.

Selenium AI Agent closes that loop. Every test is generated from one scenario of an approved plan (lesson 10), and every result is linked back to that scenario: in the JUnit XML your CI already reads, and in Allure, where the report is laid out as the plan. A failure then reads as “scenario 2.1 Totals for two products of the approved plan Shopping cart and checkout fails at the step Open the cart”, which a product owner can understand.

What you will learn

  • How a test result is linked to its plan scenario
  • What healer_run_tests reports after a run
  • reports/junit-plans.xml: the JUnit report with the plan in it
  • Allure: the plan as the report’s tree, plan steps as report steps, a screenshot on failure
  • Tests without an approved plan, and why the report counts them

How a result finds its scenario

The link is made from two facts the agent already has:

  1. The plan names a File: for every test (tests/checkout/test_totals_two_products.py for scenario 2.1).
  2. generator_write_test records the plan (specFile) and, when the file differs from the plan’s File:, the scenario in .test-manifest.json.

After a run, the agent reads the runner’s JUnit XML, matches each test case to its file (by file attribute, class name or suite name, depending on the language), and the file to its plan and scenario. That works the same for pytest, JUnit 5, TestNG, NUnit, Mocha, WebdriverIO and Robot Framework. The run command generator_write_test stores already asks the runner for JUnit XML: --junitxml=reports/junit.xml for pytest, the Surefire reports for Maven, the JUnit logger for .NET, --xunit for Robot Framework.

What a run returns

healer_run_tests runs the suite with the manifest’s run command and returns a report next to the console output. Suppose the shop started rounding the tax down; a run would then report (shortened):

{
  "message": "Tests executed",
  "command": "pytest -v --junitxml=reports/junit.xml",
  "exitCode": 1,
  "passed": false,
  "report": {
    "results": ["reports/junit.xml"],
    "total": 8, "passed": 7, "failed": 1, "skipped": 0, "time": 61.4,
    "failures": [
      {
        "test": "tests.checkout.test_totals_two_products test_totals_two_products",
        "message": "AssertionError: assert 'Tax (21%): $60.90' in 'Subtotal: $289.98 Shipping: FREE Tax (21%): $60.89 Total: $350.87'",
        "plan": "shopping-cart-and-checkout.md",
        "scenario": "2.1 Totals for two products"
      }
    ],
    "withoutPlan": 0,
    "written": ["reports/junit-plans.xml"]
  }
}

The agent sees at once which approved scenario is broken. For the healer (lesson 15) that is the starting point of an important question: did the application change, or did the test break?

withoutPlan counts the test cases with no approved plan behind them: hand-written tests, tests from a draft, tests whose plan was deleted. A rising number is a sign that the suite is drifting away from what was reviewed.

junit-plans.xml

The agent writes the linked results to reports/junit-plans.xml: the same JUnit XML, with the plan, its title and its review status as properties of each test case. Every CI system can show JUnit XML, and tools such as ReportPortal and Xray import these properties. A real excerpt, from a Robot Framework suite for Salesforce accounts:

<testsuites name="selenium-ai-agent" tests="8" failures="0" skipped="0" time="156.09">
  <testsuite name="selenium-ai-agent" tests="8" failures="0" skipped="0" time="156.09">
    <testcase name="2.3 Create Customer With All Main Fields" classname="Salesforce Accounts" time="17.948">
      <properties>
        <property name="plan" value="salesforce-accounts-create-customer.md"/>
        <property name="plan.title" value="Salesforce Accounts – view list and create new customer"/>
        <property name="plan.review" value="approved (by the user in the review page on 2026-11-24 20:17 UTC)"/>
      </properties>
    </testcase>

Notice plan.review: an auditor can see, per test result, that the behaviour it checks was approved, by whom and when.

The read-only plan pages from lesson 8 (npx selenium-ai-agent review) also show the last result per scenario, so the review page and the test results live in one place.

Allure: the report is the plan

JUnit XML is the default because every tool reads it. When the team wants a richer report, ask for Allure, or let the agent detect it: generator_setup_page chooses Allure when the project already uses it, and returns what the project needs once (for pytest: pip install allure-pytest).

With Allure, the agent does three more things.

The plan is the tree. Every result gets three labels: the plan title as the epic, the suite as the feature, the scenario as the story. The agent writes an allurerc.mjs (when the project has no Allure config yet) that groups the report by them, so the report’s navigation is the plan:

Shopping cart and checkout          (epic: the plan)
├── 1. Add to cart                  (feature: the suite)
│   ├── 1.1 Add a product from the grid      ✔
│   ├── 1.2 Add a product from the detail pop-up  ✔
│   └── 1.3 Out-of-stock product cannot be added  ✔
└── 2. Checkout
    ├── 2.1 Totals for two products          ✘
    └── ...

Each result also gets the scenario as its name, the approved steps and expected results as its description, and a link to the plan.

Plan steps are report steps. The generated test wraps each plan step in an Allure step with the step’s own words:

import allure


def test_totals_two_products(shop):
    with allure.step("Add the Mechanical Keyboard and the Ergonomic Chair"):
        shop.add_to_cart(2)
        shop.wait_for_cart(1, "$89.99")
        shop.add_to_cart(10)
        shop.wait_for_cart(2, "$289.98")

    with allure.step("Open the cart"):
        shop.open_checkout()
        summary = " ".join(shop.order_summary().split())
        assert "Subtotal: $289.98" in summary
        assert "Shipping: FREE" in summary
        assert "Tax (21%): $60.90" in summary
        assert "Total: $350.88" in summary

A failure now shows “Open the cart” as the failing step, in the tester’s words.

A screenshot on failure. One hook in the seed (conftest.py) attaches a screenshot when a test fails:

import allure
import pytest


@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
    outcome = yield
    report = outcome.get_result()
    driver = item.funcargs.get("driver")
    if report.when == "call" and report.failed and driver is not None:
        allure.attach(driver.get_screenshot_as_png(), name="Screenshot at failure",
                      attachment_type=allure.attachment_type.PNG)

In the shop seed from lesson 7 the fixture is called shop, so you would use item.funcargs.get("shop") and its .driver. The agent adapts the hook to your seed.

View the report with Allure Report 3, which needs no Java:

npx allure generate allure-results && npx allure open allure-report

The agent gives the same hint for Java (JUnit 5 and TestNG), C# (NUnit, xUnit, MSTest), JavaScript and Robot Framework, each in that language’s Allure API.

Exercise

  1. Run your suite through the agent: “Run the tests with healer_run_tests and show me the report.” How many tests are withoutPlan?
  2. Add a small hand-written test to the project (any test_*.py that opens the shop and checks the title). Run again. What changed in the report, and in reports/junit-plans.xml?
  3. Optional: switch to Allure (“Use Allure for the reports”), regenerate one test, run, and open the report. Find the scenario under its plan and suite.
Show suggested answer
  1. With only generated tests from an approved plan, withoutPlan is 0.
  2. withoutPlan is 1. In junit-plans.xml the new test case has no plan properties. That is not wrong in itself (not every test needs a plan) but it is visible: the report shows what is covered by an approved specification and what is not.
  3. In Allure Report 3 the left-hand tree is grouped by epic and feature: the plan title, then the suite, then the scenario with its plan steps as report steps. A test without a plan appears outside the plan’s tree.

Exam-style questions

Quiz

1. How does the agent know which plan scenario a test result belongs to?

  • A. It asks the AI after the run
  • B. From the plan’s File: line for the scenario and the plan recorded in .test-manifest.json, matched to the result’s file or class
  • C. From the test’s name only
  • D. It doesn’t; the user links them by hand
Show answer
B.
Quiz

2. What does withoutPlan in the run report count?

  • A. Failed tests
  • B. Test cases with no approved plan behind them
  • C. Plans without tests
  • D. Skipped tests
Show answer
B.
Quiz

3. Why does the generated Allure test use the plan’s step text as the step name?

  • A. Allure requires it
  • B. So the report shows which agreed step failed, in the words of the approved plan
  • C. To make the test run faster
  • D. To avoid assertions
Show answer
B.