A dear friend is a neuropsychologist. She has a zillion interesting brain factoids but one relevant one is the allure of the "inconsistent reward".
My paraphrased essence is that we are drawn to situations where there is the possibility of a reward. It has to be Goldilocks: never being rewarded is daunting; being rewarded too easily is boring. This phenomenon explains computer games, gambling, ...
And unit-testing, IMO. I have said before that unit-testing is fun: "like getting a row of limes on the Turing Slot Machine. It is an electrochemical buzz, broadcasting to our dopamine receptors." Personally, I find a palpable tension while the tests are running, just before the outcome.
A thought for a Friday: Maybe the Java IDE's should represent JUnit results as the spinners on a mini slot-machine? "Big money, no whammies...."