schwern / javascript-tap-harness

Run Javascript unit tests in a real browser driven from the command line

This URL has Read+Write access

javascript-tap-harness / README
100644 57 lines (41 sloc) 1.493 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
This is a prototype demonstrator of using Selenium + Test.Simple +
TAP::Harness to automate Javascript unit tests.
 
 
Requires:
 
* Selenium Remote Control Server running on localhost port 4444
  http://seleniumhq.org/projects/remote-control/
* Perl >= 5.8.8
* Perl modules...
  * autodie
    http://search.cpan.org/dist/autodie
  * TAP::Harness 3.17 or newer (part of Test-Harness)
    http://search.cpan.org/dist/Test-Harness
  * WWW::Selenium (part of Test-WWW-Selenium)
    http://search.cpan.org/dist/Test-WWW-Selenium
* A web browser Selenium can talk to.
  Currently hard coded to Firefox.
 
 
To run:
 
* Start your Selenium RC server.
 
  The docs on that.
  http://seleniumhq.org/docs/05_selenium_rc.html
 
* Run javascript_harness
 
* It will run the demonstration tests in t/. One is a
  Perl test to demonstrate it still runs Perl tests. One is
  Javascript inside HTML. The rest are pure Javascript.
 
* If all goes well you'll see....
 
$ perl javascript_harness
t/perl.t .... ok
t/tap.js .... ok
t/tap1.js ... ok
t/tap2.js ... ok
t/tap3.js ... ok
t/tap4.js ... ok
t/tap5.js ... ok
t/tap.html .. ok
All tests successful.
Files=8, Tests=8, 9 wallclock secs ( 0.24 usr 0.07 sys + 0.03 cusr 0.02 csys = 0.36 CPU)
Result: PASS
 
 
Notes:
 
* The Javascript tests are written using Test.Simple, a Javascript testing
  library which outputs TAP. They are bundled in t/lib. You can get
  your own copy here.
  http://openjsan.org/doc/t/th/theory/Test/Simple/