-
Notifications
You must be signed in to change notification settings - Fork 45
Python and JS support #1197 #1199
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
Changes from 77 commits
Commits
Show all changes
112 commits
Select commit
Hold shift + click to select a range
9fcf5c0
UTBotFamily
denis-fokin eee8f85
Add CodeGenLanguage.id
tamarinvs19 08ccb65
Update Renderers
tamarinvs19 301f2d5
Move codeGenLanguage to CgRenderContext
tamarinvs19 ddc57d9
Add init to CodeLanguage
tamarinvs19 8086a63
UTBotFamily
denis-fokin 0708155
Fix after merge bugs
tamarinvs19 64ade72
Fix bug with variableConstructors and remove ExecutionStateAnalyzer from
tamarinvs19 50c9a57
Update generated_tests__dicts
tamarinvs19 6a6a337
Change targetCompatibility verstion
tamarinvs19 9e9725c
Refactor js
tamarinvs19 8a53d09
Fix PycharmUltimate code and uncomment js
tamarinvs19 8abe0b7
Fix Windows symbols problem
tamarinvs19 542aeae
Disable runIde tasks in modules where we need only Idea sdk dependencies
denis-fokin ee45191
Merge actual UTBot Go, set up and fix its CLI
GlebSolovev e44813d
Improve requirements description for UTBot Go
GlebSolovev a3ad833
Merge UTBot Go IntelliJ plugin support
tamarinvs19 a7b8d25
Fix Go
tamarinvs19 8def007
New file chooser in Python plugin
tochilinak 0af38e8
Fixed bug in Python cli
tochilinak 14ff580
Refactored Slava's CodegenLanguage
zishkaz d8328e2
disable go runIde
Markoutte 8a91164
Change "\\" to File.separator
tamarinvs19 14ccaf6
Add relation sys.path support
tamarinvs19 894707b
Change cli result output
tamarinvs19 78e8f9d
[WIP] Linux cmd possible fix
rudolf101 99c5d8b
[WIP] universal JsCmdExec implementation
zishkaz e6b0168
Moved OsProvider for a wider access scope
zishkaz 299452d
Getting node and npm from IDEA settings
zishkaz ba23868
JsDynamicSettings added
zishkaz 4b3fb14
[WIP] Added nyc path field to dialog window
rudolf101 079e8d0
New js coverage algo implementation
zishkaz 319bc54
Added nyc path field into dialog window
rudolf101 54f079c
Update samples
tamarinvs19 ff1b093
Added replace separator in Nyc validation
rudolf101 9ed03f0
Added new options to js CLI and fixed exports managers
zishkaz 074d0d1
Fix after rebase problems
tamarinvs19 b11718f
Fixed js samples and help tips in js CLI
zishkaz 18f514f
Fixed js exports managers regexes
zishkaz eae8efe
Move language-specific UtModels to utbo-<lang> and remove CodegenLang…
tamarinvs19 d99deb9
Fix cli bug
tamarinvs19 e74317f
Simle style fix
tamarinvs19 3887c93
Moved test directory chooser to ui-commons and fixed graal error
zishkaz 1247455
Removing go from pr branch
zishkaz 037098f
Added gitignore file for js samples
zishkaz 97f4d6a
Fix changes
tamarinvs19 7688990
Fix testClassName bug
tamarinvs19 29180b9
Rebase FileUtil.kt onto main
tamarinvs19 3129d70
Rebase files onto main
tamarinvs19 0152df5
Remove internal UtilMethodProvider
tamarinvs19 84ec8fc
Rebase onto main
tamarinvs19 b24caf9
Update language settings
tamarinvs19 fc52711
Merge branch 'main' into tamarinvs19/UnitTestBot_Family_PR
tamarinvs19 52085ec
Update gradle files
tamarinvs19 eba7d57
Fix js npm path and nyc validator for linux
tamarinvs19 be1adc7
Add conditions for ideType
tamarinvs19 f997039
Merge branch 'main' into tamarinvs19/UnitTestBot_Family_PR
tamarinvs19 9e0b25a
Update ide settings
tamarinvs19 83a9dcd
Add docs page about IDE
tamarinvs19 fcca3bf
Add docs link
tamarinvs19 f21a1cb
Fix Coverage error
tamarinvs19 2d7d817
Merge branch 'main' into tamarinvs19/UnitTestBot_Family_PR
tamarinvs19 05af2c5
Rebase onto main
tamarinvs19 68c5d7d
Merge branch 'main' into tamarinvs19/UnitTestBot_Family_PR
tamarinvs19 92f6f72
Rebase onto main
tamarinvs19 55c278b
Merge branch 'main' into tamarinvs19/UnitTestBot_Family_PR
tamarinvs19 1f1b016
Rebase onto main
tamarinvs19 1d5b379
Make GgGetClass sealed
tamarinvs19 3d98f82
Fix deprecated showYesNoDialog and ProjectFileIndex.SERVICE
tamarinvs19 dc242fe
Change IU to IC
tamarinvs19 bdd4442
Remove open from ClassId.elementClassId
tamarinvs19 c7b69a1
Code style refactoring
tamarinvs19 4432359
Add file with changes description
tamarinvs19 284928b
Update gitignores
tamarinvs19 7ee92d1
Remove com.jetbrains.intellij.idea:ideaIC dependency
tamarinvs19 67b9fe0
Change IU to IC
tamarinvs19 6d9522a
Added coverage mode buttons | JS
rudolf101 54faab1
Update CLI docs
rudolf101 5a50a55
Fixed JS basic coverage service algo
zishkaz 60e96e9
Fixes JsConstantsModelProvider after master merge
zishkaz 972607e
Removed unnecessary check for Mocha framework that failed in built pl…
zishkaz 05d7b4e
Removed lateinit modifier
zishkaz f578890
Removed export statements from js samples
zishkaz f8f064a
Merge branch 'tamarinvs19/UnitTestBot_Family_PR' of https://github.co…
zishkaz aa4c1a8
Fix in Python CLI
tochilinak 3409678
JS cli naming fix
zishkaz 289b6b9
Rename python cli class
tamarinvs19 5f205e3
Move comment line in CodeGeneratorResult
tamarinvs19 ec8f1dd
Remove jClass from python/js branch
tamarinvs19 d66c1ba
Merge branch 'main' into tamarinvs19/UnitTestBot_Family_PR
tamarinvs19 6295f85
Reworked text annotations in Mocha object
zishkaz 1781fa8
Merge remote-tracking branch 'origin/tamarinvs19/UnitTestBot_Family_P…
zishkaz d53325b
Remove soot dependency from utbot-python and implement new CgRender m…
tamarinvs19 18acd32
Merge remote-tracking branch 'origin/tamarinvs19/UnitTestBot_Family_P…
tamarinvs19 2385dc6
Used withUtContext in JsTestGenerator and reworked Mocha TestFramewor…
zishkaz 20e416a
Locally fixed explicit File.separator replacements
zishkaz 6dff767
Removed unnecessary catch
rudolf101 766616c
Fix weak comments
rudolf101 58415b3
Removed unnecessary try catch
rudolf101 f73d3fd
Merge branch 'main' into tamarinvs19/UnitTestBot_Family_PR
tamarinvs19 5c9e7fb
Fix CgRenderer bugs after merge
tamarinvs19 a8d4d92
Merge branch 'main' into tamarinvs19/UnitTestBot_Family_PR
tamarinvs19 0b66cab
Add README.md to utbot-python-cli
tamarinvs19 7a8893c
Merge branch 'main' into tamarinvs19/UnitTestBot_Family_PR
tamarinvs19 98ac84a
JS code refactoring
zishkaz d0815c8
Merge remote-tracking branch 'origin/tamarinvs19/UnitTestBot_Family_P…
zishkaz 7e16b66
Removed unnecessary JS file parsing
zishkaz dcfa7eb
Refactor utbot-intellij-python
tamarinvs19 a781aa9
Refactor utbot-python
tamarinvs19 9074ed2
Fix "Language <> is disabled" problem from Issue #1329
tamarinvs19 f9698b3
Merge branch 'main' into tamarinvs19/UnitTestBot_Family_PR
tamarinvs19 37c9564
Change GenerateTestsModel to BaseTestsModel
tamarinvs19 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Choosing language specific IDE | ||
|
||
Some language-specific modules depends on specific IntelliJ IDE: | ||
* Python can work with IntelliJ Community, IntelliJ Ultimate, PyCharm Community, PyCharm Professional | ||
* JavaScript can work with IntelliJ Ultimate, PyCharm Professional and WebStorm | ||
* Java and Kotlin - IntelliJ Community and IntelliJ Ultimate | ||
|
||
You should select correct IDE in `gradle.properties` file: | ||
``` | ||
ideType=<IU> | ||
ideVersion=<222.4167.29> | ||
``` | ||
|
||
### IDE marking | ||
|
||
| Mark | Full name | Supported plugin | | ||
|------|----------------------|----------------------------------------| | ||
| IC | IntelliJ Community | JVM, Python, AndroidStudio | | ||
| IU | IntelliJ Ultimate | JVM, Python, JavaScript, AndroidStudio | | ||
| PC | PyCharm Community | Python | | ||
| PY | PyCharm Professional | Python, JavaScript | | ||
|
||
[IntelliJ Platform Plugin SDK documentation](https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#tasks-runpluginverifier) |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
val ideType: String by settings | ||
|
||
val pythonIde: String by settings | ||
val jsIde: String by settings | ||
|
||
pluginManagement { | ||
resolutionStrategy { | ||
eachPlugin { | ||
if (requested.id.name == "rdgen") { | ||
useModule("com.jetbrains.rd:rd-gen:${requested.version}") | ||
} | ||
} | ||
} | ||
} | ||
|
||
rootProject.name = "utbot" | ||
|
||
include("utbot-core") | ||
include("utbot-framework") | ||
include("utbot-framework-api") | ||
include("utbot-intellij") | ||
include("utbot-sample") | ||
include("utbot-fuzzers") | ||
include("utbot-junit-contest") | ||
include("utbot-analytics") | ||
include("utbot-analytics-torch") | ||
|
||
include("utbot-cli") | ||
|
||
include("utbot-api") | ||
include("utbot-instrumentation") | ||
include("utbot-instrumentation-tests") | ||
|
||
include("utbot-summary") | ||
include("utbot-gradle") | ||
include("utbot-maven") | ||
include("utbot-summary-tests") | ||
include("utbot-framework-test") | ||
include("utbot-rd") | ||
include("utbot-android-studio") | ||
|
||
include("utbot-ui-commons") | ||
|
||
if (pythonIde.split(",").contains(ideType)) { | ||
include("utbot-python") | ||
include("utbot-cli-python") | ||
include("utbot-intellij-python") | ||
} | ||
|
||
if (jsIde.split(",").contains(ideType)) { | ||
include("utbot-js") | ||
include("utbot-cli-js") | ||
include("utbot-intellij-js") | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { | ||
kotlinOptions { | ||
jvmTarget = JavaVersion.VERSION_11 | ||
freeCompilerArgs += ["-Xallow-result-return-type", "-Xsam-conversions=class"] | ||
} | ||
} | ||
|
||
tasks.withType(JavaCompile) { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_11 | ||
} | ||
|
||
configurations { | ||
fetchInstrumentationJar | ||
} | ||
|
||
dependencies { | ||
implementation project(':utbot-framework') | ||
implementation project(':utbot-cli') | ||
implementation project(':utbot-js') | ||
|
||
// Without this dependency testng tests do not run. | ||
implementation group: 'com.beust', name: 'jcommander', version: '1.48' | ||
implementation group: 'org.junit.platform', name: 'junit-platform-console-standalone', version: junit4PlatformVersion | ||
implementation group: 'io.github.microutils', name: 'kotlin-logging', version: kotlinLoggingVersion | ||
implementation group: 'com.github.ajalt.clikt', name: 'clikt', version: cliktVersion | ||
implementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: junit5Version | ||
implementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: junit5Version | ||
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: log4j2Version | ||
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: log4j2Version | ||
implementation group: 'org.json', name: 'json', version: '20220320' | ||
//noinspection GroovyAssignabilityCheck | ||
fetchInstrumentationJar project(path: ':utbot-instrumentation', configuration: 'instrumentationArchive') | ||
} | ||
|
||
processResources { | ||
from(configurations.fetchInstrumentationJar) { | ||
into "lib" | ||
} | ||
} | ||
|
||
task createProperties(dependsOn: processResources) { | ||
doLast { | ||
new File("$buildDir/resources/main/version.properties").withWriter { w -> | ||
Properties properties = new Properties() | ||
//noinspection GroovyAssignabilityCheck | ||
properties['version'] = project.version.toString() | ||
properties.store w, null | ||
} | ||
} | ||
} | ||
|
||
classes { | ||
dependsOn createProperties | ||
} | ||
|
||
jar { | ||
manifest { | ||
attributes 'Main-Class': 'org.utbot.cli.js.ApplicationKt' | ||
attributes 'Bundle-SymbolicName': 'org.utbot.cli.js' | ||
attributes 'Bundle-Version': "${project.version}" | ||
attributes 'Implementation-Title': 'UtBot JavaScript CLI' | ||
attributes 'JAR-Type': 'Fat JAR' | ||
} | ||
|
||
archiveVersion.set(project.version as String) | ||
|
||
dependsOn configurations.runtimeClasspath | ||
from { | ||
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } | ||
} | ||
|
||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
## Build | ||
|
||
.jar file can be built in GitHub Actions with script publish-plugin-and-cli-from-branch. | ||
|
||
## Requirements | ||
|
||
* NodeJs 10.0.0 or higher (available to download https://nodejs.org/en/download/) | ||
* Java 11 or higher (available to download https://www.oracle.com/java/technologies/downloads/) | ||
* Nyc 15.1.0 or higher (`> npm install -g nyc`) | ||
* Mocha 10.0.0 or higher (`> npm install -g mocha`) | ||
|
||
## Basic usage | ||
|
||
Generate tests: | ||
|
||
java -jar utbot-cli.jar generate_js --source="dir/file_with_sources.js" --output="dir/generated_tests.js" | ||
|
||
This will generate tests for top-level functions from `file_with_sources.js`. | ||
|
||
Run generated tests: | ||
|
||
java -jar utbot-cli.jar run_js --fileOrDir="generated_tests.js" | ||
|
||
This will run generated tests from file or directory. | ||
|
||
Generate coverage report: | ||
|
||
java -jar utbot-cli.jar coverage_js --source=dir/generated_tests.js | ||
|
||
This will generate coverage report from generated tests and print in `StdOut` | ||
|
||
## `generate_js` options | ||
|
||
- `-s, --source <path>` | ||
|
||
(required) Source code file for a test generation. | ||
- `-c, --class <classname>` | ||
|
||
If not specified, tests for top-level functions or single class are generated, otherwise for the specified class. | ||
|
||
- `-o, --output <dir/filename>` | ||
|
||
File for generated tests. | ||
- `-p, --print-test` | ||
|
||
Specifies whether test should be printed out to `StdOut` (default = false) | ||
- `-t, --timeout <seconds>` | ||
|
||
Timeout for a single test case to generate in seconds (default = 5) | ||
|
||
## `run_js` options | ||
|
||
- `-f, --fileOrDir` | ||
|
||
(required) File or directory with tests. | ||
- `-o, --output` | ||
|
||
Specifies output of .txt file for test framework result (If empty prints to `StdOut`) | ||
|
||
- `-t, --test-framework [mocha]` | ||
|
||
Test framework of tests to run. | ||
|
||
## `coverage_js` options | ||
|
||
- `-s, --source <file>` | ||
|
||
(required) File with tests to generate a report. | ||
|
||
- `-o, --output` | ||
|
||
Specifies output .json file for generated tests (If empty prints .json to `StdOut`) |
35 changes: 35 additions & 0 deletions
35
utbot-cli-js/src/main/kotlin/org/utbot/cli/js/Application.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.utbot.cli.js | ||
|
||
import com.github.ajalt.clikt.core.CliktCommand | ||
import com.github.ajalt.clikt.core.subcommands | ||
import com.github.ajalt.clikt.parameters.options.default | ||
import com.github.ajalt.clikt.parameters.options.option | ||
import com.github.ajalt.clikt.parameters.options.versionOption | ||
import com.github.ajalt.clikt.parameters.types.enum | ||
import org.slf4j.event.Level | ||
import org.utbot.cli.getVersion | ||
import org.utbot.cli.setVerbosity | ||
import kotlin.system.exitProcess | ||
|
||
class UtBotCli : CliktCommand(name = "UnitTestBot JavaScript Command Line Interface") { | ||
private val verbosity by option("--verbosity", help = "Changes verbosity level, case insensitive") | ||
.enum<Level>(ignoreCase = true) | ||
.default(Level.INFO) | ||
|
||
override fun run() = setVerbosity(verbosity) | ||
|
||
init { | ||
versionOption(getVersion()) | ||
} | ||
} | ||
|
||
fun main(args: Array<String>) = try { | ||
UtBotCli().subcommands( | ||
JsCoverageCommand(), | ||
JsGenerateTestsCommand(), | ||
JsRunTestsCommand(), | ||
).main(args) | ||
} catch (ex: Throwable) { | ||
ex.printStackTrace() | ||
exitProcess(1) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.