Testing junit springway tests. Failure.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2015 03:06 AM
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:
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); }}
Labels:
- Labels:
-
Archive
12 REPLIES 12
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2015 05:15 PM
I'm not sure if you can inject the Activiti rule. I can't get the project to run here, but all in all that test should run just fine, nothing special about it. So i'm guess it's more an env/setup thing than anything else.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2015 04:10 PM
if I run your test as you provided here I receive an error related to sql syntax. (didn't checked yet what's wrong with the sql and version 3.3.0 of mybatis but i'll have a look.)
if I use another version of mybatis (the one which is used in Activiti 5.17.0) it is working well.
<code>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.2.4</version>
</dependency>
</code>
The tests are working even I run them from IDE or from command line (I prefer command line because the output it's more verbose and I could see the errors better.)
if I use another version of mybatis (the one which is used in Activiti 5.17.0) it is working well.
<code>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.2.4</version>
</dependency>
</code>
The tests are working even I run them from IDE or from command line (I prefer command line because the output it's more verbose and I could see the errors better.)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2015 01:02 AM
Thanks a lot. That's was the solution.
