Skip to content

Commit 05990cf

Browse files
authored
Add the information about SARIF report and Gradle/Maven plugins (#1549)
1 parent ea5a58a commit 05990cf

File tree

1 file changed

+55
-7
lines changed

1 file changed

+55
-7
lines changed

docs/OverallArchitecture.md

Lines changed: 55 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,41 @@ sequenceDiagram
116116

117117
TODO (Vassily Kudryashov)
118118

119-
### Maven/gradle plugin
119+
### Gradle/Maven plugin
120120

121-
TODO (Nikita Stroganov)
121+
> Modules:
122+
> [utbot-gradle](https://github.com/UnitTestBot/UTBotJava/tree/main/utbot-gradle),
123+
> [utbot-maven](https://github.com/UnitTestBot/UTBotJava/tree/main/utbot-maven)
124+
>
125+
> Purpose: Plugins for Gradle/Maven build systems
122126
123-
### Github action
127+
Plugins just provide user settings (such as test generation timeout, testing framework and so on)
128+
to the `GenerateTestsAndSarifReportFacade` which runs test generation and creates SARIF reports.
124129

125-
TODO (Nikita Stroganov)
130+
More information about both plugins can be found in the following design documents:
131+
- [utbot-gradle.md](https://github.com/UnitTestBot/UTBotJava/blob/main/utbot-gradle/docs/utbot-gradle.md)
132+
- [utbot-maven.md](https://github.com/UnitTestBot/UTBotJava/blob/main/utbot-maven/docs/utbot-maven.md)
133+
134+
### GitHub action
135+
136+
> Repository: [UTBotJava-action](https://github.com/UnitTestBot/UTBotJava-action)
137+
>
138+
> Purpose: Display detected errors in the GitHub section "Security Code Scanning Alerts"
139+
140+
UTBotJava-action uses our [gradle plugin](https://github.com/UnitTestBot/UTBotJava/tree/main/utbot-gradle)
141+
to run UnitTestBot on the User's repository and then imports the SARIF output into the Security Code Scanning Alerts section,
142+
where the User can find all the displayed code errors.
143+
144+
Please note that at the moment this action cannot work with Maven projects due to the fact that
145+
our [maven plugin](https://github.com/UnitTestBot/UTBotJava/tree/main/utbot-maven) is not published.
146+
147+
More information about the action can be found [here](https://github.com/UnitTestBot/UTBotJava-action#readme).
148+
149+
Also, there is a detailed [example](https://github.com/UnitTestBot/UTBotJava-action-example) of using UTBotJava-action.
126150

127151
### CLI
128152

129-
TODO (Nikita Stroganov)
153+
TODO (???)
130154

131155
### Contest estimator
132156
Contest estimator runs UnitTestBot on the provided projects and returns the generation statistics such as instruction coverage.
@@ -213,10 +237,34 @@ Also, JavaDocs built in two modes: as plain text or in especial format enriched
213237

214238
This subsystem is fully located in the ```utbot-summary``` module.
215239

216-
### Sarif report
217-
TODO (Nikita Stroganov)
240+
### SARIF report
241+
242+
SARIF (Static Analysis Results Interchange Format) is a JSON–based format for displaying static analysis results.
243+
244+
All the necessary information about the format and its use can be found
245+
in the [official documentation](https://github.com/microsoft/sarif-tutorials/blob/main/README.md)
246+
and in the [GitHub wiki](https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/sarif-support-for-code-scanning) about it.
218247

248+
In our project `SarifReport` class is responsible for generating reports.
249+
We use SARIF reports to display errors detected by UnitTestBot such as
250+
unchecked exceptions, overflows, assertion errors and so on.
251+
252+
For example, for the class below
253+
```Java
254+
public class Main {
255+
int example(int x) {
256+
return 1 / x;
257+
}
258+
}
259+
```
219260

261+
We'll create a report which contains the following information:
262+
- `java.lang.ArithmeticException: / by zero` may occur in the line 3
263+
- The exception occurs if `x == 0`
264+
- To reproduce this error, the user can run the generated test `MainTest.testExampleThrowsAEWithCornerCase`
265+
- The exception stacktrace:
266+
- Main.example(Main.java:3)
267+
- MainTest.testExampleThrowsAEWithCornerCase(MainTest.java:39)
220268

221269
# Cross-cutting subsystems
222270

0 commit comments

Comments
 (0)