This repository contains an automated Oracle generation tool that leverages the power of Large Language Models (LLMs) to enhance software testing efficiency. The tool is designed to generate JUnit tests and test case assertions, acting as an Oracle for the system under test.
The tool follows the following workflow:
- JUnit Test Generation: The system under test is input to EvoSuite, a test case generation tool that generates JUnit tests.
- Prompt Preparation: Based on query strategies, a prompt is prepared from the code base of the system under test. This prompt is used to query the Large Language Model interface.
- LLM Interface: The tool interfaces with multiple Large Language Models through an API. The prompt is sent to the LLM interface, which generates responses in the form of JUnit tests and oracles.
- Response Handling: The generated JUnit tests and oracles are received from the LLM interface. The tool checks for any compilation errors in the received responses. If errors are detected, the LLM interface is prompted again for corrected responses.
- Test Execution and Comparison: The generated tests are executed, and the tool compares the results with the tests generated by EvoSuite.
- Create a virtual environment
python -m venv evooracle_venv
- Activate it:
- Windows:
.\evooracle_venv\Scripts\activate
- Mac:
source evooracle_venv/bin/activate
- Windows:
- Download the required LLM models and take note of the PATH they're installed to
- Clone this repo
[email protected]:skhandaker/evooracle.git
- Go into the directory
cd evooracle
- Install the required dependencies
pip install -r requirements.txt
- Update the base ggml download path of the models in line 17 of
app.py
, e.g.BASE_PATH = 'C:/Users/User/AppData/Local/nomic.ai/GPT4All/'
and openAI api key on line 19 - Start the python app by running
streamlit run app.py
-GPT4AllReference : mainly used to determine how to install the GPT4All library and references. Doco was changing frequently, at the time of coding this was the most up to date example of getting it running.
๐จ๐พโ๐ป Author: Shaker Mahmud Khandaker
๐
Version: 1.x
๐ License: This project is licensed under the MIT License