n1k0/casperjs — pull request #329 by n1k0 (2012-12-18 22:16:57+00:00)
Title: Initial attempt at bringing support for test cases

Regarding #56 I've been working on a new implementation of proper *test cases* on the [testcase branch](https://github.com/n1k0/casperjs/tree/testcase).

Basically now you can do:

```js
function Cow() {
this.mowed = false;
this.moo = function moo() {
this.mowed = true;
return 'moo!';
};
}

casper.test.begin('Cow can moo', function(casper) {
var cow = new Cow();
this.assertEquals(cow.moo(), 'moo!');
this.assert(cow.mowed);
this.done(2);
});

casper.test.begin('Casperjs.org is navigable', function(test) {
casper.start('http://casperjs.org/', function() {
test.assertTitleMatches(/casperjs/i);
this.clickLabel('Testing');
});

casper.then(function() {
test.assertUrlMatches(/testing\.html$/);
});

casper.run(function() {
test.done(2);
});
});
```

Also, here's a sample XUnit XML results log output of the whole casper test suite: https://gist.github.com/4332371

What do you think? As you can see, it's quite a big changeset, so as we're in 1.0RCX should we wait for 1.1 for pushing this?