Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forced to use waitForIdleState on each test #1131

Open
melohagan opened this issue Mar 19, 2024 · 1 comment
Open

Forced to use waitForIdleState on each test #1131

melohagan opened this issue Mar 19, 2024 · 1 comment
Labels
kind/feature Categorizes an issue or PR as a feature, i.e. new behavior

Comments

@melohagan
Copy link

Description
I'm quite new to Camunda so I'm not sure if this is my own lack of experience, or if this can be handled in a slightly better way.

Currently I've found that my tests only pass when I use the engine.waitForIdleState method before doing assertions. As this is always needed, could this not be abstracted into the testing library itself?

This is my workaround at the moment:

// resolve task
client.newCompleteCommand(job.key)
            .variables(variables)
            .send()
            .join()

// assert when the task has completed
assertWhenIdle {
            BpmnAssert.assertThat(instance)
                .hasPassedElementsInOrder(<..>)
}

With a base class that has the assertWhenIdle method:

protected fun assertWhenIdle(assertions: () -> ProcessInstanceAssert) {
        // Wait for currently running tasks to complete
        engine!!.waitForIdleState(Duration.ofMillis(Constants.IDLE_TIMEOUT_MILLIS))

        // Run assertions
        assertions()
    }

Am I doing something wrong? It doesn't seem ideal that I'm forced to add in the wait for idle state for every assertion in my test suite.

@melohagan melohagan added the kind/feature Categorizes an issue or PR as a feature, i.e. new behavior label Mar 19, 2024
@saig0
Copy link
Member

saig0 commented May 31, 2024

Note

Heads up! We are building a new Java testing library for Camunda 8.6. The new library will replace Zeebe Process Test.
Read more about upcoming changes here and stay tuned for updates. 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes an issue or PR as a feature, i.e. new behavior
Projects
None yet
Development

No branches or pull requests

2 participants