Skip to content

MOB-43135: EFT failed_transactions.json for browser-based tests - #2017

Open
pjain05 wants to merge 12 commits into
masterfrom
ai-mob-43135
Open

MOB-43135: EFT failed_transactions.json for browser-based tests#2017
pjain05 wants to merge 12 commits into
masterfrom
ai-mob-43135

Conversation

@pjain05

@pjain05 pjain05 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds Taurus-side generation of a generic failed_transactions.json artifact (EFT — Exclude Failed Transactions) for browser-based (Selenium/Apiritif) runs. Each failed transaction is categorized into general errors vs. failed assertions vs. failed embedded resources, reusing the existing ERRTYPE_* classification, and written to engine.artifacts_dir so it uploads via the standard artifacts.zip path. The feature is opt-in via a new config flag modules.blazemeter.generate-failed-transactions (default off — zero behaviour change when unset). JTLErrorsReader / bzt/modules/jmeter.py are intentionally left unchanged; the classification logic is extracted, not modified. Gating stays server-side (a.blazemeter.com) — Taurus generates the artifact unconditionally when the flag is set.

Tasks completed (10)

  • T003 — scaffold bzt/modules/eft.py public surface (4e4737f3)
  • T007 — implement build_failed_transactions three-way split + reportInfo (4e4737f3)
  • T011 — implement classify_failure extracting ERRTYPE_* logic from JTLErrorsReader.find_failure (4e4737f3)
  • T012 — implement recover_assertion_name + synthetic assert::<label> fallback (4e4737f3)
  • T016 — graceful degradation: empty responseBodies, null rc tolerated (4e4737f3)
  • T008 — flag-gated EFT generation hook in BlazeMeterUploader.post_process() (f252ad34)
  • T014 — config guard (f252ad34)
  • T017 — YAML config docs in site/dat/docs/BlazemeterReporter.md (0e79cea1)
  • T018 — Sparta schema sign-off — non-blocking, no code change
  • T019 — full nose2 suite regression-checked

Stage validation

  • N/A — BlazeMeter product (jenkins.enabled: false). No stage build/deploy from this pipeline.

Regression validation

  • N/A — BlazeMeter product (regression.enabled: false). No consolidated regression suite runs for this product/ticket.

Implementer note: full nose2 -s tests/unit suite compared before/after — 91 pre-existing environmental failures, 0 regressions introduced, all 8 target EFT tests red→green (9/9 including S9 flag-off guard).

Links


AI-SDLC run: mob-43135-20260825T082749Z

ai-sdlc-bot and others added 6 commits August 25, 2026 11:43
…owser-based Selenium tests

Opt-in via modules.blazemeter.generate-failed-transactions (default off).
Extract ERRTYPE_* classification into bzt/modules/eft.py; generate in
BlazeMeterUploader.post_process; reuse existing artifact upload. JTLErrorsReader
unchanged; EFT not gated in taurus. Includes brownfield-context, spec, plan,
tasks, test-scenarios, design-contract, evidence-index.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… (classify/recover/build)

Executor-agnostic EFT helper for browser-based (Selenium/Apiritif) tests:
- classify_failure() maps a failure to an error_item_skel-shaped dict, typing
  ERRTYPE_ASSERT when an assertion name is present else ERRTYPE_ERROR (T011).
- recover_assertion_name() returns a synthetic assert::<label> for assertion
  failures whose real name is not recoverable, None for general errors (T012, A-ASSERT).
- build_failed_transactions() assembles the reportInfo + three-way-split artifact (T007).
- Graceful degradation: empty responseBodies, null rc tolerated (T016).
Classification extracted from JTLErrorsReader.find_failure; jmeter.py unchanged (FR-008).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…post_process

- Read modules.blazemeter.generate-failed-transactions (default off) and skip all
  generation when falsy — zero behaviour change (T014, FR-006).
- When on, iterate FunctionalAggregator.cumulative_results, classify each FAILED/BROKEN
  sample via bzt.modules.eft, and write failed_transactions.json to engine.artifacts_dir
  before __upload_artifacts bundles it into artifacts.zip (T008, FR-001/FR-002).
- Whole path is defensively wrapped so a build/write error is logged and never breaks
  post_process (Failure Modes contract).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ons flag

Add BlazeMeter reporter docs for the opt-in failed_transactions.json artifact for
browser-based tests, matching specs/mob-43135/quickstart.md.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an opt-in EFT (Exclude Failed Transactions) flow to generate a failed_transactions.json artifact for browser-based (Selenium/Apiritif) runs, so it can be uploaded via the existing artifacts.zip upload path and consumed by BlazeMeter for error categorization.

Changes:

  • Introduces bzt/modules/eft.py to classify functional failures and assemble the failed_transactions.json artifact structure.
  • Hooks artifact generation into BlazeMeterUploader.post_process() behind modules.blazemeter.generate-failed-transactions (default off), and documents the new flag.
  • Adds unit/integration-style tests plus a real fixture for assertion-vs-general-error behavior.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
bzt/modules/eft.py New EFT helper module: assertion detection, assertion-name recovery (with synthetic fallback), and artifact assembly.
bzt/modules/blazemeter/blazemeter_reporter.py Adds flag-gated generation of failed_transactions.json during post_process() so it’s included in artifact upload.
tests/unit/modules/test_eft.py Unit tests for EFT artifact shape and classification behavior (including null rc / empty responseBodies expectations).
tests/unit/modules/test_eft_assertion_probe.py “Probe” test validating real-fixture assertion-name recoverability assumptions and fallback behavior.
tests/unit/modules/blazemeter/test_blazemeter_eft.py Integration-style unit tests ensuring the artifact is written (or not) depending on the opt-in flag.
tests/resources/selenium/eft_assertion_failure.ldjson Realistic functional-result fixture rows used by EFT tests/probe.
site/dat/docs/BlazemeterReporter.md Documents generate-failed-transactions config flag and the emitted artifact semantics.
CLAUDE.md Adds repository guidance describing the EFT helper and where it’s invoked.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/unit/modules/test_eft.py Outdated
Comment thread bzt/modules/blazemeter/blazemeter_reporter.py Outdated
…t gaps

- Fix Counter() not JSON-serializable in classify_failure() → use plain dict
- Fix except BaseException → except Exception (don't swallow KeyboardInterrupt)
- Remove dead _sample_is_assertion() method and unreachable fallback
- Remove unreachable ERRTYPE_SUBSAMPLE branch in _transaction_from_item()
- Remove broken schema file reference in test (fixes CI FileNotFoundError)
- Add integration tests for general error and mixed failure scenarios
- Clean up phantom spec.md/tasks.md references in test docstrings
- Remove internal CLAUDE.md addition from open-source repo

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@devership16

Copy link
Copy Markdown
Collaborator

Copilot Review Items — Resolved in 46fe5ce

1. Schema file FileNotFoundError (test_eft.py:65)
Removed the broken specs/mob-43135/contracts/failed_transactions.schema.json reference. Replaced with json.dumps(artifact) which also guards against the Counter serialization bug fixed in the same commit.

2. except BaseException too broad (blazemeter_reporter.py:361)
Changed to except Exception to avoid swallowing KeyboardInterrupt/SystemExit.

Additional fixes in the same commit:

  • Bug fix: Counter(){} in classify_failure() — Counter is not JSON-serializable, causing silent artifact loss for general (non-assertion) errors
  • Dead code removed: _sample_is_assertion() method + unreachable ERRTYPE_SUBSAMPLE branch
  • Test coverage added: integration tests for general errors and mixed failure scenarios
  • Cleanup: phantom spec.md/tasks.md references in docstrings, internal CLAUDE.md addition

@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.55172% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.17%. Comparing base (3599312) to head (74fc566).

Files with missing lines Patch % Lines
bzt/modules/blazemeter/blazemeter_reporter.py 95.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2017      +/-   ##
==========================================
+ Coverage   88.11%   88.17%   +0.06%     
==========================================
  Files          73       74       +1     
  Lines       20964    21051      +87     
==========================================
+ Hits        18471    18559      +88     
+ Misses       2493     2492       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

devership16 and others added 3 commits August 26, 2026 16:49
Cover _find_functional_aggregator() returning None when engine uses
ConsolidatingAggregator (load test) instead of FunctionalAggregator.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
nose2 requires __init__.py to discover tests in subdirectories.
Without it, tests/unit/modules/blazemeter/test_blazemeter_eft.py
was not being run by CI's coverage command, causing 0% patch
coverage on blazemeter_reporter.py EFT code.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
test_engine_metrics.py used bare `from modules.blazemeter...` and
`from unit import...` instead of fully qualified `from bzt.modules...`
and `from tests.unit import...`. Never caught because the missing
__init__.py prevented nose2 from discovering it.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
devership16 and others added 2 commits August 28, 2026 17:05
When no FunctionalAggregator is present (BBT / performance mode),
_generate_failed_transactions_artifact now reads from
ConsolidatingAggregator.cumulative (KPISets) and classifies errors
by ERRTYPE_* — same three-way split as DatapointSerializer.__add_errors.

Adds 4 new unit tests covering: assertion failure, general error,
passing labels excluded, and Counter JSON serialization.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

3 participants