Hi,
I need to write a testcase to test an asynchronous process mocking some of the service tasks in it. I am able to mock by extending from ActivitiTestCase class but the process doesnt wait until all jobs are done. And I am able to test async process with the help of PluggableActivitiTestCase class but in this case, I am unable to mock a service task. Not sure how to test my scenario. Your inputs are highly appreciated. Thanks in advance.
Regards,
Durga Prasad.
If there are async jobs/tasks in the process, you may need to query for jobs via the management service and complete the jobs in your test case for it to move to the next step. There are plenty of examples in the activiti repo under unit test cases. GitHub - Activiti/Activiti: Activiti is a light-weight workflow and Business Process Management (BPM...
Are you using Activiti Community or Alfresco Process Services (enterprise version)?
If enterprise, I have an example in this blog where I am using org.mockito.Mockito to mock some classes. You could take a similar approach even with community version, but I don't have an example handy!
Hi,
You will need to follow the below steps to be able to mock the service tasks of an async process.
1) Create a custom class to extend AbstractActivitiTestCase class and add mock support to it. You may refer to ActivitiTestCase class on how it was done.
2) Extend PluggableActivitiTestCase and modify it to extend from the above created custom class.
3) In your test case, extend from your CustomPluggableActivitiTestCase class.
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.