Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run unit-tests in all browsers?

I've never used Selenium but I guess it's for simulating user interaction in all browsers.

That's like integration tests.

But how do you test your js libraries/frameworks (unit testing) on all the browsers in an automated way?

like image 493
ajsie Avatar asked Apr 21 '11 05:04

ajsie


People also ask

How can we run same test cases on multiple browsers at once?

Step1: If we are using Selenium WebDriver, we can automate test cases using Internet Explorer, FireFox, Chrome, Safari browsers. Step 2: To execute test cases with different browsers in the same machine at the same time we can integrate TestNG framework with Selenium WebDriver.

How do I test browser compatibility?

The best way to make sure that your page looks the same in all browsers is to write your page using valid HTML and CSS, and then test it in as many browsers as possible. Clean, valid HTML is a good insurance policy, and using CSS separates presentation from content, and can help pages render and load faster.


2 Answers

For unit-testing you can try http://code.google.com/p/js-test-driver/

JsTestDriver consist of a single JAR file which contains everything you need to get started. For in depth discussion of command line option see GettingStarted.

Here is an overview of how JsTestDriver works at runtime...

like image 130
Olegas Avatar answered Oct 14 '22 10:10

Olegas


You can have a look at TestSwarm:

project that I’m working on: TestSwarm...

Its construction is very simple. It’s a dumb JavaScript client that continually pings a central server looking for more tests to run. The server collects test suites and sends them out to the respective clients.

All the test suites are collected. For example, 1 “commit” can have 10 test suites associated with it (and be distributed to a selection of browsers)...

The nice thing about this construction is that it’s able to work in a fault-tolerant manner. Clients can come-and-go. At any given time there might be no Firefox 2s connected, at another time there could be thirty. The jobs are queued and divvied out as the load requires it. Additionally, the client is simple enough to be able to run on mobile devices (while being completely test framework agnostic)...

like image 41
9ikhan Avatar answered Oct 14 '22 10:10

9ikhan