Avoiding Test-Driven Development?

Ryan LaRue Dev Methodologies, Testing Leave a Comment

Throughout time, there have been certain questions that will always result in great battles. In one recent throw down, I drew my line in the sand and bravely asserted, “Hell no, a hotdog is not a sandwich!”

There are other more dangerous questions that we’ve all heard, of course… is Mac better than PC? Is Android better than iPhone? Are dogs better than cats? That last question is the silliest of all as the correct answer is so very obvious. Regardless, these intriguing questions have often led to disastrous consequences such as sulking and hurt feelings.

Allow me to add another one to the list: Is Test-Driven Development (TDD) a good practice?

I know, provocative. In this blog, I will discuss test-driven development, why many in our field seem to hate it, and why you should choose to still implement some of its main concepts in your development….

Getting Started with Marble Testing

Todd Leininger Testing, Tutorial Leave a Comment

When working with RxJS observables, it can get a little tricky to unit test. Sometimes it can be hard to get insight into what is going on with the observable in the test. I’ve personally been frustrated numerous times by trying to test my observables with the subscribe and assert method. This is where marble testing can make testing observables easier.

The main advantage of using marble testing is the marble diagrams. With the diagrams, we have a visual representation of our observables and subscriptions so we can see the interactions between the two. Once the basics are understood, you should be able to get observable tests running in no time.

In this post, I will show you how to get started using Marble testing with an example. By the end, you should have enough information to get started on your journey testing observables. My examples are based on an Angular application using Jasmine, but these can also be applied to different testing frameworks for React and other applications.

Spring Batch Testing & Mocking Revisited with Spring Boot

Jonny Hackett Development Technology, Java, Spring, Spring Batch, Spring Boot, Testing Leave a Comment

Several years ago, 2012 to be precise, I wrote an article on an approach to unit testing Spring Batch Jobs. My editors tell me that I still get new readers of the post every day, so it is time to revisit and update the approach to a more modern standard.

The approach used in the original post was purely testing the individual pieces containing any business logic. Back then, we didn’t have some of the mocking capabilities that we have today, so I went with an approach that made sense at the time.

However, there have been a few improvements in the past several years. One of those improvements has been the ability to Mock beans within a Spring Context. That’s where the @MockBean annotation comes to the rescue.

What’s New in JUnit 5.2

Billy Korando Development Technology, Effective Automated Testing With Spring Series, Java, Testing Leave a Comment

The JUnit team continues to make great progress in adding new features and enhancements to the JUnit 5 framework. We already have a second significant feature update after just seven months from the initial release of JUnit 5.

In this article, we look at some of the key features and enhancements added in JUnit 5.2 which was released on April 29th. We’ll focus on build tool enhancements that help in the adoption/migration to JUnit 5 for existing test suites and resolve annoyances, as well as what new changes further improve parameterized tests.

Why Am I Writing This Test?

Billy Korando Development Technology, Effective Automated Testing With Spring Series, Testing Leave a Comment

… The highlight of this episode for me was when Dan laid out the three major concerns of automated tests. I hadn’t previously heard all the major purposes for automated testing laid out in such a succinct fashion. They are paraphrased:

Using Tests to Specify the Requirements of the System
Using Tests to Document the System
Using Tests to Build Confidence in the System

With purpose in mind, it is good practice for both developers and automated testers to ask themselves the following questions when writing a test: Why am I writing this test? Am I specifying system requirements? Documenting system behavior? Building confidence in the system? I’m a firm believer that asking the right questions when writing tests can lead to a better design for individual tests, in addition to more coherent and effective automated test suites.

In this article, we look into the three major purposes for writing automated unit tests. We discuss how they should be approached and what developers and automated testers can do right now to establish better, more purposeful, practices.