This repository has been archived by the owner on Sep 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Add testing documentation (#210)
Add testing doc
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,29 @@ | ||
# Testing | ||
|
||
EDC provides a JUnit test fixture for running automated integration tests. The EDC JUnit runtime offers a number of advantages: | ||
|
||
- Fast build time since container images do not need to be built and deployed | ||
- Launch and debug tests directly within an IDE | ||
- Easily write asynchronous tests using libraries such as [Awaitility](http://www.awaitility.org/) | ||
|
||
The JUnit runtime can be configured to include custom extensions. Running multiple instances as part of a single test setup is also possible. The following demonstrates how to set up and launch a basic test using JUnit's `RegisterExtension` annotation and the `RuntimePerClassExtension`: | ||
|
||
```java | ||
@EndToEndTest | ||
class Basic01basicConnectorTest { | ||
|
||
@RegisterExtension | ||
static RuntimeExtension connector = new RuntimePerClassExtension(new EmbeddedRuntime( | ||
"connector", | ||
emptyMap(), | ||
":basic:basic-01-basic-connector" | ||
)); | ||
|
||
@Test | ||
void shouldStartConnector() { | ||
assertThat(connector.getService(Clock.class)).isNotNull(); | ||
} | ||
} | ||
``` | ||
|
||
For more details and examples, check out the [EDC Samples system tests](https://github.com/eclipse-edc/Samples/tree/main/system-tests). |