Creating RESTful APIs with Spring Boot is a straightforward process, making it a popular choice for a variety of applications, from UI to batch processing. The same API created can be used anywhere, whether it’s called from a UI application or batch applications. However, testing these APIs to ensure they work correctly can be challenging. In this article, I’ll introduce …
Using Equivalence Class Partition and Boundary Value Analysis while Unit Testing
The value of writing tests for code, especially unit tests, is clearly evident. Testing enhances software quality, improves security, inspires customer satisfaction, and most of all, saves the company money. Catching errors in the development phase before they reach production can save a company thousands.
I wanted to share a couple of the strategies I’ve followed in my career when it comes to writing unit tests. We’ll start with Equivalence Class Partitioning and finish with Boundary Value Analysis. While they are different, they can be used together to help make sure you’re writing the best unit tests you can write.
Unit Testing Using Jasmine Spies
Unit testing is an important part of the development process. It gives us the ability to know that our code is working as intended and can also let us know if we may have broken something that we didn’t even think of.
With the help of Jasmine Spies, we can make our test setup easier, and we can give ourselves more options for what we can test against. Hopefully, this will give you a good starting point for all your Jasmine spying needs!
Comments In Our Code: Necessary or Not?
No matter what your opinion is on comments, one thing is universally true: developers should create code that the next developer can understand.
Sometimes, comments are a safe, simple way to leave the code better than how you found it. Sometimes, extracting sections of code into a well-named method can be an alternative way of doing this, with the added benefit that (a) you can test this method individually and (b) it may help you to spot smells in your code or see places for further refactoring or simplification.
Each situation you encounter will require different treatment, but I hope this post has given you a starting place for creating clean, readable code in your own life!
Using Jest and Testing Library with React Native Part III: Element Not Found
In the last installment (Part II), we walked through creating and executing our very first test. With that out of the way, let’s move on to something slightly more complicated. Elements that cannot be found typically are elements that are initially hidden. In this post, we’ll cover how to test for an element or component that isn’t found.