Activit unit I test (integration test with spring), activitspring
1. Test
Install the activiti plug-in and maven in eclipse
Right-click to create the activiti project (the pom dependency and activiti. cfg. xml will be automatically created, but not the maven project)
Right-click the project root directory and select the convert maven project under configure (convert the project to a maven project)
Test file storage principle (not mandatory): Put the test file class under test/java, and put the process bpmn under resource (ensure that all files are under classpath after compilation)
Naming rules: the test class and bpmn file are in the same package, and the name of the test bpmn isClass Name. method name. bpmn.
If the naming rule is not installed, enter the path and name of the bpmn resource after @ Deployment, for example, @ Deployment (resources = "test/ActivitTest. testUser. bpmn ")
:
2. Test the integration environment of spring and activiti
Dependent jar package: activiti-Spring.jar
@ContextConfiguration("classpath:activiti-context.xml")public class SpringTestActiviti extends SpringActivitiTestCase { @Deployment(resources = "spring/SpringTest.bpmn20.xml") public void testSpring() { runtimeService.startProcessInstanceByKey("process1"); Task task = taskService.createTaskQuery().singleResult(); taskService.complete(task.getId()); }}