r/developersIndia • u/chillgoza001 • May 10 '25
General Conundrum of bad engineering managers and unit test cases.
Might be an unpopular opinion but if your engineering manager/lead 's only idea of process improvement or quality assurance is to start writing unit test cases, please know that they don't know jack about engineering, do not properly understand software development and are just holding the title because of number of years of experience!
I've been in the industry for more than a decade; have worked with ems with experience in the range 6-32yoe, and I am now of the opinion that apart from the common utility methods and apis, writing unit test cases is a massive waste of resources. Although it's not just me; all the "serious" senior engineers and architects I've met and worked with over the years share the same thoughts. Lines of code written for unit test cases and test covergage metrics look good as bullet points in ppts. That's why the managers who don't understand the product and the way development processes, but still want to masquerade as a knowledgeable think-tank, almost always suggest writing unit test cases as some sort of magical process improvement.
•
u/AutoModerator May 10 '25
It's possible your query is not unique, use
site:reddit.com/r/developersindia KEYWORDSon search engines to search posts from developersIndia. You can also use reddit search directly.Recent Announcements
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
55
u/Funny_Detail_7295 May 10 '25
Unit test case is the first shield against a code regression i.e if a new person joins your team, has limited context, and checks in a pull request. If he hasn't thought the changes through, a unit test failure will shield you from a prod failure. Some of these changes can look harmless to reviewers, if the code has enough complexity. Idk how you have reached a conclusion that UT's are useless
13
u/shiv23072003 May 10 '25
So what are the methods that you suggest excluding writing unit tests ??
9
u/praveeja May 10 '25
When the feature is implemented for the first time , the unit test doesn't provide any real benefits. But A well written unit test will catch bugs during subsequent feature enhancements done to the code.
4
u/[deleted] May 10 '25 edited May 11 '25
I disagree respectfully whether whom so ever you worked with, and are not in agreement for unit/integration tests, means they don’t know what are they really meant for in the first place. Secondly, most successful projects such as CNCF projects are well covered with tests written otherwise they wouldn’t have reached to a level where people who don’t believe in writing tests use them blindly.
Writing tests is an art and a widely misunderstood topic in the context of software engineering. Especially in country like India, all levels of development are totally centric on delivering quick with almost mediocre quality and the code always get harder and harder to maintain.
Starting with basics, the each tool that you use for development are using tests to deliver utmost quality, so your development environment/experience is always hassle free.
Examples: NodeJS, Sprint Boot, Frameworks such as NestJS, NextJS, Magento, Wordpress, etc. What ever the mature project is out there, even the tiniest of npm packages such as dayjs or the hell like webpack all of them use it. Just check their repos.
At the end of the day, there’s no shame in not writing tests, but encouraging they don’t matter and your work circle also don’t believe in writing tests doesn’t mean literally sh*t.
Your opinion could’ve mattered if you would have used tests and when you had not written tests and then speculating upon differences and difficulties. But, boasting negatively about something that you haven’t even given a shot is actually a sign of bad developer who is always kind of short sighted of engineering processes. In the end devs like these get under radars of EMs/leads/etc.
The whole objective of writing tests is to have sane code, i.e one should know how it behaves on what situations. It’s an entry point for maintainable code in the most efficient way possible. It allows other to understand your code better and even easier it becomes for them to make changes in your code. Allows others to priorly detect what is broke by their changes before the code goes to prod. There are countless benefits but one cannot understand them until he/she practices it.
Bonus: The missiles that rn India is using, the missile interceptors, the mars rover, etc. All of these things are actually using code that is well covered with tests. Even this platform Reddit, would’ve been a disaster every now and then if it wasn’t covered with tests written.
3
u/[deleted] May 10 '25
I agree with the engineering manager part but your opinion on unit tests is just plain wrong, unit tests are as important as any other piece of software engineering, of course if you are writing it to satisfy code coverage on your PR, then it’s the fault in the engineering culture, not in the purpose of unit tests, few years back I worked in a massive MES ERP system, multi tenant and thousands of configurations and so complex logic around production planning and all, and trust me without unit tests, the development would never be good enough to reach QA, forget UAT or Production.
2
u/[deleted] May 10 '25
No unit test ? Dude 10 year nice
2
u/Soft-Elephant7278 May 10 '25
Two points from my side here to strongly support writing unit tests-
4
u/Gugu_gaga10 Software Engineer May 10 '25
I thought people did test driven development 🥲. Am I the only one to do this ? tf ?
7
u/xyraxes Full-Stack Developer May 10 '25
What's your logic and thought process to reach this conclusion?
6
u/Sanyasi091 May 10 '25
Unit tests are important.
2
u/[deleted] May 11 '25
Having 10 years of experience doesn't make you an expert.
Saying stupid things like writing unit test is a waste of resources 😂😂😂😂.
Guys don't listen to him and his stupid advice.
He has most probably never written maintainable code in his life.
3
u/Normal_Heron_5640 May 10 '25
Something new to 'learn' everyday
2
u/mallumanoos May 10 '25
One good thing about software is absolute objectivity ..You think unit tests are not important , then easily it can be proven by lack of defects in test cycles.
2
u/Best_Ad_3595 May 10 '25
What would you consider a good manager as opposed to what you’ve written
1
u/pal_lab May 11 '25
good engineering teams / engineers knows the importance of unit test cases, I hope you have heard about TDD, it came into picture to save resources, so that dev can think of negative scenarios firsthand and then write code, writing unit test case gives perspective of the errors which can be handled, which reduce the burden on QA teams, also QA can fully focus on automation, when you work on large code base with very complex logic it is not possible for qa's to check each and every permutations of scenarios that's when you need good UT's and good automation, I have experienced it's very challenging to understand a code base when that code is running from 15 to 20 years with customers using it differently , business logics changed numerous times, do you think it will be easy to manage such systems without UT's , we have the concept of the Test pyramid, which also say that UT's should be the base of all the other testing, definitely UT's are just not mere mocking and writing stubs , a good well thought unit test are always going to keep yourself sane
1
u/call-me-sage47 May 11 '25
That depends on the complexity of the system. If it is simple than the end to end qa test can cover most of the use cases but if it is huge and complex the unit tests are necessary otherwise it will be very difficult to change any existing functionality. Also, when you make some changes in the system (bug fix or feature update) it will be very difficult to wait for the change to happen on the automation change or even imposible (they are dependent on dev done), but unit test can be modified easily. Unit tests gives you the flexibility but they can be overwhelming sometimes specialy in a small /simple project. A project which takes more than a year to develop must have unit tests.
0
u/prateekm2995 May 10 '25
Unit tests only catch known bugs.
1
u/amrullah_az Software Engineer May 10 '25
Unit tests work when the person writing them knows inductive reasoning in logic. Unfortunately, throughout the education, we only get to strengthen our deductive reasoning (through euclidean geometry).
My advice is, first search "wireless philosophy critical thinking Playlist" on youtube. Once you have watched that, comment here. I'll explain how unit tests work and what value they add.
0
u/Hour_Part8530 May 11 '25
Looks like you and most of your engineering managers never worked on a codebase of size > 5 million lines or older than 5 years.
One reason I and my mentors wrote unit tests are to improve the design. Testable code leads to more modular and loosely coupled design. If your method is doing way too much than it is supposed to do, writing unit test becomes hard, so you have to refactor the method to make it SOLID.
May be they are useless for the first iteration of development. Once your project enters into maintenance mode and changes multiple hands, unit tests keep developers sane and stress free.
0
u/[deleted] May 10 '25
[deleted] — view deleted comment
0
u/[deleted] May 10 '25
[deleted] — view deleted comment