Skip to main content
Verdent for VS Code helps you write comprehensive tests and debug issues through multipass generate-test-repair cycles, error analysis, and automated test coverage improvements. Generate unit, integration, and end-to-end tests that match your project’s testing framework and style.

What You’ll Learn

  • Generate unit tests covering edge cases and expected behavior
  • Work with all major testing frameworks (Jest, Pytest, JUnit, etc.)
  • Create integration tests verifying multi-component workflows
  • Improve test coverage by identifying and testing uncovered code paths
  • Debug issues using error message analysis and execution tracing
  • Diagnose bugs from stack traces, error logs, and unexpected behavior

Prerequisites

Before testing and debugging with Verdent:
  • Visual Studio Code with Verdent extension installed
  • A codebase or project workspace open in VS Code
  • Active Verdent subscription with available credits
  • Testing framework configured in your project (optional for test generation)

Writing Unit Tests

Verdent generates unit tests that match your project’s testing framework and style. It analyzes existing tests to understand your patterns, then generates tests with proper setup, assertions, and mocking. Example:
Write unit tests for the calculateDiscount function
Verdent will:
  • Examine the calculateDiscount function implementation
  • Identify input parameters and return values
  • Analyze existing tests to match your conventions (test structure, assertion style, naming patterns)
  • Generate tests covering:
    • Happy path: Valid inputs with expected outputs
    • Edge cases: Boundary values, zero, negative numbers, maximum values
    • Invalid inputs: null, undefined, wrong types
    • Expected behavior: Business logic validation
Generated Test Structure: Verdent creates tests following your project’s patterns:
  • Test suite organization: Describe blocks, test classes, or module structure
  • Setup and teardown: Before/after hooks matching your existing tests
  • Assertions: Using your project’s assertion library (expect, assert, should, etc.)
  • Mocking: Matching your mocking patterns (jest.mock, sinon, unittest.mock)
  • Naming conventions: Test names following your established style
Multipass Generate-Test-Repair Cycles: For comprehensive testing, Verdent uses multipass cycles:
  1. Generate: Create initial test suite
  2. Run: Execute tests to verify they work
  3. Repair: Fix failing tests or improve coverage
  4. Iterate: Repeat until tests pass and coverage is sufficient
This ensures tests are not just written but actually work correctly with your codebase.
Verdent analyzes your existing tests to match your conventions. The more consistent your existing test patterns, the better Verdent’s generated tests will align with your project’s style.

Supported Test Frameworks

Verdent supports all major testing frameworks across different programming languages and technology stacks without requiring additional configuration.
  • JavaScript/TypeScript
  • Python
  • Java & JVM
  • Other Languages
Unit Testing Frameworks:
test('sum returns correct result', () => {
  expect(sum(2, 3)).toBe(5);
});
Framework-Specific Testing:
  • React Testing Library - User-centric React component testing
  • Vue Test Utils - Official Vue.js testing library
End-to-End Testing:
  • Cypress - End-to-end and component testing
  • Playwright - Cross-browser end-to-end testing
  • Puppeteer - Headless Chrome testing
Verdent recognizes your testing framework from your project configuration and existing tests, automatically generating tests that match your setup.

Generating Integration Tests

Verdent generates integration tests that verify how multiple components, services, or modules work together. It creates tests simulating real workflows including API interactions, database operations, authentication flows, and multi-step user journeys. Example:
Write integration tests for the user registration flow
Verdent generates tests verifying the complete flow:
  1. Form Submission: User submits registration form with valid data
  2. Validation: Backend validates email format, password strength, data completeness
  3. Database Insertion: User record is created in the database
  4. Email Sending: Confirmation email is sent (mocked or actual)
  5. Successful Login: New user can immediately log in with credentials
Integration Test Structure: Verdent creates integration tests with:
  • Test Setup: Database seeding, service initialization, test data creation
  • Workflow Simulation: Multi-step operations in sequence
  • State Verification: Checking database state, API responses, side effects
  • Mocking External Services: Email services, payment APIs, third-party integrations
  • Test Teardown: Cleanup of test data, database rollback, service shutdown
Example Test Scenarios:
Write integration tests for the checkout and payment process
Verdent tests:
  • Adding items to cart
  • Applying discount codes
  • Calculating totals with tax and shipping
  • Processing payment (with mocked payment gateway)
  • Creating order record in database
  • Sending confirmation email
  • Updating inventory
Test Isolation: Verdent ensures integration tests are properly isolated:
  • Each test starts with a clean database state
  • External service calls are mocked to prevent side effects
  • Tests can run in any order without dependencies
  • Cleanup happens even if tests fail
Integration tests benefit from isolated test environments, Verdent can help set up database fixtures and mock external services.
Integration tests verify that components work together correctly. They’re more complex than unit tests but provide higher confidence that real-world workflows function as expected.

Improving Test Coverage

Verdent analyzes your codebase to identify untested functions, branches, and edge cases, then generates tests to improve coverage. It examines your existing test suite and identifies gaps where code paths aren’t exercised. Example:
Analyze test coverage and write tests for uncovered code paths in the payment module
Verdent will:
  1. Analyze Existing Tests: Examine what’s currently tested
  2. Identify Coverage Gaps: Find specific functions, conditional branches, error handling paths, and edge cases lacking tests
  3. Generate Missing Tests: Create tests targeting uncovered code
  4. Verify Coverage Improvement: Run tests to confirm coverage increases
What Verdent Identifies:
  • Untested Functions: Functions with no test coverage at all
  • Conditional Branches: If/else statements where one branch isn’t tested
  • Error Handling Paths: Try/catch blocks or error callbacks without failure tests
  • Edge Cases: Boundary values, null/undefined handling, type coercion
  • Integration Points: API calls, database operations, external service interactions
Example Coverage Improvement:
Improve test coverage for the UserService class
Verdent identifies:
  • getUserById has tests for valid IDs but not invalid IDs
  • updateUser missing tests for validation failures
  • deleteUser missing tests for authorization checks
  • Error handling paths in createUser are untested
Then generates tests specifically targeting these gaps, increasing coverage from 65% to 95%. Coverage Metrics: Verdent helps you reach higher coverage percentages and catch potential bugs in previously untested code:
  • Line Coverage: Percentage of code lines executed by tests
  • Branch Coverage: Percentage of conditional branches tested
  • Function Coverage: Percentage of functions with at least one test
  • Statement Coverage: Percentage of statements executed

Debugging with Verdent

Verdent helps debug by analyzing error messages, tracing execution flow, identifying root causes, and suggesting fixes. Paste error logs, describe unexpected behavior, or ask Verdent to investigate specific issues.
  • Unexpected Behavior
  • Performance Issues
  • Execution Flow
Describe what’s wrong and what you expected:
This function returns undefined instead of the user object. Debug it.
Verdent will:
  • Read the function implementation
  • Trace the execution flow
  • Identify where the code path goes wrong (missing return statement, incorrect conditional, async/await issue)
  • Propose a fix with explanation
  • Suggest test cases to prevent regression
Example:
The login form redirects to the home page even when credentials are invalid
Verdent will:
  • Examine the login form submission logic
  • Trace authentication flow
  • Identify the bug (redirect happens before async validation completes)
  • Propose a fix (await validation before redirecting)
Paste error messages or stack traces directly into the chat. Verdent analyzes the error, locates the problematic code, and explains what went wrong with specific file paths and line numbers.

Diagnosing from Error Messages and Logs

Paste error messages, stack traces, or log files directly into the chat. Verdent analyzes the error, identifies the source file and line number, explains the cause, and suggests a fix.
  • Stack Traces
  • Log Analysis
  • Multi-Step Debugging
Paste error messages and stack traces:
TypeError: Cannot read property 'name' of undefined
    at UserProfile.render (UserProfile.jsx:45)
    at processComponent (react-dom.js:2103)
Paste this into Verdent:
I'm getting this error: [paste stack trace]
Verdent will:
  • Identify the error type (TypeError from null/undefined access)
  • Locate the exact line (UserProfile.jsx:45)
  • Read the code at that location
  • Explain why it’s happening (user object is undefined before data loads)
  • Propose fixes:
    • Add null check: if (!user) return <Loading />
    • Use optional chaining: user?.name
    • Ensure data loads before rendering component

Best Practices

Write tests as you develop features, not after completion. Verdent can generate tests immediately after creating new functions or components.
Verdent matches your project’s testing patterns. Maintain consistent test structure so Verdent generates tests that align with your conventions.
Ask Verdent to test boundary conditions, error scenarios, and unusual inputs: “Write tests including edge cases for invalid inputs and boundary values.”
Don’t paraphrase errors. Paste the complete stack trace for accurate diagnosis and faster resolution.
When debugging, clearly state what you expected to happen and what actually happened. This context helps Verdent identify the root cause.
For critical features, request comprehensive test generation with multipass cycles: “Generate comprehensive tests for the payment module and verify they all pass.”
After refactoring code, request tests to verify functionality is preserved: “Generate tests to verify the refactored authentication module works correctly.”
After fixing a bug, request a test to prevent regression: “Write a test that ensures this bug doesn’t happen again.”

See Also