feat: add assertions for message variables#1195
feat: add assertions for message variables#1195sephiroth-j wants to merge 3 commits intocamunda:mainfrom
Conversation
Test Results 24 files 24 suites 12s ⏱️ Results for commit c357eb6. ♻️ This comment has been updated with latest results. |
adds `hasVariable` and `hasVariableWithValue` to `MessageAssert`, similar to `ProcessInstanceAssert`
8a716ce to
8de00a7
Compare
hasVariable and hasVariableWithValue to MessageAssert|
I fixed the formatting problems and swapped the title and description. |
|
@sephiroth-j thank you for your contribution. 👍 I checked the changes but I'm unsure about the use case. Do you want to check the variables of a published message? Note Heads up! We are building a new Java testing library for Camunda 8.6. The new library will replace Zeebe Process Test. |
Yes, exactly. Right now, you need to retrieve a process instance that may have been created after the message was received to be able to check the variables. But it makes no sense if the client's task is only to publish a specific message with specific variables. It could also be that no process instance was created at all. |
saig0
left a comment
There was a problem hiding this comment.
@sephiroth-j the changes look good. 👍
I have two minor comments before we can merge the PR. Please have a look. 🍪
| } | ||
|
|
||
| private Map<String, Object> getVariables() { | ||
| return StreamFilter.processMessageSubscription(recordStream) |
There was a problem hiding this comment.
❌ We should get the variables of the message from the message records.
A process message subscription is only written when a message is correlated to a process instance.
There was a problem hiding this comment.
I would use StreamFilter.message(recordStream) for this?
There was a problem hiding this comment.
❌ We need to add the API module as a test dependency. The dependency plugin fails with the message:
[INFO] --- maven-dependency-plugin:3.6.1:analyze-only (analyze) @ zeebe-process-test-assertions ---
Error: Used undeclared dependencies found:
Error: io.camunda:zeebe-process-test-api:jar:8.6.0-alpha2-rc2-SNAPSHOT:compile
Error: Non-test scoped test only dependencies found:
Error: io.camunda:zeebe-process-test-api:jar:8.6.0-alpha2-rc2-SNAPSHOT:compile
Add the following test dependency to the module pom.xml:
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-process-test-api</artifactId>
<scope>test</scope>
</dependency>
|
I'm getting the following build error on the main branch. Any ideas? |
|
For some reason, the jar file zeebe-client-java-8.6.0-20240625.094240-1041 does not contain any class files. All jar files currently available at https://artifacts.camunda.com/ui/native/zeebe-io-snapshots/io/camunda/zeebe-client-java/8.6.0-SNAPSHOT/ are affected! |
|
@sephiroth-j yes, in |
Okay, then please update your main branch first and let me know when that's done so I can rebase my feature branch again. |
|
Main is updated, so it should be possible now. Apologies that it took so long. |

Description
Adds
hasVariableandhasVariableWithValuetoMessageAssert, similar toProcessInstanceAssert.Related issues
Definition of Done
Not all items need to be done depending on the issue and the pull request.
Code changes:
Testing:
Documentation: