Search Based Test Input Generation
A Python implementation of automated test data generation.
Currently, it works only for the subset of Python functions satisfying these conditions:
-
takes only integer arguments
-
had only integer type local variables
-
contains predicates that only involve relational operators (==, !=, <, >, <=, >=), integer variables, and calls to functions with integer return type
Run from Source
If directly clone the source and run package, run below command on project root directory.
python -m covgen <file>
Additional options can be given (you can remain it as default value):
--function (-f) <target_function_name>
--method (-m) <avm or hillclimbing>
--retry-count (-r) <retry count>
--int-min <minimum value of initial arguments for heuristic methods>
--int-max <maximum value of initial arguments for heuristic methods>
For example:
python -m covgen target/triangle.py -m avm --retry-count 10 --int-min 0 --int-max 1000
prints out list of generated inputs that cover detected branches, from each function defined in the target file.
Using pip
This input generator package is available on PyPI of name covgen.
After installing the dependencies:
pip install anytree
pip install astor
You can install this package with below command:
pip install covgen
Then run it anywhere with your python.
python -m covgen <target file location>
Or, you can build your own program using generated inputs.
from covgen.run.inputgenerator import InputGenerator
generator = InputGenerator('target/triangle.py', function_name='triangle')
inputs = generator.generate_all_inputs()
print(inputs['triangle'])
Metadata
Release files for covgen 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| covgen-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for covgen-0.0.4-py3-none-any.whl |
Release files / covgen-0.0.4-py3-none-any.whl
| Download URL | covgen-0.0.4-py3-none-any.whl |
|---|---|
| Size | 14.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2bc2f28646fb1d126a474150a73b309b54dee042c1e55f292114aa5b59d891d9
|
|
BLAKE2b-256 checksum How to use checksums |
1fcaccce68795d5b5b4b2fa4c3150ee3492cb4c7ff4ceba6919cfe1f13f7b4b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.1
|
Security for covgen 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.