From: Vincent Foley Date: 2005-05-10T14:49:22+09:00 Subject: Testing a user application Hi everyone, I recently wrote a small user application called RJournal[1], and for the next release I would love to have much more unit tests than I currently do. However, my problem is that most methods I would like to test have side effects. For example, I have a method called LiveJournalClient#post which, as its name says, posts a new message to LiveJournal. How can I test that this worked without filling up a journal? Similarily, when the application starts, it checks to see if the config file exists; if it does not, it should create it and add the parameters to it: how can I test this if the file already exists? And without nuking everything I already have. Ryan Levengood suggested in another thread that I use mock objects for my testing purposes, but I don't understand clearly how they work. If anyone could actually write a test or two for my application, so that I can see how to do it, I would be very grateful. Vincent. [1] RJournal: http://ljrb.rubyforge.org