SimpleTest: harness helpers for error report checking



10 years ago
3 months ago


(Reporter: shaver, Unassigned)



Firefox Tracking Flags

(Not tracked)


I have a couple of bugs that are about improving error messages or eliminating them, and sometimes they go to the console directly rather than by way of an uncaught exception.  That makes it clumsy to test, because one has to wire up a console listener and count or compare in each test.


reports_error(f, /regexp/, "message"):
  passes iff f() reports an error matching /regexp/
reports_n_errors(f, count, "message"):
  passes iff f() reports count errors to the console

If we can make this work for non-chrome tests, so much the better!

Comment 1

10 years ago
Nitpicking, but existing stuff like sendMouseEvent is all camelCaps or whatever it's called.

We probably also should build in the types of reports that go to the console, since we don't want a warning to pass when we expected an error.

Maybe something like this instead, and push the error-checking code up to the specific test?  Note also that this signature gives the flexibility to only do the error tests when console logging is enabled, since we might not always want to make it so.

type AnyFunction = function() : void;
type ErrorChecker = function(errors : [{type: string, msg: string}]) : void;

function testForErrors(func : AnyFunction, check : ErrorChecker) : void
Component: Testing → Mochitest
Product: Core → Testing
QA Contact: testing → mochitest
Version: Trunk → unspecified
Blocks: 483391
Version: unspecified → Trunk

Comment 2

9 years ago
Uhm, this bug is probably not related to bug 483959. The problem there was
that we didn't find a way to view online, from the tinderboxes output, the
text of _unexpected_ exceptions reported to the console by a browser-chrome
test that timed out. This bug is about providing a way for tests to check for
_expected_ exceptions, that are only reported to the console and not raised
by the underlying code.

Maybe the first problem is worth a separate bug?
Paolo: that's already filed as bug 481406.

Comment 4

9 years ago
(In reply to comment #3)
> Paolo: that's already filed as bug 481406.

Thanks, I didn't find it since I included "tinderbox" in my search.
No longer blocks: 483959
No longer blocks: 483391
Mass closing mochitest bugs that haven't had activity in the past 5 years. Please re-open or file a new bug with modern context if this is still relevant.
Last Resolved: 3 months ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.