root / trunk / web / dojo / dojox / robot / README
History | View | Annotate | Download (2.85 KB)
| 1 | 9 | andrej.cim | ------------------------------------------------------------------------------- | 
|---|---|---|---|
| 2 | dojox.robot.recorder | ||
| 3 | ------------------------------------------------------------------------------- | ||
| 4 | Version 0.1 | ||
| 5 | Release date: 2008-07-30 | ||
| 6 | ------------------------------------------------------------------------------- | ||
| 7 | Project state: experimental | ||
| 8 | ------------------------------------------------------------------------------- | ||
| 9 | Project authors | ||
| 10 | Mark Hays | ||
| 11 | ------------------------------------------------------------------------------- | ||
| 12 | Project description | ||
| 13 | |||
| 14 | Writing automated test cases takes time, and DOH is no exception. You have to | ||
| 15 | look up element ids, invent dojo.queries for elements with no id, | ||
| 16 | figure out exactly how many pixels to move the mouse . . . the list goes on. | ||
| 17 | |||
| 18 | This recorder module enables DOH test case writers to create complete DOH test | ||
| 19 | scripts directly from their actions and input on a Web page. Simply drop the | ||
| 20 | generated code into your test page, set a pass condition, and the test will | ||
| 21 | repeat your actions. | ||
| 22 | ------------------------------------------------------------------------------- | ||
| 23 | Dependencies: | ||
| 24 | |||
| 25 | dojo | ||
| 26 | ------------------------------------------------------------------------------- | ||
| 27 | Documentation | ||
| 28 | |||
| 29 | See installation instructions below to prepare a test page for recording. | ||
| 30 | |||
| 31 | To record a test, click in an area of the document with no dojo.stopEvents | ||
| 32 | and press CTRL-ALT-ENTER in the main window. You will get a verification alert | ||
| 33 | when you successfully start the recorder. Then you can interact with the Web | ||
| 34 | page and the recorder will monitor your actions. It's usually good to record one | ||
| 35 | test per widget instance per type of interaction (keyboard vs mouse for instance) | ||
| 36 | you are testing. | ||
| 37 | |||
| 38 | After you finish interacting with the Web page, click out of any dojo.stopEvents | ||
| 39 | and press CTRL-ALT-ENTER again. You will see a box containing the generated source | ||
| 40 | code for your recording. Copy this into a dojo.addOnLoad on the same page to register | ||
| 41 | the test with DOH. Replace the /*Your condition here*/ text with a JS condition that | ||
| 42 | indicates that the test passed. Again, having multiple small tests will help you | ||
| 43 | keep the condition small. Add a doh.run() call after you register all of your tests | ||
| 44 | to make them execute when you load the page. | ||
| 45 | ------------------------------------------------------------------------------- | ||
| 46 | Installation instructions | ||
| 47 | |||
| 48 | To ready the recorder for a particular page, add this line to your dojo.requires: | ||
| 49 | dojo.require("dojox.robot.recorder");
 | ||
| 50 | |||
| 51 | You can safely remove this line after you are finished recording your tests. | ||
| 52 | ------------------------------------------------------------------------------- | ||
| 53 | Additional Notes | ||
| 54 | |||
| 55 | Known limitations: | ||
| 56 | - Content in an iframe might not report events to the recorder. | ||
| 57 | - keyDown/keyUp events are supported by DOH, but not by the recorder. | ||
| 58 | If you hold a key down, it will generate lots of keyPress events instead. | ||
| 59 | Simply change these to one keyDown call yourself. |