updated CHANGELOG
Showing
1 changed file
with
41 additions
and
3 deletions
... | @@ -4,13 +4,49 @@ CasperJS Changelog | ... | @@ -4,13 +4,49 @@ CasperJS Changelog |
4 | XXXX-XX-XX, v1.1 | 4 | XXXX-XX-XX, v1.1 |
5 | ---------------- | 5 | ---------------- |
6 | 6 | ||
7 | This version is yet to be released. | 7 | This version is yet to be released, and will possibly be tagged as 2.0 as not-so-backward-compatible refactoring occured on the `master` branch. I don't know yet. |
8 | 8 | ||
9 | ### Important Changes & Caveats | 9 | ### Important Changes & Caveats |
10 | 10 | ||
11 | #### Tester refactor | 11 | #### Testing framework refactoring |
12 | 12 | ||
13 | Scraping and testing are now betterly separated in CasperJS, and bad code is now a bit less bad. That involves breaking up BC on some points though: | 13 | A new `Tester.begin()` method has been introduced to help organizing tests better: |
14 | |||
15 | ```js | ||
16 | function Cow() { | ||
17 | this.mowed = false; | ||
18 | this.moo = function moo() { | ||
19 | this.mowed = true; // mootable state: don't do that | ||
20 | return 'moo!'; | ||
21 | }; | ||
22 | } | ||
23 | |||
24 | // unit style synchronous test case | ||
25 | casper.test.begin('Cow can moo', 2, function suite(test) { | ||
26 | var cow = new Cow(); | ||
27 | test.assertEquals(cow.moo(), 'moo!'); | ||
28 | test.assert(cow.mowed); | ||
29 | test.done(); | ||
30 | }); | ||
31 | |||
32 | // asynchronous test case | ||
33 | casper.test.begin('Casperjs.org is navigable', 2, function suite(test) { | ||
34 | casper.start('http://casperjs.org/', function() { | ||
35 | test.assertTitleMatches(/casperjs/i); | ||
36 | this.clickLabel('Testing'); | ||
37 | }); | ||
38 | |||
39 | casper.then(function() { | ||
40 | test.assertUrlMatches(/testing\.html$/); | ||
41 | }); | ||
42 | |||
43 | casper.run(function() { | ||
44 | test.done(); | ||
45 | }); | ||
46 | }); | ||
47 | ``` | ||
48 | |||
49 | Also, scraping and testing are now betterly separated in CasperJS, and bad code is now a bit less bad. That involves breaking up BC on some points though: | ||
14 | 50 | ||
15 | - The Casper object won't be created with a `test` reference if not invoked using the [`casperjs test` command](http://casperjs.org/testing.html#casper-test-command), therefore the ability to run any test without calling it has been dropped. I know, get over it. | 51 | - The Casper object won't be created with a `test` reference if not invoked using the [`casperjs test` command](http://casperjs.org/testing.html#casper-test-command), therefore the ability to run any test without calling it has been dropped. I know, get over it. |
16 | - Passing the planned number of tests to `casper.done()` has been dropped as well, because `done()` may be never called at all when big troubles happen; rather use the new `begin()` method and provide the expected number of tests using the second argument: | 52 | - Passing the planned number of tests to `casper.done()` has been dropped as well, because `done()` may be never called at all when big troubles happen; rather use the new `begin()` method and provide the expected number of tests using the second argument: |
... | @@ -24,6 +60,8 @@ casper.test.begin("Planning 4 tests", 4, function(test) { | ... | @@ -24,6 +60,8 @@ casper.test.begin("Planning 4 tests", 4, function(test) { |
24 | }); | 60 | }); |
25 | ``` | 61 | ``` |
26 | 62 | ||
63 | Last, all the casper test suites have been upgraded to use the new testing features, you may want to have a look at the changes. | ||
64 | |||
27 | ### Bugfixes & enhancements | 65 | ### Bugfixes & enhancements |
28 | 66 | ||
29 | None yet. | 67 | None yet. | ... | ... |
-
Please register or sign in to post a comment