<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xml:lang="en">

  <title type="html">Florian Quèze - Tag - testing</title>
  <subtitle type="html">Florian Quèze's blog, talking about Mozilla, Instantbird, Summer of Code, Ami 6 cars, ...</subtitle>
  <link href="http://blog.queze.net/feed/tag/testing/atom" rel="self" type="application/atom+xml"/>
  <link href="http://blog.queze.net/" rel="alternate" type="text/html"
  title="Florian Quèze's blog, talking about Mozilla, Instantbird, Summer of Code, Ami 6 cars, ..."/>
  <updated>2026-11-28T22:47:00+01:00</updated>
  <author>
    <name></name>
  </author>
  <id>urn:md5:d59fad53f8b1c54effe51c1e5b249670</id>

  <entry>
    <title>Every mochitest can now run alone, and twice in a row</title>
    <link href="https://blog.queze.net/post/2026/11/28/Every-mochitest-can-now-run-alone-and-twice-in-a-row" rel="alternate" type="text/html"
    title="Every mochitest can now run alone, and twice in a row" />
    <id>https://blog.queze.net/post/2026/11/28/Every-mochitest-can-now-run-alone-and-twice-in-a-row</id>
    <published>2026-11-28T22:47:00+01:00</published>
    <updated>2026-11-28T22:47:00+01:00</updated>
    <author><name>Florian Quèze</name></author>
    <dc:subject>Mozilla</dc:subject>
    <dc:subject>testing</dc:subject>
    <content type="html">    &lt;p&gt;Yesterday, &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2095794&quot; title=&quot;Bug 2095794 - [meta] Fix the mochitest-plain tests that fail when run twice in a row&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;&lt;code&gt;mochitest-plain-repeat&lt;/code&gt; jobs started running on autoland and mozilla-central&lt;/a&gt;. With that, every mochitest suite now has &lt;a href=&quot;https://wiki.mozilla.org/Sheriffing/Job_Visibility_Policy#Overview_of_the_Job_Visibility_Tiers&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;tier 1&lt;/a&gt; jobs enforcing that each test passes when it runs alone in a fresh browser, and when it runs twice in a row. If you have ever tried to debug a test locally and been confused by a failure that had nothing to do with what you were investigating, this is for you.&lt;/p&gt;
&lt;h2&gt;Why this matters&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;When fixing a test locally.&lt;/strong&gt; Running a single test with &lt;code&gt;./mach mochitest path/to/test.js&lt;/code&gt; should now work: no more hidden dependency on another test of the same manifest that happened to run first. And when trying to reproduce an intermittent failure with &lt;code&gt;--repeat 10&lt;/code&gt; or &lt;code&gt;--run-until-failure&lt;/code&gt;, the second run will no longer perma-fail just because the first one left something behind. If the test fails, it's likely the failure you are looking for.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Making Test Verify reliable.&lt;/strong&gt; &lt;a href=&quot;https://firefox-source-docs.mozilla.org/testing/test-verification/index.html&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Test Verify&lt;/a&gt; (TV) is the job that runs the tests modified by a push many times: 10 times in the same browser, 5 times with a fresh browser each time, and then all of that again in chaos mode. It's meant to catch new intermittent failures, on try before they land, and on autoland right after. Today, it fails too often for reasons that have nothing to do with the push. Nobody should be needinfo'ed because a test couldn't run alone or twice before they touched it. The standalone and repeat jobs remove 2 of these 3 sources of pre-existing failures. Chaos mode still needs work.&lt;/p&gt;
&lt;h2&gt;Getting there&lt;/h2&gt;
&lt;p&gt;Standalone jobs (Treeherder suffix &lt;code&gt;sa&lt;/code&gt;) restart the browser before each test; use &lt;code&gt;--restart-between-tests&lt;/code&gt; to do the same locally. Repeat jobs (suffix &lt;code&gt;rp&lt;/code&gt;) run each test twice in a row in the same browser, like &lt;code&gt;--repeat 1&lt;/code&gt; (one extra run). Both run on Linux and Windows, every 20 pushes or 4 hours on autoland (on backstop pushes) and on mozilla-central.&lt;/p&gt;
&lt;p&gt;It took many fixes, in &lt;a href=&quot;https://bugzilla.mozilla.org/buglist.cgi?bug_id=987115,1113676,1316680,1775779,1775943,1838996,1844234,1868598,1870534,1870751,1882642,1883194,1883461,1883561,1920615,1923050,1932027,1935530,1935589,1938697,1945797,1956068,1970685,1972348,1975964,1979074,1983051,1987201,1995881,2002101,2009494,2009767,2010250,2010322,2010430,2010620,2011291,2011552,2011623,2013476,2013672,2019592,2019910,2020070,2021173,2022645,2022665,2023514,2023581,2023721,2024015,2024301,2024340,2024696,2024701,2024858,2025711,2025775,2026747,2026755,2026757,2026807,2026925,2027681,2028115,2028517,2028645,2028647,2028648,2028651,2028652,2028654,2028766,2029094,2057689,2059750,2068983,2077709,2086525,2086751,2086752,2086753,2086756,2086758,2086760,2086762,2089807,2090968,2090969,2090970,2090982,2090983,2090984,2090986,2090987,2091368,2091370,2091373,2091375,2091377,2091378,2091414,2091464,2091986,2091987,2091988,2091989,2092058,2092060,2092065,2092068,2092071,2092076,2092082,2092091,2092259,2092272,2092273,2092274,2092277,2092281,2092283,2092294,2092296,2092310,2092317,2092319,2092321,2092322,2092324,2092326,2092327,2092328,2092543,2092544,2092549,2092552,2092555,2092557,2092558,2092559,2092560,2092561,2092565,2092569,2092570,2092571,2094004,2094404,2094409,2094418,2094421,2094425,2094427,2094702,2094711,2094724,2094726,2094729,2094731,2095706,2095713,2095714,2095739,2095740,2095742,2095753,2095778,2095781,2095817,2098494&quot; title=&quot;171 bugs&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;171 bugs&lt;/a&gt;, to get all the jobs green enough:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Suite&lt;/th&gt;
&lt;th&gt;Run alone&lt;/th&gt;
&lt;th&gt;Run twice&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;browser-chrome&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2010766&quot; title=&quot;Bug 2010766 - Ensure browser-chrome mochitests can run standalone&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;44 fixes&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2092566&quot; title=&quot;Bug 2092566 - [meta] Fix the browser-chrome tests that fail when run twice in a row&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;68 fixes&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;devtools-chrome&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2026744&quot; title=&quot;Bug 2026744 - [meta] Fix devtools tests failing in standalone mode&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;8 fixes&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2090991&quot; title=&quot;Bug 2090991 - [meta] Fix the devtools tests that fail when run twice in a row&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;11 fixes&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;chrome&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2086769&quot; title=&quot;Bug 2086769 - [meta] Fix the failures uncovered by removing the standalone skip-if annotations&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;4 fixes&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2092575&quot; title=&quot;Bug 2092575 - [meta] Fix the mochitest-chrome tests that fail when run twice in a row&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;11 fixes&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;plain&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2086769&quot; title=&quot;Bug 2086769 - [meta] Fix the failures uncovered by removing the standalone skip-if annotations&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;8 fixes&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2095794&quot; title=&quot;Bug 2095794 - [meta] Fix the mochitest-plain tests that fail when run twice in a row&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;28 fixes&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Only 6 tests are still skipped in standalone mode, and 6 in repeat mode.&lt;/p&gt;
&lt;p&gt;Examples of things that broke in a fresh browser: &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2025775&quot; title=&quot;Bug 2025775 - browser_elevationDialog.js fails standalone due to uninitialized UpdateServiceStub causing extra elevation dialog&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;uninitialized&lt;/a&gt; &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2024701&quot; title=&quot;Bug 2024701 - browser_aiwindow_smartbar_mentions.js fails standalone because smartbar creation happens after async work in firstUpdated()&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;services&lt;/a&gt;, &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2010430&quot; title=&quot;Bug 2010430 - browser_preview_navigation.js::testToolbarVisibility fails standalone due to CSS transition delay&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;first-time&lt;/a&gt; &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2011623&quot; title=&quot;Bug 2011623 - Make flicker tests pass when running standalone&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;flicker&lt;/a&gt;, &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2010322&quot; title=&quot;Bug 2010322 - browser_sidebar_prefs.js and browser_tools_migration.js fail standalone because sidebar is not visible&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;hidden&lt;/a&gt; &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2010250&quot; title=&quot;Bug 2010250 - browser_chat_telemetry.js fails standalone due to incorrect expectation for browser.ml.chat.page default&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;dependencies&lt;/a&gt;, &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2028652&quot; title=&quot;Bug 2028652 - browser_ext_windows_update.js fails standalone on Windows opt (and also --headless on mac/Linux/Windows)&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;window size&lt;/a&gt;, &lt;a href=&quot;https://bugzilla.mozilla.org/buglist.cgi?bug_id=2025711,2026925,2029094&quot; title=&quot;Bugs 2025711, 2026925, 2029094&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;leaks&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Examples of things that broke on the second run: &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2094427&quot; title=&quot;Bug 2094427 - test_net_failedtoprocess.html times out when run twice in the same browser&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;image&lt;/a&gt;, &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2094702&quot; title=&quot;Bug 2094702 - test_font_loading_api.html fails when run twice in the same browser (mochitest-plain-repeat)&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;font&lt;/a&gt; and &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2095740&quot; title=&quot;Bug 2095740 - test_subresources_prompts.html times out when run twice in the same browser because its HTTP auth credentials stay cached&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;auth&lt;/a&gt; caches, leftover &lt;a href=&quot;https://bugzilla.mozilla.org/buglist.cgi?bug_id=2091377,2091986,2092076,2095739&quot; title=&quot;Bugs 2091377, 2091986, 2092076, 2095739&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;cookies&lt;/a&gt;, &lt;a href=&quot;https://bugzilla.mozilla.org/buglist.cgi?bug_id=2091378,2091989,2092317&quot; title=&quot;Bugs 2091378, 2091989, 2092317&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;history&lt;/a&gt; and &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2090982&quot; title=&quot;Bug 2090982 - browser_dbg-overrides.js times out when run twice because it leaves its override file in the temp directory&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;files&lt;/a&gt;, &lt;a href=&quot;https://bugzilla.mozilla.org/buglist.cgi?bug_id=2092068,2094425,2095706,2095713,2095714,2095778&quot; title=&quot;Bugs 2092068, 2094425, 2095706, 2095713, 2095714, 2095778&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;.sjs state&lt;/a&gt;, &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2094418&quot; title=&quot;Bug 2094418 - test_wheel_zoom_on_form_controls.html leaves the harness page zoomed out, and fails when run twice in a row&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;page zoom&lt;/a&gt;, &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2091373&quot; title=&quot;Bug 2091373 - browser_last_window_close_trigger.js fails when run twice in the same browser (Bypass metric not recorded yet - 1 == null)&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;once-per-session telemetry&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2092566&quot; title=&quot;Bug 2092566 - [meta] Fix the browser-chrome tests that fail when run twice in a row&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Fixing the browser-chrome repeat failures&lt;/a&gt; has been my largest stack of patches yet, and fixing all of this would not have been possible without the many engineers who reviewed them quickly. Thank you!&lt;/p&gt;
&lt;h2&gt;Actual browser bugs&lt;/h2&gt;
&lt;p&gt;Most fixes were in tests, but some were real Firefox bugs. A few examples:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Clearing history didn't make links unvisited.&lt;/strong&gt; Each process caches the visited status of the links its documents track. Clearing history never reset that cache, so links in already open pages &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2022665&quot; title=&quot;Bug 2022665 - Intermittent TV toolkit/components/places/tests/browser/browser_visituri_restriction_origin.js | same_origin_but_other - Uncaught exception in test - undefined - timed out after 50 tries.&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;kept showing as visited&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=1113676&quot; title=&quot;Bug 1113676 - img resources missing from resource-timing entries when loaded from cache&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Resource Timing bug from 2014&lt;/a&gt;.&lt;/strong&gt; Images served from the image cache, which is shared across documents, got no &lt;code&gt;PerformanceResourceTiming&lt;/code&gt; entry, unlike stylesheets and scripts. The bug had collected years of &amp;quot;any update?&amp;quot; comments; a test failing when run twice finally got it fixed.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2086760&quot; title=&quot;Bug 2086760 - Crash in nsWindow::TryDwmResizeHack when a window opened with sizemode=&amp;quot;fullscreen&amp;quot; is the session's first fullscreen entry&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;crash on Windows&lt;/a&gt;.&lt;/strong&gt; When the first fullscreen entry of the session came from a window opened with &lt;code&gt;sizemode=&amp;quot;fullscreen&amp;quot;&lt;/code&gt;, Firefox dereferenced a renderer that didn't exist yet. Restarting the browser before each test made this crash happen every time.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Next&lt;/h2&gt;
&lt;p&gt;Chaos mode, which randomizes thread and event scheduling, is the last part of Test Verify that doesn't &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2029984&quot; title=&quot;Bug 2029984 - Add mochitest-chaos and xpcshell-chaos jobs&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;have its own tier 1 jobs&lt;/a&gt; yet. Adding randomness to scheduling will likely uncover many more bugs. Some smaller mochitest suites, like a11y and media, &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2098503&quot; title=&quot;Bug 2098503 - Add repeat and standalone tasks for the a11y and media mochitests&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;don't have standalone and repeat jobs yet&lt;/a&gt;, but they should soon.&lt;/p&gt;
&lt;p&gt;The ongoing work to clean up flaky tests is effective, but new intermittent failures land quickly too, so the overall failure rate only goes down when we fix them faster than they get introduced. &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=1975728&quot; title=&quot;Bug 1975728 - [meta] make test-verify tier 1&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Making Test Verify tier 1&lt;/a&gt; would stop most of these regressions when they land, and then we will finally have a chance of making the flakiness rate go down for good.&lt;/p&gt;
</content>
  </entry>

</feed>
