-
Notifications
You must be signed in to change notification settings - Fork 83
Move JUnit tests to get started #767
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,7 +55,38 @@ This command will compile your application and create a native executable in the | |
| ./gradlew nativeRun | ||
| ---- | ||
|
|
||
| Continue reading below to learn more about the plugin. | ||
| Continue to advanced use cases to learn more about the plugin. | ||
|
|
||
| [[run-junit-tests]] | ||
| === Run Junit Tests | ||
|
|
||
| This plugin supports running tests on the JUnit Platform. | ||
| The tests are compiled ahead of time and executed as native code. | ||
|
|
||
| - Add the JUnit 5 dependency to _build.gradle_ / _build.gradle.kts_ to include the testing framework: | ||
|
|
||
| [source,groovy,role="multi-language-sample"] | ||
| ---- | ||
| testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1' | ||
| testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1' | ||
| testImplementation 'junit:junit:4.13.2' | ||
| ---- | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @melix correct me if I am wrong, but since version
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It depends on the version of Gradle. Since 8.14 they have to.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this requirement independent of the plugin usage?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I am not wrong, with earlier versions of NBT, users did not have to add this dependency themselves. When we fixed the issue with "leaking" dependencies (release @melix please correct me if I missed something since you implemented fix for leaking dependencies. See this comment: #712 (comment) |
||
|
|
||
| [source,kotlin,role="multi-language-sample"] | ||
| ---- | ||
| testImplementation('org.junit.jupiter:junit-jupiter-api:5.8.1') | ||
| testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.8.1') | ||
| testImplementation('junit:junit:4.13.2') | ||
| ---- | ||
|
|
||
| - Run the tests: | ||
|
|
||
| [source,bash,role="multi-language-sample"] | ||
| ---- | ||
| ./gradlew nativeTest | ||
| ---- | ||
|
|
||
| The tests are compiled ahead of time and executed as native code. | ||
ban-mi marked this conversation as resolved.
Show resolved
Hide resolved
ban-mi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| [[advanced-use-cases]] | ||
| == Advanced Use Cases: How to | ||
|
|
@@ -134,37 +165,6 @@ This works similarly to `JAVA_TOOL_OPTIONS`, where the value of the environment | |
|
|
||
| Learn more about Native Image build configuration https://www.graalvm.org/reference-manual/native-image/overview/BuildConfiguration/[on the website]. | ||
|
|
||
| [[run-junit-tests]] | ||
| === Run Junit Tests | ||
|
|
||
| This plugin supports running tests on the JUnit Platform. | ||
| The tests are compiled ahead of time and executed as native code. | ||
|
|
||
| - Add the JUnit 5 dependency to _build.gradle_ / _build.gradle.kts_ to include the testing framework: | ||
|
|
||
| [source,groovy,role="multi-language-sample"] | ||
| ---- | ||
| testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1' | ||
| testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1' | ||
| testImplementation 'junit:junit:4.13.2' | ||
| ---- | ||
|
|
||
| [source,kotlin,role="multi-language-sample"] | ||
| ---- | ||
| testImplementation('org.junit.jupiter:junit-jupiter-api:5.8.1') | ||
| testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.8.1') | ||
| testImplementation('junit:junit:4.13.2') | ||
| ---- | ||
|
|
||
| - Run the tests: | ||
|
|
||
| [source,bash,role="multi-language-sample"] | ||
| ---- | ||
| ./gradlew nativeTest | ||
| ---- | ||
|
|
||
| The tests are compiled ahead of time and executed as native code. | ||
|
|
||
| [[gather-execution-profiles]] | ||
| === Gather Execution Profiles and Build Optimized Images | ||
|
|
||
|
|
@@ -444,4 +444,4 @@ All the monitoring and debugging tools https://www.graalvm.org/reference-manual/ | |
|
|
||
| === Learn more | ||
|
|
||
| To continue learning, refer to the <<changelog.adoc#,extensive reference documentation for the GraalVM Native Image Gradle plugin>>. | ||
| To continue learning, refer to the <<gradle-plugin.adoc#,Gradle plugin documentation>>. | ||
ban-mi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Uh oh!
There was an error while loading. Please reload this page.