Testing Endpoints and Lessons Learned

Testing Endpoints and Lessons Learned

Everyone, let’s quickly test all of our endpoints starting from registration. We have already created a user, but we can create another one. For example, we can use the username ‘user123@example.com’. Now, let’s execute and see if the user is created successfully. Great, it worked! We can also try the login separately to verify that it is functioning correctly. Now, let’s check out the books. We can request two books and see if they are returned correctly. Perfect, the books are returned as expected. Next, let’s test how to get a book back based on its ID. We can pass the ID and execute the request. The book is found, great! Now, let’s check the user’s orders. Since this is a new user, there are no orders yet. Now, let’s make an order. We already have the book ID stored, so let’s use that and set the quantity to two. The total price should be 1898. Let’s execute the order and check if it is saved correctly. The order is saved successfully, and we can see it in the user’s orders. Now, let’s move on to testing the review controller. We can see that there are seven reviews for the current book. Let’s also check the user’s individual reviews, which should be empty. Now, let’s post a review about the book. We can say it’s a good book and execute the request. The review is posted successfully. We can also check the model validity to ensure that the rating is within the range of one to five. If we try to post a review with a rating of zero or outside the range, it will return an error. Now, let’s post another review and see if it is added. We can also delete the review that we just posted. Finally, we have tested all of our endpoints and everything is working fine. In the next video, we will discuss the lessons learned from this testing process. If you found this helpful, please like, comment, and subscribe. Thank you for watching!

The Power of Generative AI and Real-Time Event Streaming
Older post

The Power of Generative AI and Real-Time Event Streaming

Newer post

Writing the Reviews Controller

Writing the Reviews Controller