3
kleopi
5y

Is it actually required to write unit tests in microservices?
every time i write them it feels like im just redundantly copying a method...
Dont get me wrong, im not against testing, I am using test environments, integration tests and mocks, but unit test seem kinda redundant to me.

Comments
  • 6
    Microservices or other architecture should have no bearing on whether you write unit tests or not. All code written should be unit tested. Even better if TDD.
  • 1
    If you have full coverage with integration tests then I don't think you need unit tests. But usually that's not how integration tests work, right?
  • 1
    Why does writing unit tests have to involve copying a method?

    All that your unit tests should do is ensuring the contract is honoured
  • 2
    Is it always necessary to wear a condom? Feel like I'm just putting one on every time.
  • 2
    Depends on what the service does. If it runs a custom algorithm, test that. If there is SLA, test to make sure it's satisfied. Make sure you get errors where expected so as to avoid unexpected input.
Add Comment