I have started to write JUnit tests cases for our voting process. The current voting process has been implemented with our BPM tool, IPP. In the past to test code or model changes, I would need to redeploy the model and walk through the changes via the on-line portal. Although there are tools (Selenium for one) that can be used to test web applications by providing button clicking and web page display validation, they are limited in the fact that the range of what is tested is defined by the current logged in user. By using the api I can test my processes, activities, and the states of both simply by running a unit test. So instead of manually logging on, starting a voting process, and then validating that each user that should have a voting activity has one, a test is started that walks through this entire process via the IPP api and uses JUnit to assert the correct results.
1. Start the process:
ProcessInstance processInstance = workflowService.startProcess("VotingSystem",votingInformation,false);
2. Verify that activites are created for the correct number of voters:
ActivityInstanceQuery aiQuery = ActivityInstanceQuery.findAlive(processInstance.getProcessId(), "vote");
assertEquals("The number of activity instances in vote does not match",