We're working on a large product which has been in production for about 5 years. The codebase is.. erm.. working. Not really well but it is working. New features are thrown into production and tested with a small QA. Bugs are fixed, etc. But no one, except me, is writing unit-tests. No one uses the power of "tracking" down bugs by writing unit tests to ensure this special bug (test case) would never, ever occur again.
I've talked to management. I've talked to developers. I've talked to everyone in the whole company. Everybody says: "Yep, we must write more unit-tests!" That was about a year ago. Since then I have forced introduction of pre-commit code review (Gerrit) and continuous integration (Jenkins).
I held some meetings about unit-tests and I also showed the benefits of writing unit-tests. But no one seems to be interested.
Q1: How do I motivate my fellow co-workers to write unit-tests?
Q2: How do I stay motivated to follow my personal code quality standards? (Sometimes it' s really frustrating!)
PS: Some frustrating facts (reached in 1 year):
- Total unit-tests: 1693
- Total "example unit-tests": around 50
- Done by me: 1521
Edit: Am I expecting too much? Its my first working place and I'm trying to do my best.
Edit 2: Based upon all answers I've made a small checklist for myself. I've talked to two developer in private and we had a good and honest talk.
One of them told me, like Telastyn said, that he is really uncomfortable with unit-tests. He said that he would like to be "more professional" but he needs a kickstart. He also said that our unit-test meeting with all developers (around 9-11) was good, but it was too crowdy. Meh. Some critics for me, but I'll learn from that. (see answers below concering tdd kata meetings!)
The other one said that he is not interested in writing unit-tests. He thinks that his work is good enough for his salary. He don't want to put more effort in. I was quite speechless. Typical 9-5 "worker".
Next week I'm going to talk to the other developers.
Thanks for your great answers (so far!) and your support. I really appreciate it! I'ved learned a lot, thank you very much!