Skip to content
This repository was archived by the owner on May 30, 2023. It is now read-only.

Revamp the test system #12439

Closed
ariya opened this issue Aug 9, 2014 · 1 comment
Closed

Revamp the test system #12439

ariya opened this issue Aug 9, 2014 · 1 comment
Assignees
Milestone

Comments

@ariya
Copy link
Owner

ariya commented Aug 9, 2014

The plan is as follows:

  • There will be a master test runner.
  • The test runner executes every test script with a fresh instance of PhantomJS.
  • The exit code of every script defines the success or failure.
  • If necessary, the output (stdout, stderr) can be compared against a defined baseline.

This was previously discussed in the mailing-list.

@ariya ariya added this to the Release 2.0 milestone Aug 9, 2014
ariya added a commit that referenced this issue Aug 20, 2014
@ariya ariya self-assigned this Aug 24, 2014
ariya added a commit that referenced this issue Aug 26, 2014
This Python script serves as a master test runner. It will run each test
script with a fresh instance of PhantomJS. The exit code of each script
determines its success or failure.

The existing tests (run-tests.js) are wrapped as one of the test
scripts. This permits a gradual migration to the new test system.

#12439
ariya added a commit that referenced this issue Aug 28, 2014
ariya added a commit that referenced this issue Sep 3, 2014
ariya added a commit that referenced this issue Sep 4, 2014
ariya added a commit that referenced this issue Sep 6, 2014
The server runs on port 9180 and serves the content from test/www
directory. Any tests can use this base URL to load test content and
to exercise certain PhantomJS API.

#12439
ariya added a commit that referenced this issue Sep 7, 2014
ariya added a commit that referenced this issue Sep 8, 2014
The HTTP server launched by the test runner has a new endpoint called
/echo. This simply echoes back some information (current on the made
request, in the future it will be expanded to further information)
formatted as JSON. This echo system facilitates easy testing for request
header manipulation feature.

#12439
ariya added a commit that referenced this issue Sep 8, 2014
This reduces the total test duration from 72 seconds to 54 seconds.

#12439
ariya added a commit that referenced this issue Sep 11, 2014
zackw added a commit to zackw/phantomjs that referenced this issue Sep 15, 2014
This means that there is no longer a need to add every individual test
to the list; only new *directories* have to be mentioned.  New tests
can be added just by dropping .js files into appropriate directories.

Tests which are not meant to be run by default now live in tests/manual/.
Currently there is one such test, tests/manual/standards/ecma-test262.js,
which downloads and runs the ECMAScript conformance suite.

Ongoing work on issue ariya#12439.
zackw added a commit to zackw/phantomjs that referenced this issue Sep 15, 2014
We already have 'base_path' as a global variable, so use that (or rather,
a new derivative of that) instead of inspect.getfile(inspect.currentframe()).

Rather than splitting the path and then iterating over every component
trying to figure out if it's "special", take advantage of the fact that
posixpath.normpath() will reliably produce a path with all ../ and bare-/
components at the very beginning.  Preserve the distinction between paths
with and without a trailing /, as SimpleHTTPRequestHandler expects.

So that paths containing unusual (e.g. non-ASCII, non-UTF-8) segments can
safely be tested, unquote and then requote the entire path.  This means
that the *bytes* corresponding to the ASCII characters

  0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz -_./

are guaranteed to be unquoted, and all other *bytes* are guaranteed to be
%-quoted.  (Note especially that *whether or not* the tests are being run
on Windows, \ in the original URL will be represented as %5C, and will
*not* be treated as a pathname separator.)

So that the tests behave consistently whether or not the OS has a case-
sensitive filesystem, after the above transformation, lowercase the entire
path.

Ongoing work on issue ariya#12439.
zackw added a commit to zackw/phantomjs that referenced this issue Sep 15, 2014
Rather than add all the special URLs we'll ever want to run-tests.py,
the embedded HTTP server now supports scripts in test/www/.  If you
try to load http://localhost:9180/path and test/www/path doesn't exist
but test/www/path.py does, then test/www/path.py is loaded as a module.
That module must export one function, handle_request(), which is called
to produce the response.

handle_request() has the same semantics as
SimpleHTTPRequestHandler.send_head().  That is, it takes one argument,
the SimpleHTTPRequestHandler object, conventionally named 'req'.
It should call the send_response(), send_header(), and end_headers()
methods of that object as appropriate.  And it should return a readable
filelike whose contents are taken as the body of the response.

If either module import or handle_request() throws any exception, the
HTTP response will be a 500 Internal Server Error with body provided
by cgitb.

Ongoing work on issue ariya#12439.
zackw added a commit to zackw/phantomjs that referenced this issue Sep 15, 2014
If there are any positional arguments to test/run-tests.py, they are matched
(verbatim, not as regular expressions) against each test's name.  Only those
tests whose names contain at least one of the positional arguments will be
run.  Thus, for instance, you can run just the webpage tests with

    ./test/run-tests.py module/webpage

or one specific test with

    ./test/run-tests.py exact/name/of/test.js

or the basics and standards tests with

    ./test/run-tests.py basics standards

If no tests at all match, run-tests.py will print "ALL TESTS SKIPPED" and
exit unsuccessfully.

Ongoing work on issue ariya#12439.
jakozaur added a commit to jakozaur/phantomjs that referenced this issue Dec 8, 2014
Callback, clip-rect, confirm, object, prompt, scroll-position,
viewport-size and window.

ariya#12439
jakozaur added a commit to jakozaur/phantomjs that referenced this issue Dec 12, 2014
@ariya
Copy link
Owner Author

ariya commented Feb 1, 2015

Looks good for now. Further refinements will be filed as a separate ticket.

@ariya ariya closed this as completed Feb 1, 2015
@ariya ariya added the Resolved label Feb 1, 2015
kjelloe pushed a commit to kjelloe/phantomjs that referenced this issue Feb 2, 2015
zackw added a commit to zackw/phantomjs that referenced this issue Jul 16, 2015
If set, this hook is called when the main script (the one named on the
phantomjs command line) completes evaluation.  This allows a library
(e.g. a test harness) to detect when no further code will execute
except as a result of events already pending.

ariya#12439
zackw added a commit to zackw/phantomjs that referenced this issue Jul 16, 2015
zackw added a commit to zackw/phantomjs that referenced this issue Jul 16, 2015
If set, this hook is called when the main script (the one named on the
phantomjs command line) completes evaluation.  This allows a library
(e.g. a test harness) to detect when no further code will execute
except as a result of events already pending.

ariya#12439
zackw added a commit to zackw/phantomjs that referenced this issue Jul 16, 2015
zackw added a commit to zackw/phantomjs that referenced this issue Aug 6, 2015
If set, this hook is called when the main script (the one named on the
phantomjs command line) completes evaluation.  This allows a library
(e.g. a test harness) to detect when no further code will execute
except as a result of events already pending.

ariya#12439
zackw added a commit to zackw/phantomjs that referenced this issue Aug 6, 2015
zackw added a commit to zackw/phantomjs that referenced this issue Aug 10, 2015
If set, this hook is called when the main script (the one named on the
phantomjs command line) completes evaluation.  This allows a library
(e.g. a test harness) to detect when no further code will execute
except as a result of events already pending.

ariya#12439
zackw added a commit to zackw/phantomjs that referenced this issue Aug 10, 2015
zackw added a commit to zackw/phantomjs that referenced this issue Aug 13, 2015
 * Eliminate the global variables.
 * More thorough error detection in the HTTP(S) server.
 * Test directive comments must start with //! and the parser is more robust.
 * Handle child process stderr separately from stdout
   (this will make it possible to test more things).
 * Execute tests within each directory in alphabetical order. (ariya#12439)
 * Support and use multi-level wildcards in TESTS.  This means we don't
   have to touch run-tests.py every time we add a subdirectory to
   module/ or standards/.
 * Handle HTTP server errors during a test more gracefully.  Errors caused by
   the client disconnecting in the middle of a query-response transaction are
   ignored.  Other errors are reported and the test suite exits cleanly.
 * Add HTTPS and POST support to test server.
 * Add ability to run PhantomJS under a debugger on a test case.
 * Use argparse for command line parsing.
 * Accept -v as short for --verbose.
 * Repeating -v means more verbosity; at -vvv, phantomjs command lines are
   printed.  (-vv is reserved for printing individual subtests, which will
   happen later.)
 * Fix bug where, with one or more -v, the pjs version number was printed
   twice.
zackw added a commit to zackw/phantomjs that referenced this issue Aug 15, 2015
 * Eliminate the global variables.
 * More thorough error detection in the HTTP(S) server.
 * Test directive comments must start with //! and the parser is more robust.
 * Handle child process stderr separately from stdout
   (this will make it possible to test more things).
 * Execute tests within each directory in alphabetical order. (ariya#12439)
 * Support and use multi-level wildcards in TESTS.  This means we don't
   have to touch run-tests.py every time we add a subdirectory to
   module/ or standards/.
 * Handle HTTP server errors during a test more gracefully.  Errors caused by
   the client disconnecting in the middle of a query-response transaction are
   ignored.  Other errors are reported and the test suite exits cleanly.
 * Add HTTPS and POST support to test server.
 * Add ability to run PhantomJS under a debugger on a test case.
 * Use argparse for command line parsing.
 * Accept -v as short for --verbose.
 * Repeating -v means more verbosity; at -vvv, phantomjs command lines are
   printed.  (-vv is reserved for printing individual subtests, which will
   happen later.)
 * Fix bug where, with one or more -v, the pjs version number was printed
   twice.
zackw added a commit to zackw/phantomjs that referenced this issue Aug 19, 2015
 * Eliminate the global variables.
 * More thorough error detection in the HTTP(S) server.
 * Test directive comments must start with //! and the parser is more robust.
 * Handle child process stderr separately from stdout
   (this will make it possible to test more things).
 * Execute tests within each directory in alphabetical order. (ariya#12439)
 * Support and use multi-level wildcards in TESTS.  This means we don't
   have to touch run-tests.py every time we add a subdirectory to
   module/ or standards/.
 * Handle HTTP server errors during a test more gracefully.  Errors caused by
   the client disconnecting in the middle of a query-response transaction are
   ignored.  Other errors are reported and the test suite exits cleanly.
 * Add HTTPS and POST support to test server.
 * Add ability to run PhantomJS under a debugger on a test case.
 * Use argparse for command line parsing.
 * Accept -v as short for --verbose.
 * Repeating -v means more verbosity; at -vvv, phantomjs command lines are
   printed.  (-vv is reserved for printing individual subtests, which will
   happen later.)
 * Fix bug where, with one or more -v, the pjs version number was printed
   twice.
zackw added a commit to zackw/phantomjs that referenced this issue Aug 19, 2015
If set, this hook is called when the main script (the one named on the
phantomjs command line) completes evaluation.  This allows a library
(e.g. a test harness) to detect when no further code will execute
except as a result of events already pending.

ariya#12439
zackw added a commit to zackw/phantomjs that referenced this issue Aug 22, 2015
If set, this hook is called when the main script (the one named on the
phantomjs command line) completes evaluation.  This allows a library
(e.g. a test harness) to detect when no further code will execute
except as a result of events already pending.

ariya#12439
zackw added a commit to zackw/phantomjs that referenced this issue Aug 23, 2015
 * Eliminate the global variables.
 * More thorough error detection in the HTTP(S) server.
 * Test directive comments must start with //! and the parser is more robust.
 * Handle child process stderr separately from stdout
   (this will make it possible to test more things).
 * Execute tests within each directory in alphabetical order. (ariya#12439)
 * Support and use multi-level wildcards in TESTS.  This means we don't
   have to touch run-tests.py every time we add a subdirectory to
   module/ or standards/.
 * Handle HTTP server errors during a test more gracefully.  Errors caused by
   the client disconnecting in the middle of a query-response transaction are
   ignored.  Other errors are reported and the test suite exits cleanly.
 * Add HTTPS and POST support to test server.
 * Add ability to run PhantomJS under a debugger on a test case.
 * Use argparse for command line parsing.
 * Accept -v as short for --verbose.
 * Repeating -v means more verbosity; at -vvv, phantomjs command lines are
   printed.  (-vv is reserved for printing individual subtests, which will
   happen later.)
 * Fix bug where, with one or more -v, the pjs version number was printed
   twice.

Part of issue ariya#13478 (test suite overhaul).
zackw added a commit to zackw/phantomjs that referenced this issue Aug 23, 2015
If set, this hook is called when the main script (the one named on the
phantomjs command line) completes evaluation.  This allows a library
(e.g. a test harness) to detect when no further code will execute
except as a result of events already pending.

ariya#12439
zackw added a commit to zackw/phantomjs that referenced this issue Aug 29, 2015
 * Eliminate the global variables.
 * More thorough error detection in the HTTP(S) server.
 * Test directive comments must start with //! and the parser is more robust.
 * Handle child process stderr separately from stdout
   (this will make it possible to test more things).
 * Execute tests within each directory in alphabetical order. (ariya#12439)
 * Support and use multi-level wildcards in TESTS.  This means we don't
   have to touch run-tests.py every time we add a subdirectory to
   module/ or standards/.
 * Handle HTTP server errors during a test more gracefully.  Errors caused by
   the client disconnecting in the middle of a query-response transaction are
   ignored.  Other errors are reported and the test suite exits cleanly.
 * Add HTTPS and POST support to test server.
 * Add ability to run PhantomJS under a debugger on a test case.
 * Use argparse for command line parsing.
 * Accept -v as short for --verbose.
 * Repeating -v means more verbosity; at -vvv, phantomjs command lines are
   printed.  (-vv is reserved for printing individual subtests, which will
   happen later.)
 * Fix bug where, with one or more -v, the pjs version number was printed
   twice.

Part of issue ariya#13478 (test suite overhaul).
zackw added a commit to zackw/phantomjs that referenced this issue Aug 29, 2015
If set, this hook is called when the main script (the one named on the
phantomjs command line) completes evaluation.  This allows a library
(e.g. a test harness) to detect when no further code will execute
except as a result of events already pending.

ariya#12439
vitallium pushed a commit to vitallium/phantomjs that referenced this issue Oct 20, 2015
 * Eliminate the global variables.
 * More thorough error detection in the HTTP(S) server.
 * Test directive comments must start with //! and the parser is more robust.
 * Handle child process stderr separately from stdout
   (this will make it possible to test more things).
 * Execute tests within each directory in alphabetical order. (ariya#12439)
 * Support and use multi-level wildcards in TESTS.  This means we don't
   have to touch run-tests.py every time we add a subdirectory to
   module/ or standards/.
 * Handle HTTP server errors during a test more gracefully.  Errors caused by
   the client disconnecting in the middle of a query-response transaction are
   ignored.  Other errors are reported and the test suite exits cleanly.
 * Add HTTPS and POST support to test server.
 * Add ability to run PhantomJS under a debugger on a test case.
 * Use argparse for command line parsing.
 * Accept -v as short for --verbose.
 * Repeating -v means more verbosity; at -vvv, phantomjs command lines are
   printed.  (-vv is reserved for printing individual subtests, which will
   happen later.)
 * Fix bug where, with one or more -v, the pjs version number was printed
   twice.

Part of issue ariya#13478 (test suite overhaul).
zackw added a commit to zackw/phantomjs that referenced this issue Oct 20, 2015
 * Eliminate the global variables.
 * More thorough error detection in the HTTP(S) server.
 * Test directive comments must start with //! and the parser is more robust.
 * Handle child process stderr separately from stdout
   (this will make it possible to test more things).
 * Execute tests within each directory in alphabetical order. (ariya#12439)
 * Support and use multi-level wildcards in TESTS.  This means we don't
   have to touch run-tests.py every time we add a subdirectory to
   module/ or standards/.
 * Handle HTTP server errors during a test more gracefully.  Errors caused by
   the client disconnecting in the middle of a query-response transaction are
   ignored.  Other errors are reported and the test suite exits cleanly.
 * Add HTTPS and POST support to test server.
 * Add ability to run PhantomJS under a debugger on a test case.
 * Use argparse for command line parsing.
 * Accept -v as short for --verbose.
 * Repeating -v means more verbosity; at -vvv, phantomjs command lines are
   printed.  (-vv is reserved for printing individual subtests, which will
   happen later.)
 * Fix bug where, with one or more -v, the pjs version number was printed
   twice.

Part of issue ariya#13478 (test suite overhaul).
zackw added a commit to zackw/phantomjs that referenced this issue Oct 20, 2015
If set, this hook is called when the main script (the one named on the
phantomjs command line) completes evaluation.  This allows a library
(e.g. a test harness) to detect when no further code will execute
except as a result of events already pending.

ariya#12439
zackw added a commit to zackw/phantomjs that referenced this issue Nov 3, 2015
If set, this hook is called when the main script (the one named on the
phantomjs command line) completes evaluation.  This allows a library
(e.g. a test harness) to detect when no further code will execute
except as a result of events already pending.

ariya#12439
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant