Skip to content

Commit 105aef7

Browse files
committed
Add documentation for using testkit
Relates to #270
1 parent a486778 commit 105aef7

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

docs/libraries.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,21 @@ tasks.processJupyterApiResources {
131131
}
132132
```
133133

134+
### Integration testing for the integration logic
135+
You may want to automatically check if your library integrates correctly into kernel. To achieve this, inherit your
136+
test class from `org.jetbrains.kotlinx.jupyter.testkit.JupyterReplTestCase` and use its methods to execute cells.
137+
Your library integration descriptors should be already on classpath and will be loaded automatically by the test logic,
138+
you don't need to use `%use` magic or `DependsOn` annotation to switch on your library. But you may use magics and
139+
annotations for other purposes, as usual.
140+
141+
The artifact containing test templates is included automatically into `testImplementation` configuration if you
142+
use the Gradle plugin. You may turn this behavior off by setting `kotlin.jupyter.add.testkit` Gradle property
143+
to `false`. If you want to include this artifact into your build manually, you'll find the instructions
144+
[here][maven-search-testkit].
145+
146+
For the examples of integration testing see `org.jetbrains.kotlinx.jupyter.testkit.test.JupyterReplTestingTest` in
147+
this repository or [related tests in DataFrame][dataframe-integration-tests].
148+
134149
### Integration using other build systems
135150

136151
If you don't use Gradle as a build system, there is an alternative way.
@@ -156,4 +171,6 @@ resources. This file should contain FQNs of all integration classes in the JSON
156171
Classes derived from `LibraryDefinition` should be added to the `definitions` array.
157172
Classes derived from `LibraryDefinitionProducer` should be added to the `producers` array.
158173

159-
[libs-repo]: https://github.com/Kotlin/kotlin-jupyter-libraries
174+
[libs-repo]: https://github.com/Kotlin/kotlin-jupyter-libraries
175+
[dataframe-integration-tests]: https://github.com/Kotlin/dataframe/tree/master/src/test/kotlin/org/jetbrains/dataframe/jupyter
176+
[maven-search-testkit]: https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlin-jupyter-test-kit

0 commit comments

Comments
 (0)