72
donuts
8y

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...

Comments
  • 1
    Fuck unit tests!
  • 1
    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?
  • 1
    Just go with TDD. It does magic with your code ☺
  • 1
    Unit 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.
  • 0
    Duck Yeah!
  • 0
    @LynxMagnus what do you men by abstractions? Interfaces/mocks?
  • 1
    Fuck unit tests. I just test the shit by hand xD
  • 1
    Yes 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.
  • 1
    BDD all the way! #RubyonRails
  • 2
    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?
  • 0
    @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.
  • 1
    As 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.
Add Comment