Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I find unit tests great in theory - I just lack knowledge how to handle ui-heavy or interop code (most of my code is used in an addin context, using interop classes from a big library)
How do you guys do it? -
LMagnus20638yUnit tests are a must in my opinion, especially when working with large applications. If done properly they can quickly identify any bugs in your code and are great for faster regression tests.
If you're going to use them then you need to write unit testable code using abstraction where necessary, otherwise you'll find them a nightmare. -
LMagnus20638yYes interfaces where appropriate. Separating your data access layer, keeping to SOLID principles etc. All make writing unit tests easier and faster.
And if unit tests are easy and fast you're more likely to do them and see the benefits. -
If you have time, sure. But for me, I'm usually on such a tight deadline that I can't afford to spend the time making tests for everything. (Even realizing it might save me time, later.) How do other devs cope?
-
donuts238488y@fortyseven yea I'm seeing that as well... I don't cope well... all those PROD issues.... if only they tested before releasing. Magic doesn't work for us.
-
volaski748yAs someone who used to be a passionate unit test hater (probably hated it more than all of you guys on this thread combined and thought it was for people who have nothing better to do), but now working on an open source project that involves a lot of complex logic, here's my take:
I started writing tests when the amount of pain I get from not writing tests exceeded the amount of anger and pain I got from having to write tests. I still personally think people who write tests for web UIs are doing it wrong, but when you have a super complex logic, and you don't write tests, you will soon realize you're better off just writing tests.
Also tests have been effective for open sourcing. Because a lot of people just send pull requests without testing shit themselves so I have to go through and do all their work myself, whereas if I had written tests their PR will fail immediately and I don't even have to waste my time.
Bottom line: Only write tests when you start feeling the pain.
So what does everyone think about unit tests, do you do it?
My own experience is I've seen people on my current team disable failing tests...
undefined