Activit unit I test (integration test with spring), activitspring

Source: Internet
Author: User

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());    }}

 




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.