Inferensys

Prompt

Obsolete Test Retirement Recommendation Prompt

A practical prompt playbook for using the Obsolete Test Retirement Recommendation Prompt in production test maintenance workflows.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the specific job, required inputs, and operational boundaries for the Obsolete Test Retirement Recommendation Prompt.

This prompt is designed for SDETs and test architects who need to make a data-backed case for retiring a specific test case. The core job-to-be-done is generating a structured justification that links the retirement recommendation to concrete evidence: traceability gaps, code coverage overlap, stale requirement mappings, or prolonged periods of zero defect yield. It is not a bulk suite scanner; it works on one test case at a time, producing a detailed impact assessment suitable for stakeholder review or compliance audit trails.

Use this prompt when you have already identified a candidate test case and gathered its supporting evidence—such as its last execution results, linked requirements, code path coverage data, and defect history. The prompt requires you to provide this context explicitly via the [TEST_CASE_DETAILS] and [EVIDENCE_CONTEXT] placeholders. Do not use this prompt for initial discovery of redundant tests; use the Redundant Test Case Identification Prompt for that. Avoid using it when the test case guards an untracked regression or a critical safety property that lacks formal documentation, as the model will not infer undocumented risk.

The output is a structured retirement justification containing a coverage impact assessment, risk rationale, and explicit rollback conditions. Before acting on the recommendation, you must validate that no unique assertion or untracked regression path is silently dropped. The prompt includes a [REVIEW_CHECKLIST] placeholder to enforce human sign-off, ensuring the final decision remains auditable. If the test case belongs to a regulated system, route the output through your compliance review workflow before any retirement action is taken.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Obsolete Test Retirement Recommendation Prompt works and where it does not. Use these cards to decide if this prompt fits your workflow before wiring it into a test suite maintenance pipeline.

01

Good Fit: Traceable Test Suites

Use when: test cases are linked to requirements, user stories, or code paths via a test management system or traceability matrix. The prompt needs evidence to justify retirement without guessing. Guardrail: provide a traceability map as [TRACEABILITY_EVIDENCE] so the model can cite specific coverage relationships.

02

Good Fit: Structured Retirement Reviews

Use when: you have a batch of candidate tests flagged for retirement and need consistent justification documents for stakeholder review. The prompt produces auditable retirement rationales at scale. Guardrail: always route output through a human approval step before removing tests from the active suite.

03

Bad Fit: Untracked Legacy Suites

Avoid when: tests have no requirement links, no code path mapping, and no execution history. The model cannot invent traceability evidence and will produce plausible-sounding but ungrounded justifications. Guardrail: invest in traceability instrumentation before applying retirement prompts to legacy suites.

04

Bad Fit: Real-Time CI Decisions

Avoid when: you need sub-second decisions about whether to skip a test in a running CI pipeline. This prompt is designed for deliberate, human-reviewed retirement analysis, not runtime test selection. Guardrail: use a regression test selection prompt for CI-time decisions and reserve this prompt for offline suite maintenance.

05

Required Inputs

Must provide: test case metadata (ID, name, steps, assertions), traceability links to requirements or code, execution history (pass/fail trends, last run date), and coverage data. Guardrail: missing traceability evidence should trigger an output flag stating that retirement cannot be confidently recommended rather than producing a weak justification.

06

Operational Risk

Risk: removing a test that guards an untracked regression path can create a coverage gap that surfaces in production. Guardrail: require a rollback condition in every retirement recommendation—specify what signal would trigger test reinstatement and who owns the decision.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for generating structured test retirement recommendations with coverage impact assessment and risk rationale.

This section provides the core prompt template for the Obsolete Test Retirement Recommendation workflow. The template is designed to be copied directly into your prompt library, IDE, or orchestration layer. It uses square-bracket placeholders for all dynamic inputs, making it straightforward to wire into a CI/CD pipeline, a test management system, or a manual review queue. The prompt forces the model to justify every retirement recommendation with traceability evidence, coverage impact analysis, and explicit rollback conditions—preventing the removal of tests that guard against untracked regressions.

text
You are a senior SDET analyzing a test case for potential retirement. Your task is to determine whether [TEST_CASE_ID] should be retired from the test suite and to produce a structured recommendation with evidence.

## INPUT
- Test Case: [TEST_CASE_ID]
- Test Name: [TEST_NAME]
- Test Steps: [TEST_STEPS]
- Assertions: [ASSERTIONS]
- Last Execution Status: [LAST_STATUS]
- Defects Found (last 12 months): [DEFECT_HISTORY]
- Linked Requirements: [REQUIREMENT_IDS]
- Code Paths Exercised: [CODE_PATHS]
- Current Feature Status: [FEATURE_STATUS]
- Maintenance History: [MAINTENANCE_HISTORY]

## CONTEXT
- Suite Health Goals: [SUITE_HEALTH_GOALS]
- Risk Tolerance: [RISK_TOLERANCE]
- Regulatory Constraints: [REGULATORY_CONSTRAINTS]
- Recent Code Changes: [RECENT_CODE_CHANGES]

## CONSTRAINTS
- Do not recommend retirement if the test covers a unique code path that is still active.
- Do not recommend retirement if the test has caught a defect in the last [DEFECT_WINDOW_MONTHS] months.
- If the linked requirement is deprecated but the code path is still exercised by another feature, flag the gap instead of recommending retirement.
- For any retirement recommendation, you must specify a rollback condition.

## OUTPUT_SCHEMA
Return a JSON object with the following structure:
{
  "recommendation": "RETIRE" | "KEEP" | "REFACTOR" | "INVESTIGATE_FURTHER",
  "confidence": "HIGH" | "MEDIUM" | "LOW",
  "rationale": "string explaining the primary reason for the recommendation",
  "coverage_impact": {
    "unique_coverage_lost": ["list of assertions or paths that would no longer be tested"],
    "alternative_coverage_exists": true | false,
    "alternative_tests": ["test IDs that cover the same risk"]
  },
  "risk_assessment": {
    "regression_risk": "HIGH" | "MEDIUM" | "LOW",
    "risk_rationale": "string explaining the risk level"
  },
  "rollback_conditions": ["specific conditions that would require restoring this test"],
  "evidence": {
    "requirement_status": "ACTIVE" | "DEPRECATED" | "UNKNOWN",
    "code_path_status": "ACTIVE" | "DEAD" | "UNKNOWN",
    "defect_history_relevant": true | false
  },
  "stakeholder_approval_required": true | false,
  "suggested_reviewers": ["roles or individuals who should approve before retirement"]
}

## EXAMPLES
[FEW_SHOT_EXAMPLES]

## INSTRUCTIONS
1. Compare the test assertions against the linked requirements and current feature status.
2. Check whether the code paths exercised are still reachable in the current codebase.
3. Review defect history to determine if this test provides unique regression protection.
4. If coverage is duplicated elsewhere, verify that the alternative tests actually assert the same conditions.
5. If you cannot determine code path status from the provided information, set recommendation to INVESTIGATE_FURTHER.
6. For any RETIRE recommendation, provide at least one specific rollback condition.

Adapting the template for your environment: Replace each square-bracket placeholder with data from your test management system, CI pipeline, or manual analysis. The [FEW_SHOT_EXAMPLES] placeholder should be populated with 2-3 example recommendations showing correct RETIRE, KEEP, and INVESTIGATE_FURTHER outputs for your domain. If your organization uses a different risk taxonomy, adjust the enum values in risk_assessment.regression_risk and confidence to match your internal terminology. For regulated environments, add a [COMPLIANCE_EVIDENCE] field to the INPUT section and require explicit regulatory citations in the rationale. The [DEFECT_WINDOW_MONTHS] constraint should be set based on your release cadence—typically 6-12 months for quarterly releases, or 3 months for continuous deployment teams. Before deploying this prompt to an automated pipeline, validate that the output JSON conforms to your schema using a programmatic validator, and log every retirement recommendation for auditability.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Obsolete Test Retirement Recommendation Prompt. Each variable must be populated with traceability evidence to prevent removal of tests guarding untracked regressions.

PlaceholderPurposeExampleValidation Notes

[TEST_CASE]

The test case under retirement evaluation, including its name, ID, steps, assertions, and tags

TC-AUTH-042: Verify OAuth token refresh with expired refresh_token returns 401

Must include test body or unique identifier resolvable in the test management system. Null not allowed.

[REQUIREMENT_MAP]

Traceability links connecting the test case to requirements, user stories, or acceptance criteria it was designed to cover

REQ-SEC-018 (Token lifecycle), US-214 (Session expiry handling)

Each entry must reference a live requirement. Stale or deprecated requirement links must be flagged. Empty map is a strong retirement signal but requires explicit risk acknowledgment.

[CODE_COVERAGE_EVIDENCE]

Code paths, functions, or modules exercised by this test, sourced from coverage tooling or static analysis

auth/token_refresh.go:handleExpiredToken() lines 142-178

Must be verifiable against current branch coverage data. Null allowed if coverage instrumentation is unavailable, but retirement confidence must be downgraded.

[ALTERNATIVE_TEST_IDS]

IDs of other test cases that cover the same or overlapping functionality

TC-AUTH-041, TC-AUTH-045, TC-SESSION-012

Each alternative must be confirmed active and passing. If no alternatives exist, retirement recommendation must default to DENY unless explicit risk acceptance is provided.

[DEFECT_HISTORY]

Bug reports, incidents, or regressions caught by this test case, with timestamps and severity

BUG-8912 (token refresh race condition, Sev-2, 2024-11-03)

Null allowed for tests with no defect yield. Low defect history combined with overlapping alternatives strengthens retirement case.

[EXECUTION_METADATA]

Recent execution history including pass/fail rate, flakiness score, average duration, and last run timestamp

Pass rate: 98.2%, Flaky: false, Avg duration: 1.4s, Last run: 2025-01-15

Flaky tests with unique coverage must not be retired without root cause analysis. Duration outliers may indicate refactoring opportunity rather than retirement.

[REGULATORY_CONTEXT]

Compliance obligations, audit requirements, or regulatory standards that mandate this test's existence

SOC 2 CC6.1 (logical access controls), FDA 21 CFR Part 11 (audit trail validation)

Null allowed for non-regulated domains. If populated, retirement requires documented stakeholder approval and alternative coverage evidence. This field gates the approval workflow.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Obsolete Test Retirement Recommendation Prompt into a test management application or CI workflow.

This prompt is designed to be called programmatically as part of a test suite maintenance pipeline, not as a one-off chat interaction. The implementation harness must supply structured evidence about each candidate test case, invoke the model, validate the structured output, and route the recommendation to the appropriate review queue. Because the prompt recommends removing safety assets, the harness must treat every retirement recommendation as a draft requiring human approval before any test is deleted or disabled.

Wire the prompt into an application by first assembling the required inputs for each test candidate: the test case identifier, its current steps and assertions, the traceability links to requirements or code paths it claims to cover, recent execution history (pass/fail/flaky rates over the last N runs), and any known coverage overlap with other tests. Package these into the [TEST_CASE_PROFILE] placeholder as a structured JSON block. Set [CONSTRAINTS] to enforce the output schema and require explicit coverage gap analysis. On the model side, choose a model with strong structured output support (GPT-4o, Claude 3.5 Sonnet, or equivalent) and set response_format to json_schema where available, using the retirement recommendation schema defined in the prompt. Implement a validation layer that checks: (1) the output parses as valid JSON matching the expected schema, (2) the retirement_recommendation field is one of the allowed enum values, (3) every coverage_gap entry references a specific requirement or code path, and (4) the rollback_conditions field is non-empty when the recommendation is retire. If validation fails, retry once with the validation errors injected into the prompt as additional context. If the second attempt fails, escalate to a human reviewer with the raw output and validation failure details.

Log every invocation with the test case ID, model version, prompt version, raw response, validation result, and final recommendation. This audit trail is essential for compliance reviews and for debugging false-positive retirement suggestions. Route retire recommendations to a review queue where an SDET or test architect must confirm or reject the recommendation before any CI configuration change. Route retain and investigate recommendations to a lower-priority backlog for periodic review. Never automate the actual deletion or disabling of tests based solely on model output—the harness should produce a signed-off change ticket that a human applies. For teams using test management systems like TestRail, Zephyr, or Xray, the harness should update the test case status field to pending_retirement_review and attach the full recommendation as evidence, rather than modifying the test directly.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, format, and validation rules for the retirement recommendation output. Use this contract to parse, validate, and store the model response before presenting it to a human reviewer or automation pipeline.

Field or ElementType or FormatRequiredValidation Rule

test_case_id

string

Must match the [INPUT_TEST_CASE_ID] format. Non-empty and present in the source test registry.

retirement_recommendation

enum: retire | retain | conditional_retire

Must be one of three allowed values. Conditional_retire requires a non-null condition field.

coverage_impact_assessment

string

Must contain at least one specific requirement ID or code path reference. Cannot be generic statements like 'low impact' without evidence.

risk_rationale

string

Must cite at least one of: feature deprecation, code path removal, or requirement retirement. Null or empty string triggers a retry.

rollback_conditions

array of strings

If present, each item must describe a verifiable condition. Required when recommendation is conditional_retire. Null allowed for retain.

traceability_evidence

array of objects with source and reference fields

Array must contain at least one object with non-empty source and reference. Source must match a known traceability system (e.g., 'requirements_db', 'code_commit', 'test_history').

alternative_coverage

array of test_case_id strings

If retirement_recommendation is retire or conditional_retire, at least one alternative test must be listed. Each ID must exist in the test registry. Null allowed for retain.

confidence_score

number between 0.0 and 1.0

Must be a float. Scores below 0.7 require human review before any automated retirement action. Scores above 0.95 without traceability evidence trigger a validation warning.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when asking a model to recommend test retirement, and how to guard against it.

01

Retiring Tests That Guard Untracked Regressions

Risk: The model recommends retiring a test that appears redundant but actually covers a regression scenario not documented in requirements or code comments. Guardrail: Require a traceability check against bug databases and incident postmortems, not just requirements. Flag any candidate that has caught a defect in the last 12 months for manual review.

02

Coverage Gap Blindness

Risk: The model asserts coverage is preserved by another test, but that test exercises the path under different conditions or with weaker assertions. Guardrail: Require assertion-level comparison, not just path-level. Validate that the surviving test checks the same boundary values, error conditions, and state transitions before accepting the retirement recommendation.

03

Over-Confidence in Code Path Analysis

Risk: The model claims a code path is no longer reachable based on static analysis or outdated documentation, but the path is still exercised through dynamic dispatch, reflection, or configuration flags. Guardrail: Pair static analysis claims with runtime coverage data. If execution data is unavailable, escalate the candidate to a human reviewer with a "cannot confirm dead code" annotation.

04

Ignoring Regulatory or Compliance Coverage

Risk: The model treats a test as low-value based on functional coverage metrics alone, missing that the test exists to satisfy an audit requirement, regulatory control, or contractual obligation. Guardrail: Tag all tests with compliance and regulatory metadata before analysis. Exclude any test with a compliance tag from automated retirement recommendations.

05

Hallucinated Justifications with Fake Evidence

Risk: The model fabricates coverage statistics, defect history, or requirement references to justify a retirement recommendation. Guardrail: Require every justification to cite a specific, verifiable source—test execution logs, coverage reports, requirement IDs, or defect tickets. Validate citations programmatically before presenting recommendations to stakeholders.

06

Batch Retirement Cascading Errors

Risk: The model recommends retiring multiple tests simultaneously, but the combined coverage gap is larger than the sum of individual gaps because tests share setup or teardown logic. Guardrail: Simulate the coverage impact of the full retirement batch, not just individual candidates. Require a staged retirement plan where each phase is validated before proceeding to the next.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for evaluating the quality of an obsolete test retirement recommendation before shipping the prompt to production. Use these checks to catch over-retirement, missing evidence, and unjustified risk acceptance.

CriterionPass StandardFailure SignalTest Method

Traceability Evidence

Every retirement candidate cites at least one specific source: requirement ID, code path, commit SHA, or test history log

Recommendation says 'no longer needed' or 'seems unused' without linking to a traceability artifact

Parse output for [EVIDENCE] field; assert non-empty and matches expected source format (e.g., REQ-123, src/auth/login.ts)

Coverage Impact Assessment

Output includes a concrete statement of which requirement, risk, or code path loses direct test coverage if the test is retired

Coverage impact is missing, vague ('low risk'), or assumes another test covers it without naming that test

Check [COVERAGE_GAP] field is present and references a specific requirement ID or code path; fail if null or 'none' without justification

Risk Rationale Completeness

Retirement justification addresses probability and impact of missed regression, with explicit reasoning for why the risk is acceptable

Risk rationale is a single sentence ('risk is low') or copies the same justification across multiple candidates

LLM-as-judge check: prompt a separate evaluator to score risk rationale on completeness (1-5 scale); fail below 3

Rollback Condition Specification

Output defines a concrete, observable trigger that would warrant reinstating the test (e.g., 're-add if module X is modified' or 're-add if defect type Y reappears')

Rollback condition is missing, generic ('if needed'), or defers all responsibility to a future reviewer

Parse [ROLLBACK_CONDITION] field; assert length > 50 characters and contains a specific module, feature, or defect class reference

False Positive Discrimination

Recommendation distinguishes between tests that appear obsolete but guard untracked regressions, and tests that are genuinely safe to retire

Output recommends retiring a test that has no traceability link but has caught a production defect in the last 6 months

Cross-reference retirement candidates against defect history; fail if any candidate has a linked defect fix in [DEFECT_HISTORY_WINDOW] without explicit override justification

Stakeholder Approval Readiness

Output is structured so a non-author can understand the decision, the evidence, and the residual risk without additional research

Recommendation requires the reader to already know why the test exists or what it covers; uses internal shorthand without expansion

Human review spot-check: give output to a peer SDET not familiar with the specific test; fail if they cannot explain the retirement rationale in under 2 minutes

Batch Consistency

When evaluating multiple candidates, each recommendation uses the same structure, evidence standards, and risk language; no candidate gets a 'free pass'

One candidate is retired with thin evidence while a similar candidate is retained with equally thin evidence; inconsistent bar

Automated schema check across all candidates in batch; assert all required fields present; LLM pairwise comparison of justification depth variance; fail if variance exceeds threshold

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base prompt and a single test case plus its traceability evidence. Use a lightweight output format—plain text or a simple JSON object with retire, justification, and risk fields. Skip formal schema validation and coverage gap analysis in this phase. Focus on whether the model correctly identifies tests that clearly map to removed features or dead code paths.

Watch for

  • Over-retirement: the model recommends removing tests that still guard active code paths but have stale documentation
  • Missing evidence checks: the model accepts traceability claims without verifying them against current requirements or code
  • Vague justifications like "low value" without linking to specific coverage alternatives
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.