Guide / Test and run
Process tests and coverage
Penstock lists every way through a process, writes a JUnit test for each, and shows on the diagram what your tests reach.
Three tools, one idea
A process with two gateways has several ways through it. Each way is a scenario. Penstock finds them all, and then:
- Listing the scenarios gives a test plan you can read. In a terminal it is
penstock scenarios list. - JUnit tests are written for each scenario. In a terminal it is
penstock junit. - Coverage shows which elements your tests reached.
Running the scenarios against an engine, without JUnit, is Scenarios. The older command names paths and tests still work and are left out of the help.
List the ways through
Each scenario shows the decision taken at each gateway and its condition. You can print the list as text, as a Markdown checklist to paste into a test plan, or as JSON for a tool. An AI assistant gets it from the MCP tool list_scenarios.
List the scenarios in your tool
JetBrains
Right-click a file or folder in the Penstock tool window and choose Run Penstock | Scenarios. Each process in the tool window also lists its tests.
VS Code
The Scenarios tab of the sidebar lists the ways through the diagram you have open. For a whole project, run penstock scenarios list . on the command line.
Command line
$ penstock scenarios list .
src/main/resources/order-process.bpmn 2 scenario(s)
1. Order received → Approve order → Charge card → Decide shipping method → Shipment confirmed → Send receipt → Order completed
2. Order received → Approve order → Charge card → Card declined → Payment declined
Card declined fires on Charge card
$ penstock scenarios list . --format md
### 1. Order received → Order completed
- [ ] runs Approve order → Charge card → Decide shipping method → Shipment confirmed → Send receipt
Use --format json for a tool. See Every command.
Write the tests
Penstock writes one JUnit class per process, with a test for every way through it. It names the test dependencies your build is missing. Add them, then run the tests with your normal test runner.
Each test starts the process with variables chosen to take that way: a value just past each condition, and at a default flow a value no other condition accepts. It completes the jobs, user tasks and external tasks, correlates messages, moves time past timers, throws errors from jobs where an error boundary is taken, and checks the elements the run passed.
Write the tests in your tool
JetBrains
Choose Run Penstock | JUnit Tests in the Penstock tool window. The output names the test dependencies your build is missing.
VS Code
Choose Run Penstock | JUnit Tests in the Penstock view. The output names the test dependencies your build is missing.
Command line
$ penstock junit .
wrote src/test/java/io/penstock/example/process/OrderProcessTest.java 2 scenario(s)
The tests need these test dependencies in pom.xml:
io.camunda:camunda-process-test-java:8.9.21
2 test(s) in 1 class(es), one per way through each process.
Use --out and --package to choose the folder and the package. See Every command.
| Camunda 8 | Camunda Process Test. |
| Camunda 7, Operaton, CIB seven | camunda-bpm-assert (or the engine's own equivalent) with an in-memory engine and mocked delegate beans. |
| Where the tests go | The diagram's own module, in Kotlin or Java as that module already is, and in its application's package followed by .process. |
| A way the data cannot choose | Marked in the test for you to finish. |
If the guess is wrong, set tests in penstock.yaml: language (java or kotlin), out (the source folder) and package. See penstock.yaml.
Run and debug tests from the diagram
Pro
From an element on the canvas you can run or debug the test methods that name the element or its process, with your project's own test runner. When you debug, the diagram shows where the process stops.
Run and debug in your tool
JetBrains
Right-click an element on the canvas, or the empty canvas, and choose Run Tests or Debug Tests. In the Penstock tool window a Tests node lists every process test by class, and Run All Process Tests is on its toolbar. See Tests in the IDE.
VS Code
From a diagram, running the tests it is linked to opens the test file at the cursor and starts VS Code's testing commands. Stopping in a worker marks the step on the diagram. Pro. Test-case files also run under the Penstock scenarios controller in the Testing view. See Code links in VS Code.
Command line
Not available on the command line. Run the generated tests with your build tool, for example mvn test or gradle test.
Coverage
Pro
- Run your process tests with your build. Use Camunda Process Test, or on Camunda 7 the process test coverage extension.
- A button Coverage appears on the toolbar. Press it.
- The diagram colours what the tests reached and dims what they did not.
- The panel lists the tests with how much of the diagram each covers. Pick one to see the way it takes. It also lists the elements no test reaches.
- Run the tests again. Coverage follows.
Penstock reads the reports under target or build, and follows them as the tests run again.
What you see
- A test class file in your test sources, with one test for each way through the process.
- After a test run, a Coverage button. Pressed, it colours what was reached and dims the rest.
Common problems
- There is no Coverage button.
- No test report was found yet. Run the process tests first. Reports must be under
targetorbuild. - The generated test does not compile.
- Add the test dependencies the command printed to your build file.
- The tests went to the wrong place.
- Set
tests.outandtests.packageinpenstock.yaml. - "To fill in".
- A way that the data cannot choose is marked for you to finish. Fill in the variables that take it.
- I want to run scenarios against a live engine without JUnit.
- Use Scenarios. They need no build setup.