AnsweredAssumed Answered

Testing junit springway tests. Failure.

Question asked by nikz2 on Jun 11, 2015
Latest reply on Jul 10, 2015 by nikz2
At this point it works, and everything is fine, but…

If i do just like in the tutorial example with @Deployment annotation it produce this output:

<c>
INFO: Refreshing org.springframework.context.support.GenericApplicationContext@4ae69619: startup date [Thu Jun 11 10:07:04 AST 2015]; root of context hierarchy
июн 11, 2015 10:07:07 AM org.activiti.engine.impl.ProcessEngineImpl <init>
INFO: ProcessEngine default created
июн 11, 2015 10:07:07 AM org.activiti.engine.impl.bpmn.deployer.BpmnDeployer deploy
INFO: Processing resource D:\Java\workspace\HelloWorld\target\classes\diagrams\autodeploy.HelloProcess.HelloProcessId.png
июн 11, 2015 10:07:07 AM org.activiti.engine.impl.bpmn.deployer.BpmnDeployer deploy
INFO: Processing resource D:\Java\workspace\HelloWorld\target\classes\diagrams\autodeploy.HelloProcess.bpmn
Hello world
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.714 sec <<< FAILURE!

Results :

Tests in error:
  simpleProcessTest(HelloTest)

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

[INFO] ————————————————————————
[INFO] BUILD FAILURE
[INFO] ————————————————————————
</c>

And when i comment @deployment annotation everything runs fine.

My code:


import static org.junit.Assert.*;

import org.junit.runner.RunWith;
import org.junit.Test;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.test.ActivitiRule;
import org.activiti.engine.test.Deployment;
import org.junit.Rule;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.ContextConfiguration;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:activiti-context.xml")
public class HelloTest {

  @Autowired
  private RuntimeService runtimeService;

  @Autowired
  @Rule
  public ActivitiRule activitiRule; 
 
  @Test
  @Deployment
  public void simpleProcessTest() {
    runtimeService.startProcessInstanceByKey("HelloProcessId");
    assertEquals(0,0);
  }
}


Outcomes