A Python CLI tool that automatically generates manual test cases from software requirement documents using AI (OpenAI GPT or Google Gemini).
- π₯ Multi-format Support: Read requirements from PDF, DOCX, and TXT files
- π€ AI-Powered: Use OpenAI GPT or Google Gemini for intelligent test case generation
- π Excel Output: Generate structured test cases in Excel format
- βοΈ Configurable: Easy configuration via YAML file
- π§ͺ Comprehensive: Generate positive, negative, and edge case scenarios
- Clone the repository:
git clone https://github.com/huynhminhvangit/Spec2Test.git
cd Spec2Test- Install dependencies:
pip install -r requirements.txt- Configure your API keys in
config.yaml:
ai_engine: openai # or 'gemini'
openai:
api_key: "your-openai-api-key-here"
model: "gpt-4"
gemini:
api_key: "your-gemini-api-key-here"
model: "gemini-pro"python main.py path/to/requirements.docx# Specify output file
python main.py requirements.pdf -o my_testcases.xlsx
# Use custom config file
python main.py requirements.txt -c custom_config.yaml
# Full example
python main.py docs/requirements.docx -o testcases/sprint1_tests.xlsx -c config/prod_config.yamlinput_file: Path to requirement document (PDF, DOCX, or TXT)-o, --output: Output Excel file path (default: testcases.xlsx)-c, --config: Configuration file path (default: config.yaml)
auto_testcase_generator/
βββ main.py # Entry point
βββ config.yaml # Configuration file
βββ requirements.txt # Python dependencies
βββ extract_text.py # Document text extraction
βββ export_excel.py # Excel export functionality
βββ ai_engines/
β βββ __init__.py
β βββ openai_engine.py # OpenAI integration
β βββ gemini_engine.py # Google Gemini integration
βββ README.md
Choose between OpenAI and Google Gemini in config.yaml:
ai_engine: openai # or 'gemini'Get your API keys from:
- OpenAI: https://platform.openai.com/api-keys
- Google Gemini: https://makersuite.google.com/app/apikey
The tool generates an Excel file with the following columns:
| Column | Description |
|---|---|
| Test ID | Unique test identifier (TC001, TC002, etc.) |
| Feature | Feature/functionality being tested |
| Test Case Title | Descriptive title of the test case |
| Test Steps | Step-by-step instructions |
| Expected Result | Expected outcome |
| Priority | Test priority (High/Medium/Low) |
| Status | Test execution status (Not Executed by default) |
| Actual Result | Space for actual test results |
| Notes | Additional notes |
User Login Feature:
- Users must be able to log in with email and password
- System should validate credentials against database
- Invalid login attempts should display error message
- Users should be redirected to dashboard after successful login
- TC001: Verify successful login with valid credentials
- TC002: Verify login failure with invalid email
- TC003: Verify login failure with invalid password
- TC004: Verify error message display for invalid credentials
- TC005: Verify dashboard redirection after successful login
-
Import Errors: Make sure all dependencies are installed
pip install -r requirements.txt
-
API Key Errors: Verify your API keys are correctly set in
config.yaml -
File Format Errors: Ensure your input file is in supported format (PDF, DOCX, TXT)
-
Empty Output: Check if the requirement document contains readable text
- β PDF files (via PyPDF2)
- β DOCX files (via python-docx)
- β TXT files (UTF-8 and Latin-1 encoding)
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
Huynh Minh Vang
- GitHub: @huynhminhvangit
- Email: huynhminhvang.it@gmail.com
This project is licensed under the MIT License - see the LICENSE file for details.
Copyright (c) 2025 Huynh Minh Vang
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
If this project helps you save time and improves your testing workflow, consider supporting the development:
- Bank: ACB (Asia Commercial Bank)
- Account Number: 4278361
- Account Name: HUYNH MINH VANG
- β Star this repository
- π Report bugs and issues
- π‘ Suggest new features
- π€ Contribute code improvements
Your support helps maintain and improve this project for the community!
For issues and questions:
- Check the troubleshooting section
- Review existing issues on GitHub
- Create a new issue with detailed information
Made with β€οΈ by Huynh Minh Vang