This lab focused on using code analysis and AI-assisted reasoning to generate targeted test suggestions. It combined source inspection, suggestion generation, and pipeline validation in a small project environment.
- Build an AI-powered pipeline to analyze code changes
- Generate intelligent test suggestions based on code modifications
- Integrate OpenAI-compatible APIs for test coverage analysis
- Implement automated test gap detection in a CI/CD workflow
- Basic understanding of Python programming
- Familiarity with Git and version control concepts
- Basic knowledge of unit testing principles
- Experience with command-line operations in Linux
- Understanding of REST APIs and JSON
- Platform: Ubuntu 24.04 LTS cloud lab environment
- User:
toor - Host:
ip-172-31-10-252 - Shell: Bash
- Create Project Structure
- Implement Code Analyzer
- Create
src/code_analyzer.py - Create Sample Project for Testing
- Create
sample_project/calculator.py - Test Code Analyzer
- Create
tests/test_analyzer.py
- Set Up Local AI Model (Ollama)
- Create Test Suggester Module
- Create
src/test_suggester.py - Create Pipeline Orchestrator
- Create
src/pipeline.py - Run the Complete Pipeline
- Create a New Change to Test Pipeline
lab30-ai-test-suggestion-pipeline/
└── README.md
└── commands.sh
└── interview_qna.md
└── output.txt
└── sample_project/
└── calculator.py
└── src/
└── code_analyzer.py
└── pipeline.py
└── test_suggester.py
└── tests/
└── test_analyzer.py
└── troubleshooting.md
- Confirmed the environment and toolchain were installed correctly
- Validated the core workflow with command execution and captured outputs
- Preserved scripts, configuration files, and supporting artifacts used during the lab
- Documented common failure paths and remediation steps in the troubleshooting guide
- How to inspect code structure to identify missing test coverage ideas
- How to separate analyzer, suggester, and pipeline responsibilities
- How to validate AI-assisted testing logic with automated tests
- How suggestion pipelines can support quality engineering workflows
Better test suggestions can improve coverage planning and help teams move faster when analyzing unfamiliar codebases or newly added features.
- Quality engineering automation
- Coverage planning
- Developer assist tooling
- AI-augmented testing workflows
The workflow in this lab maps well to practical cloud, DevOps, software assurance, and security operations responsibilities where repeatable procedures and evidence-backed validation matter.
The AI-assisted test suggestion pipeline successfully analyzed code structure and produced targeted testing guidance through a reproducible workflow.
You’ve successfully built an AI-powered test suggestion pipeline that:
- analyzes code changes using Git and AST parsing
- extracts function complexity metrics
- generates test suggestions using a local-model workflow with fallback support
- produces actionable JSON and Markdown outputs for improving coverage
This workflow fits the goal of the uploaded lab: use code-diff awareness plus structured function analysis to surface likely missing tests before code is merged or deployed. The local-model path supports privacy-preserving automation, and the fallback path keeps the workflow usable even when model output is slow or malformed.