Skip to content

test(steps): add unit coverage for StepLogger - #22

Merged
shossain786 merged 1 commit into
masterfrom
test/unit-coverage
Jul 14, 2026
Merged

shossain786 merged 1 commit into
masterfrom
test/unit-coverage

Conversation

@shossain786

Copy link
Copy Markdown
Contributor

Closes #8

What

The steps/ package had no unit tests. Adds StepLoggerTest targeting StepLogger's previously-untested branches:

  • No active test context → step is ignored (nothing recorded, no capture) — for both step() and stepWithScreenshot()
  • INFO status recorded without a screenshot
  • screenshot=true → ScreenshotManager.captureAsBase64() is captured and attached to the StepRecord
  • Explicit StepStatus is preserved
  • offsetMs == 0 when the test start time is unknown (getTestStartTime returns 0)
  • stepWithScreenshot stores the pre-captured base64 as-is (and never triggers a live capture)

Approach

StepLogger's collaborators — SeleniumBootContext, ExecutionMetrics, ScreenshotManager — are all static, so they're mocked with mockStatic, and the recorded StepRecord is asserted via an ArgumentCaptor. No real browser / Selenium interaction.

Acceptance criteria

  • New tests cover the previously-untested branch(es)
  • mvn clean verify passes — 480 tests, 0 failures (+7)
  • No real browser required (all collaborators mocked)

🤖 Generated with Claude Code

Closes #8

The steps/ package had no unit tests. Adds StepLoggerTest covering the
previously-untested branches:

- no active test context -> step is ignored (nothing recorded, no capture)
  for both step() and stepWithScreenshot()
- INFO status recorded without a screenshot
- screenshot=true -> ScreenshotManager.captureAsBase64() captured & attached
- explicit StepStatus preserved
- offsetMs = 0 when the test start time is unknown
- stepWithScreenshot stores the pre-captured base64 as-is (no live capture)

Collaborators (SeleniumBootContext, ExecutionMetrics, ScreenshotManager)
are all static, mocked with mockStatic — no real browser required.
mvn clean verify: 480 passing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@shossain786
shossain786 merged commit 80093fd into master Jul 14, 2026
2 checks passed
@shossain786
shossain786 deleted the test/unit-coverage branch July 14, 2026 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tests: add unit coverage for an untested code path

1 participant