Files
werkator/docs/prs/2026-10-10-PR#142-ui-page-specs-per-page.md
claude-code d62b46a681
werkator build succeeded after 02:22
werkator/deploy build succeeded after 00:09
UI page specs per page (v1.38.10) (#142)
Co-authored-by: claude-code <claude-code@javagil.de>
2026-10-10 13:37:21 +02:00

2.7 KiB

PR#142: UI Page Specs per Page

WARNING: This document describes only the change applied in this PR. It may already be outdated once the next PR is merged. Historic PR-documentation is not maintained along with new PRs — treat it as a snapshot, not as current documentation.

The Problem

All tests of the web pages stood in one spec, UiControllerRestTest: 52 tests, about 2 s per run. PIT runs a whole spec for every mutant whose line the spec reaches. Because this spec reaches every page, it covered 850 mutants in 25 classes in the nightly of 2026-10-10, and it ran for about 300 of them. A mutant in the system page's gauges ran the tests of the artifact page as well.

Non-Goals

  • No test is changed, added or removed; they only move.
  • No change to the pages.

The Scenarios

The behaviour does not change, so the scenarios the moved tests verify stay as they are.

The Solution

  • UiPageRestTest is an abstract base with the annotations, the mocks and the setup of the former spec. Because all page specs share exactly these, Spring builds their context once and caches it for all.
  • Five specs extend it, one per page or page family:
Spec Tests Pages
UiLayoutRestTest 16 what every page shares: header, footer, token, routes
UiHomeRestTest 6 home page and Repositories page
UiBuildListsRestTest 14 latest, branches, history and current views
UiArtifactPageRestTest 14 artifact page, its permanent form, reports and logs
UiSystemPageRestTest 2 system page

A local PIT run of UiController and the views of its pages (BuildRowView, CurrentBuildView, SystemMetricsView, the Home… views), two minions, without history:

Run Duration Killed Timed out Survived
One spec 551 s 232 7 101
Five specs 317 s 235 0 105

Four mutants that timed out before now survive: ramTotal ?: "n/a" in SystemMetricsView.from, startedAt ?: "" in BuildRowView.from, and two getters of CurrentBuildView. With them, every test of the five specs passes, so no test checks these values; the timeouts had counted them as killed. They are gaps that were there before; why the one spec ran out of time with them is not known. No method gets above the limit of 15: SystemMetricsView.from scores 8.1, BuildRowView.from at most 13.7.