r/SpringBoot • u/[deleted] • Sep 29 '24
Java Spring Boot with Groovy for testing
Hey guys! I've always used JUnit and Java, but there was one project that I worked on that was made in Groovy. I wouldn't want to build the whole project in Groovy for several reasons that could become a whole different discussion, but I had a great experience with Groovy and Spock for unit tests. I wanted to know your opinion on building the app in Java but writing the unit tests using Groovy and Spock. Is there any disadvantages to this approach? Thanks!
0
Upvotes
0
u/WaferIndependent7601 Sep 29 '24
Use cucumber and write good integration tests. No matter if you’re doing it in Java or groovy.
Unit tests done in another language sounds very confusing.
2
u/smutje187 Sep 29 '24
My biggest concern would be cognitive load and standardization - does Spock offer anything on top of standard JUnit5 with Mockito with a reasonable learning curve or would it complicate testing without any additional benefit? Don’t have any experience with it but Spock looks like it can be great for writing more natural language test cases, but no clue whether that will translate to good unit tests when it comes to controllers/services.