16147
|
1 |
Nashorn tests are TestNG based. Running tests requires downloading the TestNG
|
|
2 |
library and placing its jar file into the lib subdirectory:
|
|
3 |
|
|
4 |
# download and install TestNG
|
|
5 |
wget http://testng.org/testng-x.y.z.zip
|
|
6 |
unzip testng-x.y.z.zip
|
|
7 |
cp testng-x.y.z/testng-x.y.z.jar lib/testng.jar
|
|
8 |
|
|
9 |
# run tests
|
|
10 |
cd ..
|
|
11 |
ant test
|
|
12 |
|
|
13 |
This will fail with a message like
|
|
14 |
|
|
15 |
taskdef class org.testng.TestNGAntTask cannot be found
|
|
16 |
|
|
17 |
if the TestNG jar file is not installed properly or if the wrong
|
|
18 |
version is present. (Check build.xml to find the version of TestNG
|
|
19 |
that is required.) Only the jar file is necessary. The unzipped
|
|
20 |
hierarchy can be removed.
|
|
21 |
|
|
22 |
We have tested using TestNG 6.7 as well ad TestNG 6.8. TestNG 6.7's jar file
|
|
23 |
is also available as part of jtreg 4.1 b05 which can be downloaded at
|
|
24 |
http://download.java.net/openjdk/jtreg/
|
|
25 |
|
|
26 |
ECMAScript script test framework:
|
|
27 |
|
|
28 |
* Test tags for test framework:
|
|
29 |
|
|
30 |
The test runner crawls these directories for .js files and looks for JTReg-style
|
|
31 |
@foo comments to identify tests.
|
|
32 |
|
|
33 |
* @test - A test is tagged with @test.
|
|
34 |
|
|
35 |
* @test/fail - Tests that are supposed to fail (compiling, see @run/fail
|
|
36 |
for runtime) are tagged with @test/fail.
|
|
37 |
|
|
38 |
* @test/compile-error - Test expects compilation to fail, compares
|
|
39 |
output.
|
|
40 |
|
|
41 |
* @test/warning - Test expects compiler warnings, compares output.
|
|
42 |
|
|
43 |
* @test/nocompare - Test expects to compile [and/or run?]
|
|
44 |
successfully(may be warnings), does not compare output.
|
|
45 |
|
|
46 |
* @subtest - denotes necessary file for a main test file; itself is not
|
|
47 |
a test.
|
|
48 |
|
|
49 |
* @run - A test that should be run is also tagged with @run (otherwise
|
|
50 |
the test runner only compiles the test).
|
|
51 |
|
|
52 |
* @runif - A test that should be run only if a specific System property
|
|
53 |
is defined (Example: @runif external.v8)
|
|
54 |
|
|
55 |
* @run/fail - A test that should compile but fail with a runtime error.
|
|
56 |
|
|
57 |
* @run/param - specify runtime arguments to script.
|
|
58 |
|
|
59 |
* @run/ignore-std-error - script may produce output on stderr, ignore
|
|
60 |
this output.
|
|
61 |
|
|
62 |
* @compilearg \ - pass arg to compiler, sample.
|
|
63 |
|
|
64 |
/**
|
|
65 |
* @compilearg --dump-ir-graph
|
|
66 |
* @test/warning
|
|
67 |
*/
|
|
68 |
|
|
69 |
* @compilefirst foo.js - foo.js being a necessary file for a test; it
|
|
70 |
may or may not itself be a test. These are compiled separately before
|
|
71 |
main test file.
|
|
72 |
|
|
73 |
* @compile/fail foo.js - foo.js being a necessary file for a test; it
|
|
74 |
may or may not itself be a test, compile should fail. These are compile
|
|
75 |
with main file.
|
|
76 |
|
|
77 |
* @compile bar.js - bar.js being a necessary file for a test; it may or
|
|
78 |
may not itself be a test. These are compiled with main file.
|