Bug 70944 - [Meta] Simplify JS Test Harness
Summary: [Meta] Simplify JS Test Harness
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 69881 70432 70784 70959 71339 71398 71533
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-26 10:58 PDT by Erik Arvidsson
Modified: 2017-07-18 08:29 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Arvidsson 2011-10-26 10:58:45 PDT
I'm currently in the process of simplifying the JS Test Harness. The end goal is to only have to include a single js file.

<script src="path/to/test.js"></script>
<script>
shouldBeTrue('true');
</script>

Here are a few things that needs to be done

* Remove pre+post scripts. Today we have js-test-pre.js, js-test-post.js, js-test-post-async.js and js-test-function.js.
* Remove the need to manually set successfullyParsed to true
* Remove the link to include js-test-style.css
* Standardize/simplify async tests

Right now there are so many ad-hoc ways of doing tests which makes both writing and maintaing tests a real nightmare.
Comment 1 Erik Arvidsson 2011-10-26 11:01:27 PDT
I forgot to mention

* Remove #console and #description elements
Comment 2 Alexey Proskuryakov 2011-10-26 11:38:54 PDT
As discussed on webkit-dev a few weeks ago, I don't really think that making the harness more dynamic and complicated for the sake of reducing boilerplate helps much.

One will still most likely use make-new-script-test script or copy/paste, but there are now more points of failure for the engine, and more invisible things to keep in mind when writing tests.

That's only a personal opinion/vote, and doesn't seem like something that can be meaningfully discussed.
Comment 3 Erik Arvidsson 2011-10-26 11:55:09 PDT
One of the main problems (IMO) is that having a boiler plate leaves too much room for ad-hoc testing. By making it simpler to do the right thing I believe that we will get less ad hoc tests which leads to better maintainability.
Comment 4 Ojan Vafai 2011-10-26 12:11:19 PDT
FWIW, even after the handful of cleanups Erik has done so far, I find writing tests much easier. Even without getting rid of js-test-post, I'm finding it tolerable to write them manually now.
Comment 5 Erik Arvidsson 2011-11-11 15:52:07 PST
Another strange thing is that the description element is a p element and we append a span with more p elements in it which is kind of silly. We should probably just make the description element a div.