Testing

The perils of sharing state when writing tests

Sharing state is always a bad idea. Functional programmers have been using immutability for a long time now, completely avoiding the perils this can bring. For all the others that for one reason or another keep going on with the good ol’ OOP, this is an hard lesson that needs to be learned. And sooner […]

Bad test coverage results? No worries!

Yesterday I stumbled upon an “interesting” bug in the code coverage tool. In case you’re generating it (and I strongly encourage you to), please make sure you’re satisfied with the results. At work by policy we have to ensure at least 70% of test coverage. However in one of my projects I was getting way […]

Testing the boundaries of your Web APIs

How do you make sure an entire software you wrote works? And how would you do that if your system doesn’t have a UI? Well, simply by testing the boundaries of course! From time to time I like to extract pieces of code from what I’m working on and create small repos just to showcase […]

Unit, integration, end-to-end tests: do I need all of them?

Yes. I mean, don’t even think about it. You’ll need all of them, probably in different measures, but there is no “we shipped to production without tests”. Tests are the first rampart separating you from madness and failure. Why madness? Try to do even a small refactoring after you’ve deployed your app. Without automatic tests […]

How to reset the entities state on a Entity Framework Db Context

I had two bad days. Those days wasted chasing a stupid bug. I had a test class with 4 test cases on my infrastructure layer. If executed one by one, they pass. If the whole suite was executed, only the first one was passing. At the end I found out that it was due to […]

Scroll to top