Tuesday 16 August 2011

Are you tired of using 3 or 4 different browsers to test your web apps?

One of the problems programmers have working with web applications is testing with different users.

The browsers uses your session coockies to maintain state throughout your browsers instances. That means that you can "open firefox"(or at least that what you think), many times and your gmail(for example) will remember that you are already logged in. Indeed, that is a headache for programmers, because you have to install and open two or three different browsers to do the job.

But there's a workaround to that issue that seems to be ignored for a quite a lot of programmers, and I will let you know how to do that. Firefox works with profiles and we usualy not aware of that.

When you install it, it will create a profile called "default" for you and you will use it any time you run it. By executing you firefox you will be running as "default" no matter how many times you open it. Regardless of how you work with it you will share all the "default" profile information. So the workaround is very easy to deduct.

You need to start firefox on diferent "profiles". It surprised me how easy was to do it. If you read the command line help of the application, you will see an option called "-P profile" firefox -P "new profile" -no-remote The -P option allow you to run firefox specifing a profile and there is the magic. As this is almost a completely new firefox, you will need to install all plugins and bookmarks again but this is just a side effect. :D The -no-remote option will tell firefox not to connect this instance with any other running instances of firefox. The first time you run this command line, you will probably be taken to the Profile Manager because the "new profile" doesn't exist. There you will realise what I am talking about.


So, to test your application using different session coockies you just need to create as many profiles you need and that's it. As a tip, I can suggest you to create launchers for each of the profiles and put them in the desktop so you will have them handy.

 I hope you like it...

2 comments:

  1. You're welcome!! Sorry. I hadn't seen your comment before. I still don't understand why the blogspot dosn't notify me about new comments. I have to find out how to do so.

    ReplyDelete