YT Tutorial 7: 'Build Failed' because of 'Failed tests'

Hola,
I tried to follow the tutorial 7 on Youtube but I am not able to deploy/build the project.
According to the console (using Eclipse) I get the following error message:
Failed tests: testHappyPath(com.camunda.demo.BpmnCommunication.ProcessUnitTest): Expecting ProcessInstance {id='5', processDefinitionId='BpmnCommunication:1:3', businessKey='null'} to be ended, but it is not!. (Please make sure you have set the history service of the engine to at least 'activity' or a higher level before making use of this assertion!)

I looked up the setting of the history service in C:/…/camunda-bpm-ee-wildfly-7.14.5-ee\server\wildfly-20.0.1.Final\standalone\configuration/standalone.xml and it says that the setting is on “full”.

Any idea what I’m doing wrong?

Can you upload the model your trying to test?
Also upload the JUnit code. Remember to format it correctly to make it easy to read :slight_smile:

(wow, that was a fast reply :slight_smile: )

That’s the model:
process.bpmn (10.9 KB)

And here is the JUnit code (pom.xml):
pom.xml (7.2 KB)

Thanks!
Actually the JUnit java code i’m looking for should actually be in src/test/ folder

mb
That is the one in src/test/java:

package com.camunda.demo.BpmnCommunication;

import org.apache.ibatis.logging.LogFactory;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.camunda.bpm.engine.test.Deployment;
import org.camunda.bpm.engine.test.ProcessEngineRule;
import org.camunda.bpm.extension.process_test_coverage.junit.rules.TestCoverageProcessEngineRuleBuilder;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;

import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.*;
import static org.junit.Assert.*;

/**
 * Test case starting an in-memory database-backed Process Engine.
 */
public class ProcessUnitTest {

  static {
    LogFactory.useSlf4jLogging(); // MyBatis
  }

  @ClassRule
  @Rule
  public static ProcessEngineRule rule = TestCoverageProcessEngineRuleBuilder.create().build();

  @Before
  public void setup() {
    init(rule.getProcessEngine());
  }

  @Test
  @Deployment(resources = "process.bpmn")
  public void testHappyPath() {
    // Drive the process by API and assert correct behavior by camunda-bpm-assert

    ProcessInstance processInstance = processEngine().getRuntimeService()
        .startProcessInstanceByKey(ProcessConstants.PROCESS_DEFINITION_KEY);

    assertThat(processInstance).isEnded();
  }

}

The first thing i noticed is that the file you uploaded was not called process.bpmn. This line would load a file with that name into the engine.

 @Deployment(resources = "process.bpmn")

Also this test will always fail because it’s expecting the process to end right after it starts with isn’t the case.

you should remove the assert that makes this check either my removing it or commenting it out

assertThat(processInstance).isEnded();
1 Like

Nice.
I commented the assertThat(processInstance).isEnded(); out and now its working. I successfully deployed and now i can work with the process in my engine.

Just so I’m clear: What do you mean by "[…] the file you uploaded was not called process.bpmn"? The file of the process I uploaded is called “process.bpmn”. Am I missing something out?

No need to worry as long as the file name is the same as the one in the code. :slight_smile:

2 Likes