Regarding
some of the problems we had in automating testing for our rails app, I was reminded of another today: how do we test functionality that requires the user to be logged in?
At first, I tried just setting the required session variables manually, in the setup method. Now, I can't see why that didn't work, and I didn't investigate long enough to find out, because Rachana Parmar, one of our team members, had a brilliant idea: why not just go through the login process? So, she wrote a test helper method that we could call that instantiated the user controller and performed the login action. After that, we had no more problems related to needing to log in to the app to test something.
On another note, I want to explain these short, almost useless postings: Part of the idea here is that I want to learn, and I find that when I write something down, I remember it better. And if I forget, I can always look it up when I know "I've seen this before, but I can't remember how we solved it." So, I find them helpful, and my hope is that someone else will too.
As another aside, for the longest time I didn't write down simple solutions like this and the
previous one about upgrading functionality only for users with Javascript enabled, but the idea came to me when I read Venkat Subramaniam's and Andy Hunt's
Practices of an Agile Developer. It's chock full of great advice, and even though most of it is obvious common sense (or seems that way), I found that I wasn't really doing a lot of the things it suggests. So, I have to give credit where credit is due.
Hey! Why don't you make your life easier and subscribe to the full post
or short blurb RSS feed? I'm so confident you'll love my smelly pasta plate
wisdom that I'm offering a no-strings-attached, lifetime money back guarantee!
Leave a comment
There are no comments for this entry yet.
Leave a comment