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