TestRogue is a Flask-based web application that enables intelligent testing of APIs by leveraging Swagger/OpenAPI specifications and OpenAI. It automates test case generation, execution, and result exportation — all from a simple browser interface.
- 🔍 Extract Endpoints: Parse Swagger 2.0 URLs to retrieve all available API endpoints.
- 🧠 Generate Test Cases: Use OpenAI to automatically generate test scenarios for each endpoint.
- ⚙️ Execute Tests: Run the generated test cases and view real-time results.
- 📥 Download Results: Export test cases and execution results as CSV files for sharing or analysis.
- Python 3.8+
pip
(Python package installer)- OpenAI API Key
git clone git@github.com:KeyValueSoftwareSystems/testrogue.git
cd testrogue
pip3 install -r requirements.txt
Create a .env
file in the root of the project with the following content:
OPENAI_API_KEY=your_openai_api_key
💡 Replace
your_openai_api_key
with your actual OpenAI API key.
⚠️ The application will not start without this key.
python webapp.py
Open your browser and go to:
http://127.0.0.1:5000
api_ai_automation/
├── webapp.py # Main entry point for the Flask app
├── requirements.txt # Python dependencies
├── logs
│ ├── api_test.log # Application logs
├── static
│ ├── style.css # CSS file for styling
│ ├── script.js # JavaScript file for client-side logic
├── utils/
│ ├── utils.py # Core logic for endpoint extraction, test generation & execution
│ ├── constants.py # Global constants (e.g. default paths, config keys, prompts)
│ ├── llm_manager.py # Manages interactions with the LLM for generating test cases
│ ├── models.py # Dataclasses/models representing endpoints, test cases, etc.
├── templates/ # HTML templates for rendering the web interface
│ ├── index.html # Main UI template for Swagger input & results
├── .env # Environment variables (e.g. API keys, secret tokens)
Endpoint | Method | Description |
---|---|---|
/extract_endpoints |
POST | Extracts endpoints from Swagger URL |
/generate_tests |
POST | Generates test cases for all endpoints |
/generate_single_test |
POST | Generates a test case for one endpoint |
/execute_tests |
POST | Executes the generated test cases |
/download_test_cases |
POST | Downloads test cases and results as CSV |
- Python 3.8 or higher is installed
- All dependencies are installed via
pip3 install -r requirements.txt
-
.env
file is created with a validOPENAI_API_KEY
- Port
5000
is available (or configured in.env
)