Unit Tests are BANNED here!
You tried to introduce unit testing at work, but it didn't go well. The team is against what you're doing. What happens now?
👋 Hello, this is Valentina with the free edition of the Optivem Journal. I help Engineering Leaders & Senior Software Developers apply TDD in Legacy Code. To get these articles in your inbox every week, subscribe:
You wrote Unit Tests. The team was angry!
You read about Clean Code & Unit Testing, and tried to introduce it at work. The whole team turned against you.
The team is against unit tests:
“Why are you adding unit tests! They are such a waste of time. We tried writing unit tests, but as we change the design of our code, they keep on breaking. They are useless and such a waste of time!”
They didn’t like the interfaces you were putting in:
“Why are you putting that interface, and splitting the business logic from the database. Now you’ve made 3 files instead of one, we now have to separately open the interface and the database. This level of indirection is so hard for us. We prefer it when it’s all together, in one file.”
Some of them are senior developers, with 20 years experience, who are citing DHH about “test-induced design damage”.
They don’t want to change
They’re getting really annoyed now - with unit tests you introduced decoupled design. Those 20-year experienced seniors are frustrated because now it would force them to completely change the way they write code. And they don’t want to change the way they work.
If you fight, you’ll lose
If you go against them, you’ll lose. No amount of reasoning will do, because of office politics. They’re seen as the only ones who are “experienced” in maintaining the Big Ball of Mud project.
And you’ll lose your reputation. They’ll say you’re not a team player, that you’re not aligned with the rest of the them.
Lastly, you’ll lose your nerves.
Instead, invest in yourself
If you can’t change them, and they won’t let you write unit tests because unit tests result in a decoupled design… do you then just give up?
No. Don’t give up.
Read, read, read. Knowledge starts with books. For example TDD by Example, Unit Testing Principles, Practices, and Patterns, Continuous Delivery, Hexagonal Architecture Explained, Clean Architecture, Domain Driven Design, Implementing Domain Driven Design, Working Effectively with Legacy Code
Join software craftsmanship meetup groups and meet like-minded developers that you’d never meet otherwise. Join Tech Excellence Meetups (which I initiated to raise the bar of excellence across the world). Meetups are a great place for networking.
But, theory is not enough. You need to practice.
Invest in your skillsets, because no one else will.
As you learn stuff, you need to practice it. Years ago, back when I was a developer, I faced a lot of resistance from colleagues who didn’t want unit testing, who thought it was useless… so I had to learn on my own, I had no mentor.
So in my own time after work, I created GitHub projects - where I tried to apply what I learnt from books, I made mistakes, iterated, etc.
Make your own GitHub Project
I’m a huge advocate of project-based learning. Don’t just read; instead, apply it—even on a personal project! It’s much better to apply it on a personal project first before even attempting to try it on a real-life project.
Making my own GitHub project helped me so much. Even though I was working in companies who were against quality practices, I invested in myself in my own time, and later, when I got a Team Lead position in a new company, I was ready to implement these practices in real life projects. All that was possible because I had previously practiced by myself on my personal GitHub project outside of work.
As you can tell, I’m a huge fan of making your own GitHub project to invest in your skillsets. This is why in the TDD in Legacy Code series, I added Sandbox Project Tasks so that you can try out the skills on your GitHub project.
That’s the path that helped me grow as a Senior Developer, later as a Team Lead, as an Architect, and finally a Technical Coach. I want to help you on this journey. 💪
Want to apply TDD in practice?
You tried TDD, but it didn’t work. That's why I'm going to help you practice TDD step-by-step. Apply TDD on a sandbox project. Access TDD in Legacy Code.
This is a very tough situation - how can you find a company to work for - one that genuinely upholds best practices?
The following are few questions from some of our managers:
1) What data do you have to prove that the team needs TDD?
2) How do we know if the team members are following test first or test after?
3) What are the baseline measures now and what measures prove that they reaching the target state?
Any advise on this would be appreciated! Thanks in advance!
Murali