• I can not merge your pull request on our Git.

  • Why?

  • There is only one file modified.

  • That is because we modified only one Java class.

  • That is exactly the problem. I can not see in the pull request the modified JUnit test.

  • I could not modify the unit test because there was no any.

  • I see. And that is a problem of the past. The present problem is that still there is no unit test.

  • But we have no time to write unit test for the whole program. There are zillion of lines of code developed during the last few hundred years. They have no unit tests and they just work.

  • I acknowledge that. That is the life when you maintain legacy code. But why did not you write unit test for the change you just created?

  • There are zillion of lines already…​

  • Yes, those that "work". But your change is new. How do you know that it works?

  • We just agreed that we do not start to write unit tests now. We do ad-hoc testing.

  • Okay. Then let’s just get back to the basics. Why do we have unit tests? What is the primary reason?

  • To have working and tested code.

  • Im my opinion this is more like documentation. Unit test is a live documentation that is more likely to be maintained than any other documenation. You just created a few lines of code without documentation.

  • I get your point, but we just do not have time for that.

  • Let’s look at the following situation. It is summer and hot. You wake up late and want to rush to fetch the bus. You take the shower and drink your coffe and run to the bus. Right?

  • Right.

  • You do not even dress. Run out naked.

  • No! No! I dress!

  • But you have no time. You are in a rush. If you have time to dress yourself why do you let your code run to production without unit tests naked?

  • I get the point. But you can survive without unit tests. If you run on the street naked you will not survive.

  • Why is that? The summer is hot, you will not catch cold.

  • Yeah, but police would catch you.

  • So this is a kind of society issue, is it?

  • Yes, it is.

  • And the coding society is not that matured yet, it lets you run naked without unit tests.

  • I assume…​ yes.

we still have a long way to go ahead of us…​

Comments imported from Wordpress

tvk 2016-05-02 11:57:40

There’s always time for having a conversation about having no time for writing unit tests.

Vasile Boris 2016-05-17 14:22:30

There are projects were the clients do not want to pay for unit tests. I did not worked in such a project but I heard that it is a common practice. I heard that they explain that they will do the testing so there is not need to also unit test it.

tamasrev 2016-05-02 09:00:15

So, we walk on the street naked because everybody else does. Thus we have lots of code out there that "works" :)

Stefan Reich 2016-05-02 09:20:42

So you’re the "police" kind of guy. I think that’s why my algorithms are better than yours.

Peter Verhas 2016-05-17 14:31:15

There are car owners, who do not bring their car to service. They explain that they do brake regularly so they will know when there is some problem with the brakes, so there is no need for the service testing the brakes.

matopeter 2016-11-06 09:29:29

And…​ They will ;D

Kemény András 2016-11-06 10:16:38

ah, come on peter, you know unit testing is for wussies. anything you can test by unit testing is so simple it’s actually embarrassing you have to test it. anyway, any code that is so divided that all its pieces can be unit-tested separately is guaranteed to be a shameless resource hog.

now, integration tests…​ that’s where the point is. alas, they are almost as complicated as (and in most cases, actually MORE complicated than) the software they’re testing. the systems i code would humongously benefit from integration tests as they tend to have a lot of simple parts interconnected in very, hm, exciting ways.

but most of the clients are, "nah, we’ll fix any errors that pop up in the production run." actually, unless you’re stupid enough to code bugs that cause actual unfixable data corruption or hard cash losses, then, with a bit of a devotion to fixing errors, it’s a viable option.

Kemény András 2016-11-06 10:17:07

are you a car owner, peter? :)

Java Testing Weekly 19 / 2016 2020-07-10 20:57:18

[…] Code Naked is an entertaining blog post that describes the discussion of two developers. The first developer tries to explain to the second developer why he cannot marge the pull request made by the second developers because it has no automated tests. Unfortunately, the second developer doesn’t seem to get it. […]


Comments

Please leave your comments using Disqus, or just press one of the happy faces. If for any reason you do not want to leave a comment here, you can still create a Github ticket.