About Unit Testing
As we move more and more into using continuous delivery we need to start getting better at building tests. Test Driven Development (TDD) was a trend and for a long time was the new hot, it's now been replaced by DevOps as the new trend but TDD is now more important then ever before and is a massive requirement to having a good DevOps practice.
I have a number of projects some of which I am the solo developer and I don't have a QA team to dump a load of work on so having good repeatable tests is important. It's also important to wire these tests into a CI / CD pipeline and I'm going to share how I do it, also I'm going to explore other tools and look into what I find and how can we use it. As a Solo Developer and as a team.
Test Driven Development
At it's very core TDD was all about building your test cases before or even as you develop but if you did it after no one would know unless you tell them.
As a developer it was a tool in our tool belt that allowed us to build software that we would know would just work. It makes it easy to expand and take change requests and build onto the base of the software because we can run these tests that would tell us when we break something and we always do.
About unit testing
Unit Testing is the basic part of testing. I found this definition online
Unit testing is a software development process in which the smallest testable parts of an application, called units, are individually and independently scrutinized for proper operation. Unit testing can be done manually but is often automated.
It sums it up right. Unit testing is taking your application and testing different parts of it to make sure they work. Then joining all the parts to the flow of your application and testing that.
We've all been there, one part of our application fails and we spend hours debugging the whole application only to not find it.
Unit testing helps in this it gives us the ability to test the components individually and then as a whole application and it's all AUTOMATED!
Unit Testing Frameworks
The cool part is these frameworks are free - at least I've yet to find a unit testing framework that is priced.
.NET Frameworks
For .net I've found 3.
I mostly use Nunit when I am working in .NET it's quick and easy to build tests and I've been using it for years.
At the time of writing I haven't really started using XUnit but I plan on changing that I hear alot of good things about it.
Javascript
As with anything Javascript there are a few, but these 3 stand out as ones I want to try.
I'll admit at time of writing this, I've tried these with mixed results but I'm going to get down to them and do some more of a side by side with them for a later project. Karma and Protractor come from the Angular Team so might be something worth looking into more.
Ruby On Rails
Ruby on Rails is setup for testing, a bit like .NET has a built in testing.
Python
I don't do alot of python work but it has unit testing.
So Go Test!