https://github.com/andrehora/pathspotter
Exploring tested paths in Python programs
https://github.com/andrehora/pathspotter
dynamic-analysis mining-software-repositories python testing
Last synced: about 2 months ago
JSON representation
Exploring tested paths in Python programs
- Host: GitHub
- URL: https://github.com/andrehora/pathspotter
- Owner: andrehora
- License: mit
- Created: 2023-06-06T19:08:17.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-29T19:08:31.000Z (over 2 years ago)
- Last Synced: 2024-01-29T22:15:09.386Z (over 2 years ago)
- Topics: dynamic-analysis, mining-software-repositories, python, testing
- Language: JavaScript
- Homepage:
- Size: 12.9 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/andrehora/pathspotter/actions/workflows/pages/pages-build-deployment)
# PathSpotter
PathSpotter is a tool for computing and exploring *tested paths* of Python methods.
A *tested path* of a method represents a set of input values that will make the method behave in the same way, that is, execute the same lines of code.
PathSpotter generates HTML reports like these: [calendar](https://andrehora.github.io/pathspotter/examples/report_html/calendar), [csv](https://andrehora.github.io/pathspotter/examples/report_html/csv), and [gzip](https://andrehora.github.io/pathspotter/examples/report_html/gzip).
## Install
First, create a virtual environment (and activate it):
```shell
python3 -m venv .venv
source .venv/bin/activate
```
Next, clone and install [SpotFlow](https://github.com/andrehora/spotflow):
```
git clone https://github.com/andrehora/spotflow
pip install -e ./spotflow
```
Then, clone and install PathSpotter:
```
git clone https://github.com/andrehora/pathspotter
pip install -e ./pathspotter
```
## Quick usage
Let's export the tested paths for the test suite `test_gzip` of the Python Standard Library.
This command generates reports in HTML and CSV formats:
```shell
python3 -m spotflow -t gzip -s pathspotter/pathspotter/runner.py -arg gzip test.test_gzip
```
Then, open the file `report_html/gzip/index.html` to see an [HTML report like this](https://andrehora.github.io/pathspotter/examples/report_html/gzip).
Open the folder `report_csv/gzip` to see a [CSV report like this](https://github.com/andrehora/pathspotter/blob/main/examples/report_csv/gzip).
## Usage details
This command runs and monitors a test suite called `` with [SpotFlow](https://github.com/andrehora/spotflow) and generates PathSpotter reports:
```shell
python3 -m spotflow -t -s -arg
# Examples
python3 -m spotflow -t gzip -s pathspotter/pathspotter/runner.py -arg gzip test.test_gzip
python3 -m spotflow -t csv -s pathspotter/pathspotter/runner.py -arg csv test.test_csv
python3 -m spotflow -t calendar -s pathspotter/pathspotter/runner.py -arg calendar test.test_calendar
```
The first argument `-t` sets the target SUT to be monitored.
The second argument `-s` sets the PathSpotter script that is executed to generate CSV and HTML reports.
The third argument `-arg` sets the report folder name.
The final argument (``) is the command to execute the test suite.
## More reports
See the repository [tested_paths_dataset](https://github.com/andrehora/tested_paths_dataset) for more reports of popular projects, like [Rich](https://andrehora.github.io/tested_paths_dataset/report_html/rich), [Flask](https://andrehora.github.io/tested_paths_dataset/report_html/flask), and [Pylint](https://andrehora.github.io/tested_paths_dataset/report_html/pylint).