Skip to content

UTBot Java architecture - first version. #1403

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 21, 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
179 changes: 179 additions & 0 deletions docs/OverallArchitecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
# Overall Unit Test Bot Architecture

Unit Test Bot overall architecture can be presented as following bird-eye view. Look below to check each component's purpose.

```mermaid
flowchart TB
subgraph Clients
direction LR
IntellijPlugin
MavenPlugin["Maven/Gradle plugins"]
GithubAction-->MavenPlugin
ExternalJavaClient[\External Java Client\]
CLI
ContestEstimator

end

subgraph Facades
direction LR
EngineMain[[EngineMain]]
UtBotJavaApi[[UtBotJavaApi]]
GenerateTestsAndSarifReport[[GenerateTestsAndSarifReport]]
end
IntellijPlugin--RD-->EngineMain
MavenPlugin-->GenerateTestsAndSarifReport
ExternalJavaClient-->UtBotJavaApi

subgraph API["Generation API"]
direction LR
TestCaseGenerator[[TestCaseGenerator]]
CodeGenerator[[CodeGenerator]]
end
Facades-->API
CLI-->API
ContestEstimator-->API



subgraph Components
direction LR
SymbolicEngine-->jlearch
SymbolicEngine-->ConcreteExecutor
Fuzzer-->ConcreteExecutor
SarifReport
Minimizer
CodeRenderer
Summaries
jlearch
end
CodeGenerator-->CodeRenderer
TestCaseGenerator-->SymbolicEngine
TestCaseGenerator-->Fuzzer
TestCaseGenerator-->Minimizer
TestCaseGenerator-->Summaries
GenerateTestsAndSarifReport-->SarifReport

UTSettings((UTSettings))
UTSettings<--RD/local-->Components
UTSettings<---->Clients
TestCaseGenerator--warmup-->ConcreteExecutor
ConcreteExecutor--RD-->InstrumentedProcess

```

## Typical interraction between components

Interaction diagram started from Intellij plugin UI is presented below
```mermaid
sequenceDiagram
autonumber
actor user as User
participant ij as Intellij plugin
participant engine as Engine process
participant concrete as Instrumented process

user ->> ij: Invoke "Generate tests with UTBot"
ij ->> ij: Calculate methods, framework to show
ij ->> user: Show UI

break user clicked "Cancel"
user -->> user: Exit
end
user ->> ij: Click "Generate tests"
ij ->> ij: Calculate what jar need to be installed

opt Some jars need to be installed
ij ->> user: Do you accept new jars installed?
user -->> ij: [Accept/reject]

alt Accepted
ij ->> ij: Install jars
end
end

ij ->> engine: Start process
activate engine
ij ->> engine: Setup ut context

loop For all files
ij ->> engine: Generate UtExecutions
loop for all UtExecutions for method found by engine
engine ->> concrete: Run concretely
end
engine --> engine: Minimize all tests for method
engine --> engine: Summaries for method
end
ij ->> engine: Render code
engine ->> ij: File with tests
deactivate engine


```

# Clients

### Intellij plugin
> Module: [utbot-intellij](https://github.com/UnitTestBot/UTBotJava/tree/main/utbot-intellij)
>
> Purpose: UI interface for Java/Kotlin users


TODO (Vassily Kudryashov)

### Maven/gradle plugin

TODO (Nikita Stroganov)

### Github action

TODO (Nikita Stroganov)

### CLI

TODO (Nikita Stroganov)

### Contest estimator

TODO (Rustam Sadykov)


# Components

### Symbolic engine
TODO (Alexey Menshutin)

### Concrete executor
TODO (Sergey Pospelov)

### Instrumented process
TODO (Rustam Sadykov)

### Code renderer
TODO (Egor Kulikov)

### Fuzzer
TODO (Maxim Pelevin)

### Minimizer
TODO (Sergey Pospelov)

### Summaries
TODO (Alexey Zinoviev)

### Sarif report
TODO (Nikita Stroganov)



# Cross-cutting subsystems

### Logging
TODO (Arteniy Kononov)

### RD
TODO (Arteniy Kononov)

### UTSettings
TODO (Vassily Kudryashov)