Skip to content

Commit

Permalink
Document more about testing
Browse files Browse the repository at this point in the history
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
  • Loading branch information
david-a-wheeler committed Feb 3, 2025
1 parent 4614921 commit 72e77c6
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions docs/labs/create_checker.md
Original file line number Diff line number Diff line change
Expand Up @@ -474,28 +474,44 @@ As always, it's best to try to
make smaller changes, test them, and once they work
check them in. That way you won't need to debug a long complicated
set of changes.
See the next section on [testing](#testing).

### Testing

Every time you reload the lab HTML, the program will reload and
all self-tests will be run. If you see no errors, and the text entry
areas are showing in yellow, a *lot* of things are working well.

Please create tests! You can create test cases for attempts
(`successes` should pass, `failures` should fail), and test cases
to ensure the hints work correctly.
Remember, hints are checked in order - it's possible to create a hint
Hints are checked in order - it's possible to create a hint
that won't trigger because something earlier would always match.
These tests are automatically checked every time the page is (re)loaded.

The script `mass-test` for Linux or MacOS will automatically open
every lab in your default browser's current window.
This will rerun all our lab automated tests.
If every lab has a yellow text entry area, and doesn't show test failure
alerts, then all the labs pass the test.

### Debugging

Sadly, sometimes things don't work; here are some debugging tips for labs.

Every time you reload the lab HTML, the program will reload and
all self-tests will be run. If you see no errors, and the text entry
areas are showing in yellow, a *lot* of things are working well.

If you load a page and the text entries don't have color, there
was a serious problem loading things.
Use your browser's *Developer Tools* to show details.
In Chrome, this is More Tools -> Developer Tools -> (Console Tab).
In Firefox, this is More Tools -> Web Developer Tools -> (Console Tab).
You may need to further open specifics to see them.
Often the problem is that (1) a line just before added material needs a
trailing comma, or (2) a string was not properly closed (e.g.,
it is double-quoted but includes double-quote that was not properly escaped).

If the JavaScript loads successfully, but then a self-test fails,
you'll see alert box(es) telling you which tests failed.
See [testing](#testing).

Note:

Expand Down

0 comments on commit 72e77c6

Please sign in to comment.