No description
This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
Find a file
2023-12-09 18:27:49 +01:00
benchmark cose 2023-12-09 11:56:23 +01:00
instrumented instrument script supports function execution 2023-11-15 13:32:08 +01:00
tests aaa 2023-12-09 17:56:51 +01:00
.gitattributes Initial commit 2023-11-13 12:47:53 +00:00
.gitignore wip instrumentor 2023-11-13 14:45:51 +01:00
fuzzer.py aaa 2023-12-09 17:56:51 +01:00
genetic.py aaa 2023-12-09 17:56:51 +01:00
instrument.py aaa 2023-12-09 17:56:51 +01:00
operators.py aaa 2023-12-09 17:56:51 +01:00
README.md Interim submission for parts 05,06,07 done 2023-12-09 18:27:49 +01:00
requirements.txt run tests 2023-11-15 18:23:53 +01:00

Project 02 - Python test generator

About the Project

This project has the goal of writing a search based automated test generator for Python. It is part of the Knowledge Search & Extraction - 2023 course from the Università della Svizzera italiana.

In this repository, you can find the following files:

  • benchmark/ folder: which contains the benchmark of functions under test to be instrumented

Note: Feel free to modify this file according to the project's necessities.

Environment setup

To install the required dependencies make sure python3 points to a Python 3.10 or 3.11 installation and then run:

python3 -m venv env
source env/bin/activate
pip install -r requirements.txt

Instrumentation (Part 1)

To generate the instrumented code for all the files in the benchmark run the command:

python3 ./instrument.py

The generated files are created in the directory instrumented. Each file name matches the file name of the corresponding source file in benchmark.

Test case generation (Part 2 and Part 3)

To generate test cases for all files in the benchmark run the command:

python3 ./genetic.py

The test suite is created in the directory tests. One test class is generated for each function defined in the benchmark package. Run the command with the -h options for more details on partial generation.

The test suite can be then executed over the benchmark code with the command:

python3 -m unittest discover tests