Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Forcing Unit Testing on Developers

First a little background. The company I work for writes web based software that is a hosted solution for our customers (ie ASP (Application Service Provider)). We are adopting agile practices such as Scrum and we execute sprints to build new features for our product.

I am a proponent of TDD (Test Driven Design), and as a part of what I deliver in a sprint I always write tests and I always get them integrated with the build (ie ccnet); however the other developers do not follow this practice and it is not enforced.

Is it a good practice to force a development group into providing unit tests as a part of what is delivered in a sprint?

like image 610
Michael Mann Avatar asked Aug 23 '09 17:08

Michael Mann


People also ask

Is unit testing done by developers?

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. This testing methodology is done during the development process by the software developers and sometimes QA staff.

Why testing should not be done by developers?

Many developers hate testing because they think it's boring, repetitive, and too complicated. They also don't understand how all the parts of the application work together.

Should developers be responsible for testing?

Testing should be a shared responsibility and should be seen as the natural progression from development, rather than an add-on responsibility. A good developer knows the basics of testing and can do some of the things that a tester does.

Should developers write their own unit tests?

Developers should write unit tests for their own code. Both the code and unit tests will then in the future be updated by other developers as features changes and bugs are discovered depending on resource availability. Not trusting juniors with real features is not the best way to manage projects.


1 Answers

Unless you are a position of authority, the best thing you can do is to convince them of the value of the test suite.

It's very difficult to get developers to see the light on this issue if they aren't seeing it done right.

Try to pair with another developer and show them the benefits and the clarity that comes from writing the tests FIRST. If you don't do this, they are likely to write all of their code, get it working, and then write tests. So, from their point of view, it will feel like simply an extra task that doesn't help them get things done.

Also keep in mind that people often do not understand how to write good tests. Even more, some do not know how to make use of tools like jmock, which can lead to them getting stuck and giving up on writing a test.

like image 59
TM. Avatar answered Oct 21 '22 05:10

TM.