<?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 Asis Alimi on Medium]]></title>
        <description><![CDATA[Stories by Asis Alimi on Medium]]></description>
        <link>https://medium.com/@azeezaalimi?source=rss-6d5bf1287bdf------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*by7pPqxTmZfUS6_a</url>
            <title>Stories by Asis Alimi on Medium</title>
            <link>https://medium.com/@azeezaalimi?source=rss-6d5bf1287bdf------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 14:51:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@azeezaalimi/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[Day 13— Refactor & Retrospective in Test Automation]]></title>
            <link>https://medium.com/@azeezaalimi/day-13-refactor-retrospective-in-test-automation-41dad0c9f804?source=rss-6d5bf1287bdf------2</link>
            <guid isPermaLink="false">https://medium.com/p/41dad0c9f804</guid>
            <category><![CDATA[faang]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[Asis Alimi]]></dc:creator>
            <pubDate>Tue, 17 Jun 2025 12:08:20 GMT</pubDate>
            <atom:updated>2025-06-17T12:08:20.287Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is refactoring in QA automation?</h3><p>Refactoring is the process of restructuring existing test code without changing its external behaviour. The goal is to improve readability, maintainability and scalability of your tests.</p><h4>Why refactor?</h4><ul><li>Reduce code duplication</li><li>Make tests easier to maintain</li><li>Improve test reliability</li><li>Support long-term scalability as new features are added</li><li>Follow SOLID and DRY principles</li></ul><h4>What can be refactored?</h4><ul><li>Common setup logic - Move api context creation to beforeEach or utility module</li><li>Repeated test data - Extract JSON fixtures or constants</li><li>Assertion blocks - Use helper methods like validateBooking()</li><li>Harcoded values - Replace with data-driven inputs or config files</li><li>Test naming - Rename for clarity (e.g. should create a booking with valid payload)</li><li>Long test files - Split large tests into smaller suites based on endpoint or feature</li></ul><h3>Example (Before vs after refactor)</h3><h4>Before:</h4><pre>test(&#39;Booking Creation&#39;, async () =&gt; {<br>  const response = await context.post(&#39;/booking&#39;, {<br>    data: {<br>      firstname: &#39;John&#39;,<br>      lastname: &#39;Doe&#39;,<br>      ...<br>    },<br>  });<br>  expect(response.status()).toBe(200);<br>  const body = await response.json();<br>  expect(body.booking.firstname).toBe(&#39;John&#39;);<br>});</pre><h4>After refactor:</h4><pre>import { validBooking } from &#39;../data/bookings.json&#39;;<br>import { createBooking, validateBooking } from &#39;../utils/bookingHelpers&#39;;<br><br>test(&#39;Create booking with valid payload&#39;, async () =&gt; {<br>  const booking = await createBooking(context, validBooking);<br>  validateBooking(booking, validBooking);<br>});</pre><h3>What is a retrospective in test automation?</h3><p>A retrospective is a structured reflection on what went well, what didn’t and what could be improved after a sprint or milestone.</p><h4>When to run a retrospective?</h4><ul><li>After completing a sprint of test writing</li><li>After a major bug was missed</li><li>After the test refactoring</li><li>After an integration or production release</li></ul><h3>Retrospective questions for a QA automation engineer</h3><ul><li>What went well? - Did the automated test catch any critical bugs before the release?</li><li>What didn’t go well? - Were some test failures flaky? Did we duplicate logic?</li><li>What can be improved? - Should we convert hardcoded tests to data-driven ones? Should we enhance coverage on edge cases?</li></ul><h3>Summary</h3><ul><li>Refactor - Clean, modular, DRY test code</li><li>Retrospective - Constant improvement in QA practices</li><li>Test efficiency - Clean tests =. faster builds, fewer bugs, higher trust in automation</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41dad0c9f804" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 12 — Test Reports & CI]]></title>
            <link>https://medium.com/@azeezaalimi/day-12-test-reports-ci-65180d9ba8bd?source=rss-6d5bf1287bdf------2</link>
            <guid isPermaLink="false">https://medium.com/p/65180d9ba8bd</guid>
            <category><![CDATA[playwrights]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <dc:creator><![CDATA[Asis Alimi]]></dc:creator>
            <pubDate>Mon, 16 Jun 2025 13:09:10 GMT</pubDate>
            <atom:updated>2025-06-16T13:09:10.801Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 12 — <strong>Test Reports &amp; CI</strong></h3><p>As part of building a scalable QA automation framework, it’s essential to integrate test reporting and continuous integration. These two elements ensure visibility, traceability, and early detection of issues across development cycles.</p><h3>What is test reporting?</h3><p>A good test report answers the question: “What passed, what failed and why?”</p><p>In my Playwright-based API and UI automation projects, I utilise allure reports for clean, visual output that’s easy to share with developers, stakeholders, or project managers (PMs).</p><h4>Key benefits:</h4><ul><li>Clear breakdown of passed/failed/skipped tests</li><li>Rich error logs with screenshots and API payloads</li><li>Timeline view to monitor execution time</li><li>Ability to attach environment info and steps</li></ul><h4>Playwright allure setup example:</h4><pre>npx playwright test --reporter=line,allure-playwright<br>npx allure generate ./allure-results --clean<br>npx allure open</pre><h3>What is continuous integration?</h3><p>Continuous integration (CI) is the practice of automatically running tests every time new code is pushed to your repository. It ensures you catch bugs early, enforce code quality, and prevent regressions before merging to main branches.</p><p>I’ve used CI tools like:</p><ul><li>Github actions</li><li>Jenkins</li></ul><p>These tools help run Playwright tests on every push or pull request.</p><h4>Example: GitHub actions workflow for Playwright + Allure</h4><ul><li>Check out your code</li><li>Install dependencies</li><li>Run Playwright tests</li><li>Generate Allure report</li><li>Publish the report to GitHub Pages or another server</li></ul><pre>name: Run Playwright Tests<br><br>on:<br>  push:<br>    branches: [main]<br><br>jobs:<br>  test:<br>    runs-on: ubuntu-latest<br>    steps:<br>      - uses: actions/checkout@v3<br>      - name: Install deps<br>        run: npm install<br>      - name: Run tests<br>        run: npx playwright test --reporter=dot,allure-playwright<br>      - name: Generate report<br>        run: |<br>          npx allure generate ./allure-results --clean<br>          npx allure open</pre><h3>Summary</h3><p>Integration Allure reports and CI into your QA pipeline:</p><ul><li>Builds trust across teams</li><li>Speeds up feedback cycles</li><li>Gives your automation framework the professional polish it needs for production-grade systems</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65180d9ba8bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 11 — Mastering API Mocking and Service Virtualisation in Automated Testing]]></title>
            <link>https://medium.com/@azeezaalimi/day-11-mastering-api-mocking-and-service-virtualisation-in-automated-testing-a7246311138d?source=rss-6d5bf1287bdf------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7246311138d</guid>
            <category><![CDATA[internet]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[playwright-automation]]></category>
            <dc:creator><![CDATA[Asis Alimi]]></dc:creator>
            <pubDate>Thu, 05 Jun 2025 11:59:35 GMT</pubDate>
            <atom:updated>2025-06-05T11:59:35.942Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 11 — Mastering API Mocking and Service Virtualisation in Automated Testing</h3><h3>What is API mocking?</h3><p>API mocking refers to simulating a backend service by intercepting a request and returning a predefined response, rather than making a real network call.</p><p>This allows us to:</p><ul><li>Test the frontend logic before the backend is ready</li><li>Simulate unusual conditions (e.g. 500 errors, timeout)</li><li>Isolate flaky APIs to make UI tests more stable</li></ul><p>In Playwright, this is achieved using page.route():</p><pre>await page.route(&#39;**/api/cart&#39;, async route =&gt; {<br>  await route.fulfill({<br>    status: 200,<br>    contentType: &#39;application/json&#39;,<br>    body: JSON.stringify({ items: [{ id: 1, name: &#39;Laptop&#39; }] }),<br>  });<br>});</pre><h3>What is service virtualisation?</h3><p>Service virtualisation goes a step further. It simulates full-service behaviour, including dynamic responses, based on rules or historical data.</p><p>Think of it as “smart mocking”.</p><p>It’s commonly used when:</p><ul><li>APIs depend on third-party services</li><li>Integration environments are hard to replicate</li><li>Backend systems are costly to invoke (e.g. payments or booking APIs)</li></ul><p>Popular tools include WireMock, Mountebank, Postman Mock Servers and Mockoon.</p><h3>Contract Testing: Ensuring we’re speaking the same language</h3><p>In contract testing, we ensure that:</p><ul><li>The API provider and consumer agree on the structure (schema) of the data</li><li>Required fields, types, and response formats are consistent</li></ul><p>Benefits:</p><ul><li>Avoids integration bugs</li><li>Enables independent development</li><li>Catch breaking changes early</li></ul><p>Example tools: Pact, Postman schema validators, Swagger + Dredd</p><h3>When should you mock APIs?</h3><ul><li>UI blocked by unfinished backend - Enables frontend progress</li><li>The backend response is flaky or unavailable - Prevent false test failures</li><li>Want to simulate edge cases or errors - Simulate 403, 500, timeouts</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7246311138d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 10 — Mastering Waits, Flakiness, and Visibility in UI Test Automation]]></title>
            <link>https://medium.com/@azeezaalimi/day-10-mastering-waits-flakiness-and-visibility-in-ui-test-automation-c5e3ee38f18a?source=rss-6d5bf1287bdf------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5e3ee38f18a</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[internet]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[playwrights]]></category>
            <dc:creator><![CDATA[Asis Alimi]]></dc:creator>
            <pubDate>Wed, 04 Jun 2025 16:11:00 GMT</pubDate>
            <atom:updated>2025-06-04T16:11:00.858Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 10 — Mastering Waits, Flakiness, and Visibility in UI Test Automation</h3><h3><strong>Waits: Synchronising with your application</strong></h3><p>Waits are mechanisms that ensure your test code pauses until the application is ready to proceed. Without proper waits, your test might click buttons or assert elements before they exist.</p><h4>Types of waits</h4><ul><li><strong>Hard waits</strong></li></ul><p>Example: page.waitForTimeout(3000)</p><p>Bad practice. This sleeps for 3 seconds, regardless of whether the app is ready.</p><ul><li><strong>Explicit waits</strong></li></ul><p>Example: await expect(page.locator(‘button.checkout’)).toBeVisible()</p><p>This waits until the element meets a condition like visibility or state.</p><ul><li><strong>Auto-waits</strong></li></ul><p>Playwright intelligently waits for actions like like clicks or fills to be safe before executing them.</p><h3>Flakiness: The silent test killer</h3><p>Flaky test passes or fail unpredictably, often due to poor synchronisation or unstable application behaviour.</p><h4>Common causes:</h4><ul><li>Elements not rendered yet</li><li>Animations or loading spinners are still in progress</li><li>Race conditions between the frontend and the backend</li><li>Data not cleaned or reused across tests</li></ul><h4>Solutions:</h4><ul><li>Use playwrights expect(locator).toBeVisible() instead of waitForTimeout</li><li>Prefer stable, non-dynamic locators (e.g. data-test IDs)</li><li>Use mocks or seed test data</li><li>Isolate tests from each other</li><li>Avoid inter-test dependencies</li></ul><h3>Visibility: Just because it’s there doesn’t mean it’s ready</h3><p>Many UI elements exist in the DOM but are hidden from the user (e.g. behind a modal, not scrolled into view).</p><h4>Best Practices:</h4><ul><li>Always check visibility, not just presence</li></ul><pre>await expect(page.locator(&#39;#error&#39;)).toBeVisible();</pre><ul><li>Test conditional rendering (modals, popups)</li><li>Assert the actual user experience, not just what the browser renders</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5e3ee38f18a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 9 — Mastering Auth & Negative Testing in API Automation]]></title>
            <link>https://medium.com/@azeezaalimi/day-9-mastering-auth-negative-testing-in-api-automation-42ed90df5694?source=rss-6d5bf1287bdf------2</link>
            <guid isPermaLink="false">https://medium.com/p/42ed90df5694</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[playwrights]]></category>
            <dc:creator><![CDATA[Asis Alimi]]></dc:creator>
            <pubDate>Tue, 03 Jun 2025 11:10:10 GMT</pubDate>
            <atom:updated>2025-06-03T11:10:10.285Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 9 — Mastering Auth &amp; Negative Testing in API Automation</h3><h3>What is authentication in API testing?</h3><p>Authentication is the process of verifying a user or client’s identity before granting access to protected resources.</p><p>Most modern APIs use<strong> JWT (JSON Web Tokens)</strong> for stateless authentication. A JWT is issued after login and passed as a <strong>Bearer token</strong> in the header for subsequent requests.</p><h3>JWT Lifecycle</h3><ol><li><strong>Login request</strong> &gt; Token issued</li><li><strong>Authenticated request</strong> &gt; Token is validated</li><li><strong>Token expiry </strong>&gt; Triggers 401 or 403 error</li><li><strong>Logout/invalidation</strong> &gt; Token is revoked</li></ol><h3><strong>Status code deep dive</strong></h3><ul><li>200 OK - Success - Valid token provided</li><li>401 Unauthorised - No token or invalid token - You&#39;re not logged in or your token has expired</li><li>403 Forbidden - Valid token but without permission - You&#39;re logged in but not allowed to access</li></ul><h3>Negative testing for authentication</h3><p>Negative testing ensures your API behaves securely and predictably when incorrect or unauthorised inputs are sent.</p><h4>Scenarios to test:</h4><ol><li>Valid token &gt; access granted</li><li>No token &gt; should return 401</li><li>Invalid token &gt; should return 401</li><li>Expired token &gt; should return 401</li><li>Valid token but wrong role &gt; should return 403</li></ol><h3>Example: Auth flow using playwright</h3><pre>const context = await request.newContext({<br>  baseURL: &#39;https://my-api.dev&#39;,<br>  extraHTTPHeaders: {<br>    Authorization: `Bearer ${token}`,<br>    Accept: &#39;application/json&#39;,<br>  },<br>});</pre><p>To simulate an <strong>expired or invalid token</strong>, you can do:</p><pre>Authorization: &#39;Bearer this.is.fake.a.token&#39;</pre><h3>Why this matters</h3><ul><li>Prevents unauthorised access</li><li>Ensures robust error handling</li><li>Builds trust in your API’s security</li><li>Helps avoid production outages caused by expired tokens or misconfigured access</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42ed90df5694" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 7— Mastering Data-Driven Testing in API and UI automation]]></title>
            <link>https://medium.com/@azeezaalimi/day-7-mastering-data-driven-testing-in-api-and-ui-automation-0557b0f496e3?source=rss-6d5bf1287bdf------2</link>
            <guid isPermaLink="false">https://medium.com/p/0557b0f496e3</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[playwrights]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Asis Alimi]]></dc:creator>
            <pubDate>Mon, 02 Jun 2025 11:47:58 GMT</pubDate>
            <atom:updated>2025-06-02T11:47:58.466Z</atom:updated>
            <content:encoded><![CDATA[<p>How to separate test data from test logic to improve flexibility, coverage and maintainability in automated testing.</p><h3>What is data-driven testing?</h3><p>Data-driven testing is a testing methodology where test logic is separated from test data. Instead of hardcoding values inside the test case, data is pulled from external sources like:</p><ul><li>JSON files</li><li>CSV or Excel files</li><li>JS/TS arrays or objects</li><li>Databases or APIs</li></ul><h3>Why data-driven testing is critical for QA</h3><ul><li><strong>Reusability: </strong>The same test logic runs multiple test cases with different data sets</li><li><strong>Scalability: </strong>Easily scale your test coverage by adding more input variations</li><li><strong>Maintainability:</strong> Centralised test data makes maintenance easier when business logic changes</li><li><strong>Real-world coverage: </strong>Helps simulate multiple user scenarios, edge cases, and business rules</li></ul><h3>When to use it</h3><ul><li>Login validations</li><li>Form submissions</li><li>API payload variations</li><li>UI flow validations (positive and negative input)</li></ul><h3>Data-driven testing in playwright</h3><h4>For API</h4><pre>const users = [<br>  { email: &#39;rooney@test.com&#39;, password: &#39;pass123&#39;, expectedStatus: 200 },<br>  { email: &#39;wayne@test.com&#39;, password: &#39;&#39;, expectedStatus: 400 },<br>  { email: &#39;&#39;, password: &#39;123&#39;, expectedStatus: 400 },<br>];<br><br>for (const user of users) {<br>  test(`POST login: ${user.email}`, async () =&gt; {<br>    const res = await context.post(&#39;/api/login&#39;, {<br>      data: { email: user.email, password: user.password }<br>    });<br>    expect(res.status()).toBe(user.expectedStatus);<br>  });<br>}</pre><h4>For UI</h4><pre>const credentials = [<br>  { username: &#39;user1&#39;, password: &#39;pass1&#39; },<br>  { username: &#39;user2&#39;, password: &#39;pass2&#39; },<br>];<br><br>for (const { username, password } of credentials) {<br>  test(`UI login for ${username}`, async ({ page }) =&gt; {<br>    await page.goto(&#39;https://example.com/login&#39;);<br>    await page.fill(&#39;#username&#39;, username);<br>    await page.fill(&#39;#password&#39;, password);<br>    await page.click(&#39;#submit&#39;);<br>    await expect(page).toHaveURL(&#39;/dashboard&#39;);<br>  });<br>}</pre><h4>External data with JSON</h4><pre>import users from &#39;../data/users.json&#39;;<br>users.forEach(user =&gt; {<br>  test(`Login test for ${user.email}`, async () =&gt; {<br>    const response = await context.post(&#39;/api/login&#39;, {<br>      data: { email: user.email, password: user.password }<br>    });<br>    expect(response.status()).toBe(user.expected);<br>  });<br>});</pre><h4>Schema of a test data file (users.json)</h4><pre>[<br>  {<br>    &quot;email&quot;: &quot;valid@test.com&quot;,<br>    &quot;password&quot;: &quot;123456&quot;,<br>    &quot;expected&quot;: 200<br>  },<br>  {<br>    &quot;email&quot;: &quot;&quot;,<br>    &quot;password&quot;: &quot;wrong&quot;,<br>    &quot;expected&quot;: 400<br>  }<br>]</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0557b0f496e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 6— Refactoring & Scalable Automation Architecture]]></title>
            <link>https://medium.com/@azeezaalimi/day-6-refactoring-scalable-automation-architecture-5995d47f900a?source=rss-6d5bf1287bdf------2</link>
            <guid isPermaLink="false">https://medium.com/p/5995d47f900a</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[playwrights]]></category>
            <dc:creator><![CDATA[Asis Alimi]]></dc:creator>
            <pubDate>Sat, 31 May 2025 13:23:50 GMT</pubDate>
            <atom:updated>2025-05-31T13:23:50.117Z</atom:updated>
            <content:encoded><![CDATA[<p>Refactoring and designing a scalable test architecture for API + UI automation in Playwright.</p><h3>What is refactoring in automation testing?</h3><p>Refactoring means restructuring your test code to make it <strong>cleaner, more readable, and more maintainable,</strong> without altering its functionality. In test automation, this includes breaking down long test flows, removing duplicate code, organising locators, and improving data handling.</p><h3>Why is refactoring important for QA?</h3><p>As test suites grow, unstructured code becomes harder to maintain and debug. A well-refactored test framework is a sign of <strong>technical maturity</strong> and <strong>scalability</strong>.</p><p>As a QA, you’re expected to:</p><ul><li>Build frameworks that others can contribute to</li><li>Reuse core test logic, like login or token generation</li><li>Separate test logic from test data and UI locators</li></ul><h3>Signs that your test code needs refactoring</h3><ul><li>Duplicated login logic or request setup</li><li>Long test files mixing API + UI logic</li><li>Hardcoded values inside test cases</li><li>Repeated locators in different UI test files</li><li>Test files over 80 lines without structure</li></ul><h3>Playwright test structure after refactoring</h3><p><strong>POM (Page Object Model):</strong> Stores all UI locators and flows, e.g. LoginPage.ts</p><p><strong>Test cases:</strong> Call POM functions to test flows, e.g. login.spec.ts and cart.spec.ts</p><p><strong>Utilities:</strong> Handles token creation and schema checks, e.g. authHelper.ts and schemaHelper.ts</p><p><strong>Data:</strong> Stores payload and test inputs, e.g. loginData.json and users.ts</p><h3>Before vs After example (UI login test)</h3><h4>Before</h4><pre>await page.goto(&#39;/login&#39;);<br>await page.locator(&#39;#username&#39;).fill(&#39;user&#39;);<br>await page.locator(&#39;#password&#39;).fill(&#39;pass&#39;);<br>await page.locator(&#39;button&#39;).click();<br>await expect(page).toHaveURL(&#39;/dashboard&#39;);</pre><h4>After</h4><pre>const login = new LoginPage(page);<br>await login.goto();<br>await login.login(&#39;user&#39;, &#39;pass&#39;);<br>await login.assertOnDashboard();</pre><h3>What should I do as a QA?</h3><ul><li>Move repeated flows like request.newContext() into a shared helper</li><li>Create reusable assertion functions, e.g. expectBookingToBeValid())</li><li>Split large flies by flow (login, booking, product listing)</li><li>Apply the single responsibility principle (SRP) to each file</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5995d47f900a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 5 — Mastering assertions & debugging in API and UI testing (Playwright)]]></title>
            <link>https://medium.com/@azeezaalimi/day-5-mastering-assertions-debugging-in-api-and-ui-testing-playwright-89c71b8b531f?source=rss-6d5bf1287bdf------2</link>
            <guid isPermaLink="false">https://medium.com/p/89c71b8b531f</guid>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[playwright-automation]]></category>
            <category><![CDATA[automation-testing]]></category>
            <dc:creator><![CDATA[Asis Alimi]]></dc:creator>
            <pubDate>Fri, 30 May 2025 12:13:30 GMT</pubDate>
            <atom:updated>2025-05-30T12:21:32.697Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 5 — Mastering assertions &amp; debugging in API and UI testing (Playwright)</h3><p>Validating system behaviour across API and UI layers, assertions and debugging techniques.</p><h3>What are assertions?</h3><p>An <strong>assertion</strong> is a way to tell your test:</p><blockquote>“This must be true; if not, fail the test.”</blockquote><p>In both API and UI testing, assertions check whether the system’s <strong>actual behaviour</strong> matches the <strong>expected result</strong>. For example:</p><ul><li>Did the response status return 200?</li><li>Did the UI display the login error message?</li><li>Does the object contain an ID field?</li></ul><p>Without assertions, tests wouldn’t know if something went wrong.</p><h3>Types of assertions in Playwright</h3><p>There are <strong>two main types of assertions</strong> we can think about when writing tests:</p><h4>Hard assertions</h4><ul><li>Stop the test <strong>immediately</strong> if the assertion fails</li><li>Example:</li></ul><pre>expect(response.status()).toBe(200);</pre><p>If the response status is not 200, the test <strong>stops</strong> here.</p><h4>Soft assertions</h4><ul><li>Log the failure, but allow the test to <strong>continue</strong></li><li>Useful for validating <strong>multiple things at once</strong></li><li>Example</li></ul><pre>const softErrors = [];<br><br>try {<br>  expect(body.id).toBeDefined();<br>} catch (e) {<br>  softErrors.push(e.message);<br>}<br><br>if (softErrors.length &gt; 0) {<br>  throw new Error(softErrors.join(&#39;\n&#39;));<br>}</pre><h3>API testing assertions</h3><p>In API tests, assertions are used to confirm:</p><ul><li>HTTP status codes</li><li>Response schema</li><li>Key fields and values</li></ul><p>Example:</p><pre>expect(response.status()).toBe(201);<br>const body = await response.json();<br>expect(body.name).toBe(&#39;doggie&#39;);<br>expect(body).toHaveProperty(&#39;id);</pre><h3>UI testing assertions</h3><p>Assertions in UI tests validate that:</p><ul><li>Elements are present and correct</li><li>Pages load the right URL</li><li>UI behaves as expected</li></ul><p>Example:</p><pre>await expect(page).toHaveURL(/inventory/);<br>await exoect(page.locator(&#39;.error-message&#39;)).toBeVisisble();<br>await expect(page.locator(&#39;#username)).toHaveValue(&#39;standard_user&#39;);</pre><h3>Why assertions matter</h3><p>Assertions are your <strong>alarm system</strong>. They:</p><ul><li>Detect broken features early</li><li>Highlight incorrect data</li><li>Prevent false positives</li><li>Catch regression bugs before production</li></ul><p>Think of them as your test’s <strong>truth detector.</strong></p><h3>Debugging failing tests</h3><p>When a test fails, debugging helps you <strong>understand why</strong>. Here’s how to approach it:</p><h4>In API testing:</h4><ul><li>Log the request/response</li></ul><pre>console.log(await response.json());</pre><ul><li>Check:<br>- Is the <strong>auth token</strong> correct?<br>- Is the <strong>endpoint</strong> valid?<br>- Is the <strong>payload</strong> missing fields?</li></ul><h4><strong>In UI testing:</strong></h4><ul><li>Use page.pause() to freeze the test and inspect manually</li><li>Capture screenshots or traces</li><li>Use Playwright’s trace viewer</li><li>Re-run failed tests with debug mode</li></ul><h3>Real-world example</h3><p>You send a POST /pet request with this payload:</p><pre>{<br>  name: &#39;doggie&#39;,<br>  category: { id: 1, name: &#39;Pets&#39; },<br>  status: &#39;available&#39;<br>}</pre><h4>You expect:</h4><ul><li>201 status code</li><li>A response body with an ID and matching name</li></ul><h4>So you:</h4><pre>expect(response.status()).toBe(201);<br>const body = await response.json();<br>expect(body.name).toBe(&#39;doggie&#39;);<br>expect(body).toHaveProperty(&#39;id&#39;);</pre><p>Then you chains it with a GET request to verify:</p><pre>const getRes = await context.get(`/pet/${body.id}`);<br>expect(getRes.status()).toBe(200);</pre><p>If this fails, you:</p><ul><li>Log the response</li><li>Check if the POST didnt actuall persist the pet</li><li>Report to devs if necessary</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89c71b8b531f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 4— UI Test Setup + POM with Playwright]]></title>
            <link>https://medium.com/@azeezaalimi/day-4-ui-test-setup-pom-with-playwright-4c23188c1203?source=rss-6d5bf1287bdf------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c23188c1203</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[playwright-automation]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Asis Alimi]]></dc:creator>
            <pubDate>Thu, 29 May 2025 12:31:08 GMT</pubDate>
            <atom:updated>2025-05-29T12:45:49.488Z</atom:updated>
            <content:encoded><![CDATA[<p>How to build scalable UI tests with POM and chain full RESTful flows with Playwright for robust automation</p><h3>What is the Page Object Model (POM) in UI testing?</h3><p>The <strong>Page Object Model</strong> is a design pattern that structures your test code by separating the test logic from the UI structure. Each page or screen of an application is represented by a class that contains all relevant locators and user actions.</p><p>For example, instead of repeating selectors in multiple tests, I can define a LoginPage class that handles all login interactions. This keeps tests clean, readable, and easy to maintain.</p><h3>Why POM improves scalability and maintainability</h3><p>Automation tests are prone to breaking when UI changes occur.</p><p>With POM:</p><ul><li>Locators and interactions are defined in <strong>one place</strong></li><li>Tests call <strong>methods</strong>, not low-level UI commands</li><li>Updating a locator in the page file updates all dependent tests</li><li>Teams can scale test suites with <strong>minimal duplication</strong></li></ul><p>POM becomes critical as test suites grow, especially in large-scale environments of tech companies.</p><h3>Playwright test structure: Tests vs POM</h3><p>Here’s how I structured my files using Playwright:</p><pre>project/<br>├── pages/<br>│   └── login.page.ts<br>├── tests/<br>│   └── login.spec.ts</pre><p>login.page.ts</p><pre>export class loginPage {<br>  constructor(private page: Page) {}<br><br>  async goto() {<br>    await this.page.goto(&#39;https://www.fakesite.com&#39;);<br>  }<br><br>  async login(username: string, password: string) {<br>    await this.page.fill(&#39;#user-name&#39;, username);<br>    await this.page.fill(&#39;#password&#39;, password);<br>    await this.page.click(&#39;#login-button&#39;);<br>  }<br><br> async assertErrorVisible() {<br>    await expect(this.page.locator(&#39;[data-test=&quot;error&quot;]&#39;)).toBeVisible();<br>  }<br>}</pre><p>login.spec.ts</p><pre>test(&#39;Invalid login shows error&#39;, async ({ page }) =&gt; {<br>  const loginPage = new LoginPage(page);<br>  await loginPage.goto();<br>  await loginPage.login(&#39;invalid&#39;, &#39;wrong&#39;);<br>  await loginPage.assertErrorVisible();<br>});</pre><p>This structure enabled me to reuse login logic across multiple tests while keeping my test files concise and focused.</p><h3>How to chain full API test flows: POST &gt; GET &gt; PUT &gt; DELETE &gt; 404</h3><p>Using Playwright’s request API, I practiced chaining a complete RESTful flow:</p><ol><li><strong>POST /booking</strong> - Create a new booking &gt; expect 201 Created</li><li><strong>GET /booking/{id} - </strong>Retrieve booking &gt; expect 200 Ok</li><li><strong>PUT /booking</strong> <strong>/{id} - </strong>Update booking &gt; expect 200 Ok + updated body</li><li><strong>DELETE /booking</strong> <strong>/{id} - </strong>Delete booking &gt; expect 204 No content</li><li><strong>GET /booking</strong> <strong>/{id} - </strong>Recheck deletion &gt; expect 404 Not found</li></ol><p>I also added <strong>negative tests</strong> to check:</p><ul><li>POST with missing fields &gt; 400</li><li>PUT with invalid token &gt; 401</li><li>DELETE with non-existent ID &gt; 404</li></ul><p>This approach ensures full lifecycle testing and captures backend regression risks early.</p><h3><strong>Real-world reasons to combine API + UI testing</strong></h3><p><strong>Preconditioning:</strong> Create test data via API before running UI tests</p><p><strong>Faster debugging:</strong> Helps isolate UI vs backend bugs</p><p><strong>Security testing:</strong> Validate token/auth scenarios efficiently</p><p><strong>End-to-End Accuracy:</strong> Ensures workflows behave correctly across layers</p><p><strong>Faster test suites: </strong>Use APIs to skip slow frontend setup steps</p><p>Example: I can create a user via API, log in via UI, and validate the post-login dashboard, combining speed and coverage.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c23188c1203" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 3 — Schema Validation & Chaining API Requests in Playwright]]></title>
            <link>https://medium.com/@azeezaalimi/day-3-schema-validation-chaining-api-requests-in-playwright-b47fd3cb4084?source=rss-6d5bf1287bdf------2</link>
            <guid isPermaLink="false">https://medium.com/p/b47fd3cb4084</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[playwright-automation]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[automation-testing]]></category>
            <dc:creator><![CDATA[Asis Alimi]]></dc:creator>
            <pubDate>Wed, 28 May 2025 15:06:47 GMT</pubDate>
            <atom:updated>2025-05-28T15:06:47.159Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 3 — Schema Validation &amp; Chaining API Requests in Playwright</h3><p>Understanding the importance of JSON schema validation and chaining API requests in Playwright to ensure end-to-end backend reliability and data integrity.</p><h3>What is JSON Schema validation?</h3><p>JSON Schema validation is the process of verifying that an API response <strong>conforms to an expected structure</strong>.</p><p>This includes:</p><ul><li>Required fields (e.g. id, name)</li><li>Correct data types (e.g. number, string, boolean)</li><li>Proper nesting and array formats</li></ul><p>In essence, it ensures that the <strong>shape and format</strong> of the data are exactly what your system expects, no more, no less.</p><h3>Why Schema validation is critical for QA</h3><p>Relying solely on HTTP status codes (200, 201) only tells you that a request didn’t crash. It doesn’t tell you:</p><ul><li>If the <strong>response body is missing field</strong>s</li><li>If <strong>the types are incorrect</strong> (e.g. string instead of number)</li><li>If the response <strong>breaks the frontend</strong></li></ul><p>Schema validation catches these issues early, before they cause a bug in production.</p><h3>How to chain requests: POST &gt; GET &gt; Assert</h3><p>Chaining requests means using the output from one API call as the input for the next.</p><p>Example flow:</p><ol><li>POST /users &gt; return a new user.id</li><li>GET /users/{id} &gt; retrieve that exact user</li><li>Assert that the retrieved data matches what was created</li></ol><p>In Playwright:</p><pre>const context = await request.newContext({ baseURL: &#39;https://reqres.in/api&#39; });<br><br>const postRes = await context.post(&#39;users&#39;, {<br>  data: { name: &#39;Yamal&#39;, job: &#39;Footballer&#39; },<br>});<br>const postData = await postRes.json();<br>expect(postRes.status()).toBe(201);<br>expect(postData).toHaveProperty(&#39;id&#39;);<br><br>const getRes = await context.get(`users/${postData.id}`);<br>expect(getRes.status()).toBe(200);<br>const getData = await getRes.json();<br>expect(getData).toMatchObject({ id: postData.id });</pre><h3>How broken Schemas can lead to regressions</h3><p>If a developer removes or renames a field in the response, and you don’t validate the schema, your texts might still pass.</p><p>But your <strong>frontend will break</strong>, or other services may fail silently.</p><p>Broken schemas can cause:</p><ul><li>Crashes in production</li><li>Undetected bugs in dependent systems</li><li>Inconsistent behaviour across the environments</li></ul><h3>Why Schema validation is more reliable than status codes alone</h3><p>A 200 OK response doesn’t mean the API is working correctly, only that it didn’t fail.</p><p>Schema validation ensures:</p><ul><li>The response is <strong>complete</strong></li><li>The data format is <strong>correct</strong></li><li>The system behaves <strong>as expected</strong></li></ul><p>This adds a <strong>deeper layer of quality</strong> to your automation tests and protects against subtle but dangerous regressions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b47fd3cb4084" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>