|
| 1 | +# UnitTestBot decomposition |
| 2 | + |
| 3 | +This document is a part of UnitTestBot roadmap for the nearest future. We plan to decompose the whole UnitTestBot mechanism into the following standalone systems. |
| 4 | + |
| 5 | +## Fuzzing platform |
| 6 | + |
| 7 | +Entry points: |
| 8 | +* `org.utbot.fuzzing.Fuzzing` |
| 9 | +* `fuzz` extension function |
| 10 | + |
| 11 | +Exit point: |
| 12 | +overridden `Fuzzing#run` method |
| 13 | + |
| 14 | +Probable fields of use (without significant implementation changes): |
| 15 | +1. Test generation |
| 16 | +2. Taint analysis |
| 17 | +3. Finding security vulnerabilities |
| 18 | +4. Static analysis validation |
| 19 | +5. Automatic input minimization |
| 20 | +6. Specific input-output search |
| 21 | + |
| 22 | +## Symbolic engine platform |
| 23 | + |
| 24 | +Probable fields of use (without significant implementation changes): |
| 25 | +1. Test generation |
| 26 | +2. Taint analysis |
| 27 | +3. Type inference |
| 28 | + |
| 29 | +A more abstract interface can be extracted. For instance, we can use the interface to solve type constraints for Python or other languages. |
| 30 | +Currently, there are two levels of abstraction: |
| 31 | +1. Java-oriented abstraction that is intended to mimic heap and stack memory. |
| 32 | +2. More low-level and less Java-coupled API to store constraints for Z3 solver. |
| 33 | + |
| 34 | +There is a room for improvement, namely we can extract more high-level abstraction, which can be extended for different languages. |
| 35 | + |
| 36 | +Entry points: |
| 37 | +* `org.utbot.engine.Memory` |
| 38 | +* `org.utbot.engine.state.LocalVariableMemory` |
| 39 | +* `org.utbot.engine.SymbolicValue` |
| 40 | + |
| 41 | +Exit point: |
| 42 | +`org.utbot.engine.Resolver` → `UtModel` |
| 43 | + |
| 44 | +Another level of abstraction is `UtExpression`. Basically, it is a thin abstraction over Z3 solver. |
| 45 | + |
| 46 | +## Program synthesis system |
| 47 | + |
| 48 | +An implementation that allows `UtAssembleModel` to keep information about object creation in a human-readable format. Otherwise, the object state should be initiated with _Reflection_ or sufficient constructor call. The synthesizing process is built upon the UnitTestBot symbolic execution memory model and is supposed to preserve construction information during the analysis process. |
| 49 | + |
| 50 | +Entry and exit point: |
| 51 | +`org.utbot.framework.synthesis.Synthesizer` |
| 52 | + |
| 53 | +## Program analysis system |
| 54 | + |
| 55 | +We use an outdated approach with the [Soot](https://github.com/soot-oss/soot) framework. It is not worth being extracted as a separate service. A good substitution is the [JacoDB](https://github.com/UnitTestBot/jacodb) library. Currently, this library provides an API to work with Java code, send queries, provide custom indexes, and so on. |
| 56 | + |
| 57 | +## Code generation system |
| 58 | + |
| 59 | +The current domain of code generation is specific for generating tests, though it could be reused for other purposes. Currently, the engine can be used to generate tests for different test frameworks. One can use the code generator to generate test templates inside the IntelliJ-based IDEs. |
| 60 | + |
| 61 | +Entry and exit point: |
| 62 | +`org.utbot.framework.codegen.CodeGenerator#generateAsStringWithTestReport` |
| 63 | + |
| 64 | +## SARIF report visualizer |
| 65 | + |
| 66 | +UnitTestBot represents the result of analysis using SARIF — the format that is widely used in the GitHub community. SARIF allows users to easily represent the results in the built-in GitHub viewer. Additionally, we provide our own SARIF report visualizer for IntelliJ IDEA. |
| 67 | + |
| 68 | +Entry and exit point: |
| 69 | +`org.utbot.gradle.plugin.GenerateTestsAndSarifReportTask` |
0 commit comments