The Deska blog

Which Test Cases Are Missing? Ask the Agent

Learn how to use AI coding agents to identify which test cases are missing in your codebase and improve coverage through automated gap analysis.

· 11 min read

Identifying which test cases are missing from a suite is a constant challenge for developers. While code coverage tools provide quantitative data on which lines were executed, they rarely highlight the qualitative gaps in logic or edge cases that remain untested. Relying solely on manual inspection is time consuming and prone to human oversight. AI coding agents offer a new way to bridge this gap by analyzing function requirements against existing test implementations to suggest missing scenarios.

The Problem with Traditional Coverage Metrics

Standard code coverage metrics like line, statement, and branch coverage are useful but limited. They tell you that a line of code was touched during a test run, but they do not guarantee that the logic on that line was actually validated against all possible inputs.

A common scenario is the happy path fallacy. A developer writes a function and a corresponding test that passes with standard input. The coverage tool marks the function as covered. However, the test might miss null inputs, extremely large integers, or unexpected data types. These missing test cases often lead to production bugs that automated CI/CD pipelines fail to catch.

Using AI Agents for Gap Analysis

Coding agents can process the context of your entire file or project. Unlike a simple linter, an agent can understand the intent of a function. By comparing the source code with the existing test suite, the agent can deduce what logic is being ignored.

To find which test cases are missing, you can provide the agent with access to your source files and your test directory. The agent then performs a cross reference. It looks for conditional branches in the source that do not have a corresponding assertion in the tests. It also identifies business logic requirements that might be described in comments but lack programmatic validation.

Strategies for Finding Untested Logic

When you ask an agent to identify missing tests, it is helpful to guide the analysis through specific lenses. This ensures the output is actionable and technical rather than generic.

  • Boundary Value Analysis: Ask the agent to look for loops, comparisons, and mathematical operations. It should suggest tests for values exactly at, just below, and just above defined limits.
  • Error Handling Paths: Instruct the agent to find every try-catch block or error return. Often, the successful path is tested while the recovery logic is neglected.
  • State Machine Transitions: If your code manages state, the agent can map out all possible transitions and flag those that are never triggered in the test suite.
  • Input Permutations: For functions with multiple arguments, the agent can suggest combinations of inputs that might trigger unexpected interactions.

Comparison of Testing Approaches

ApproachStrengthWeakness
Manual ReviewDeep logical understandingHigh human effort and slow
Coverage ToolsPrecise execution dataBlind to missing logic paths
AI AgentsHigh context awarenessRequires verification by developer
Property TestingExhaustive input searchHard to configure for complex UI

Enhancing Your Workflow with Deska

Deska provides a workspace designed for this type of iterative analysis. Within the infinite canvas, you can place your source code, your test files, and multiple AI agents side by side. This visual arrangement allows you to see the logic and the suggestions simultaneously.

By using coding agents like Claude Code or Codex CLI within Deska panels, you can give the agent direct access to your local files. Since Deska is local-first, your proprietary source code stays on your machine during the analysis. You can run a terminal panel to execute your current test suite, then use Ask Deska to prompt an agent: Analyze the current file and tell me which test cases are missing based on the edge cases we haven't covered in the test folder.

The agent can then generate the missing test code directly in a new panel. You can review the code in the integrated Monaco editor, run it in a terminal, and verify the results without leaving the canvas. If you need to step away from your desk, the mobile app allows you to monitor the progress of long running test suites through a secure relay.

Implementation Steps for Missing Test Detection

  1. Open your project in the Deska workspace.
  2. Arrange your source file and its corresponding test file in side by side panels.
  3. Launch an agent panel such as Claude Code.
  4. Provide the agent with the context of both files.
  5. Use a specific prompt: Review the logic in the source file and compare it to the assertions in the test file. Identify three critical edge cases that are currently missing.
  6. Review the agent suggestions and use the editor to integrate the new tests.
  7. Run the tests in a terminal panel to confirm they pass and improve coverage.

FAQ

How to find missing test cases in React?

To find missing tests in React, you should use an agent to analyze your component props and hook dependencies. The agent can identify if certain state transitions or user interactions, such as clicking a button while a fetch is pending, are not represented in your Jest or Vitest files.

Can AI agents write unit tests automatically?

Yes, agents can generate unit test boilerplate and specific assertions based on your code. However, it is essential to review the generated code for logical correctness. Agents are best used to suggest the structure and the scenarios, while the developer confirms the expected output.

What is the best tool for test gap analysis?

The best tool depends on your stack. Traditional tools like SonarQube provide excellent static analysis. For a more interactive and context aware approach, using coding agents within a flexible workspace like Deska allows for real time gap identification and code generation.

Improve Your Test Suite with Deska

Improving code quality requires the right tools to visualize gaps and the right intelligence to fill them. Deska combines the power of multiple AI agents with an infinite workspace that keeps your code local and secure. You can download the app for Mac, Windows, or Linux to start exploring your codebase more effectively.

Download Deska

💡 Ideas+🐛 BugsSuggest a feature or report a bug