Launching The NoMock Movement

NoMock MovementEverything started when Eve said ‘No‘ when God told her not to eat the fruit. Then my daughter said ‘No‘ when I told her to clean her room. Then we had a bunch of guys saying ‘No‘ to SQL. Then I read Is there such a thing as the NoMock movement?… And today I’m saying let’s launch the NoMock Movement ( ‘No‘ meaning Not Only of course ;o)

Have you ever felt uncomfortable surrounded by a group of people who all agree and you don’t ? Feels strange doesn’t it. You think ‘what’s wrong with me ?‘. That’s exactly what I felt all these years with Unit Testing and Mocking. Everybody was unit testing, everybody was mocking… and I was questioning the relevance of so much mocking. Through my customers’ projects I’ve seen everything from zero test coverage to complex unit tests with more mocks than code to test. But everybody agreed that mocking was the way to go, so I did the same (BTW, thank you Mockito for showing me the way, your framework rocks).

Then in memory databases arrived (but some were still mocking DB access). Then in memory web servers arrived (but some were still mocking HTTP requests). Then Microsoft decided to do a 64 bits OS so we could have more memory. Then in memory containers arrived (but some where still mocking container services). Then Arquillian arrived. So while everybody was mocking I took all these new tools and started to write more and more integration tests, less unit tests and less mocks.

So now I’m officially launching the NoMock Movement (‘Not Only Mocks Movement’). This movement is for people stopping being ashamed of not mocking every single aspect of their code and starting to write more integration tests. Join the movement, don’t be ashamed and repeat after me : Stop mocking, start testing !

What are the concrete actions of this movement ? For now it’s just buying the domain name and pointing it to my own website (isn’t that arrogant !) and then I’ll see what to do with it when I have some free time (a GitHub site where everybody can aggregate resources about integration testing would be good, so you can all contribute). I’ve also created the NoMockMov Twitter account and will use it to promote integration testing (by re-tweeting any useful article/blog/resource).

And now, go back to coding (real code)

References :

Disclaimer : of course I use unit tests and mocks, I’m just saying that today we can also use integration tests.

Disclaimer bis : Take a laugh, not everything in life has to be taken seriously ;o)

12 thoughts on “Launching The NoMock Movement

  1. I’m following! as an Arquillian fan for more than 1 year…

    Suggestion: your logo suggests the “No NoMock” movment 😉

    1. Yesterday Motherfucker Programming
      Today NoMocking Programming
      Tomorrow the Trash Delivery

      One step left for the most reliable Apps ever !

  2. You seem to forget that there’s a lot of people outside that can’t (read: aren’t allowed to) work with the latest shiny tools: Tomcat 5, JDK 5, 3Gigs of RAM and a dual processor….Sadly enough some people still use these tools. 🙁

    However I completely agree, mocks are overused: some people use it as an excuse for badly designing their code.
    Low coupling and high cohesion still seem to be ignored by far too many programmers.
    On the other hand, if you have a lot of mocks in your tests, you have a good excuse to go get a cup of coffee! 😉

  3. Thanks for taking the lead in the fight against the “50 lines of mock setup, 2 lines of testing” code! I certainly have suffered through this too often, too, although I also found it quite useful as a good indicator of “smell” in your design, with too many dependencies/too much coupling going on.

    More seriously: what are your thoughts/what do you use for simulation of external services? For example, when testing code that talks to e.g. a cloud API?

  4. “50 lines of mock setup, 2 lines of testing”, well I feel like mocking is not the issue here: it’s the code you’re trying to test! No one should write 50 lines of mockup in order to do a test. Mine is always ~5 max

    1. C’était une blague pour embêter David Gageot, tu peux le reprendre ;o)

Leave a Reply