I added companion object {
in top of the @ClassRule annotation and now i faced by this error :
The @ClassRule 'rule' must be public.
Actually i think var rule = TestCoverageProcessEngineRuleBuilder.create().build()
Is public and static in kotlin .
I think problem is related to rule .
Because in this topic :
mentioned if we use Spring boot , we shouldn’t use ProcessEngineRule .
Is that true or i got wrong meaning ?
If its advisable to use the engine depends on your test level. If you want to run an in memory test based on your bpmn and mocked delegates, it is still the way to go. If you are more on the integration test level, running the complete springApplicationTest is the better approach. Both are valid and useful in my opinion.
Regarding classrule in kotlin: you are probably missing the JvmField annotation:
companion object {
@ClassRule @JvmField
val camunda = new ProcessEngineRule()
}
I faced by error again . ( however i use mysql )
For using complete(task(processInstance) we should use camunda.processEngine.runtimeService.startProcessInstanceByKey("my-process")
instead of val processInstance = camunda.runtimeService.startProcessInstanceByKey("my-process")
format ?
if you look at the implementation of camunda asserts static helpers you will notice that one way or the other they all go down to calling the services camunda provides. so basically both approaches are vaild.
Hi @jangalinski
Sorry, but i faced by another error again :
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [activiti.cfg.xml]; nested exception is java.io.FileNotFoundException: class path resource [activiti.cfg.xml] cannot be opened because it does not exist
@Test
@Deployment(resources = ["my-process.bpmn"])
internal fun `deploy and start`() {
val processInstance = rule.runtimeService.createProcessInstanceByKey(PROCESS_DEFINITION_KEY)
}
The rule tries to configure the test-engine. Default source for config is the xml file you mentioned. It’s missing, so setting up the rule fails.
There’s plenty of documentation on engine configuration, you should check it out