Writing testling-ci tests is super easy. The only thing your test runner needs to do is to produce TAP output on console.log or process.stdout.

Let's create a new node module called testling-ci-test-example and let's add cross-browser tests to it. Once the tests run, you get a badge like this that shows in which browsers your code works:


If you click the badge you go to the test status page.

First, let's create index.js that exports a few functions, some of which work in some browsers and fail in others:

// doesn't work in IE<9
//
exports.timesTwo = function (list) {
    return list.map(function (x) { return x*2 });
}

// works everywhere
//
exports.timesThree = function (list) {
    var ret = [];
    for (var i = 0; i < list.length; i++) {
        ret[i] = list[i]*3;
    }
    return ret;
}

Now let's write tests for this module. We'll put tests in tests/test.js:

var test = require('tape');
var exampleLib = require('../index.js');

test('timesTwo test', function (t) {
  t.plan(1);
  t.deepEqual(exampleLib.timesTwo([1,2,3]), [2,4,6]);
});

test('timesThree test', function (t) {
  t.plan(1);
  t.deepEqual(exampleLib.timesThree([1,2,3]), [3,6,9]);
});

The tests use tape module that console.log's TAP formatted output.

Now let's add testling field to package.json:

"testling" : {
    "files" : "test/*.js",
    "browsers" : {
        "ie" : [ 6, 7, 8, 9, 10 ],
        "ff" : [ 3.5, 10, 15.0, 16.0, 17.0 ],
        "chrome" : [ 10, 20, 21, 22, 23 ],
        "safari" : [ 5.1 ],
        "opera" : [ 10, 11, 12 ]
    }
}

Finally, let's setup the github hook and point it to git.testling.com. First go to the settings of the repository,

Next, go to the service hooks,

Then, choose WebHook URLs,

Finally, type git.testling.com in the webhook URL field and press update settings,

And we're done. If we visit http://ci.testling.com/pkrumins/testling-ci-test-example we'll see the badge and which browsers the tests succeeded and in which browsers the code failed:

We can instantly see that the code fails in IE6, IE7, and IE8 because these versions of IE don't have Array.prototype.map, and that the code works everywhere else. So awesome!

For more information about testling-ci see ci.testling.com.


ci.testling.com

About Browserling

Our mission at Browserling Inc is to make the developers' life easier. Follow us on twitter for updates - @browserling, @testling, @substack, @pkrumins.

Comments

Nephi Wright Permalink
January 20, 2013, 16:52

I would like to explore browserling with a Jenkins/Mercurial build and test environment. Further, the code we write doesn't go public except to our clients, so it would be ideal if we could set it up on our servers or privately.

Is any of this in the future of browserling?

January 20, 2013, 20:15

Sorry, I don't know about that. Please ask my co-founder @substack. He knows more about various test environments.

September 03, 2013, 17:07

thanks

joson Permalink
October 29, 2013, 07:23

Superb! Generally I never read whole articles but the way you wrote this information is simply amazing and this kept my interest in reading and I enjoyed it.WatchohThanks!!

peggyd Permalink
December 20, 2013, 05:45

Writing testling-ci tests is super easy. The only thing your test runner needs to do is to produce TAP output on console.log or process.stdout. writing is really an art. Not all students have the same writing skill. So most of the students buy custom essays online. It is also a good option. Online writers provides outstanding essays.

jenniffer07 Permalink
May 06, 2014, 07:12

what i did was i just used some essay writing service usa and that was really helped me to prepare for CI tests...

August 20, 2014, 13:10

It's really a great article, Given plenty information and facts with it, These kind of information articles keeps the people interest on the web site, and maintain on posting about it further ...
file upload free
enjoy!

September 12, 2014, 10:28

I can see that you are an expert at your field!
I am launching a website soon, and your information will be very useful for me.
Thanks for all your help and wishing you all the success in your business.

September 12, 2014, 10:30

I just couldn't leave your website before telling you that I truly enjoyed the top quality info you present to your visitors?
Will be back again frequently to check up on new posts.

October 06, 2014, 04:57

I think you made a few rather interesting points.
Not too many people would really think about this the way you just did.
I am truly impressed that there is so much about this subject that has been revealed and you did it so nicely, with so considerably class.
Top-notch one, thank you.
Best MCX Tips.

October 06, 2014, 05:04

The piece of work is very pretty. It is rare to get high quality post like this.
The post is very interesting that I have bookmarked it.
MCX Tips.

October 14, 2014, 08:56

I am very much impressed by the post indeed. The post is pretty enough to understand the author's motto. I like the post which contains the proper word stuffing and good sentenced framed structure.
Androidone Phone.

October 15, 2014, 14:17

Contents of this site are very helpful thank you very much for the useful content

Leave a new comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the word "antispam": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.

Advertisements