Hi, are there any advices how to write tests for testing Vaadin Security Setup? Normally, I would write a Spring MVC Test and use @WithMockUser(roles="ADMIN")
. Are there any recommendations how to test Vaadins @AnonymousAllowed
or the @RolesAllowed
?
What testframework are you using?
I use Karibu Testing GitHub - mvysny/karibu-testing: Vaadin Server-Side Browserless Containerless Unit Testing
And there you can see in the AbstractAppTest that it has a login method that fakes the user
If you use Testbench you can use WithMockUser and WithAnonymousUser similar to Spring MVC Test: Spring-based Projects | UI Unit Testing | Testing | Vaadin Docs
I am using Spring Testcontext framework together with Spring Boot. Thank you for the links - will give it a try.
@adaptable-uakari Thank you for the links. This helps me.
If you want to see Karibu in action checkout GitHub - 72services/jtaf4: JTAF - Java Track and Field
Nice project, Thank you!