Skip to content

Update UnitTestBot Go docs #2283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 28, 2023
Merged

Update UnitTestBot Go docs #2283

merged 2 commits into from
Jul 28, 2023

Conversation

egiptipavel
Copy link
Collaborator

Description

Update UnitTestBot Go docs.

How to test

The PR introduces no code changes.
Manual scenario: the text itself has been previewed in the IntelliJ IDEA viewer.

Self-check list

  • I've set the proper labels for my PR (at least, for category and component).
  • PR title and description are clear and intelligible.
  • I've added enough comments to my code, particularly in hard-to-understand areas.
  • The functionality I've repaired, changed or added is covered with automated tests.
  • Manual tests have been provided optionally.
  • The documentation for the functionality I've been working on is up-to-date.

@egiptipavel egiptipavel added ctg-documentation Improvements or additions to documentation lang-go Issue is related to Go support labels Jun 13, 2023
@egiptipavel egiptipavel self-assigned this Jun 13, 2023
Copy link
Collaborator

@olganaumenko olganaumenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but please consider the suggested changes.

@@ -15,14 +15,14 @@ inserts these values into the user functions, and executes the resulting test ca

### Supported types for function parameters

Now UnitTestBot Go can generate values for _primitive types_, _arrays_, _slices_ and _structs_.
Now UnitTestBot Go can generate values for _primitive types_, _arrays_, _slices_, _maps_, _structs_, _channels_, _interfaces_ and _pointers_.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now UnitTestBot Go can generate values for primitive types, arrays, slices, maps, structs, channels, interfaces, and pointers.

* `-f, --function TEXT`: specifies a function name to generate tests for. Can be used multiple times to select multiple functions.
* `-m, --method TEXT`: specifies a method name to generate tests for. Can be used multiple times to select multiple methods.
* `-go TEXT`, _required_: specifies a path to a Go executable. For example, `/usr/local/go/bin/go`.
* `-gopath TEXT`, _required_: specifies a path the location of your workspace. It defaults to a directory named `go` inside your home directory, so `$HOME/go` on Unix, `$home/go` on Plan 9, and `%USERPROFILE%\go` (usually `C:\Users\YourName\go`) on Windows.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • -gopath TEXT, required: specifies a path to your workspace location. It defaults to a directory named go in your home directory: $HOME/go for Unix, $home/go for Plan 9, and %USERPROFILE%\go (usually C:\Users\YourName\go) for Windows.

* `-m, --method TEXT`: specifies a method name to generate tests for. Can be used multiple times to select multiple methods.
* `-go TEXT`, _required_: specifies a path to a Go executable. For example, `/usr/local/go/bin/go`.
* `-gopath TEXT`, _required_: specifies a path the location of your workspace. It defaults to a directory named `go` inside your home directory, so `$HOME/go` on Unix, `$home/go` on Plan 9, and `%USERPROFILE%\go` (usually `C:\Users\YourName\go`) on Windows.
* `-parallel INT`: specifies the number of fuzzing processes running at once, default 8.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • -parallel INT: specifies the number of fuzzing processes running at once (eight by default).

* `-et, --each-execution-timeout INT`: specifies a timeout in milliseconds for each target function execution.
The default timeout is 1,000 ms.
* `-at, --all-execution-timeout INT`: specifies a timeout in milliseconds for all target function executions.
The default timeout is 60,000 ms.
* `-p, --print-test`: specifies whether a test should be printed out to `StdOut`. Disabled by default.
* `-w, --overwrite`: specifies whether to overwrite the output test file if it already exists. Disabled by default.
* `-fm, --fuzzing-mode`: stops test generation when a panic, error or timeout occurs (only one test will be generated for one of these cases).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • -fm, --fuzzing-mode: stops test generation when a panic situation, an error, or timeout occurs (only one test will be generated for one of these cases).

### Code instrumentation

UnitTestBot Go adds logging about the passage of a given line during the execution
after each line in functions.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After each line in a function, UnitTestBot Go adds logging about this line traversal during the execution.

UnitTestBot Go collects information about the target functions:
* signatures and type information (in the basic version);
* constants in the function bodies (to be implemented).
UnitTestBot Go collects the size in bits of an int or uint value and information about the target functions:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UnitTestBot Go gains information about the int or uint value size in bits, and information about the target functions:

@olganaumenko olganaumenko merged commit c1e9f60 into main Jul 28, 2023
@olganaumenko olganaumenko deleted the egiptipavel/go-docs branch July 28, 2023 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ctg-documentation Improvements or additions to documentation lang-go Issue is related to Go support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants