Beth, others,

On Mon, Apr 7, 2025 at 9:24 AM 'Beth Rennie' via [email protected] <
[email protected]> wrote:

> Hi y'all,
>
> Last week I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1957513
> for investigating ways to improve mochitest and xpcshell-test tests for
> Firefox Desktop. I initially was proposing a decorator based approach (à la
> NormandyTestUtils [1]) but I've also implemented a mocha-ish to add_task
> wrapper which is entirely opt-in. I've attached patches for both patterns
> to the bug, as well as some additional patches which migrate a single test
> (test_FirefoxLabs.js) to each of these patterns.
>
> I'm hoping this drives some discussion on these patterns (or other
> potential patterns). Feedback is much appreciated.
>

Commenting here rather than on BZ in the hope that we spur more and broader
discussion.

I have often lamented not having richer testing primitives and support
doing almost anything in the area to fill the gap.  I am not familiar with
Mocha but I am familiar with JUnit, which groups tests by classes in the
namespace, and then exposes `{Before,After}Each` and `{Before,After}All`
decorators (for per-test and per-suite setup and teardown, respectively).
Right now we only have `BeforeAll` in the form of `add_setup`.  I am not a
fan of the `add_task` decorators that we currently have; they make it
really quite awkward to add conditions to tests, so I would be happier if
we exposed `add_cleanup`(for `AfterAll`) and perhaps
`add_{before,after}_each` for the per-test variants.  It's annoying to have
to split tests across files in order to have fine-grained before/after
configurations, but I'd prefer that to having to decorate every test and
have many more awkward definitions than we already do.

Thanks for making this better!
Nick


>
> Thanks!
> Beth
>
> [1]:
> https://searchfox.org/mozilla-central/source/toolkit/components/normandy/test/browser/browser_AddonStudies.js#16-21
>
> --
> You received this message because you are subscribed to the Google Groups "
> [email protected]" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion visit
> https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/CA%2BSxwbfJv-1sUmTJhF8Cm9Bfo%3DjRYtnL7kKg30X13pM0W24XEA%40mail.gmail.com
> <https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/CA%2BSxwbfJv-1sUmTJhF8Cm9Bfo%3DjRYtnL7kKg30X13pM0W24XEA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"[email protected]" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/CAMnWBR0e8scmG95vStAk3DnpOv8AUOdemO4dgyQQ1i6646YLNQ%40mail.gmail.com.

Reply via email to