I’ve always had the “will” to test my code in Grails, but have had little time to dedicate to writing tests, so at the first sign of difficulty, I’ve abandoned it. Â This is bad. Â I know it’s bad, but sometimes it can’t be helped. Â Part of my difficulties have been due to me trying to get my tests to do something which is not unit testing. Â It’s really easy to think you are writing unit tests when in reality, you are writing poor integration tests. Â One area in particular that I’ve had trouble is with a small app that tracks time, and produces invoices, and recently I’ve had the luxury of being able to revisit the code and make amends for my previous omissions. Â I want to share the revelations I’ve had with you here in the hope that it proves useful to someone.
Continue reading “Testing Acegi Security with mock objects in Grails”