<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Laxminarayanaboga on Medium]]></title>
        <description><![CDATA[Stories by Laxminarayanaboga on Medium]]></description>
        <link>https://medium.com/@laxminarayanaboga4079?source=rss-27e94dc3d581------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*aW9oBC8taS9lx_aD</url>
            <title>Stories by Laxminarayanaboga on Medium</title>
            <link>https://medium.com/@laxminarayanaboga4079?source=rss-27e94dc3d581------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 02:03:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@laxminarayanaboga4079/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Plain Code, a Decision Model and a Coding Agent: Who Should Make Which Call?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@laxminarayanaboga4079/plain-code-a-decision-model-and-a-coding-agent-who-should-make-which-call-466e8d1065cb?source=rss-27e94dc3d581------2"><img src="https://cdn-images-1.medium.com/max/1269/1*o2U8wcTpu7iLQE0jimF_lg.png" width="1269"></a></p><p class="medium-feed-snippet">Plain Code, a Decision Model and a Coding Agent: Who Should Make Which Call?</p><p class="medium-feed-link"><a href="https://medium.com/@laxminarayanaboga4079/plain-code-a-decision-model-and-a-coding-agent-who-should-make-which-call-466e8d1065cb?source=rss-27e94dc3d581------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@laxminarayanaboga4079/plain-code-a-decision-model-and-a-coding-agent-who-should-make-which-call-466e8d1065cb?source=rss-27e94dc3d581------2</link>
            <guid isPermaLink="false">https://medium.com/p/466e8d1065cb</guid>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[playwright-test]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[claude-code]]></category>
            <dc:creator><![CDATA[Laxminarayanaboga]]></dc:creator>
            <pubDate>Tue, 13 Oct 2026 13:31:01 GMT</pubDate>
            <atom:updated>2026-10-13T13:31:01.880Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Latency Is a Design Constraint: A Decision Model Plays the Chrome Dino Game]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@laxminarayanaboga4079/latency-is-a-design-constraint-a-decision-model-plays-the-chrome-dino-game-9bf307752ece?source=rss-27e94dc3d581------2"><img src="https://cdn-images-1.medium.com/max/1269/1*o2U8wcTpu7iLQE0jimF_lg.png" width="1269"></a></p><p class="medium-feed-snippet">Latency Is a Design Constraint: A Decision Model Plays the Chrome Dino Game</p><p class="medium-feed-link"><a href="https://medium.com/@laxminarayanaboga4079/latency-is-a-design-constraint-a-decision-model-plays-the-chrome-dino-game-9bf307752ece?source=rss-27e94dc3d581------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@laxminarayanaboga4079/latency-is-a-design-constraint-a-decision-model-plays-the-chrome-dino-game-9bf307752ece?source=rss-27e94dc3d581------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bf307752ece</guid>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[playwright-test]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[jevs]]></category>
            <dc:creator><![CDATA[Laxminarayanaboga]]></dc:creator>
            <pubDate>Mon, 12 Oct 2026 16:26:01 GMT</pubDate>
            <atom:updated>2026-10-12T16:26:01.667Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Teaching a Decision Model to Play 2048 — and Why the Facts Mattered More Than the Model]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-snippet">Teaching a Decision Model to Play 2048 &#x2014; and Why the Facts Mattered More Than the Model</p><p class="medium-feed-link"><a href="https://medium.com/@laxminarayanaboga4079/teaching-a-decision-model-to-play-2048-and-why-the-facts-mattered-more-than-the-model-27562f9042d1?source=rss-27e94dc3d581------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@laxminarayanaboga4079/teaching-a-decision-model-to-play-2048-and-why-the-facts-mattered-more-than-the-model-27562f9042d1?source=rss-27e94dc3d581------2</link>
            <guid isPermaLink="false">https://medium.com/p/27562f9042d1</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[jevs]]></category>
            <category><![CDATA[playwright-test]]></category>
            <dc:creator><![CDATA[Laxminarayanaboga]]></dc:creator>
            <pubDate>Sun, 11 Oct 2026 12:11:01 GMT</pubDate>
            <atom:updated>2026-10-11T12:11:01.582Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Time‑Travel Testing in Playwright: Automating Date‑Sensitive Flows]]></title>
            <link>https://medium.com/@laxminarayanaboga4079/time-travel-testing-in-playwright-automating-date-sensitive-flows-e135b8a5ac26?source=rss-27e94dc3d581------2</link>
            <guid isPermaLink="false">https://medium.com/p/e135b8a5ac26</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[playwright-automation]]></category>
            <category><![CDATA[playwright-test]]></category>
            <dc:creator><![CDATA[Laxminarayanaboga]]></dc:creator>
            <pubDate>Thu, 09 Jul 2026 17:41:00 GMT</pubDate>
            <atom:updated>2026-07-09T17:41:00.904Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>Some bugs only appear on the last day of the month, on a leap year, or 30 days after sign‑up. Here’s how to make those moments reproducible by controlling the clock — and how to put time back when the test ends.</em></blockquote><p>A surprising amount of software behaviour depends on <em>what day it is</em>. Billing cycles, subscription renewals, free‑trial expiries, statement generation, “due in 7 days” reminders, weekend vs weekday logic, month‑end rollups — none of these can be tested honestly by waiting for the calendar to cooperate. You need to <strong>travel in time</strong>.</p><p>This article covers a pragmatic time‑travel technique for end‑to‑end Playwright tests: shifting the <strong>host system clock</strong> so the whole stack — browser, app, and backend — agrees it’s a different day, then guaranteeing the clock is restored no matter how the test ends.</p><blockquote><em>There are two flavours of time control. We’ll start with the lightweight in‑browser approach, then move to the heavyweight system‑clock approach for true full‑stack date travel.</em></blockquote><h3>Two ways to fake time (and when each fails)</h3><p><strong>1. Browser‑only mocking.</strong> Playwright can freeze or shift the clock <em>inside the page</em>:</p><pre>await page.clock.setFixedTime(new Date(&quot;2026-01-31T09:00:00&quot;));</pre><p>This is fast, isolated, and perfect when the date logic lives in the <strong>front end</strong> — a countdown, a “renews on” label computed client‑side, relative timestamps.</p><p>But it has a hard limit: it only fools Date in the browser tab. The moment your <em>backend</em> stamps a record with its own server time, or a downstream service decides &quot;today is the 31st,&quot; the illusion breaks. The page thinks it&#39;s month‑end; the server disagrees.</p><p><strong>2. System‑clock travel.</strong> For genuinely full‑stack date behaviour — where the <em>server</em> must believe it’s a different day — you shift the clock of the machine the whole stack runs on. Heavier and more invasive, but it’s the only thing that makes the entire system agree on “now.”</p><p>The rest of this article is about doing (2) safely.</p><h3>Shifting the host clock from a test helper</h3><p>In an environment where the app, services, and tests share a host (a local dev box or a self‑contained CI container), a small helper can set the OS date by shelling out to the system:</p><pre>const { exec } = require(&quot;child_process&quot;);<br>const util = require(&quot;util&quot;);<br>const execAsync = util.promisify(exec);<br><br>export async function setSystemDate(dateString) {<br>  // dateString: &quot;YYYY-MM-DD&quot;<br>  const [year, month, day] = dateString.split(&quot;-&quot;);<br>  // Apply the new date via the OS date command, then let services settle<br>  await applyOsDate({ year, month, day });<br>  await wait(5000); // give the stack a moment to observe the new clock<br>  // Always verify the change actually took effect<br>  const now = await readOsDate();<br>  console.log(`System date is now: ${now}`);<br>}</pre><p>Two non‑obvious but important details:</p><ul><li><strong>Settle, then verify.</strong> After changing the clock, wait briefly and <em>read it back</em>. Date changes aren’t always instantaneous, and a silent failure here produces baffling test results (“why is it still yesterday?”). Verifying turns a heisenbug into a clear log line.</li><li><strong>Treat it as environment mutation, not test data.</strong> Changing the host clock affects <em>everything</em> on that host — every parallel worker, every service. That has consequences we’ll address head‑on below.</li></ul><p>Exposed as a single helper, the test reads cleanly:</p><pre>test(&quot;invoice is generated on the last day of the month&quot;, async ({ page }) =&gt; {<br>  await setSystemDate(&quot;2026-01-31&quot;);<br>  await triggerBillingRun(page);<br>  await expectInvoiceVisible(page);<br>});</pre><h3>The real problem: putting time back</h3><p>Here’s the trap. The test above <em>works</em> — until it fails halfway through, or someone adds an early return, and the clock is left in the past. Now every subsequent test on that host is silently running in the wrong year. One forgotten restore poisons the entire run.</p><p>A try/finally helps, but it&#39;s easy to forget and easy to bypass. The robust answer is a <strong>teardown‑only fixture</strong> that restores the real date <em>after every test that touches time</em>, guaranteed, pass or fail:</p><pre>restoreSystemClock: async ({}, use) =&gt; {<br>  await use(new DoNothing());        // setup: hand back a no-op<br>  const today = new Date().toISOString().split(&quot;T&quot;)[0];<br>  await setSystemDate(today);        // teardown: ALWAYS restores real date<br>},</pre><p>A date‑sensitive test opts into the guarantee simply by <strong>listing the fixture</strong> — it never writes cleanup code:</p><pre>test(&quot;trial expires 30 days after signup&quot;, async ({ page, restoreSystemClock }) =&gt; {<br>  await signUp(page);<br>  await setSystemDate(daysFromNow(30)); // jump forward<br>  await expectTrialExpired(page);<br>  // no restore here — the fixture resets the clock on teardown, even on failure<br>});</pre><p>Because Playwright runs fixture teardown in reverse order regardless of outcome, the clock is <em>always</em> put back. This converts “remember to undo your time change” from a code‑review hope into a structural guarantee.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/275/0*wu052d1oxcrqLwe8.png" /></figure><h3>Synchronising on server time, not local time</h3><p>Once the <em>server</em> owns “now,” your assertions must trust the <em>server’s</em> clock, not the test process’s. A subtle but real source of flakiness is reading new Date() in the test and comparing it to a timestamp the server produced moments later — clock skew of even a second or two breaks &quot;is this after that?&quot; checks.</p><p>The fix is to anchor on server time explicitly:</p><pre>noteServerTime: async ({ request }, use, runTimeCache) =&gt; {<br>  const serverNow = await getServerTime(request); // ask the app, not the OS<br>  runTimeCache.notedTime = serverNow;<br>  await use();<br>},<br><br>test(&quot;reminder fires after the due date&quot;, async ({ page, request }) =&gt; {<br>  const before = await getServerTime(request);   // server&#39;s clock<br>  await advanceSystemDateBy({ days: 8 });<br>  await triggerReminderJob(page);<br>  const stamped = await readReminderTimestamp(page);<br>  expect(stamped).toBeGreaterThan(before);        // compare server-to-server<br>});</pre><blockquote><em>Rule of thumb for date tests: </em><strong><em>whoever owns the source of truth for “now” is who you compare against.</em></strong><em> If the backend stamps records, read the backend’s clock — never assume the test runner’s clock matches.</em></blockquote><h3>Keeping clock‑travel tests off the parallel highway</h3><p>Mutating a shared host clock is fundamentally <strong>global</strong>: it affects every test running on that host simultaneously. Two tests time‑travelling to different dates in parallel will corrupt each other. So these tests must be treated as a special, serialised class:</p><ul><li><strong>Isolate them.</strong> Run clock‑sensitive tests with a single worker, or pin them to a dedicated execution slice that never overlaps with others (the per‑suite concurrency model: wide workers for independent tests, <em>one</em> worker for time‑travel flows).</li><li><strong>Tag them</strong> so they can be selected, scheduled, and <em>excluded</em> deliberately — you don’t want a date‑shifting test sneaking into a wide parallel batch.</li><li><strong>Always pair them with the restore fixture</strong>, so even a crash leaves the next suite a clean clock.</li></ul><p>This is the price of full‑stack time travel: it buys you honest end‑to‑end date behaviour, at the cost of giving up parallelism for that slice. For the handful of genuinely date‑critical journeys, it’s a trade worth making — and for everything else, the lightweight in‑browser page.clock approach keeps its parallelism.</p><h3>Lessons learned</h3><ul><li><strong>Pick the right altitude.</strong> In‑browser page.clock for front‑end date logic; system‑clock travel only when the <em>server</em> must agree on the date.</li><li><strong>Settle and verify after changing the clock.</strong> A read‑back log line turns silent date failures into obvious ones.</li><li><strong>Make restoration structural, not optional.</strong> A teardown‑only fixture guarantees the clock is reset on pass, fail, or crash — the single most important safeguard.</li><li><strong>Compare against the clock that owns the truth.</strong> If the backend stamps “now,” read the backend’s time; never trust cross‑process clock equality.</li><li><strong>Serialise and tag clock‑travel tests.</strong> Global state can’t run in parallel — isolate it, label it, and keep it out of wide batches.</li></ul><p>Date‑sensitive behaviour is some of the highest‑value, lowest‑covered surface area in most applications. With a small clock helper, a teardown guard, and a bit of execution discipline, those once‑a‑month and once‑a‑year code paths become tests you can run any day you like.</p><p><em>Written from real‑world experience building a large, multi‑environment Playwright suite. All names, values, and examples are generic illustrations of the patterns described.</em></p><p><em>Originally published at </em><a href="https://laxminarayanaboga.github.io/articles/time-travel-testing.html"><em>https://laxminarayanaboga.github.io/articles/time-travel-testing.html</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e135b8a5ac26" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[One Suite, Many Brands: A White‑Label / Multi‑Tenant Testing Strategy]]></title>
            <link>https://medium.com/@laxminarayanaboga4079/one-suite-many-brands-a-white-label-multi-tenant-testing-strategy-cb5e275ec19d?source=rss-27e94dc3d581------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb5e275ec19d</guid>
            <category><![CDATA[playwright-test]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[playwright-automation]]></category>
            <category><![CDATA[test-automation]]></category>
            <dc:creator><![CDATA[Laxminarayanaboga]]></dc:creator>
            <pubDate>Wed, 08 Jul 2026 07:01:03 GMT</pubDate>
            <atom:updated>2026-07-08T07:01:03.156Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>When the same product ships under several brands, the naive answers are “copy the suite per brand” or “test only one and hope.” Both are wrong. Here’s how a single suite covers many tenants through shared journeys, a layered data‑resolution fallback, and per‑tenant overrides.</em></blockquote><p>A white‑label product is one codebase wearing many faces: same loan journey, same checkout, same account flow — different logo, colours, copy, URLs, and a handful of genuinely different business rules per brand. Testing it is a trap. Duplicate the suite per brand and every fix becomes N fixes and the copies drift. Test one brand and the others ship untested. Parameterise badly and you get a tangle of if (brand === &#39;x&#39;) that nobody can read.</p><p>This article is about the middle path that scales: <strong>one set of journeys, executed per tenant, with data resolved through a fallback hierarchy</strong> so brands share everything by default and override only what genuinely differs. The example brands and values here are invented.</p><h3>The principle: share the journey, vary the data</h3><p>The insight that makes multi‑tenant testing tractable: for a white‑label product, the <em>journey</em> is almost always identical across brands — it’s the <strong>data</strong> that varies. So you write the scenario once and let each brand supply its own data through a resolver, falling back to shared defaults for everything it doesn’t override.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/0*ol9HpBXjU349iX3n.png" /></figure><p>You are not maintaining N suites. You are maintaining one suite and N (small) data overlays.</p><h3>Layer 1 — Brand as a tag dimension</h3><p>In a tag‑driven suite, the brand is just another orthogonal tag family. A scenario outline lists the shared steps once, then attaches brand‑specific example tables — each tagged with its brand:</p><pre>Feature: accessibility tests for application pages<br><br>Scenario Outline: a11y scan - brand: &lt;brand&gt;, page: &quot;&lt;pageName&gt;&quot;<br>    Given I access the application start page<br>    Given Run accessibility tests pageName:&quot;&lt;pageName&gt;&quot; device: &quot;&lt;device&gt;&quot;<br>    @brand-a<br>    Examples:<br>      | brand   | pageName          | device  |<br>      | BRAND_A | application-start | desktop |<br>    @brand-b<br>    Examples:<br>      | brand   | pageName          | device  |<br>      | BRAND_B | application-start | desktop |</pre><p>The journey steps are written <strong>once</strong>. Each brand contributes a row, tagged so you can run one brand, a subset, or all:</p><pre># All brands<br>npx bddgen --tags &quot;@accessibility and @preprod&quot;<br># Just one brand while debugging<br>npx bddgen --tags &quot;@accessibility and @brand-a and @preprod&quot;</pre><p>The brand value flows into the steps as a fixture, where it becomes the key for resolving everything brand‑specific — URLs, data, expectations.</p><h3>Layer 2 — The 4‑level data‑resolution fallback</h3><p>This is the engine of the whole strategy. Every piece of test data is resolved through a hierarchy that tries the <strong>most specific</strong> location first and falls back to <strong>shared defaults</strong>. The two axes that vary are <em>environment</em> and <em>brand</em>, giving four candidates in priority order:</p><pre>async function resolveTestDataPath(section, env, brand, fileName) {<br>  brand = (brand || &#39;default&#39;).toLowerCase();<br>  env   = (env   || &#39;default&#39;).toLowerCase();<br><br>const candidates = [<br>    `tests/test-data/${section}/${env}/${brand}/${fileName}`,   // 1. exact: this env, this brand<br>    `tests/test-data/${section}/${env}/default/${fileName}`,    // 2. this env, any brand<br>    `tests/test-data/${section}/default/${brand}/${fileName}`,  // 3. any env, this brand<br>    `tests/test-data/${section}/default/default/${fileName}`,   // 4. shared baseline<br>  ];<br>  for (const candidate of candidates) {<br>    if (await fs.pathExists(candidate)) return candidate;<br>  }<br>  throw new Error(`Test data not found. Tried:\n${candidates.join(&#39;\n&#39;)}`);<br>}</pre><p>Read that priority list as a sentence: <em>“Use this brand’s data for this environment if it exists; otherwise this environment’s shared data; otherwise this brand’s cross‑environment data; otherwise the shared baseline.”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/0*pcE_IiMHrwU7BUfk.png" /></figure><p>The power of this is <strong>inheritance by default</strong>. A new brand starts with <em>zero</em> data files — it inherits the shared baseline for everything. You add an override file only for the specific thing that actually differs for that brand. The directory tree becomes a precise map of “what’s truly brand‑specific” versus “what’s shared,” because shared data simply isn’t duplicated.</p><h3>Layer 3 — Per‑tenant config that isn’t data files</h3><p>Some brand variation isn’t a JSON fixture — it’s a URL, a secret, a feature flag. Resolve those by brand‑keyed environment variables, so the same step targets the right tenant without branching:</p><pre>// One line resolves the right host for whichever brand the scenario is running<br>const urlHost = process.env[`${brand}_URL`];        // BRAND_A_URL, BRAND_B_URL, ...<br>const url = `${urlHost}${pathFor(functionality)}`;</pre><p>Brand‑scoped artifacts (sessions, reports, caches) follow the same discipline — the brand is part of the key, so tenants never collide:</p><pre>function storageFilePath(env, brand, userId) {<br>  return path.join(base, `${env}-${brand.toLowerCase()}-${userId}-storageState.json`);<br>}<br>// desktop-preprod-brand_a-checkout.json, etc.</pre><p>The rule: <strong>brand is a coordinate, never a branch.</strong> You key on it — in a path, an env‑var name, a filename — rather than writing if (brand === ...).</p><h3>Layer 4 — When business rules genuinely differ</h3><p>Sometimes a brand really does behave differently — a different decline reason, an extra step, a different product. The disciplined way to express that is <em>still data</em>, not control flow. Carry the brand‑specific expectation in the example table or a brand‑resolved expectation file, so the journey stays single:</p><pre>@brand-a<br>    Examples:<br>      | brand   | decision | expectedOutcome              |<br>      | BRAND_A | decline  | tc_decline_no_offers         |<br><br>@brand-b<br>    Examples:<br>      | brand   | decision | expectedOutcome              |<br>      | BRAND_B | decline  | tc_decline_alternative_offer |</pre><p>The step reads expectedOutcome and asserts against the brand&#39;s resolved expectation file. The <em>behaviour</em> differs; the <em>test code</em> doesn&#39;t. When you genuinely can&#39;t avoid a branch (a brand has an extra screen), isolate it behind a brand‑resolved page object or a tagged sub‑scenario — never an inline conditional scattered through a shared step.</p><h3>The sensitivity caveat — genericise hard</h3><p>White‑label testing is the highest‑sensitivity topic in this series, because brand names, URLs, and divergent business rules <em>are</em> the product’s commercial structure. If you write about this pattern publicly, strip it to the mechanism:</p><ul><li>Use placeholder brands (BRAND_A, BRAND_B) — never real ones.</li><li>Use *_URL env‑var <em>shapes</em>, never real hosts or the count of real brands.</li><li>Show the <em>fallback mechanism</em> and the <em>“brand is a coordinate”</em> rule — not the actual matrix of which brand overrides what, which can reveal real business differences.</li></ul><p>The pattern is genuinely reusable; the specific overlay for a real product is not shareable. Keep the article at the level of the resolver and the directory convention.</p><h3>Lessons learned</h3><ul><li><strong>Share the journey, vary the data.</strong> For a white‑label product the flow is the same across brands — write it once and let a resolver supply per‑brand data.</li><li><strong>Make fallback the default.</strong> A most‑specific‑to‑shared resolution hierarchy means a new brand inherits everything and overrides only what truly differs; shared data is never duplicated.</li><li><strong>Brand is a coordinate, not a branch.</strong> Key on the brand in paths, env‑var names, and filenames — process.env[${brand}_URL], env-brand-user.json — instead of if (brand === ...).</li><li><strong>Keep brand artifacts brand‑scoped.</strong> Putting the brand in every cache/report/session key stops tenants from colliding in shared runs.</li><li><strong>Express divergent rules as data, isolate real branches.</strong> Carry differing expectations in example tables or brand‑resolved files; when a real code branch is unavoidable, hide it behind a brand‑resolved page object, never an inline conditional.</li><li><strong>Genericise hard before publishing.</strong> Brand names, URLs, and the override matrix are commercial structure — share the mechanism, not the matrix.</li></ul><p>The trap of multi‑tenant testing is choosing between duplication and under‑coverage. The escape is to stop thinking in suites and start thinking in <em>one suite plus thin per‑tenant overlays</em>: shared journeys, a fallback resolver, and brand as a coordinate. One thing to maintain, N brands covered, and a directory tree that tells you exactly what’s actually different.</p><p><em>Written from real‑world experience building a large, multi‑environment Playwright suite. All brand names, URLs, business rules, and examples are invented, generic illustrations of the patterns described.</em></p><p><em>Originally published at </em><a href="https://laxminarayanaboga.github.io/articles/white-label-multi-tenant-testing.html"><em>https://laxminarayanaboga.github.io/articles/white-label-multi-tenant-testing.html</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb5e275ec19d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quality Gates Beyond Functional: Lighthouse and K6 in One Tag‑Driven Pipeline]]></title>
            <link>https://medium.com/@laxminarayanaboga4079/quality-gates-beyond-functional-lighthouse-and-k6-in-one-tag-driven-pipeline-0617020d8e45?source=rss-27e94dc3d581------2</link>
            <guid isPermaLink="false">https://medium.com/p/0617020d8e45</guid>
            <category><![CDATA[k6]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[playwright-test]]></category>
            <category><![CDATA[playwright-automation]]></category>
            <category><![CDATA[software-testing]]></category>
            <dc:creator><![CDATA[Laxminarayanaboga]]></dc:creator>
            <pubDate>Tue, 07 Jul 2026 19:56:00 GMT</pubDate>
            <atom:updated>2026-07-07T19:56:00.917Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>Functional tests tell you the feature works. They say nothing about whether the page is </em>fast enough<em> or the API </em>holds up under load<em>. Here’s how performance and budget checks become first‑class, tagged, gated members of the same suite — not separate tools nobody runs.</em></blockquote><p>A suite can be 3,000 functional tests deep and still ship a homepage that takes eight seconds to paint, or an API that falls over at 10 requests a second. Functional correctness and <em>non‑functional</em> quality are different axes, and most teams test only the first because the second lives in separate tools with separate runners that drift into disuse.</p><p>This article is about pulling two non‑functional gates — <strong>Lighthouse</strong> (page‑level performance, accessibility, SEO, best‑practices budgets) and <strong>K6</strong> (API load and throughput) — into the same model as everything else: tagged for selection, thresholds as assertions, reports as artifacts, failures that break the build. Low sensitivity; the patterns are generic.</p><h3>One pipeline, three kinds of gate</h3><p>The goal is a single mental model where functional, performance‑budget, and load checks are <em>the same kind of thing</em> — a tagged slice with a pass/fail gate — even though the engines underneath differ.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/0*WwfRLiFCm6BJaZhm.png" /></figure><p>The unifying idea: <strong>a threshold is just an assertion.</strong> A Lighthouse performance score below 0.90 should fail a test the same way a missing button does. A K6 p95 latency over budget should fail a run the same way a 500 does.</p><h3>Lighthouse: page budgets as assertions</h3><p>Lighthouse runs a real audit against a URL and returns category scores (performance, accessibility, best‑practices, SEO). On its own that’s a report. To make it a <em>gate</em>, you compare each score against a configured threshold and assert.</p><p><strong>Thresholds live as data</strong>, per device, with sensible shared defaults:</p><pre>const defaultThresholds = {<br>  performance:     0.90,<br>  accessibility:   0.90,<br>  &#39;best-practices&#39;:0.90,<br>  seo:             0.90,<br>};<br><br>export const thresholds = {<br>  desktop: { ...defaultThresholds },<br>  mobile:  { ...defaultThresholds /* override per device if needed */ },<br>};</pre><p><strong>The device profiles also live as data</strong> — throttling, form factor, screen emulation — so a “mobile” run faithfully simulates a constrained device instead of a developer’s gigabit laptop:</p><pre>export const lighthouseConfig = {<br>  mobile: {<br>    extends: &#39;lighthouse:default&#39;,<br>    settings: {<br>      formFactor: &#39;mobile&#39;,<br>      throttlingMethod: &#39;simulate&#39;,<br>      throttling: { /* FAST_4G-like profile */ },<br>      screenEmulation: { mobile: true, width: 360, height: 640, deviceScaleFactor: 2 },<br>    },<br>  },<br>  desktop: { extends: &#39;lighthouse:default&#39;, settings: { formFactor: &#39;desktop&#39;, /* ... */ } },<br>};</pre><p><strong>The step ties it together</strong>: run the audit, attach the HTML report, then assert every category against its budget.</p><pre>Given(&#39;Run lighthouse tests {string}, {string}&#39;, async ({ brand, $testInfo }, functionality, device) =&gt; {<br>  const url = `${process.env[`${brand}_URL`]}${pathFor(functionality)}`;<br><br>  const result = await runLighthouseTest(url, functionality, device);<br>  // Artifact: the full HTML report, attached to the run for humans<br>  const reportPath = await saveReport(brand, functionality, device, result.report);<br>  attachFileToReport($testInfo, reportPath, &#39;text/html&#39;, &#39;lighthouse report&#39;);<br>  // Gate: every category score must meet its budget, or the test fails<br>  validateScores(result, thresholds[device]);<br>});<br>function validateScores(result, budget) {<br>  const c = result.lhr.categories;<br>  expect(c.performance.score).toBeGreaterThanOrEqual(budget.performance);<br>  expect(c.accessibility.score).toBeGreaterThanOrEqual(budget.accessibility);<br>  expect(c[&#39;best-practices&#39;].score).toBeGreaterThanOrEqual(budget[&#39;best-practices&#39;]);<br>  expect(c.seo.score).toBeGreaterThanOrEqual(budget.seo);<br>}</pre><p>Now a performance regression on a key page fails CI like any other test — with the full Lighthouse report attached so you can see <em>why</em>.</p><blockquote><em>Keep budgets in data, not in the step. When a page legitimately needs a different bar, you edit a config object, not test logic — and the override is visible and reviewable.</em></blockquote><h3>K6: load thresholds as the pass/fail contract</h3><p>K6 answers a question Playwright can’t: <em>does the API hold up when hammered?</em> It runs outside the browser, generating concurrent traffic, and — crucially — has a built‑in <strong>thresholds</strong> concept that is itself the gate. If a threshold is breached, K6 exits non‑zero, which fails the pipeline.</p><p><strong>Scenarios as data</strong>, mirroring the suite‑as‑data philosophy — smoke, load, stress, spike — each a named load profile:</p><pre>const defaultConfig = {<br>  thresholds: {<br>    http_req_duration: [&#39;p(75)&lt;800&#39;, &#39;p(95)&lt;1200&#39;, &#39;p(99)&lt;1500&#39;],  // latency budget<br>    http_req_failed:   [&#39;rate&lt;0.05&#39;],                               // error budget<br>    http_reqs:         [&#39;count&gt;0&#39;],                                 // sanity: we actually sent traffic<br>  },<br>};<br><br>export const configurations = {<br>  smoke:  createConfig({ /* 1 TPS for 30s - does the test even work? */ }),<br>  load:   createConfig({ /* 3 TPS for 3m - normal expected load */ }),<br>  stress: createConfig({ /* 5 TPS for 5m - above normal */ }),<br>  spike:  createConfig({ /* 1→10→1 TPS - sudden surge */ }),<br>};</pre><p><strong>The runner picks scenario and environment from env vars</strong> — the same run‑contract pattern the functional containers use, so the <em>same script</em> runs locally and in CI against any environment:</p><pre>const environment = __ENV.ENVIRONMENT || &#39;local&#39;;<br>const scenario    = __ENV.SCENARIO    || &#39;smoke&#39;;<br><br>export const options = {<br>  ...configurations[scenario],<br>  thresholds: { ...configurations[scenario].thresholds },<br>};<br>export default function () {<br>  const res = http.post(`${environments[environment]}/endpoint`, payload);<br>  check(res, { &#39;status is 2xx&#39;: (r) =&gt; r.status &gt;= 200 &amp;&amp; r.status &lt; 300 });<br>}</pre><pre># Selecting a load profile is just two env vars — the gate is built in<br>k6 run -e ENVIRONMENT=preprod -e SCENARIO=load \<br>       runners/api-runner.js \<br>       --out json=performance-reports/results.json</pre><p>Because the thresholds <em>are</em> the exit code, you don’t write separate assertions — a breached latency or error budget fails the run by itself.</p><h3>Bonus: load tests that catch concurrency bugs</h3><p>K6’s concurrency is good for more than throughput numbers — it reproduces <strong>race conditions</strong> functional tests can’t. Fire several simultaneous requests that <em>should</em> be mutually exclusive (e.g. only one can succeed) and assert the business invariant holds under contention:</p><pre>// Send N concurrent requests for the same entity; exactly one should win.<br>// A functional test sends them one at a time and never sees the race.<br>const responses = http.batch(concurrentRequests);<br>const approved = responses.filter((r) =&gt; r.json(&#39;status&#39;) === &#39;APPROVED&#39;).length;<br>check(null, { &#39;exactly one approved under contention&#39;: () =&gt; approved === 1 });</pre><p>This is load tooling doing <em>correctness</em> work — the kind of bug that only appears when two requests arrive in the same millisecond.</p><h3>Folding both into the tag‑driven model</h3><p>Neither tool needs a bespoke pipeline. Each becomes a tagged suite in the same suite‑as‑data map that provisions every other slice:</p><pre>const testSuites = {<br>  lighthouse:  { tags: &quot;@lighthouse&quot;,   workers: 4,  cpu: 4, memory: 8192 },<br>  performance: { tags: &quot;@performance&quot;,  workers: 1,  cpu: 4, memory: 8192 }, // K6 manages its own concurrency<br>  regression:  { tags: &quot;@regression&quot;,   workers: 12, cpu: 8, memory: 16384 },<br>};</pre><p>The orchestrator runs them in the right order, archives their reports to the same object store, and alerts on failure through the same channel. Performance and load stop being “that thing we run before a big release” and become continuous gates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/0*jvrMNEXcJk9uMrP1.png" /></figure><h3>Lessons learned</h3><ul><li><strong>A threshold is just an assertion.</strong> A Lighthouse score below budget or a K6 latency over budget should fail the build exactly like a broken button does.</li><li><strong>Keep budgets and load profiles as data.</strong> Per‑device thresholds and named scenarios (smoke/load/stress/spike) make the bar visible, reviewable, and easy to tune without touching test logic.</li><li><strong>Simulate the constrained device.</strong> A “mobile” Lighthouse run with real throttling catches regressions a developer’s fast machine hides.</li><li><strong>Let K6 thresholds be the gate.</strong> Because a breached threshold exits non‑zero, the load contract enforces itself — no separate assertions needed.</li><li><strong>Use load for correctness, not just speed.</strong> Concurrent, mutually‑exclusive requests reproduce race conditions that sequential functional tests structurally cannot see.</li><li><strong>Reuse the tag pipeline for both.</strong> @lighthouse and @performance plug into the same selection, ordering, reporting, and alerting machinery — no parallel infrastructure to rot.</li></ul><p>Functional tests prove the software <em>does the right thing</em>. Lighthouse and K6, folded into the same tag‑driven pipeline, prove it does so <em>fast enough</em> and <em>under enough load</em> — and because they’re gated and continuous, those properties stop quietly regressing between releases.</p><p><em>Written from real‑world experience building a large, multi‑environment Playwright suite. All URLs, thresholds, scenarios, and examples are generic illustrations of the patterns described.</em></p><p><em>Originally published at </em><a href="https://laxminarayanaboga.github.io/articles/lighthouse-k6-quality-gates.html"><em>https://laxminarayanaboga.github.io/articles/lighthouse-k6-quality-gates.html</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0617020d8e45" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Accessibility Testing at Scale: From One‑Off axe Script to a Tagged, Gated, Reported Suite]]></title>
            <link>https://medium.com/@laxminarayanaboga4079/accessibility-testing-at-scale-from-one-off-axe-script-to-a-tagged-gated-reported-suite-3dae8369bc52?source=rss-27e94dc3d581------2</link>
            <guid isPermaLink="false">https://medium.com/p/3dae8369bc52</guid>
            <category><![CDATA[playwright-automation]]></category>
            <category><![CDATA[playwright-test]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[web-accessibility]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Laxminarayanaboga]]></dc:creator>
            <pubDate>Mon, 06 Jul 2026 15:56:01 GMT</pubDate>
            <atom:updated>2026-07-06T15:56:01.889Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>A single </em><em>axe-core script in a corner of the repo is easy to ignore. Wiring accessibility checks into the </em>same<em> tag‑driven, fixture‑backed, reported pipeline as your functional tests is what makes them actually stick.</em></blockquote><p>Most teams’ accessibility story is a script someone wrote once, ran a few times, and quietly abandoned. It lives outside the main suite, isn’t gated in CI, produces a report nobody reads, and rots. The technology — axe-core — is excellent. The <em>integration</em> is the problem.</p><p>This article is about treating accessibility as a first‑class citizen of a large Playwright‑BDD suite: a reusable step that any scenario can call, the same tags that drive functional execution, machine‑readable reports attached to every run, and a hard gate that fails the build on a violation. Low sensitivity throughout — nothing here is product‑specific.</p><h3>The shift: a checkpoint, not a separate suite</h3><p>The key mental move is to stop thinking of accessibility as “a kind of test” and start thinking of it as <strong>a checkpoint you can drop into any journey</strong>. A page worth functionally testing is a page worth scanning. So the scan becomes a reusable step, callable both as a standalone scenario <em>and</em> inline mid‑journey.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*poCWvnFfurOA7Kae.png" /></figure><h3>Step 1 — One reusable, fixture‑backed step</h3><p>The whole scan is a single BDD step that takes the current page (already navigated by whatever journey called it), a page name for reporting, and a device label. Because it&#39;s wired through the suite&#39;s fixtures, it inherits brand, env, and the report‑attachment helpers for free.</p><pre>import AxeBuilder from &#39;@axe-core/playwright&#39;;<br>const runAccessibilityTest = Given(<br>  &#39;Run accessibility tests pageName:{string} device: {string}&#39;,<br>  async ({ page, $testInfo, brand, env }, pageName, device) =&gt; {<br>    // 1. Scan the page exactly as the user currently sees it<br>    const results = await new AxeBuilder({ page }).analyze();<br>    // 2. Persist a machine-readable artifact, keyed by everything that varies<br>    await saveAccessibilityReport(brand, env, pageName, device, results);<br>    // 3. Attach violations to the live run report (visible in HTML/trace)<br>    await attachJsonDataToTestReport($testInfo, &#39;accessibility-scan-results&#39;, results.violations);<br>    // 4. The gate: zero violations or the test fails<br>    expect(results.violations).toEqual([]);<br>  }<br>);</pre><p>Two design choices do the heavy lifting:</p><ul><li><strong>It scans the <em>current</em> DOM.</strong> Because the step takes whatever page it&#39;s handed, it tests the page in its real, post‑interaction state — after cookies are accepted, a form is filled, a modal is open — not a cold initial load.</li><li><strong>expect(violations).toEqual([]) is the gate.</strong> A violation isn&#39;t a warning logged to a file nobody reads; it fails the test like any other assertion. Accessibility becomes non‑optional.</li></ul><h3>Step 2 — Call it two ways: standalone and inline</h3><p>The same step serves both audiences. A dedicated accessibility feature scans key pages in isolation:</p><pre>@accessibility @prod @qa @local @preprod<br>Feature: accessibility tests for application pages<br><br>Scenario Outline: a11y scan - page: &quot;&lt;pageName&gt;&quot;, device: &quot;&lt;device&gt;&quot;<br>    Given I access the application start page<br>    Given Run accessibility tests pageName:&quot;&lt;pageName&gt;&quot; device: &quot;&lt;device&gt;&quot;<br>    Examples:<br>      | pageName            | device  |<br>      | application-start   | desktop |<br>      | application-details | desktop |</pre><p>And a <em>functional</em> journey can drop the same checkpoint in mid‑flow, scanning each page as the user reaches it — accessibility coverage with zero extra navigation cost:</p><pre>await goToWelcomePage(page);<br>await runAccessibilityTest({ page, $testInfo, brand, env }, &#39;welcome-page&#39;, device);<br><br>await fillDetailsAndContinue(page);<br>await runAccessibilityTest({ page, $testInfo, brand, env }, &#39;details-page&#39;, device);</pre><p>This is the payoff of the reusable‑step design: every functional journey you already have is a potential accessibility journey, for free.</p><h3>Step 3 — Tags make a11y a slice of the pipeline, not a special case</h3><p>In a tag‑driven suite, accessibility is just another tag family member. The scenarios carry @accessibility alongside the usual environment tags, so the exact same execution machinery selects them:</p><pre># Run only the accessibility slice, preprod, skipping manual-only specs<br>npx bddgen --tags &quot;@accessibility and @preprod and not @manual&quot;<br>npx playwright test</pre><p>And because it’s a tag, it slots straight into the <strong>suite‑as‑data</strong> model that provisions cloud jobs — accessibility gets its own right‑sized batch with no new infrastructure:</p><pre>const testSuites = {<br>  accessibility: { tags: &quot;@accessibility&quot;, workers: 8, retries: 2, cpu: 4, memory: 8192 },<br>  // ...other functional suites<br>};</pre><p>No bespoke runner, no separate CI job to maintain. Accessibility runs, retries, reports, and alerts exactly like everything else.</p><h3>Step 4 — Reports as artifacts, not console noise</h3><p>A violation that scrolls past in a log is forgotten by lunch. Two outputs make findings durable and actionable:</p><p><strong>A persisted JSON file per scan</strong>, keyed by every dimension that matters, so results are diffable across runs and comparable across brands/devices:</p><pre>async function saveAccessibilityReport(brand, env, pageName, device, results) {<br>  const filepath = path.join(<br>    reportsDir,<br>    `${device}-${env}-${brand}-${pageName}.json`   // e.g. desktop-preprod-acme-checkout.json<br>  );<br>  await ensureDirectoryExistence(filepath);<br>  await fs.writeFile(filepath, JSON.stringify(results, null, 2));<br>}</pre><p><strong>An attachment on the live run report</strong>, so a failing test shows <em>which</em> rules failed right next to the trace and screenshot — no hunting through a separate folder.</p><p>The naming convention (device-env-brand-page.json) means a CI archive of these files is a complete, sortable accessibility snapshot of the whole product surface for that run.</p><h3>Step 5 — Tuning the gate without weakening it</h3><p>A zero‑tolerance gate is the goal, but real products have edge cases — a third‑party widget you don’t control, a known issue with a tracked fix. The disciplined ways to handle these, in order of preference:</p><ul><li><strong>Scope the scan</strong> to the part of the page you own, excluding an embedded third‑party region — rather than disabling the whole check.</li><li><strong>Disable a specific rule with a documented reason</strong>, never a blanket suppression. The intent stays visible in the test.</li><li><strong>Tag the known‑failing scenario</strong> so it’s tracked and reportable, not silently deleted.</li></ul><pre>const results = await new AxeBuilder({ page })<br>  .exclude(&#39;#third-party-widget&#39;)   // not ours to fix; scan everything else strictly<br>  .analyze();</pre><p>The principle: narrow the scope explicitly, never lower the bar silently. A suppression with a reason is a decision; a deleted assertion is a blind spot.</p><h3>Lessons learned</h3><ul><li><strong>Make the scan a reusable step, not a script.</strong> A single fixture‑backed step that any scenario can call turns every functional journey into potential accessibility coverage at no extra cost.</li><li><strong>Scan the live DOM, mid‑journey.</strong> Testing the page in its real post‑interaction state finds issues a cold initial‑load scan never will.</li><li><strong>Gate, don’t log.</strong> expect(violations).toEqual([]) makes accessibility a build‑failing assertion instead of a report nobody opens.</li><li><strong>Reuse the tag pipeline.</strong> @accessibility plugs straight into the same selection, parallelism, retry, and cloud‑provisioning machinery as functional tests — zero bespoke infrastructure.</li><li><strong>Persist keyed JSON artifacts.</strong> Reports named by device/env/brand/page are diffable, archivable, and give a full snapshot of the product surface per run.</li><li><strong>Narrow scope explicitly; never weaken the gate silently.</strong> Exclude a region or disable a rule <em>with a reason</em> — a documented decision beats a deleted assertion.</li></ul><p>Accessibility tooling has been solved for years; axe-core is rock‑solid. What fails is integration. Fold the scan into the same tagged, fixture‑backed, gated, reported pipeline your functional tests already run in, and accessibility stops being a periodic chore and becomes a property the suite continuously enforces.</p><p><em>Written from real‑world experience building a large, multi‑environment Playwright suite. All page names, brands, and examples are generic illustrations of the patterns described.</em></p><p><em>Originally published at </em><a href="https://laxminarayanaboga.github.io/articles/accessibility-testing-at-scale.html"><em>https://laxminarayanaboga.github.io/articles/accessibility-testing-at-scale.html</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3dae8369bc52" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond Mocking: Capturing Real Network Traffic and Validating Response Contracts]]></title>
            <link>https://medium.com/@laxminarayanaboga4079/beyond-mocking-capturing-real-network-traffic-and-validating-response-contracts-fcc27d2fdba5?source=rss-27e94dc3d581------2</link>
            <guid isPermaLink="false">https://medium.com/p/fcc27d2fdba5</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[playwright-test]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[playwright-automation]]></category>
            <dc:creator><![CDATA[Laxminarayanaboga]]></dc:creator>
            <pubDate>Sun, 05 Jul 2026 14:51:00 GMT</pubDate>
            <atom:updated>2026-07-05T14:51:00.870Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>Most teams use request interception to </em>fake<em> responses. The more powerful use is the opposite — let the real traffic flow, capture it, and assert that the page actually called the right APIs and got the right answers.</em></blockquote><p>Request mocking is the first thing people reach for with Playwright’s network layer: stub an endpoint, return canned JSON, test the UI in isolation. That’s useful. But it answers the wrong question for an end‑to‑end test. Mocking proves <em>“the page renders correctly when the API behaves”</em> — it says nothing about whether the API was even called, in the right order, with the right payload, returning the right shape.</p><p>This article is about using the same network primitives for <strong>observation and contract validation</strong> instead of substitution: attaching listeners during a real user journey, capturing the actual requests and responses, and asserting on them. It also covers the targeted, surgical use of mocking — forcing a failure you can’t otherwise reproduce. All endpoint and host names here are generic placeholders.</p><h3>Two modes of network control</h3><p>Playwright gives you two distinct hooks, and the distinction is the whole article:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/0*5tsf2Q2P9IrZcV5z.png" /></figure><ul><li><strong>page.on(&#39;request&#39;) / </strong><strong>page.on(&#39;response&#39;)</strong> are <em>passive listeners</em>. Traffic flows normally to and from the real backend; you simply get a callback for every request and response to inspect. Nothing is changed.</li><li><strong>page.route(pattern, handler)</strong> is an <em>active interceptor</em>. You decide what happens — fulfil with a fake body, change the status, or let it continue. This is mocking.</li></ul><p>The mistake is using route for everything. If your goal is to prove the system worked, you want to <em>watch</em>, not <em>replace</em>.</p><h3>Pattern 1 — Extract a value the UI never shows you</h3><p>The simplest observation use: a journey triggers a backend call that returns an identifier you need later (to query a database, to assert a side effect), but the UI never displays it. Attach a response listener, watch for that call, pull the value out.</p><pre>export const captureLeadIdFromSync = async ({ journeyData, runtimeCache }, page, loanId) =&gt; {<br>  page.on(&#39;response&#39;, async (response) =&gt; {<br>    // Watch for the sync call; only act on a successful one<br>    if (response.url().includes(&#39;/api/public/lead/sync&#39;) &amp;&amp; response.status() === 200) {<br>      const body = await response.json();<br>      const leadId = body.userData.leadId;<br>      journeyData[loanId].leadId = leadId;      // make it available downstream<br>      runtimeCache.LEAD_ID = leadId;<br>      console.log(`Captured leadId from network traffic: ${leadId}`);<br>    }<br>  });<br>};</pre><p>The test does nothing special afterward — it just runs the journey. The listener fires whenever that call happens, and the value lands in the cache for later steps to use. You’ve turned the network into a <strong>data source</strong> without touching the UI or the backend.</p><blockquote><em>Attach the listener </em>before<em> the navigation or action that triggers the call. Listeners only catch traffic that happens after they’re registered.</em></blockquote><h3>Pattern 2 — Validate the response contract during a real journey</h3><p>This is the heart of it. Instead of asserting only on what the screen shows, capture the API responses the page made and assert they match the <strong>contract</strong> you expect: the call happened, the status is right, the body has the right shape and values.</p><p>Start capturing into a buffer, run the journey, then assert on what was collected:</p><pre>When(&#39;I start capturing address and lead-processor responses&#39;, async ({ page, runtimeCache }) =&gt; {<br>  runtimeCache.capture = { addressFind: [], addressRetrieve: [], leadProcessor: [] };<br>const listener = async (response) =&gt; {<br>    const url = response.url();<br>    const status = response.status();<br>    const method = response.request().method();<br>    if (method === &#39;GET&#39; &amp;&amp; url.includes(&#39;/address/find&#39;)) {<br>      runtimeCache.capture.addressFind.push({ url, status });<br>    } else if (method === &#39;GET&#39; &amp;&amp; url.includes(&#39;/address/retrieve&#39;)) {<br>      runtimeCache.capture.addressRetrieve.push({ url, status });<br>    } else if (method === &#39;POST&#39; &amp;&amp; url.includes(&#39;/lead-processor&#39;)) {<br>      let body = null;<br>      try { body = await response.json(); } catch { body = null; }<br>      runtimeCache.capture.leadProcessor.push({ url, status, body });<br>    }<br>  };<br>  runtimeCache.captureListener = listener;   // keep a handle so we can detach later<br>  page.on(&#39;response&#39;, listener);<br>});</pre><p>The validation step then makes the assertions a mock could never make — that the page <em>actually reached the real services</em>:</p><pre>Then(&#39;I validate the captured network responses&#39;, async ({ page, runtimeCache }) =&gt; {<br>  const logs = runtimeCache.capture;<br>  try {<br>    // 1. The call happened at all. A zero-length buffer means the page never<br>    //    called the API — a real bug a UI-only assertion would miss entirely.<br>    expect(logs.addressFind.length,<br>      &#39;address/find was never called — the page did not trigger lookup, or the API is unreachable&#39;<br>    ).toBeGreaterThan(0);<br>    // 2. Every captured call returned a healthy status.<br>    for (const r of logs.addressFind) {<br>      expect(r.status, `address/find should return 200, got ${r.status}`).toBe(200);<br>    }<br>    // 3. The response body matches the expected contract.<br>    const last = logs.leadProcessor.at(-1);<br>    expect(last.body, &#39;lead-processor body should be valid JSON&#39;).toBeTruthy();<br>    expect(last.body.response).toBe(501);<br>    expect(last.body.message?.error).toBe(&#39;No matching product found!&#39;);<br>  } finally {<br>    page.off(&#39;response&#39;, runtimeCache.captureListener);   // always detach<br>  }<br>});</pre><p>Three classes of bug this catches that mocking and UI assertions both hide:</p><ul><li><strong>The silent no‑call.</strong> The page rendered “success,” but it never actually hit the endpoint. An empty capture buffer fails loudly.</li><li><strong>The wrong status.</strong> The screen swallowed a 500 and showed a cached state. The capture records the real status.</li><li><strong>The contract drift.</strong> The backend changed a field name or response code. Your UI happened to still render, but the <em>contract</em> broke — and the body assertion catches it.</li></ul><h3>Pattern 3 — Surgical mocking to force the unreachable failure</h3><p>Observation is the default, but mocking earns its place for one job: reproducing a failure you <em>cannot</em> trigger against the real backend on demand — a 500, an empty payload, a timeout. Here page.route is exactly right, scoped to a single endpoint:</p><pre>When(&#39;the repayable-amount API returns an empty body&#39;, async ({ page }) =&gt; {<br>  await page.route(&#39;**/api/public/payments/repayable-amount-calc&#39;, (route) =&gt;<br>    route.fulfill({ contentType: &#39;application/json&#39;, body: JSON.stringify({}) })<br>  );<br>});<br>When(&#39;the repayable-amount API returns a 500&#39;, async ({ page }) =&gt; {<br>  await page.route(&#39;**/api/public/payments/repayable-amount-calc&#39;, (route) =&gt;<br>    route.fulfill({ contentType: &#39;application/json&#39;, status: 500 })<br>  );<br>});</pre><p>Now you can assert the UI degrades gracefully — an error banner, a retry, a safe default — for conditions the real environment almost never produces. Keep these routes <strong>narrow</strong> (one URL pattern) and <strong>temporary</strong> (per test), so the rest of the journey still talks to the real system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/0*Ea5_DC8fnI86MUnQ.png" /></figure><h3>Lessons learned</h3><ul><li><strong>Default to observing, not replacing.</strong> Passive request/response listeners prove the system actually did the work; mocks only prove the UI renders when fed canned data.</li><li><strong>An empty capture buffer is a real failure.</strong> “The call never happened” is one of the most common — and most invisible — end‑to‑end bugs. Assert that expected traffic <em>occurred</em>.</li><li><strong>Validate the contract, not just the screen.</strong> Status codes and response‑body shape are part of the system’s behaviour; assert on them directly so backend drift fails your test, not production.</li><li><strong>Attach before you act; detach in a </strong><strong>finally.</strong> Listeners only catch traffic registered before the trigger, and leaked listeners across tests cause cross‑talk. Always clean up.</li><li><strong>Reserve </strong><strong>page.route for the unreproducible.</strong> Forcing a 500 or empty body is mocking&#39;s best use — scoped to one endpoint, for one test — so the rest of the journey stays real.</li><li><strong>Keep endpoint names out of assertions where you can.</strong> Match on stable path fragments, not full hosts, so tests survive environment and infrastructure changes.</li></ul><p>Mocking asks “does the page look right when I lie to it?” Observation asks “did the software actually do what it claimed?” For an end‑to‑end suite, the second question is the one worth answering — and the network layer answers it without you touching a single line of production code.</p><p><em>Written from real‑world experience building a large, multi‑environment Playwright suite. All endpoint names, hosts, payloads, and examples are generic illustrations of the patterns described.</em></p><p><em>Originally published at </em><a href="https://laxminarayanaboga.github.io/articles/network-interception-contract-validation.html"><em>https://laxminarayanaboga.github.io/articles/network-interception-contract-validation.html</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fcc27d2fdba5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Don’t Just Test the Screen: Verifying Database & Message Side Effects in Playwright]]></title>
            <link>https://medium.com/@laxminarayanaboga4079/dont-just-test-the-screen-verifying-database-message-side-effects-in-playwright-2c9cf827db18?source=rss-27e94dc3d581------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c9cf827db18</guid>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[playwright-test]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[playwright-automation]]></category>
            <dc:creator><![CDATA[Laxminarayanaboga]]></dc:creator>
            <pubDate>Sat, 04 Jul 2026 17:46:00 GMT</pubDate>
            <atom:updated>2026-07-04T17:46:00.724Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>A green UI assertion can hide a broken backend. Here’s how to drive the front end with Playwright and then assert on the database and message store to prove the </em>system<em> actually did the right thing.</em></blockquote><p>End‑to‑end tests usually stop at the surface: click the button, see the success banner, pass. But the banner only proves the <em>page</em> reacted — not that the order was written, the relational row was created, the document landed in the right collection, or the downstream record carries the right values. Some of the nastiest production bugs live precisely in that gap: the screen says “done,” the data says otherwise.</p><p>This article is about closing that gap. We’ll drive the UI with Playwright and then <strong>assert on backend side effects</strong> — relational rows and document‑store records — using connection fixtures, polling for asynchronous writes, and deep object matching. The result is a test that verifies the <em>system</em>, not just the view.</p><h3>The pattern: act on the UI, assert on the data</h3><p>The structure of a side‑effect test is always the same three beats:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FY-OUbmu29k6GafH.png" /></figure><p>The middle beat — <em>wait</em> — is what separates a reliable data assertion from a flaky one, because backend writes are rarely synchronous with the UI response. We’ll come back to it.</p><h3>Step 1 — Database access as a worker‑scoped fixture</h3><p>Opening a database connection per test would be slow and wasteful across thousands of tests. Instead, expose the connection as a <strong>worker‑scoped fixture</strong>: created once per worker process, reused by every test that worker runs, and closed automatically at the end.</p><pre>dbConnection: [async ({}, use) =&gt; {<br>  const db = new DbConnection();<br>  await db.connect();<br>  await use(db);        // shared across all tests in this worker<br>  await db.close();     // teardown when the worker finishes<br>}, { scope: &quot;worker&quot; }],<br><br>docStore: [async ({}, use) =&gt; {<br>  const store = DocStoreConnection.getInstance();<br>  await store.connect();<br>  await use(store);<br>  await store.close();<br>}, { scope: &quot;worker&quot; }],</pre><p>The connection wrapper itself stays thin — connect, run a parameterised query, close:</p><pre>class DbConnection {<br>  async query(sql, args) {<br>    const [rows] = await this.connection.execute(sql, args); // parameterised<br>    return rows;<br>  }<br>}</pre><blockquote><strong><em>Security note:</em></strong><em> always use </em>parameterised<em> queries (</em><em>execute(sql, args)), never string‑concatenate test values into SQL. Test code that builds queries from data is just as injectable as production code — and test data often comes from external sources.</em></blockquote><p>A test now requests the connection like any other dependency, with zero setup code:</p><pre>test(&quot;submitting the form persists an order&quot;, async ({ page, dbConnection }) =&gt; {<br>  await submitOrderForm(page);<br>  // ... assert against dbConnection<br>});</pre><h3>Step 2 — Poll for asynchronous writes (don’t sleep)</h3><p>The single biggest cause of flaky data assertions is asserting <em>too early</em>. The UI returns, the test queries the database, and the row isn’t there yet — because a queue, a worker, or an async handler hasn’t finished. The wrong fix is await wait(5000): too short and it&#39;s flaky, too long and it&#39;s slow.</p><p>The right fix is a <strong>poll‑until‑present</strong> helper that retries on an interval up to a timeout:</p><pre>async function pollForRecord(db, email, intervalMs = 2000, timeoutMs = 60000) {<br>  const deadline = Date.now() + timeoutMs;<br>  while (Date.now() &lt; deadline) {<br>    const rows = await db.query(<br>      &quot;SELECT * FROM orders WHERE customer_email = ? AND is_active = 1&quot;,<br>      [email]<br>    );<br>    if (rows.length &gt; 0) return rows;     // success — return as soon as it appears<br>    await wait(intervalMs);<br>  }<br>  throw new Error(`No active order appeared for ${email} within ${timeoutMs}ms`);<br>}</pre><p>This is the database equivalent of Playwright’s web‑first auto‑waiting: assert on a <em>condition becoming true</em>, not on a fixed delay. It’s fast when the write is fast, patient when it’s slow, and it fails with a clear message instead of a mysterious empty result.</p><pre>test(&quot;order is written to the database after submission&quot;, async ({ page, dbConnection }) =&gt; {<br>  const email = await submitOrderForm(page);<br>  const [order] = await pollForRecord(dbConnection, email);<br>  expect(order.status).toBe(&quot;active&quot;);<br>  expect(Number(order.amount)).toBe(250);<br>});</pre><h3>Step 3 — Deep‑match documents against expected data</h3><p>Relational checks are usually a few columns. Document stores are different: you often want to assert that a <em>whole nested document</em> matches an expected shape — but only the fields you care about, ignoring volatile ones like generated IDs and timestamps.</p><p>Hand‑writing dozens of expect(doc.a.b.c).toBe(...) lines is brittle. A better approach is a <strong>deep, partial matcher</strong> that compares an actual document against an expected fixture, with support for &quot;ignore this field&quot; markers:</p><pre>test(&quot;the stored document matches the expected shape&quot;, async ({ docStore }) =&gt; {<br>  const expected = await loadExpectedJson(&quot;order-created-expected.json&quot;);<br>  const actual   = await docStore.findLatestFor(testUser.email);<br><br>  // Partial deep match: every field in `expected` must match `actual`;<br>  // fields marked as &quot;#ignore&quot; (ids, timestamps) are skipped.<br>  match(actual, expected);<br>});</pre><pre>{<br>  &quot;type&quot;: &quot;ORDER_CREATED&quot;,<br>  &quot;customer&quot;: { &quot;email&quot;: &quot;buyer@example.test&quot;, &quot;tier&quot;: &quot;standard&quot; },<br>  &quot;amount&quot;:   250,<br>  &quot;id&quot;:        &quot;#ignore&quot;,<br>  &quot;createdAt&quot;: &quot;#ignore&quot;<br>}</pre><p>Keeping the expected shape as a <strong>data file</strong> (resolved through the same environment/variant fallback your other test data uses) means contributors update expectations by editing JSON, not test code — and the matcher reports the exact path of any mismatch (customer.tier: expected &#39;standard&#39;, got &#39;premium&#39;), which makes failures self‑explaining.</p><h3>Step 4 — Cleanup is part of the test, not an afterthought</h3><p>Side‑effect tests <em>create</em> side effects. Left unattended, those accumulate and eventually cause the very collisions that make suites flaky — a “user already exists,” a stale record matched by the next run. So cleanup must be reliable and, ideally, automatic.</p><p>Two complementary tactics:</p><p><strong>Targeted teardown via a fixture</strong> — the test declares what it touched, and a fixture removes it afterward regardless of outcome:</p><pre>cleanupCreatedOrders: async ({ dbConnection, testUser }, use) =&gt; {<br>  await use(new DoNothing());                 // setup: nothing<br>  await deactivateOrdersFor(dbConnection, testUser.email); // teardown: always<br>},</pre><p><strong>Defensive pre‑cleanup</strong> — before a test that depends on a clean slate, proactively neutralise any leftovers from prior runs using a forgiving (fuzzy) match across the identifiers a user might be recognised by:</p><pre>async function purgeLeftovers({ db, docStore, user }) {<br>  await clearDocCacheFor(docStore, user);            // doc store<br>  const ids = await findRelatedIds(db, user);        // fuzzy: email, phone, name+dob<br>  if (ids.length === 0) return;<br>  await deactivateOrders(db, ids);<br>  await deleteAuthRecord(ids[0]);<br>  await deactivateProfiles(db, ids);<br>}</pre><blockquote><em>The fuzzy‑match cleanup matters because real systems recognise the same person through several keys (email, normalised phone, name + date of birth + postcode). Cleaning by a single key leaves orphans that the </em>next<em> test trips over. Match the way the system matches.</em></blockquote><h3>Putting it together</h3><p>A complete side‑effect test reads as one clear story — act, wait, assert across layers, and let teardown clean up:</p><pre>test(&quot;a completed purchase is consistent across UI, database, and document store&quot;,<br>  async ({ page, dbConnection, docStore, cleanupCreatedOrders }) =&gt; {<br>    // ACT — front end<br>    const email = await completePurchase(page);<br>    await expect(page.getByText(&quot;Order confirmed&quot;)).toBeVisible();<br>    // WAIT + ASSERT - relational<br>    const [order] = await pollForRecord(dbConnection, email);<br>    expect(order.status).toBe(&quot;active&quot;);<br>    // ASSERT - document store<br>    const doc = await docStore.findLatestFor(email);<br>    match(doc, await loadExpectedJson(&quot;order-created-expected.json&quot;));<br>    // CLEANUP happens automatically via the fixture<br>  }<br>);</pre><p>The UI assertion proves the user saw success; the database and document assertions prove the <em>system</em> delivered it. That’s the difference between testing the screen and testing the software.</p><h3>Lessons learned</h3><ul><li><strong>A green UI isn’t proof of a correct backend.</strong> Assert on the data the action was supposed to produce, not just the banner that says it did.</li><li><strong>Share connections per worker.</strong> Worker‑scoped fixtures give you pooling for free and guarantee the connection is closed.</li><li><strong>Poll, never sleep.</strong> Retry until the asynchronous write appears, with a clear timeout error — the data‑layer equivalent of auto‑waiting.</li><li><strong>Deep‑match documents from data files.</strong> A partial matcher with “ignore” markers keeps assertions robust against volatile fields and lets non‑coders maintain expectations.</li><li><strong>Clean up the way the system identifies users.</strong> Fuzzy, multi‑key cleanup (and teardown fixtures) prevent the orphaned records that make suites flaky over time.</li><li><strong>Parameterise every query.</strong> Test SQL is production‑grade attack surface; never concatenate values.</li></ul><p>Reaching past the browser into the database and message store turns “it looked like it worked” into “it provably worked.” For the journeys that really matter, that extra layer of truth is what makes an end‑to‑end test actually end‑to‑end.</p><p><em>Written from real‑world experience building a large, multi‑environment Playwright suite. All names, values, schema, and examples are generic illustrations of the patterns described.</em></p><p><em>Originally published at </em><a href="https://laxminarayanaboga.github.io/articles/database-side-effect-assertions.html"><em>https://laxminarayanaboga.github.io/articles/database-side-effect-assertions.html</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c9cf827db18" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The HTTP QUERY Method — The First Genuinely New HTTP Verb in Sixteen Years]]></title>
            <link>https://medium.com/@laxminarayanaboga4079/the-http-query-method-the-first-genuinely-new-http-verb-in-sixteen-years-92a30f8075a3?source=rss-27e94dc3d581------2</link>
            <guid isPermaLink="false">https://medium.com/p/92a30f8075a3</guid>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[rest-api]]></category>
            <dc:creator><![CDATA[Laxminarayanaboga]]></dc:creator>
            <pubDate>Thu, 02 Jul 2026 23:02:24 GMT</pubDate>
            <atom:updated>2026-07-02T23:02:24.862Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>HTTP almost never learns a new word. For nearly thirty years, </em><em>GET has been the only honest way to </em>ask<em> the web a question — and it can&#39;t carry a body — so we lied, sending </em><em>POST for searches and pretending they weren&#39;t mutations. In June 2026, </em><strong><em>RFC 10008</em></strong><em> ended that with </em><em>QUERY: a request that carries a body yet stays </em>safe, idempotent, and cacheable<em>. Here&#39;s why it matters, and how it fits alongside the methods you already know.</em></blockquote><p>Here’s the part that makes QUERY a story and not a footnote: <strong>the HTTP method set barely moves in a career.</strong> The vocabulary was frozen a generation ago.</p><pre>Year      HTTP version / RFC   Methods introduced                  <br>--------  -------------------  ------------------------------------<br>1991      HTTP/0.9             GET                                 <br>1996      HTTP/1.0 — RFC 1945  HEAD, POST                          <br>1997      HTTP/1.1 — RFC 2068  PUT, DELETE, OPTIONS, TRACE, CONNECT<br>2010      RFC 5789             PATCH                               <br>**2026**  **RFC 10008**        **QUERY**</pre><p>After HTTP/1.1 in 1997, the core set essentially stopped changing. The <em>only</em> broadly adopted general-purpose method added in the twenty-nine years since was <strong>PATCH (2010)</strong>. (WebDAV bolted on PROPFIND, MKCOL, COPY and friends in between, but those are a niche extension — not verbs a typical REST API ever touches.) So however you count it, QUERY is a landmark:</p><ul><li>the <strong>first new general-purpose HTTP method in ~16 years</strong>, since PATCH; and</li><li>the first new <strong>safe</strong> method — a new way to <em>read</em> — since HTTP/1.1 in <strong>1997</strong>.</li></ul><p><strong>So why now?</strong> Because the workaround finally got too expensive. The web became read-heavy and API-first: faceted search, GraphQL-style queries, analytics filters, policy and feature-flag lookups, and now semantic/vector search all send <em>large, structured read payloads</em>. Teams reached for the only verb that carries a body — POST — and paid for the lie: POST tells every cache, proxy, and retry layer <em>&quot;this changes state — don&#39;t cache me, don&#39;t repeat me,&quot;</em> so a read-only search loses edge caching, loses safe retries, and buries its filter — often full of account numbers and other sensitive fields — in a request the whole stack treats as a mutation. Two things finally made the fix practical: caches and CDNs matured to key on request bodies, and HTTP&#39;s semantics were cleanly re-specified in <strong>RFC 9110 (2022)</strong>, separating a method&#39;s <em>properties</em> (safe / idempotent / cacheable) from the method itself — leaving a neatly labelled slot for a safe, idempotent, cacheable verb that carries a body.</p><p>Before we get to QUERY itself, a quick, honest tour of the methods it joins.</p><h3>The standard HTTP methods, by their real properties</h3><p>There are nine registered methods most teams touch. What matters for testing isn’t the verb’s name — it’s three properties that govern how the whole network treats it:</p><ul><li><strong>Safe</strong> — the request is not <em>intended</em> to change server state. Safe requests can be pre-fetched, retried freely, and are assumed side-effect-free.</li><li><strong>Idempotent</strong> — making the request N times has the same effect as making it once. This is what lets a client (or a proxy, or a mobile network) retry after a timeout without fear.</li><li><strong>Cacheable</strong> — a response may be stored and reused for later equivalent requests.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*2Hu_rht5MkE-fzfEGH3EiQ.png" /></figure><p>A few things worth internalising as a tester:</p><ul><li><strong>PATCH is not idempotent</strong> by default. PUT replaces (send it twice, same result); PATCH applies a delta ({&quot;balance&quot;: &quot;+100&quot;} applied twice is a real bug). Test them differently.</li><li><strong>DELETE is idempotent, not safe.</strong> Deleting an already-deleted resource should still land you in a &quot;gone&quot; state — a second DELETE returning 404 instead of 204 is a classic idempotency smell.</li><li><strong>OPTIONS is where CORS pre-flight happens.</strong> If a browser client &quot;randomly&quot; fails, check whether the pre-flight OPTIONS was answered correctly before blaming the real call.</li><li><strong>TRACE should usually be off.</strong> If it&#39;s enabled, that&#39;s a finding, not a feature (Cross-Site Tracing).</li></ul><h3>The same methods, on one resource</h3><p>Properties are abstract until you watch them on a real endpoint. Here’s a /users collection walked through the verbs you&#39;ll actually test — pay attention to what happens on the <strong>second</strong> identical call:</p><pre># READ — safe, cacheable, no body. Ask as often as you like; nothing changes.<br>GET    /users/42        →  200  { &quot;id&quot;: 42, &quot;name&quot;: &quot;Ada&quot;, &quot;tier&quot;: &quot;gold&quot; }<br># CREATE - NOT idempotent. Send it twice, get two users.<br>POST   /users           { &quot;name&quot;: &quot;Ada&quot; }   →  201  Location: /users/42<br>POST   /users           { &quot;name&quot;: &quot;Ada&quot; }   →  201  Location: /users/43   ⚠ duplicate<br># REPLACE - idempotent. The resource becomes exactly this body, every time.<br>PUT    /users/42        { &quot;name&quot;: &quot;Ada&quot;, &quot;tier&quot;: &quot;silver&quot; }  →  200<br>PUT    /users/42        { &quot;name&quot;: &quot;Ada&quot;, &quot;tier&quot;: &quot;silver&quot; }  →  200   ✓ same end state<br># PARTIAL UPDATE - the verb can be idempotent, but the PAYLOAD decides.<br>PATCH  /users/42        { &quot;tier&quot;: &quot;platinum&quot; }   →  200   ✓ absolute value, safe to repeat<br>PATCH  /users/42        { &quot;loginCount&quot;: &quot;+1&quot; }   →  200   ⚠ relative op, NOT idempotent<br># DELETE - idempotent. Gone stays gone.<br>DELETE /users/42        →  204<br>DELETE /users/42        →  404 (or 204) - either way, 42 is still gone</pre><p>The three write verbs are where teams get burned, and nearly every one of those bugs is an <strong>idempotency</strong> bug:</p><ul><li><strong>POST is not idempotent — treat every retry as dangerous.</strong> A timeout on POST /payments doesn&#39;t tell you whether the charge landed. Retry blindly and you double-charge. The fix isn&#39;t &quot;never retry,&quot; it&#39;s an <strong>idempotency key</strong>: the client sends a unique key, the server records it, and a repeat with the same key returns the <em>original</em> result instead of acting again. Test that a retried POST with the same key creates <strong>one</strong> record, not two.</li><li><strong>PUT replaces, and must be idempotent — so prove it is.</strong> PUT /users/42 should leave the resource in <em>exactly</em> the body you sent, whether you send it once or five times. A PUT that appends, increments, or silently preserves fields you omitted is a broken PUT. The classic bug: omitting tier and finding the old value still there.</li><li><strong>PATCH is only as idempotent as its payload.</strong> A patch of absolute values ({&quot;tier&quot;:&quot;platinum&quot;}) is safe to replay. A patch of <em>relative</em> operations ({&quot;balance&quot;:&quot;+100&quot;}, or JSON Patch add/remove) is not — replay it and the balance keeps climbing. This is the single most-missed distinction in API tests.</li></ul><p>The rule of thumb to encode: <strong>GET </strong><strong>HEAD </strong><strong>PUT </strong><strong>DELETE are safe to retry; </strong><strong>POST and </strong><strong>PATCH are not — assume nothing.</strong> When a proxy, mobile network, or retry layer repeats a request on your behalf, that line is the difference between a resilient system and a double-charged customer.</p><p>Notice the top of the methods table: only GET and HEAD are safe, idempotent <em>and</em> cacheable — and neither can carry a body. That is the exact, decades-old gap QUERY closes.</p><h3>Enter QUERY (RFC 10008, June 2026)</h3><p>QUERY is best understood in one line: <strong>it is </strong><strong>GET with a request body, done honestly.</strong> The spec grants it the properties reads have always wanted together:</p><ul><li><strong>Safe</strong> — a server MUST NOT treat a QUERY as a request to change the target resource&#39;s state.</li><li><strong>Idempotent</strong> — it can be retried or repeated without additional effect.</li><li><strong>Cacheable</strong> — a cache MAY store the response and use it to satisfy later equivalent QUERY requests.</li><li><strong>Carries a body</strong> — the query itself travels in the request content, with a Content-Type. Servers MUST reject the request if Content-Type is missing (400) or unsupported (415).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/0*lCFK4a2FlwG5azZM.png" /></figure><p>A request looks exactly like the POST you&#39;d write today — but the verb now tells the truth:</p><pre>QUERY /v1/transactions HTTP/1.1<br>Host: api.example-bank.com<br>Content-Type: application/json<br>Accept: application/json<br><br>{<br>  &quot;accountIds&quot;: [&quot;acc_1029&quot;, &quot;acc_3841&quot;, &quot;acc_7720&quot;],<br>  &quot;dateRange&quot;: { &quot;from&quot;: &quot;2026-01-01&quot;, &quot;to&quot;: &quot;2026-06-30&quot; },<br>  &quot;amount&quot;: { &quot;min&quot;: 500.00, &quot;currency&quot;: &quot;GBP&quot; },<br>  &quot;categories&quot;: [&quot;card_payment&quot;, &quot;direct_debit&quot;],<br>  &quot;risk&quot;: { &quot;flagged&quot;: true }<br>}</pre><p>Two response details are new and worth testing for:</p><ul><li><strong>Content-Location</strong> — a successful response MAY include a Content-Location header pointing at a URL that represents <em>these results</em>. Clients (and caches) can then GET that URL later without resending the body. It turns an expensive query into a shareable, cacheable resource.</li><li><strong>Accept-Query</strong> — a server can advertise which query formats it understands via the Accept-Query response field, so clients can negotiate (application/json, application/sql, a custom filter grammar, etc.).</li></ul><p>And the one that will bite you if you skim the RFC: <strong>the cache key MUST incorporate the request body and its metadata.</strong> For GET, the cache key is essentially the URL. For QUERY, two requests to the same URL with <em>different bodies</em> are different queries — the cache has to key on the body too, or it will serve one customer&#39;s results to another.</p><h3>Why fintech should care more than most</h3><p>This isn’t just tidier semantics. For a regulated, high-volume financial API, QUERY touches three things auditors and SREs care about.</p><p><strong>1. Sensitive data leaves the URL.</strong> Account numbers, card BINs, customer identifiers, date-of-birth filters — anything you put in a GET query string is logged everywhere: load-balancer access logs, CDN logs, APM traces, the browser&#39;s history, and the Referer header sent to third parties. Moving the filter into a QUERY body keeps PII and PAN-adjacent data out of URLs by default. That&#39;s a direct, demonstrable control for <strong>PCI-DSS</strong> and <strong>GDPR</strong> data-minimisation reviews.</p><p><strong>2. Honest idempotency means safe retries.</strong> Reconciliation jobs, statement generation, and reporting pipelines re-run constantly and retry on flaky networks. When a search is a POST, every retry layer has to <em>assume</em> it might be a write and either refuse to retry or build bespoke idempotency-key plumbing. QUERY is idempotent by contract — the mobile client, the service mesh, and the batch runner can all retry a timed-out search safely.</p><p><strong>3. Expensive reads become cacheable again.</strong> “Show me this account’s last 90 days, filtered six ways” is costly to compute and often repeated verbatim (pagination, refreshes, dashboards). Under POST you can&#39;t cache it at the edge without lying to your caches. QUERY lets a CDN or reverse proxy cache the response keyed on the body — provided that keying is correct, which is exactly the thing your tests must prove.</p><h3>What it changes for API testing</h3><p>Not much mechanically — and that’s the point. QUERY is just a method string, so fetch, curl, Playwright&#39;s request, and k6 all send it today by setting the method:</p><pre>await request.fetch(url, {<br>  method: &quot;QUERY&quot;,<br>  headers: { &quot;Content-Type&quot;: &quot;application/json&quot; },<br>  data: filter,<br>});</pre><p>Only two assertions are genuinely new, and both are cheap:</p><ul><li><strong>Safety + idempotency</strong> — fire the same QUERY twice; assert server state is unchanged and both responses match. A QUERY that mutates is a bug <em>and</em> a security issue.</li><li><strong>The cache keys on the body</strong> — send two <em>different</em> bodies to the same URL and assert they don’t return each other’s cached results. Get this wrong in fintech and the edge serves account A’s data in response to account B’s query. It’s the one test I’d never skip.</li></ul><p>Everything else is negative-path coverage you already write: missing/unsupported Content-Type → 400/415, and — during the transition — old proxies and gateways answering 405/501, which your client should feature-detect and fall back from to POST.</p><h3>Lessons learned</h3><ul><li><strong>The verb is a contract with the whole network, not just the server.</strong> GET, POST, PUT, PATCH, DELETE each promise something to every cache and retry layer in the path. Most production bugs on the write verbs are really <em>idempotency</em> bugs — POST retried into a duplicate, a PATCH of relative values replayed one time too many.</li><li><strong>A new HTTP method is a rare event — take it seriously.</strong> QUERY is the first new general-purpose verb since PATCH in 2010, and the first new <em>safe</em> one since 1997. The method set barely moves in a career; when it does, it&#39;s because a workaround finally became too costly to keep pretending about.</li><li><strong>QUERY is </strong><strong>GET with a body, done honestly.</strong> Reach for it when you&#39;re <em>reading</em> with a filter too large or too sensitive for a URL — and stop paying the caching and idempotency tax that POST-for-search always charged.</li><li><strong>In fintech, the headline win is data staying out of URLs</strong>, with idempotent retries and edge caching close behind. The one test to never skip: two different bodies to the same URL must never share a cached response.</li></ul><p>POST-for-search was always a workaround we agreed to stop noticing. QUERY removes the excuse — the first time in most of our careers that HTTP has learned a new way to ask a question.</p><p><em>Written from real-world experience testing financial APIs at scale. RFC 10008 (“The HTTP QUERY Method”) was published by the IETF in June 2026; all endpoints, hosts, and payloads here are generic illustrations.</em></p><p><em>Originally published at </em><a href="https://laxminarayanaboga.github.io/articles/http-query-method-rfc-10008.html"><em>https://laxminarayanaboga.github.io/articles/http-query-method-rfc-10008.html</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92a30f8075a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>