Skip to content

Commit bd56c46

Browse files
Merge pull request #775 from ossf/doc_testing
Document more about testing
2 parents 01ac19b + fdce58e commit bd56c46

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

docs/labs/create_checker.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -474,11 +474,19 @@ As always, it's best to try to
474474
make smaller changes, test them, and once they work
475475
check them in. That way you won't need to debug a long complicated
476476
set of changes.
477+
See the next section on [testing](#testing).
478+
479+
### Testing
480+
481+
Every time you reload the lab HTML, the program will reload and
482+
all self-tests will be run. If you see no errors, and the text entry
483+
areas are showing in yellow, a *lot* of things are working well.
477484

478485
Please create tests! You should create test cases for full attempts
479486
(`successes` should pass, `failures` should fail) and test cases
480487
for hints (`examples`).
481-
Remember, hints are checked in order - it's possible to create a hint
488+
489+
Hints are checked in order - it's possible to create a hint
482490
that won't trigger because something earlier would always match.
483491
All tests are automatically re-run every time the page is (re)loaded.
484492

@@ -487,20 +495,29 @@ Each example is an array of answers. If you use an index, the other index
487495
values aren't considered. We suggest using `null` for array entries
488496
that aren't relevant for the test.
489497

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

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

494-
Every time you reload the lab HTML, the program will reload and
495-
all self-tests will be run. If you see no errors, and the text entry
496-
areas are showing in yellow, a *lot* of things are working well.
497-
498508
If you load a page and the text entries don't have color, there
499509
was a serious problem loading things.
500510
Use your browser's *Developer Tools* to show details.
501511
In Chrome, this is More Tools -> Developer Tools -> (Console Tab).
502512
In Firefox, this is More Tools -> Web Developer Tools -> (Console Tab).
503513
You may need to further open specifics to see them.
514+
Often the problem is that (1) a line just before added material needs a
515+
trailing comma, or (2) a string was not properly closed (e.g.,
516+
it is double-quoted but includes double-quote that was not properly escaped).
517+
518+
If the JavaScript loads successfully, but then a self-test fails,
519+
you'll see alert box(es) telling you which tests failed.
520+
See [testing](#testing).
504521

505522
Note:
506523

0 commit comments

Comments
 (0)