How should I testing my controllers in portal module with spring-test?
Is it good idea to use spring-test or I should use some build-in cuba mechanism?
You could test your logic in the portal module by using spring-test.
But remember that portal module has its own spring application context. So you will need to mock all middleware services for such tests, including DataManager. It makes isolated testing of portal module not so useful.
So my choice would be:
- create unit tests for classes with complex logic if those exist in the portal module (e.g. custom jackson converters or validators)
- create and run integration tests for the fully assembled application connected to real database to test portal controllers (can combine Masquerade and RestAssured as main tools)
Thank you very much!