TDD on freelance projects

In this chapter, I've selected the concept of test-driven development (TDD) as a measurement of project quality for one key reason. Every time that I've been handed a messy legacy project to work on, there is always one common characteristic that they share:

The code doesn't have a comprehensive test suite.

On the other hand, whenever I start working on a high-quality application I've discovered that these projects pretty much always have solid test coverage.

So, I'm not saying that a full test suite is required for a project to be considered a high-quality product. However, in my experience tests seem to be a key indicator that determines how well an application was built.

Making the decision

When you are embarking on a new project how should you decide if you should use TDD?

Giving no choice

I know plenty of developers who simply do not give clients a choice in the matter. All the code that they write will be tested, period and full stop. This helps make the decision process more straightforward. This is the approach I take now, but that's only because I now have the ability to be more picky when it comes to the clients I take on.

However, if you are new to freelancing and you need clients, it can be difficult to tell a client that a project will be around double the time and cost. If you don't have a strong set of pre-existence, you may find yourself in a situation where you price yourself out of the market.

Letting the client decide

Alternatively, you can let the client decide on what approach they want you to take. In this situation, you propose the pros and cons to building a full test suite compared with only building the application itself. If you have an intelligent client they will most likely see the benefits of including tests and choose for the pricier option.

This is an effective strategy because it allows for you to bring the client into the decision-making process, which will make them feel involved in the work. And if the client is still looking at other freelancers, this approach may help win him over.

Another benefit to letting the client decide is that his response may give you insight into how he thinks. If he acts like tests are a pointless luxury and says that he simply cares about getting the project complete, he might be a nightmare client. And in cases like that you are better off moving onto more informed people to work for.

Using common sense

Lastly, make sure that you're using common sense. Imagine being asked to build out a simple corporate website. In cases like this you only need to write some basic tests. At the most this should only add an hour or so to the project.

There is no need to bog down the process writing tests that verify that every CSS class and ID are shown on the page. As with most concepts in freelancing and life, common sense is one of your greatest tools.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.141.6