Open this lesson in your favourite AI. It'll walk you through the why, explain the demo, and quiz you on the try-it list.
Just as software development has a lifecycle, so does testing. The Software Testing Lifecycle (STLC) gives QA engineers a structured framework that answers 'what are we doing in testing right now?' and 'what needs to happen before we can release?' The phases — test planning, test analysis, test design, test implementation, test execution, and test closure — each have specific deliverables (test plan, test cases, execution results, metrics report). Without this framework, QA becomes ad hoc: 'we tested it' with no artifacts, no coverage visibility, and no way to know if testing is complete.
Software Testing Lifecycle phases are only useful when each phase has explicit entry and exit criteria — without them, teams skip phases under time pressure and discover the debt later. Entry criteria prevent wasted work (starting test execution before the environment is stable). Exit criteria prevent premature release (shipping with open P1 defects because 'most tests passed').
status='pending' to status='blocked' for 'Test Execution'. Write a print_blocked_phases() function that lists all blocked phases and their missing entry criteria. This simulates QA raising a blocker in a standup.defects_found: int = 0 field to the STLCPhase dataclass. Update the Test Execution phase to defects_found=12. Write a function that computes defect_density = defects_found / len(test_cases) and print a pass/fail vs industry benchmark (typically < 0.5 defects per test case).can_enter(phase) function that checks whether all entry_criteria for the next phase are met (simulate this with a dict of completed criteria). Print 'Ready to enter X' or 'Blocked: missing Y'.Use these three in order. Each builds on the one before.
In one paragraph, explain why entry and exit criteria matter in the test lifecycle. What happens when a team skips them — for example, when they start test execution before the test environment is stable?
Walk me through the difference between test analysis (identifying what to test) and test design (designing how to test it). Give a concrete example: for a user login feature, list 3 test conditions from analysis and 3 test cases from design.
My team's test execution phase is consistently running 2× longer than planned. Using the STLC phases, diagnose the three most likely root causes (upstream phase deliverable quality, environment instability, defect fix cycle time) and propose a measurable fix for each.
from dataclasses import dataclass, field
from typing import List, Optional
@dataclass
class STLCPhase:
name: str
entry_criteria: List[str]
activities: List[str]
deliverables: List[str]
exit_criteria: List[str]
status: str = "pending" # pending | in_progress | complete | blocked
stlc = [
STLCPhase(
name="1. Test Planning",
entry_criteria=["Requirements document available", "Project plan approved"],
activities=["Define scope", "Estimate effort", "Assign resources", "Define tools"],
deliverables=["Test Plan document", "Risk assessment"],
exit_criteria=["Test plan reviewed and signed off"],
),
STLCPhase(
name="2. Test Analysis",
entry_criteria=["Test plan approved", "Requirements finalized"],
activities=["Identify test conditions", "Prioritize by risk"],
deliverables=["Test conditions list", "Requirements traceability matrix"],
exit_criteria=["All requirements mapped to at least one test condition"],
),
STLCPhase(
name="3. Test Design",
entry_criteria=["Test conditions list complete"],
activities=["Write test cases", "Prepare test data", "review test cases"],
deliverables=["Test case suite", "Test data set"],
exit_criteria=["Test cases reviewed, test data ready"],
),
STLCPhase(
name="4. Test Execution",
entry_criteria=["Build available", "Test environment set up", "Test data ready"],
activities=["Execute test cases", "Log defects", "Re-test fixed bugs"],
deliverables=["Test execution report", "Defect report"],
exit_criteria=["All planned tests executed, all P1/P2 defects closed"],
),
STLCPhase(
name="5. Test Closure",
entry_criteria=["Exit criteria for execution met"],
activities=["Write summary report", "Archive test artifacts", "Lessons learned"],
deliverables=["Test summary report", "Metrics (defect density, pass rate)"],
exit_criteria=["Summary report approved by stakeholders"],
),
]
for phase in stlc:
print(f"\n{phase.name} [{phase.status}]")
print(f" Entry: {', '.join(phase.entry_criteria[:1])} ...")
print(f" Deliverable: {phase.deliverables[0]}")
print(f" Exit: {phase.exit_criteria[0]}")python3 main.py