Laravel’s Artisan CLI comes with a plethora of useful commands and functionality out of the box. Unfortunately, there’s one thing it doesn’t come with: an easy way to run different types of tests. On a recent project, our team had a desire to write Artisan commands that could run our tests, so we had one […]
I’ve recently been playing around with Kotlin in my free time, particularly as an alternative to Java for Android development. Figuring out where to start exploring a new language can be difficult, but knowing that Atomic Object practices test-driven development (TDD), I figured that learning to test in Kotlin would be the best option.
I like unit tests. They’re often the best documentation of a project’s behavior. They provide assurance that code modifications haven’t broken anything. But too many or poorly-written tests can have the undesirable effect of cementing code in place, making it more difficult to change. The following are some practical things I keep in mind when […]
As the ecosystem for Elixir matures more and more, there are some libraries that seem particularly promising to me. One of them is Mox, a simple but powerful library for implementing mocks for predefined behaviours (note the British spelling!).
Lately, I’ve been using Sinon.JS for mocking in my unit tests. By using mocks for dependencies inside functions, I can write unit tests that are resilient to a changing codebase. Functions with mocks can also be developed without worrying about the chain of dependencies that could affect the logic inside the functions.
It’s easy to overlook the importance of unit testing. Writing tests can be tedious. They must be updated constantly as code is refactored, and when you have a large code base, you may have to write many tests to even come close to testing all cases. Despite this, unit testing is a necessary part of […]
I remember one of my CS professors at Calvin starting class one day by talking about TDD (Test Driven Development). “Write your tests first, then write the code to make the tests pass,” he said. At that point in my programming career, TDD and unit testing in general just seemed like extra boilerplate code required […]
Unit testing is a great way to help ensure the continuous delivery of working code over a product’s lifecycle. In client-side applications, unit testing data retrieval is especially important since using data from these asynchronous calls is at the core of what most of these apps do. Unfortunately, asynchronous calls aren’t easy to test.