To do that, double click on your adle file and add the following gradle configuration file:Ĭlasspath(":spring-boot-gradle-plugin:1.5.2.RELEASE")Īpply plugin: 'io.pendency-management' You can use these dependencies, since they are public. Now that we have a project, we need to setup the dependencies. If you did everything correctly, you should now see this window with an empty Java project: Select Gradle, Java, and the JDK version. Open IntelliJ and click “Create New Project”.Ĥ. Make sure you have JDK installed (at least version 1.8.XXX).ģ. Here's how to do JUnit REST API testing with Spring Boot:Ģ. Related Resource: Watch to learn about BlazeMeter API Testing & Monitoring > Back to top How to Do JUnit REST API Testing We will write tests per controller (testing the size of the JSON Object, the status of the call to the endpoint and an assertion on one item from the JSON object) and tests per repository (inserting two new items in a table and making sure the return object is equal). In short, we have 4 controllers (ArrivalController, DepartureController, UsersController, FlightsController) and 4 repositories (ArrivalRepository, DepartureRepository, UsersRepository, FlightsRepository). We will be testing controllers and repository classes. You can also participate - the source code is located here on GitHub. These are my personal preferences but Eclipse, NetBeans, or even a simple text editor could also be used. To start, we have to have Intellij IDEA, as an IDE for development, and JDK8, for using Java for development. I prefer the following combination: Spring Boot, JUnit, MockMvc and Mockito, because they are all open-source and support Java, which is my preferred language. There are many different variations and techniques to unit test APIs.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |