This project provides an AI-driven test case generator using FastAPI. The application accepts a GitHub repository name and generates test cases for the repository using openAI LLM.
-
Clone the repository
git clone https://github.com/your-username/ai-driven-test-case-generator.git cd ai-driven-test-case-generator
-
Create and activate a virtual environment
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the dependencies
pip install -r requirements.txt
-
Start the FastAPI server
uvicorn main:app --reload
-
Access the API documentation
Open your browser and navigate to
http://127.0.0.1:8000/docs
to access the interactive API documentation provided by Swagger UI.
- Endpoint:
/
- Method:
GET
- Description: Returns a welcome message.
Response
{
"message": "ai-driven test case generator"
}
- Endpoint:
/generate test cases
- Method:
POST
- Description: Generates test cases for the given GitHub repository.
Request Body
{
"repo_name": "owner/repository_name"
}
Response
{
"message": "Test cases generation response"
}
The application uses a configuration file config.json
for initializing the TestCaseGenerator. Ensure that this file is correctly set up in the root directory of your project. The config.json
file should contain necessary configuration settings required by TestCaseGenerator. The format of config.json
is as follows:
{
"git_access_token" : "your PAT of Github",
"openai_api_key" : "open api key"
}