Skip to content

Minor updates to UtUtilsClass docs #1374

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 1 commit into from
Nov 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions docs/UtUtilsClass.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@
## What are the utility methods

_Utility methods_ implement common, often re-used operations which are helpful for accomplishing tasks in many
classes. In UnitTestBot _utility methods_ include those related to creating instances, checking deep
equals, working with arrays, using lambdas and so on — miscellaneous methods necessary for generated tests.
classes. In UnitTestBot, _utility methods_ include those related to creating instances, checking deep
equality, mocking, using lambdas and so on — miscellaneous methods necessary for generated tests.

## Why to create UtUtils class

Previously UnitTestBot generated _utility methods_ for each test class when they were needed — and only those which were necessary for the given class. They were declared right in the generated test class, occupying space. Generating multiple test classes often resulted in duplicating _utility methods_ and consuming even more space.
Previously, UnitTestBot generated _utility methods_ for each test class when they were needed — and only those which
were necessary for the given class. They were declared right in the generated test class, occupying space. Generating multiple test classes often resulted in duplicating _utility methods_ and consuming even more space.

For now UnitTestBot provides a special `UtUtils` class containing all _utility methods_ if at least one test class needs some of them. This class is generated once and the specific methods are imported from it if necessary. No need for _utility methods_ — no `UtUtils` class is generated.

We create a separate `UtUtils` class for each supported codegen language (if this class is required).
We create a separate `UtUtils` class for each supported language (if required).

## What does it look like

Here is an example of documentation comment inherent to every `UtUtils` class:
Here is an example of a documentation comment inherent to every `UtUtils` class:

![Documentation](images/utbot_ututils_2.0.png)

Expand All @@ -35,8 +36,9 @@ UnitTestBot uses [Mockito framework](https://site.mockito.org/) to implement moc
`deepEquals()`
_utility method_ should be configured — it should have a check: whether the compared object is a mock or not. That is why the `UtUtils` class for the tests with mocking differs from the one without mocking support.

If you have previously generated tests with mocking, the next `UtUtils` class will support mocking as well — even if
it is upgraded or current tests do not need mocking, so that the existing tests can still
If you have previously generated tests with mocking, the next generated `UtUtils` class supports mocking as well —
even if
its version is upgraded or current tests do not need mocking, so that the existing tests can still
rely on the proper methods from `UtUtils` class.

## Where to find it
Expand Down