# n-harsha-vardhan-dev/llm-testcase-generator architecture

> Architecture diagram of the GitHub repository n-harsha-vardhan-dev/llm-testcase-generator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/n-harsha-vardhan-dev/llm-testcase-generator
- Repository: https://github.com/n-harsha-vardhan-dev/llm-testcase-generator

## Overview

The product turns a functional requirement into structured, classified test cases and edge cases, validates the LLM response, scores coverage, and presents or exports the result. Users can initiate generation through either the FastAPI endpoint or Streamlit UI. The internal generation layer builds a prompt, calls Gemini, and retries invalid output. The README documents JSON and CSV export capabilities; sampled code shows in-memory UI downloads and CSV file export. The graph omits unverified internal details of the unsampled API and export paths.

Main entry points: [`app/main.py`](https://github.com/n-harsha-vardhan-dev/llm-testcase-generator/blob/main/app/main.py) (FastAPI endpoint), [`streamlit_app.py`](https://github.com/n-harsha-vardhan-dev/llm-testcase-generator/blob/main/streamlit_app.py) (Streamlit UI), [`app/llm_service.py`](https://github.com/n-harsha-vardhan-dev/llm-testcase-generator/blob/main/app/llm_service.py) (Retry orchestrator), [`app/coverage.py`](https://github.com/n-harsha-vardhan-dev/llm-testcase-generator/blob/main/app/coverage.py) (Coverage scoring)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_fastapi["FastAPI endpoint<br/>[main.py]"]
  node_streamlit["Streamlit UI<br/>[streamlit_app.py]"]
end

subgraph group_generation["Test generation"]
  node_prompt["Prompt template<br/>[prompt.py]"]
  node_generator["Retry orchestrator<br/>[llm_service.py]"]
  node_llm_client["LLM client<br/>[llm_client.py]"]
end

subgraph group_quality["Validation and coverage"]
  node_validator["JSON validator<br/>[validator.py]"]
  node_schema["Test case schema<br/>[schema.py]"]
  node_coverage["Coverage scoring<br/>[coverage.py]"]
end

subgraph group_delivery["Results and export"]
  node_exporter["CSV and JSON export<br/>[exporter.py]"]
  node_results["Test cases and coverage"]
end

node_qa_user(("QA user"))
node_gemini{{"Gemini model"}}

node_qa_user -->|"submits requirement"| node_fastapi
node_qa_user -->|"enters requirement"| node_streamlit
node_fastapi -->|"formats requirement"| node_prompt
node_streamlit -->|"formats requirement"| node_prompt
node_fastapi -->|"requests generation"| node_generator
node_streamlit -->|"requests generation"| node_generator
node_generator -->|"calls model"| node_llm_client
node_llm_client -->|"sends prompt"| node_gemini
node_generator -->|"validates response"| node_validator
node_validator -->|"parses into"| node_schema
node_fastapi -->|"scores coverage"| node_coverage
node_streamlit -->|"scores coverage"| node_coverage
node_fastapi -->|"saves CSV"| node_exporter
node_streamlit -->|"creates CSV download"| node_exporter
node_fastapi -->|"returns data and score"| node_results
node_streamlit -->|"displays and downloads"| node_results
node_exporter -->|"produces export"| node_results
node_coverage -->|"provides score"| node_results

click node_fastapi "https://github.com/n-harsha-vardhan-dev/llm-testcase-generator/blob/main/app/main.py"
click node_streamlit "https://github.com/n-harsha-vardhan-dev/llm-testcase-generator/blob/main/streamlit_app.py"
click node_prompt "https://github.com/n-harsha-vardhan-dev/llm-testcase-generator/blob/main/app/prompt.py"
click node_generator "https://github.com/n-harsha-vardhan-dev/llm-testcase-generator/blob/main/app/llm_service.py"
click node_llm_client "https://github.com/n-harsha-vardhan-dev/llm-testcase-generator/blob/main/app/llm_client.py"
click node_validator "https://github.com/n-harsha-vardhan-dev/llm-testcase-generator/blob/main/app/validator.py"
click node_schema "https://github.com/n-harsha-vardhan-dev/llm-testcase-generator/blob/main/app/schema.py"
click node_coverage "https://github.com/n-harsha-vardhan-dev/llm-testcase-generator/blob/main/app/coverage.py"
click node_exporter "https://github.com/n-harsha-vardhan-dev/llm-testcase-generator/blob/main/app/exporter.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_fastapi,node_streamlit,node_qa_user toneBlue
class node_prompt,node_generator,node_llm_client toneAmber
class node_validator,node_schema,node_coverage toneMint
class node_exporter,node_results toneRose
class node_gemini toneIndigo
```

## Components

### User interfaces

- [FastAPI endpoint](https://github.com/n-harsha-vardhan-dev/llm-testcase-generator/blob/main/app/main.py): `app/main.py`
- [Streamlit UI](https://github.com/n-harsha-vardhan-dev/llm-testcase-generator/blob/main/streamlit_app.py): `streamlit_app.py`

### Test generation

- [Prompt template](https://github.com/n-harsha-vardhan-dev/llm-testcase-generator/blob/main/app/prompt.py): `app/prompt.py`
- [Retry orchestrator](https://github.com/n-harsha-vardhan-dev/llm-testcase-generator/blob/main/app/llm_service.py): `app/llm_service.py`
- [LLM client](https://github.com/n-harsha-vardhan-dev/llm-testcase-generator/blob/main/app/llm_client.py): `app/llm_client.py`

### Validation and coverage

- [JSON validator](https://github.com/n-harsha-vardhan-dev/llm-testcase-generator/blob/main/app/validator.py): `app/validator.py`
- [Test case schema](https://github.com/n-harsha-vardhan-dev/llm-testcase-generator/blob/main/app/schema.py): `app/schema.py`
- [Coverage scoring](https://github.com/n-harsha-vardhan-dev/llm-testcase-generator/blob/main/app/coverage.py): `app/coverage.py`

### Results and export

- [CSV and JSON export](https://github.com/n-harsha-vardhan-dev/llm-testcase-generator/blob/main/app/exporter.py): `app/exporter.py`
- **Test cases and coverage**

### Other components

- **QA user**
- **Gemini model**

## Connections

- QA user → FastAPI endpoint: submits requirement (evidence: `README.md`)
- QA user → Streamlit UI: enters requirement (evidence: `streamlit_app.py`)
- FastAPI endpoint → Prompt template: formats requirement (evidence: `app/main.py`)
- Streamlit UI → Prompt template: formats requirement (evidence: `streamlit_app.py`)
- FastAPI endpoint → Retry orchestrator: requests generation (evidence: `app/main.py`)
- Streamlit UI → Retry orchestrator: requests generation (evidence: `streamlit_app.py`)
- Retry orchestrator → LLM client: calls model (evidence: `app/llm_service.py`)
- LLM client → Gemini model: sends prompt (evidence: `app/llm_client.py`)
- Retry orchestrator → JSON validator: validates response (evidence: `app/llm_service.py`)
- JSON validator → Test case schema: parses into (evidence: `app/validator.py`)
- FastAPI endpoint → Coverage scoring: scores coverage (evidence: `app/main.py`)
- Streamlit UI → Coverage scoring: scores coverage (evidence: `streamlit_app.py`)
- FastAPI endpoint → CSV and JSON export: saves CSV (evidence: `app/main.py`)
- Streamlit UI → CSV and JSON export: creates CSV download (evidence: `streamlit_app.py`)
- FastAPI endpoint → Test cases and coverage: returns data and score (evidence: `app/main.py`)
- Streamlit UI → Test cases and coverage: displays and downloads (evidence: `streamlit_app.py`)
- CSV and JSON export → Test cases and coverage: produces export
- Coverage scoring → Test cases and coverage: provides score
