Skip to content

Forced to use waitForIdleState on each test #1131

@melohagan

Description

@melohagan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes an issue or PR as a feature, i.e. new behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions