BDD & Camunda Examples

Hello,

I’m trying to get my team to work towards a more BDD approach in delivering better quality code. I was wondering if anyone had any good examples? I read the camunda testing page along with the extensions, but I’ve not seen anything along the lines of writing out a spec file and testing against it with an embedded engine.

I’ve already made a start in putting a sample together myself with cucumber, but I would be very keen any someone else has done this to have something to compare against for improving. I would even be keen to share this type of project with the community.

Stephen

1 Like

@stephenm currently BDD test cases for camunda examples are not available. You can give it a try and share the solutions, will be useful for others too. :slight_smile:

1 Like

We made good experiences using the “pure-java” BDD tool jgiven with camunda. Checkout the extension: https://github.com/holunda-io/camunda-bpm-jgiven

You can write tests like:

@Test
fun `should automatically approve`() {

  val approvalRequestId = UUID.randomUUID().toString()

  given()
    .process_is_deployed(ApprovalProcessBean.KEY)
    .and()
    .process_is_started_for_request(approvalRequestId)
    .and()
    .approval_strategy_can_be_applied(Expressions.ApprovalStrategy.AUTOMATIC)
    .and()
    .automatic_approval_returns(Expressions.ApprovalDecision.APPROVE)

  whenever()
    .process_continues()

  then()
    .process_is_finished()
    .and()
    .process_has_passed(Elements.SERVICE_AUTO_APPROVE, Elements.END_APPROVED)

}
1 Like

Hello jangalinski,

This is exactly what I needed and I think if we have a demo project for Camunda this in place, it would look really good on camunda’s testing section.

I’ve never used JGiven before and was really impressed with how easy it was to use. Thanks for the head’s up!

3 Likes