Vai al contenuto

CodingIdeaEN

Unit test suggestion helper

Demo idea: suggests missing unit tests for functions changed in a fictional codebase.

Esempi BestIAPubblicata il 24 novembre 2026
Maturità
Idea
Categoria
Coding
Lingua della scheda
English
Pubblicata
24 novembre 2026

01Il problema

Developers in this invented project ship changes without tests for edge cases, and regressions appear weeks later.

02La soluzione

An editor command lists the changed functions, proposes test cases with inputs and expected results, and generates a draft test file.

Il cuore AI del progetto

03Ruolo dell'AI

Per le idee descrive l'uso previsto.

Intended use: a language model proposes edge cases and draft tests; the developer runs and edits them before committing.

04Architettura tecnica

README.md

TestScout — unit test suggestions in the editor

Demo idea.

Overview

An editor extension command lists the functions changed since the last commit and proposes edge cases and a draft pytest file. Nothing is written to disk or committed automatically.

Architecture

text
[Editor command "Suggest tests"]
      |
      v
[git diff HEAD] + [language server symbols] --> changed functions
      |
      v
[Context builder] signature + body + existing tests (max 6k tokens)
      |
      v
[LLM API] --> { cases: [...], test_file: "..." }
      |
      v
[Untitled editor tab] --> developer runs pytest locally

Stack

PartTechnology
ExtensionTypeScript, editor extension API
Analysisgit CLI, language server (document symbols)
Testspytest, hypothesis (suggested for numeric inputs)
AIintended: LLM via API

Output contract

json
{
  "cases": [{ "name": "empty_list_returns_zero", "input": "[]", "expected": "0", "why": "boundary" }],
  "test_file": "import pytest\n..."
}

Guardrails

  • Only the selected functions leave the machine; files matching .env*, secrets/** are excluded.
  • Generated tests must import only the module under test (checked before opening the tab).
  • Configurable model endpoint for teams that self-host.

—Immagini

  • Illustration: changed functions in an editor with suggested unit tests marked as passing