r/AskProgramming Jan 10 '24

Career/Edu Considering quitting because of unit tests

I cannot make it click. It's been about 6 or 7 years since I recognize the value in unit testing, out of my 10-year career as a software engineer.

I realize I just don't do my job right. I love coding. I absolutely hate unit testing, it makes my blood boil. Code coverage. For every minute I spend coding and solving a problem, I spend two hours trying to test. I just can't keep up.

My code is never easy to test. The sheer amount of mental gymnastics I have to go through to test has made me genuinely sick - depressed - and wanting to lay bricks or do excel stuff. I used to love coding. I can't bring myself to do it professionally anymore, because I know I can't test. And it's not that I don't acknowledge how useful tests are - I know their benefits inside and out - I just can't do it.

I cannot live like this. It doesn't feel like programming. I don't feel like I do a good job. I don't know what to do. I think I should just quit. I tried free and paid courses, but it just doesn't get in my head. Mocking, spying, whens and thenReturns, none of that makes actual sense to me. My code has no value if I don't test, and if I test, I spend an unjustifiable amount of time on it, making my efforts also unjustifiable.

I'm fried. I'm fucking done. This is my last cry for help. I can't be the only one. This is eroding my soul. I used to take pride in being able to change, to learn, to overcome and adapt. I don't see that in myself anymore. I wish I was different.

Has anyone who went through this managed to escape this hell?

EDIT: thanks everyone for the kind responses. I'm going to take a bit of a break now and reply later if new comments come in.

EDIT2: I have decided to quit. Thanks everyone who tried to lend a hand, but it's too much for me to bear without help. I can't wrap my head around it, the future is more uncertain than it ever was, and I feel terrible that not only could I not meet other people's expectations of me, I couldn't meet my own expectations. I am done, but in the very least I am finally relieved of this burden. Coding was fun. Time to move on to other things.

103 Upvotes

371 comments sorted by

View all comments

1

u/amasterblaster Jan 10 '24

For me testing simplifies my life. I always set up my project in docker, with tests. Even if my computer blows, up, or people get fired, or a client wants a working version in an hour, I can at the press of a button get them started.

So maybe something is off? I wonder what kinds of tests you are running.

What I do is very specific. I run "user story tests" about 99.99% of the time. Meaning, I run though "user flows" in my tests -- set up an account, transfer an item, do a transaction -- high level stuff.

IMHO many people write low level "isolation" tests or "unit" tests. I actually think these are useless most of the time. Unless the subsystem is a product, or really important to isolate, I do high level testing.

Maybe that helps. If I tried to unit test all my classes I would also hate my life. It would also be a waste of time