Skip to content

Commit

Permalink
Update helps
Browse files Browse the repository at this point in the history
  • Loading branch information
tamarinvs19 committed Aug 7, 2023
1 parent 65b7b9a commit 6032d11
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 17 deletions.
31 changes: 27 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# utfuzz

`utfuzz` is a Python fuzzing engine. It supports fuzzing of Python code and code generation for error and regression suites.
`utfuzz` is a Python fuzzing engine. It supports fuzzing of Python code and generation reproducing code for error and regression suites.

### Installation

Expand All @@ -15,8 +15,7 @@ Or from source code using `poetry`:
```shell
$ git clone https://github.com/tamarinvs19/utfuzz
$ cd utfuzz
$ poetry build
$ python -m pip install dist/utfuzz-0.1.0.tar.gz
$ python -m pip install build
```

#### Java installation
Expand All @@ -32,8 +31,32 @@ function available only for Linux) or give you a link to installation instructio

### Using `utfuzz`

There are 3 modes:
You can use `utfuzz` one of three modes:
* dialog mode (default)
* config file mode (work if you add `--skip_dialog` argument and there are config file after previous executions)
* CLI arguments mode (work if you add `--skip_dialog` and `--skip_config_file`)

```
options:
-h, --help show this help message and exit
--skip_dialog Do not ask parameters before execution
--skip_config_file Do not use config file in current directory
--skip_regression_tests
Do not generate regression suite
-j JAVA, --java JAVA Path to Java
-t TIMEOUT, --timeout TIMEOUT
Timeout for test generation process per one class or group of top-level functions from one file
-p PROJECT_DIR, --project_dir PROJECT_DIR
Directory with your code for testing
-o OUTPUT_DIR, --output_dir OUTPUT_DIR
Directory for generated tests collecting
--sys_paths [SYS_PATHS ...]
Additional path to find imports(will be added to `sys.path`, default = project directory) [optional]
--files_under_test [FILES_UNDER_TEST ...]
List of files for testing, empty means <<test all>> [optional]
--requirements_file REQUIREMENTS_FILE
Path to requirements.txt [optional]
```

See also main [website](utbot.org) of UnitTestBot project and [GitHub repository](github.com/UnitTestBot/UTBotJava).

34 changes: 21 additions & 13 deletions utfuzz/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,27 @@ def parse() -> argparse.Namespace:
parser = argparse.ArgumentParser(
prog="utfuzz",
usage="utfuzz [options]",
description="utfuzz is a Python fuzzing engine. It supports fuzzing of Python code and code generation for "
"error and regression suites",
epilog="",
description="utfuzz is a Python fuzzing engine. It supports fuzzing of Python code and generation reproducing "
"code for error and regression suites",
epilog="See also main website of UnitTestBot project: utbot.org",
)
parser.add_argument('--skip_dialog', action='store_true')
parser.add_argument('--skip_config_file', action='store_false')
parser.add_argument('--skip_regression_tests', action='store_true')
parser.add_argument('-j', '--java')
parser.add_argument('-t', '--timeout', type=int, default=60)
parser.add_argument('-p', '--project_dir', default='.')
parser.add_argument('-o', '--output_dir', default='utbot_tests')
parser.add_argument('--skip_dialog', action='store_true', help='Do not ask parameters before execution')
parser.add_argument('--skip_config_file', action='store_false', help='Do not use config file in current directory')
parser.add_argument('--skip_regression_tests', action='store_true', help='Do not generate regression suite')
parser.add_argument('-j', '--java', help='Path to Java')
parser.add_argument('-t', '--timeout', type=int, default=60, help='Timeout for test generation process per one '
'class or group of top-level functions from one'
' file')
parser.add_argument('-p', '--project_dir', default='.', help='Directory with your code for testing')
parser.add_argument('-o', '--output_dir', default='utbot_tests', help='Directory for generated tests collecting')

parser.add_argument('--sys_paths', nargs='*', default=[])
parser.add_argument('--files_under_test', nargs='*', type=argparse.FileType('r'), default=[])
parser.add_argument('--requirements_file', type=argparse.FileType('r'))
parser.add_argument('--sys_paths', nargs='*', default=[], help='Additional path to find imports'
'(will be added to `sys.path`, default = project '
'directory) [optional]')
parser.add_argument('--files_under_test', nargs='*', type=argparse.FileType('r'), default=[], help='List of files '
'for testing, '
'empty means '
'<<test all>> '
'[optional]')
parser.add_argument('--requirements_file', type=argparse.FileType('r'), help='Path to requirements.txt [optional]')
return parser.parse_args()

0 comments on commit 6032d11

Please sign in to comment.