My Secret Life as a Spaghetti Coder
home | about | contact | privacy statement
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!


Comments
Leave a comment

There are no comments for this entry yet.

Leave a comment

Leave this field empty
Your Name
Email (not displayed, more info?)
Website

Comment:

Subcribe to this comment thread
Remember my details
Google
Web CodeOdor.com

Me
Picture of me

Topics
.NET (19)
AI/Machine Learning (14)
Answers To 100 Interview Questions (10)
Bioinformatics (2)
Business (1)
C and Cplusplus (6)
cfrails (22)
ColdFusion (78)
Customer Relations (15)
Databases (3)
DRY (18)
DSLs (11)
Future Tech (5)
Games (5)
Groovy/Grails (8)
Hardware (1)
IDEs (9)
Java (38)
JavaScript (4)
Linux (2)
Lisp (1)
Mac OS (4)
Management (15)
MediaServerX (1)
Miscellany (76)
OOAD (37)
Productivity (11)
Programming (168)
Programming Quotables (9)
Rails (31)
Ruby (67)
Save Your Job (58)
scriptaGulous (4)
Software Development Process (23)
TDD (41)
TDDing xorblog (6)
Tools (5)
Web Development (8)
Windows (1)
With (1)
YAGNI (10)

Resources
Agile Manifesto & Principles
Principles Of OOD
ColdFusion
CFUnit
Ruby
Ruby on Rails
JUnit



RSS 2.0: Full Post | Short Blurb
Subscribe by email:

Delivered by FeedBurner