I’ve started going through my Hellbound project and replacing some of the mocks I’ve been using in JBehave with real code.
This means, of course, that the functional tests which relied on the mocks for verification don’t do anything any more. In fact, the only way to test that Hellbound is working is by looking at the front-end.
I guess this is why packages like JFCUnit and Abbot were developed; to allow testers to get hold of the application guis and automate the tests. The only way to test a client-side application is by looking at the gui (or by checking output files, I guess). But by and large if the screen looks right, and the users can’t tell the difference between a back end made up of persistence layers and databases and J2EE technology, and a bunch of monkeys running round with bananas into which the data has been carefully etched, then it doesn’t really matter what the back-end is.
Hellbound is a game, so the users are happy if the game lets them play it. The system I’m actually being paid to produce is a retail till application, so the users are happy if they can sell things, and people are happy if they can buy things.
So really, the only way to test if your system works is if people are happy.
There are other ways to make people happy. I’m convinced that the secret of happiness, particularly in the kind of culture which permits retail till applications, is to look at what you’ve got and not at what everyone else has; to stop being jealous of success and wealth and start appreciating your own. So all I really need to do is convince the whole of western civilisation that there’s a better way, then it won’t really matter if my code works or not.
I have a sneaking suspicion that it might be easier to learn to write functional tests properly.