Simon Hunt | 8ead3a2 | 2015-01-06 11:00:15 -0800 | [diff] [blame] | 1 | #### |
Simon Hunt | f306972 | 2014-12-16 18:15:37 -0800 | [diff] [blame] | 2 | # Unit and integration tests for code under the /app directory |
Simon Hunt | 8ead3a2 | 2015-01-06 11:00:15 -0800 | [diff] [blame] | 3 | #### |
Simon Hunt | 420691a | 2014-12-16 20:16:28 -0800 | [diff] [blame] | 4 | |
| 5 | To run these tests, karma, node.js etc needs to be installed in the |
| 6 | build environment. |
| 7 | |
Simon Hunt | 8ead3a2 | 2015-01-06 11:00:15 -0800 | [diff] [blame] | 8 | From the karma installation directory, execute the following: |
Simon Hunt | 420691a | 2014-12-16 20:16:28 -0800 | [diff] [blame] | 9 | |
Simon Hunt | 8ead3a2 | 2015-01-06 11:00:15 -0800 | [diff] [blame] | 10 | $ karma start {_path_to_}/src/main/webapp/tests/karma.conf.js |
| 11 | |
| 12 | This will launch and capture a browser, install and run the unit tests. |
| 13 | |
| 14 | The configuration is currently set to re-run the tests every time a |
| 15 | file change is detected, (i.e. each time a source file is saved). |
Simon Hunt | 51fc40b | 2015-01-06 13:56:12 -0800 | [diff] [blame] | 16 | |
| 17 | ---------------------------------------------------------------------- |
| 18 | Useful Notes |
| 19 | ============ |
| 20 | |
| 21 | Set a 'breakpoint' with the debugger command: |
| 22 | |
| 23 | it('should define four functions', function () { |
| 24 | debugger; |
| 25 | |
| 26 | expect(fs.isF(gs.init)).toBeTruthy(); |
| 27 | // ... |
| 28 | }); |
| 29 | |
| 30 | Open Developer Tools in the captured Chrome browser, and reload the page. |
| 31 | The debugger will break at the given point, allowing you to inspect context. |