Whether you’re new to software development or have been around for awhile, you may have heard of TDD, but have never really gotten a full explanation of the process and benefits of adoption. The purpose of this post is to give you a quick introduction to TDD and hopefully pique your interest if you don’t already have TDD in your arsenal of tools.
So what is TDD? To put it simply,
TDD (Test Driven Development) is a methodology of developing software
that relies on very short feedback loops using unit tests.
To practice TDD, start with a failing unit test…
In my previous post, Angular Component Class Tests, I shared why I prefer to write my Angular unit tests exclusively as component class tests. In this post, I want to share a simple function I use to create typed stubs.
In my previous post, you’ll notice I had to cast my dependencies to the Typescript
any type in order to inject them into the constructor. Here’s that example again:
Now, I could have easily used the real type of my service dependency and simply stubbed all of its methods. That is easy enough if your dependency only has a…
When testing Angular components, I almost exclusively use component class tests. These are tests that do not use the TestBed and allow you to test a component the same way you would test a service.
The main reason I prefer component class tests is that they are much easier to write than using the TestBed. They don’t require you to setup a test module. Simply call the constructor of the class under test and you’re ready to go! Does your component depend on some services? Simply create stub functions or Jasmine spies and inject them into the constructor in a…
ngModel in child components inside a parent component with a
form element will not be added to that form’s
controls array. This post shows one solution to this problem.
At work, we recently came up against an interesting problem using child components in parent form components. I imagine many more teams will encounter this issue, so I’m writing this article to share the solution we found.
Our project is a typical business application comprised mostly of forms. Validation is handled primarily by the server and invalid submissions are returned as HTTP Bad Requests with a model state object…
It’s a wonderful time to be a software developer. The opportunities are abundant and the languages, frameworks, and tooling we use to do our jobs are amazing thanks in large part to our collaborative efforts in the open source world.
One negative aspect I see of this proliferation of excellent libraries and frameworks is the consumer mindset it can bring forth in developers. I think we all struggle with it, and my own struggles in this area are what inspired me to write this post.
The point of this post is not to divide all developers into either “engineer” or…
Software Developer from Omaha, NE.