We use Spring in our production code, and to make the most out of that I wan’t to use Spring to some extend in our tests as well.
I have successfully refactored our tests to spring test, using the many available examples of that.
We had a very nice workshop with @falko.menge where we configured tests with coverage. But I have not been able to find out how to combine the camunda-bpm-process-test-coverage extension with Spring testing.
My SpringProcessTest works fine. But SpringProcessWithCoverageTest does not.
I just tried to copy some of the event listeners from bpm-process-test-coverage into my spring configuration (in SpringProcessWithCoverageEngineConfiguration.java)
When I run the test it logs " WARNING: Coverage history event listener in use but no coverage run state assigned!"
that should give a hint. But the whole initialization code of the coverage plugin it quite hard to follow, for a camunda newbie like me.
Perhaps your use case doesn’t work well with our ProcessCoverageInMemProcessEngineConfiguration class. This class is more of a convenience class avoiding the xml configuration from the previous link.
I tried having the xml file, but that causes the process engine to be created twice, since it is already configured by Spring.
I just spend an hour cloning the coverage plugin, and adding constructors to the TestCoverageProcessEngineRule that allows me to provide a process engine instance.
It doesn’t work yet. It seems like it is assumed a lot of places that the process engine is configured internally…
I am just saying that I’d prefer it, if it was possible to do without the xml configuration.
And now it is (or will be, when my pull request gets merged)
Spring Java Configuration is much more elegant and flexible than the xml files, so we try to get rid of them whenever we can,
Sorry for the long delay. I have an example linked if you follow the link from my pull request above.
Because of forum rules I couln’t add more links to this thread :-S