On Apr 19, 2005, at 6:07 PM, Adam Kennedy wrote:
Consider the idea of creating a Document that doesn't actually exist in a window and is thus not seen. (I believe this is possible).
Yes, I think that this is what I'll do for the harness.
Your tests can write out to this document, and the harness can do counting of test results without spewing the entire test results to the screen.
The harness can then print the summary of the test results directly to the screen, in the same way we get either a "show all test results" or "show the summary of all the tests".
Once you are writing to an invisible document, why are you using a document? :) Just use an Array, or file-handle-like thing. Or perhaps an object that mocks/simulates a document, so that if you want to run just a single test, it will print out to the document, but in harness mode it's writing to an internal fake document.
Yes, this is what TestBuilder already does. It writes all the test results to the array returned by details(). Test::Harness can't use this because it runs tests in their own processes and can't get at their data. But that's not an issue for JS, which doesn't have the I/O support to fork processes. So I can just reach into a child document and grab the details and use them to output a summary or, with ?verbose=1, all the test output.
Great suggestions, Adam, thanks!
Cheers,
David