Skip to main content

When to Use This

Use this guide when onboarding a project that has little or no automated tests. The MCP workflow will analyze your codebase, derive a normalized PRD, generate both frontend and backend test plans, create runnable tests, execute them, and produce reports.

Prerequisites

  • Installed and configured TestSprite MCP in your IDE
  • Application can run locally (frontend dev server or backend API)
  • Basic test credentials if auth is required

Quick Start (All-in-One)

generate
Ask your IDE assistant:
Help me test this project with TestSprite.
The assistant will orchestrate the full flow automatically.

Complete Testing Workflow

TestSprite follows a systematic 8-step process to transform your code into thoroughly tested software:

Step 1: Bootstrap Testing Environment

The AI calls testsprite_bootstrap_tests to initialize the testing environment.
Learn more about bootstrap configuration: First Test: Configuration
bootstrap
Process:
  1. Project Detection: Identifies project type (frontend or backend)
  2. Port Discovery: Finds running applications and their ports
  3. Configuration Portal: Opens TestSprite configuration interface
  4. Scope Definition: Determines testing scope (codebase for full project)
testsprite_bootstrap_tests({
  localPort: 5173, // or your port
  type: "frontend", // or "backend"
  projectPath: "/absolute/path/to/your/project",
  testScope: "codebase" // test entire project
})

Step 2: Read User PRD

TestSprite reads the Product Requirements Document (PRD) that you upload to understand your product goals and requirements.
prd
Process:
  1. PRD Upload: Reads the PRD file you uploaded during configuration
  2. Requirement Parsing: Extracts user stories, acceptance criteria, and functional requirements
  3. Goal Understanding: Identifies primary product objectives and user needs
  4. Scope Definition: Determines what features should be tested

Step 3: Code Analysis & Summary

The AI calls testsprite_generate_code_summary to analyze your codebase.
summary
Analysis Process:
  1. Structure Mapping: Identifies files, folders, and dependencies
  2. Framework Detection: Recognizes React, Vue, Angular, Node.js, etc.
  3. Feature Extraction: Understands implemented functionality
  4. Architecture Analysis: Maps component relationships
  5. Security Assessment: Identifies potential vulnerabilities
testsprite_generate_code_summary({
  projectRootPath: "/absolute/path/to/your/project"
})

Step 4: Generate TestSprite Normalized PRD

The AI calls testsprite_generate_standardized_prd to create a standardized, normalized Product Requirements Document.
prd
TestSprite Innovation - TestSprite invented this normalized PRD format, a standardized structure that ensures consistent test generation across any project type, regardless of your original PRD format. Learn more in Key Terms.
PRD Components:
  1. Product Overview: High-level description and goals
  2. Core Goals: Primary objectives and user needs
  3. Key Features: Main functionality and capabilities
  4. User Flows: Step-by-step user journeys
  5. Validation Criteria: Test requirements and acceptance criteria
testsprite_generate_standardized_prd({
  projectPath: "/absolute/path/to/your/project"
})

Step 5: Create Test Plans

The AI calls testsprite_generate_frontend_test_plan or testsprite_generate_backend_test_plan based on project type.
testplan
Test Plan Components:
  1. Test Cases: Detailed scenarios with steps
  2. Categories: Functional, UI/UX, Security, Performance
  3. Priorities: High, Medium, Low based on user impact
  4. Prerequisites: Setup requirements for each test
  5. Expected Results: Success criteria and validation points
testsprite_generate_frontend_test_plan({
  projectPath: "/absolute/path/to/your/project",
  needLogin: true
})

Step 6: Generate Executable Test Code

The AI calls testsprite_generate_code_and_execute to create production-ready test code based on the test plans.
code
Test Code Generation Process:
  1. Framework Selection: Chooses appropriate testing framework (Playwright, Cypress, Jest)
  2. Test Structure: Creates organized test suites and files
  3. Helper Functions: Generates reusable utility functions
  4. Data Setup: Creates test data and fixtures
  5. Configuration: Sets up test environment configuration
testsprite_generate_code_and_execute({
  projectName: "your-project-name",
  projectPath: "/absolute/path/to/your/project",
  testIds: [], // empty = all tests
  additionalInstruction: "Focus on critical user journeys first"
})

Step 7: Execute Tests

TestSprite runs the generated test code in secure cloud environments.
cloud
Cloud Execution Process:
  1. Sandbox Creation: Isolated testing environment
  2. Dependency Installation: Installs required packages
  3. Test Execution: Runs all generated tests
  4. Result Collection: Gathers results, screenshots, logs
  5. Report Generation: Creates comprehensive test report

Step 8: Analyze Results & Reports

TestSprite generates comprehensive test reports with detailed analysis, error descriptions, and actionable fix recommendations.
report

  • What You Get
  • Files Generated
  • Detailed test results with pass/fail status for each test case
  • Error analysis explaining why tests failed
  • Fix recommendations with specific steps to resolve issues
  • Coverage metrics showing overall project health
  • Requirement breakdown organized by feature areas
Test Report Structure:
Basic Information - Every report starts with essential details:
  • Project Name - The name of your application
  • Test Date - When the tests were run
  • Version - Which version was tested
  • Summary - Quick overview of results
Test Results by Feature - The report groups tests by your app’s main features. Each feature section shows:Feature Overview:
  • What it does - Simple description of the feature
  • How many tests - Number of tests run for this feature
Each Test Shows:
  • Test ID - Unique identifier like “TC001”
  • What was tested - Clear description like “Login with valid password”
  • Result - ✅ Passed or ❌ Failed
  • Priority - High, Medium, or Low importance
  • What went wrong - Detailed error explanation (if failed)
  • How to fix it - Specific recommendations for repairs
Overall Results Summary:Quick Stats:
  • 73% of features tested - How much of your app was covered
  • 56% of tests passed - Overall success rate
  • Critical issues found - Most important problems to fix
Feature-by-Feature Breakdown:
Feature AreaTests Run✅ Passed❌ Failed
User Login211
Product Display220
Admin Panel303
Shopping Cart330

Step 9: AI Fixes Issues

When you request fixes with “Help me fix the codebase based on these test results”, your IDE AI assistant:

TestSprite’s Role - TestSprite provides the analysis and recommendations, while your IDE’s AI assistant implements the actual fixes.
  • Process
  • Example Fix Application
  1. Reads Test Results: Reviews testsprite_tests/tmp/test_results.json for detailed failure data
  2. Analyzes Test Report: Processes testsprite_tests/tmp/report_prompt.json for context and recommendations
  3. Examines Error Details: Reviews stderr messages and test visualizations
  4. Identifies Root Causes: Determines underlying issues causing test failures
  5. Generates Targeted Fixes: Creates code changes based on TestSprite’s recommendations
  6. Applies Changes: Modifies your codebase automatically
  7. Validates Fixes: Re-runs tests to verify solutions

Best Practices

  • Ensure all applications are running on specified ports
  • Prepare test credentials for auth flows
  • Update README with clear project description
  • Clean up any development artifacts
  • Review generated PRD for accuracy
  • Examine test plan coverage
  • Monitor test execution progress
  • Note any configuration adjustments needed
  • Analyze test results thoroughly
  • Understand failure patterns
  • Apply fixes systematically
  • Document lessons learned
  • Re-run tests to validate fixes

Next Steps