We all know that rubber duck is programmer's best friend (it was also proven that such duck should be yellow for maximum effect). Not surprisingly I have also a yellow toy on my desk. But it is not a duck. It is a little yellow human-like figure.
This is a short story of a bad "refactor" of test code. In Poland we say, that "dobrymi chęciami piekło brukowano", which basically means, that trying to do something good can lead to really bad results. Well, I tried to do something good and I failed. Let us take a closer look.
Few days ago I learned a very simple, yet powerful trick which saved me some time. To make long story short, it happened on a test environment shared between few projects.
From time to time it is good to see what are the latest versions of the libraries you use (because maybe you would like to upgrade). With Maven you can use the Versions Maven Plugin, but you will get better results if you add a simple bash script. Let me show you how.
Recently I have used Google Guava
EventBus in one of my projects. It worked pretty well but testing it was kind of a challenge.
If you are not familiar with the
EventBus you can learn more about it here.
It amazes me how many great tools you can find on the web! In this post I describe 4 of them. I hope you find them useful.
Sooner or later your CI server will became very busy, and your frustration will grow because of increasing wait time for each build. One thing you can do to improve the situation is to avoid running jobs when there is no need to do so.
I use Jenkins + Maven + SVN in this example, but you can use this "tricks" also when using different technologies - Gradle, Git etc.
When discussing unit tests it often happen that I hear that "unit testing is about testing methods". I do not agree, and because this is something which surfaces here and there so I think the idea deserves a comment.
Oh, a failed test again! And not on your local machine but on the CI server! What to do, oh, what to do?!
Should you put comments in your tests code? Yes? No? Why?