Given that unit testing improves the quality of code and software in the long run, I would say that, yes, it is good practice for your developers to provide unit tests - whether it be part of a sprint or not.
Two main obstacles to unit tests that I have seen:
- developers do not understand: "why do we need to write more code for testing?"
- "we don’t have time to write unit tests"
To answer the first question, you will need to provide some kind of demonstration / formation, I suppose; if you can get developers to understand why unit tests are useful, they will like them and use / develop them; but they need to understand why they are useful: if you are not their boss, you cannot force people to develop unit tests.
And, even if you are their boss, they probably won’t do the best job if they are forced to: unit testing is often done better if people understand why and how!
To answer the second question ... Well, you obviously need your developers to get "special" time for developing unit tests; this may mean less time for manual testing, by the way.
Another thing: it is difficult to find out “what to check” and “how to test”: you will need to explain / demonstrate it to your colleagues: some things cannot be tested, some things do not need to be, and some things are not “checked per unit” - well, I suppose if you are not very well designed ^^
Pascal martin
source share