Sunday, February 24, 2013

BrowserStack

As I mentioned some time ago Microsoft is offering free 3 month trial account in the BrowserStack service. Because I'm currently working on application that should support variety of browsers including old IE versions (fortunately starting from IE7 only - not IE6) I've decided to give it a try. I must say that I'm really impressed about it. But first let me explain some more details.

What is it

It is a service that gives us a possibility to use almost every browser running on operating system of our choice (but they are missing Linux - place to make some improvements in the future). We can have access to the remote browser running somewhere in the cloud to check how our application is working in it. No more using virtual machines, no more installing anything - BrowserStack is running in browser which simplifies a lot of things.

How it works - live sessions

First of all we can choose on which browser and on which operating system we want to test our application. Then in a very quick manner an instance of this browser is being prepared. Average preparation times were about 1 minute. It is acceptable because preparing your own virtual machine and starting it would definetely take much more time. After mentioned 1 minute we can control remote machine through some Adobe Flash application. It feels like remote desktop but limited to browser window. Of course we can use developer tools in almost every one of it - it is really good idea because without them service would be useless.


Tunneling

Most of applications that need to be tested are rather running locally on developer machine. For BrowserStack that isn't a problem - there is a tunneling feature to make our local sites available for the remote browsers. Tunnel is being prepared by simple Java application.

Automated testing

The most interesting thing is that with this service comes an API for making browser instances programatically (from any language where it is possible to send HTTP request). We can specify URL which should be opened when the browser will start. It is very useful because we can leverage automated JavaScript tests of our application. For example we can write and run Jasmine unit tests in the cloud. To collect test results from the remote browser we need something that can send data from the JavaScript code in the remote browser to our computer - and that is the place when node.js come in handy. There are several test runners on the internet (Testem, Yeti, etc.) that are built on the top of node.js and socket.io to send test results back to our computer through sockets. Of course they are travelling using tunnel that was prepared earlier.