refs #552, #547 - updated upgrading documentation
Showing
2 changed files
with
29 additions
and
3 deletions
... | @@ -653,6 +653,8 @@ Formats a message to highlight some parts of it. Only used internally by the tes | ... | @@ -653,6 +653,8 @@ Formats a message to highlight some parts of it. Only used internally by the tes |
653 | 653 | ||
654 | .. versionadded:: 1.0 | 654 | .. versionadded:: 1.0 |
655 | 655 | ||
656 | .. deprecated:: 1.1 | ||
657 | |||
656 | Retrieves failures for current test suite:: | 658 | Retrieves failures for current test suite:: |
657 | 659 | ||
658 | casper.test.assertEquals(true, false); | 660 | casper.test.assertEquals(true, false); | ... | ... |
1 | Upgrading to 1.1 | 1 | Upgrading to 1.1 |
2 | ================ | 2 | ================ |
3 | 3 | ||
4 | Testing framework refactor | ||
5 | -------------------------- | ||
6 | |||
4 | The most visible change is the way you write tests. With 1.0, you were able to access a ``.test`` property from any casper script and so running a suite using the standard ``casperjs`` executable:: | 7 | The most visible change is the way you write tests. With 1.0, you were able to access a ``.test`` property from any casper script and so running a suite using the standard ``casperjs`` executable:: |
5 | 8 | ||
6 | // 1.0 style test script not using the `casperjs test` subcommand | 9 | // 1.0 style test script not using the `casperjs test` subcommand |
... | @@ -41,7 +44,7 @@ Instead you now have to use the :doc:`casperjs test <../testing>` subcommand man | ... | @@ -41,7 +44,7 @@ Instead you now have to use the :doc:`casperjs test <../testing>` subcommand man |
41 | CasperError: casper.test property is only available using the `casperjs test` command | 44 | CasperError: casper.test property is only available using the `casperjs test` command |
42 | 45 | ||
43 | The new ``Tester#begin()`` method | 46 | The new ``Tester#begin()`` method |
44 | --------------------------------- | 47 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
45 | 48 | ||
46 | However, a new :ref:`begin() <tester_begin>` method as been added to the :ref:`Tester <tester_module>` prototype, to ease describing your tests:: | 49 | However, a new :ref:`begin() <tester_begin>` method as been added to the :ref:`Tester <tester_module>` prototype, to ease describing your tests:: |
47 | 50 | ||
... | @@ -64,7 +67,7 @@ More asynchronously:: | ... | @@ -64,7 +67,7 @@ More asynchronously:: |
64 | 67 | ||
65 | .. note:: | 68 | .. note:: |
66 | 69 | ||
67 | Please note that ``begin()``'s the second argument which is now the place to set the number of planned tests. | 70 | Please notice ``begin()``'s second argument which is now the place to set the number of planned tests. |
68 | 71 | ||
69 | 72 | ||
70 | require() in custom modules | 73 | require() in custom modules |
... | @@ -80,7 +83,28 @@ CasperJS 1.1 now internally uses PhantomJS' native ``require()`` function, but i | ... | @@ -80,7 +83,28 @@ CasperJS 1.1 now internally uses PhantomJS' native ``require()`` function, but i |
80 | // ... | 83 | // ... |
81 | }; | 84 | }; |
82 | 85 | ||
83 | |||
84 | .. note:: | 86 | .. note:: |
85 | 87 | ||
86 | You don't have to use ``patchRequire()`` in a standard casperjs script. | 88 | You don't have to use ``patchRequire()`` in a standard casperjs script. |
89 | |||
90 | |||
91 | ``__file__`` has been removed | ||
92 | ----------------------------- | ||
93 | |||
94 | As of 1.1, CasperJS now uses native PhantomJS' ``require()`` function which doesn't support the ``__file__`` builtin variable within custom modules like 1.0 allowed. | ||
95 | |||
96 | |||
97 | ``Tester#getFailures()`` and ``Tester#getSuccesses()`` methods removed | ||
98 | ---------------------------------------------------------------------- | ||
99 | |||
100 | These two methods have been removed from the :doc:`Tester <../modules/tester>` API. | ||
101 | |||
102 | |||
103 | Step and run completion callbacks don't throw anymore | ||
104 | ----------------------------------------------------- | ||
105 | |||
106 | Instead, you should listen to the ``step.error`` and ``complete.error`` events; if you really want to keep raising them:: | ||
107 | |||
108 | casper.on("step.error complete.error", function(error) { | ||
109 | throw error; | ||
110 | }); | ... | ... |
-
Please register or sign in to post a comment