We have amazing news at Browserling. We just launched a new product called Testling! Testling is automated cross-browser JavaScript testing tool. You write the JavaScript test, and we run it on all the browsers behind the scenes and report the results.
It's super easy to use. All you need is curl
. Try this: create a file test.js
with the following contents:
var test = require('testling');
test('json parse', function (t) {
t.deepEqual(JSON.parse('[1,2]'), [1,2]);
t.end();
});
And now do this:
curl -sSNT test.js testling.com/?browsers=iexplore/7.0,iexplore/8.0,chrome/14.0
This will run the JSON test in Internet Explorer 7, Internet Explorer 8 and Chrome 14. It's well known that IE7 does not have a JSON
object so the test will fail. However IE8 and Chrome have the global JSON
object and the test will succeed:
Here is the output:
Bundling... done iexplore/7.0 0/1 0 % ok Error: 'JSON' is undefined at [anonymous]() in /test.js : line: 4, column: 5 at [anonymous]() in /test.js : line: 3, column: 29 at test() in /test.js : line: 3, column: 1 > t.deepEqual(JSON.parse('[1,2]'), [1,2]); iexplore/8.0 1/1 100 % ok chrome/14.0 1/1 100 % ok total 2/3 66 % ok
It precisely shows what the error was on IE7 - JSON
is undefined in test.js, on line 4.
Testling supports all the major browsers:
- Internet Explorer 6, 7, 8 and 9 (all native).
- Chrome 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14.
- Firefox 3.0, 3.5, 3.6, 4.0, 5.0, 6.0, 7.0.
- Opera 10.0, 10.5, 11.0, 11.5.
- Safari 5.0.5, 5.1.
When you run a test, you can specify, which browsers to run tests on via the ?browsers
query parameter. For example, to run the test on IE6, Opera 11 and Safari 5.1, do this:
curl -sSNT test.js testling.com/?browsers=iexplore/6.0,opera/11.0,safari/5.1
You can script interactions with websites, too. Here is an example that uses jQuery to submit a login form and compare the greeting text:
var test = require('testling');
test('testling login test', function (t) {
t.createWindow('http://www.testling.com/test-form/', function (win, $) {
t.plan(1);
var form = $('#form')[0];
$('input[name=login]').val('testling');
$('input[name=passw]').val('qwerty');
t.submitForm(form, function (win, $) {
t.ok($('#welcome p:first').text() === "Login successful.", "login failed");
t.end();
});
});
});
Submitting a form only works in IE8, IE9, Chrome 7-14 and all Firefox browsers. Opera, IE6 and IE7 can't do that yet because of implementation limitations, but we're solving this problem right now.
See Testling documentation for a detailed information how to write tests!
Follow the founders of Browserling on GitHub, Twitter, Plurk, Google+ and Facebook!
- Peteris Krumins: GitHub · Twitter · Plurk · Google+ · Facebook.
- James Halliday: GitHub · Twitter · Plurk · Google+ · Facebook.
And subscribe to my blog for Browserling announcements and all kinds of other awesome blog posts!