diff --git a/README.md b/README.md index 941c3521e..cc7b2757e 100644 --- a/README.md +++ b/README.md @@ -250,7 +250,7 @@ Because of this we should wait for a busy state after increasing the engine time ## Examples -For example tests the best place to look right now is the tests in the QA module. +[Examples](examples/README.md) ## Engine lifecycle diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 000000000..654fbcf38 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,34 @@ +# Examples + +This module contains examples on how to use the assertions to test processes. + +## Example: _Pull Request Process_ + +This example demonstrates how to ... +* Annotate a unit tests +* Deploy processes to the test engine +* Control process execution +* Protect tests from flakiness caused by asynchronous processing in the engine +* Manipulate the time of the engine to trigger timer events +* Assert that deployment was successful +* Assert a certain path was taken / not taken +* Assert state of process instance variables +* Navigate from the main process to spawned child process + +**Processes** + +The example is based on the following process: +![Pull Request Created Process](assets/pr-created.png) + +[Source](src/test/resources/pr-created.bpmn) + +Which calls a subprocess _Automated tests_: + +![Automated Tests Process](assets/automated-tests.png) + +[Source](src/test/resources/automated-tests.bpmn) + +**Tests** + +[Source](src/test/java/io/camunda/zeebe/process/test/examples/PullRequestProcessTest.java) + diff --git a/examples/assets/automated-tests.png b/examples/assets/automated-tests.png new file mode 100644 index 000000000..ba00e12de Binary files /dev/null and b/examples/assets/automated-tests.png differ diff --git a/examples/assets/pr-created.png b/examples/assets/pr-created.png new file mode 100644 index 000000000..11ec5665b Binary files /dev/null and b/examples/assets/pr-created.png differ