<?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 Vinay Sharma on Medium]]></title>
        <description><![CDATA[Stories by Vinay Sharma on Medium]]></description>
        <link>https://medium.com/@vinayksharma?source=rss-309800f31509------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*qLfu28Ic0RdiF782Wu00EQ.jpeg</url>
            <title>Stories by Vinay Sharma on Medium</title>
            <link>https://medium.com/@vinayksharma?source=rss-309800f31509------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 04:07:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vinayksharma/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[I Built a Release Pipeline Agent to Untangle Our Two-Train Deploy Chaos]]></title>
            <link>https://vinayksharma.medium.com/i-built-a-release-pipeline-agent-to-untangle-our-two-train-deploy-chaos-dfd7c36a16a3?source=rss-309800f31509------2</link>
            <guid isPermaLink="false">https://medium.com/p/dfd7c36a16a3</guid>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Vinay Sharma]]></dc:creator>
            <pubDate>Sun, 09 Aug 2026 08:06:16 GMT</pubDate>
            <atom:updated>2026-08-09T08:06:16.764Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How custom Jira payload quirks, Slack formatting, and explicit config turned daily pipeline archaeology into a 5-second Slack verdict.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mEFLjfBC2mRA98ZfW1mLzw.png" /></figure><h4>The Problem: Two Trains, One Brain</h4><p>Moving from biweekly to weekly deploys sped up shipping, but expanding our pipeline to four environments (Dev → Test → Stage → Prod) doubled our mental overhead.</p><p>With an 8-day lifecycle per feature, two release cohorts run concurrently every single day:</p><ol><li><strong>Train 1 (Current):</strong> Sitting in Test/Stage, heading toward this Tuesday’s deploy.</li><li><strong>Train 2 (Next):</strong> Entering Dev QA, heading toward next Tuesday’s deploy.</li></ol><p>Mentally tracking risks across overlapping timelines meant manually cross-referencing Jira statuses every Monday morning. I needed a simple, automated Slack report before opening my computer: <em>What is actually at risk of missing its deploy window?</em></p><h4>Designing the Logic Before the Code</h4><p>Before scripting, I mapped the cadence to derive simple risk rules:</p><ul><li><strong>Dev:</strong> Cutoff Monday EOD</li><li><strong>Test:</strong> Wed–Fri signoff</li><li><strong>Stage:</strong> Mon–Tue signoff</li><li><strong>Prod:</strong> Tuesday deploy</li></ul><p><strong>The Risk Formula:</strong> Compare a ticket’s remaining pipeline stages against remaining business days before its target Tuesday. If runway &lt; required stages, flag it.</p><p>Instead of inventing a new tracking system, the script leverages our existing release-tracking field — the one our release management process already used to identify which weekly release a ticket belonged to.</p><h4>3 Real-World Bugs &amp; Lessons</h4><h4>1. Singular Field Names Return Nested Arrays</h4><p>The first live run flagged all 16 tickets as missing release data. While the JQL query was correct, Jira returned our custom release field as a nested array, not a flat key.</p><p><strong><em>Lesson:</em></strong><em> Always validate raw API response payloads. Jira custom fields vary heavily across instances, and JSON structures rarely mirror UI labels.</em></p><h4>2. Slack Markdown Isn’t Standard Markdown</h4><p>Standard markdown (*bold*, :shortcode:) rendered as raw broken text. Slack requires specific syntax variations and native unicode emojis. Formatting directly impacts whether a team reads or ignores a report.</p><h4>3. Boring Config Beats Fragile “Smart” Automation</h4><p>I initially built auto-detection for the active releases. A single dirty data entry in Jira broke the logic silently. I swapped auto-detection for two static config variables updated weekly after deploy.</p><p><strong><em>Lesson:</em></strong><em> Automation should remove drudgery, not your ability to reason about system behavior. Start with explicit configuration before adding auto-detection.</em></p><h4>Formatting as Product Design</h4><p>The initial Slack draft crammed every field onto a single dash-separated line — technically accurate, practically unreadable.</p><p>Restructuring the message vertically turned a database dump into a scannable report:</p><ul><li><strong>Line 1:</strong> Ticket key + summary</li><li><strong>Indented Bullets:</strong> Status, assignee, risk reason</li><li><strong>Top Line:</strong> A single status emoji (🔴 / 🟡 / 🟢) computed from total risk count for a 5-second glance.</li></ul><pre>🔴 RELEASE STATUS: AT RISK<br><br>Train 1: Release 2026.32 (Deploying Tue)<br>├─ ⚠️ AT RISK<br>│  └─ PROD-1042: Payment Gateway Timeout Fix<br>│     ├─ Status: Passed Dev QA (Stuck 3 days)<br>│     ├─ Assignee: @alex<br>│     └─ Reason: Missing Test/Stage runway (1 day left before freeze)<br>└─ ✅ ON TRACK (12 tickets)</pre><h4>What Lands in Slack Every Morning</h4><ol><li><strong>Headline Verdict:</strong> Instant red/yellow/green indicator.</li><li><strong>Train 1 (Deploying Tuesday):</strong> Categorized into <em>On-Track</em> vs. <em>At-Risk</em>.</li><li><strong>Train 2 (Dev Cutoff Monday):</strong> Unassigned, unstarted, or lagging items.</li><li><strong>Sanctioned Delays:</strong> Known blocker bugs separated from surprise delays.</li><li><strong>Stale Tickets:</strong> Any ticket untouched for 3+ business days.</li><li><strong>Direct Link:</strong> One-click shortcut to the live Jira filter.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dCrGvu6eq0Sqh_gSdiTHWw.png" /><figcaption>Slack report</figcaption></figure><h4>Core Takeaways</h4><ul><li><strong>Draft in plain text first:</strong> If you can’t explain the logic to a human, an agent/script can’t execute it.</li><li><strong>Reuse team habits:</strong> Tap into existing fields instead of inventing new metadata workflows.</li><li><strong>Inspect real API payloads:</strong> Don’t trust field names; check live response JSON shapes early.</li><li><strong>Prefer simple control over magic:</strong> Static config is easier to trust and debug than early heuristics.</li><li><strong>Treat output layout as UX:</strong> Information hierarchy determines whether a report gets read or muted.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dfd7c36a16a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ship Faster: AI-Powered Test Generation That Saves 4.9 Days Per Sprint]]></title>
            <link>https://vinayksharma.medium.com/ship-faster-ai-powered-test-generation-that-saves-4-9-days-per-sprint-1b0e919bc3f4?source=rss-309800f31509------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b0e919bc3f4</guid>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[cursor]]></category>
            <category><![CDATA[shiftleft]]></category>
            <dc:creator><![CDATA[Vinay Sharma]]></dc:creator>
            <pubDate>Wed, 24 Jun 2026 19:12:30 GMT</pubDate>
            <atom:updated>2026-06-24T19:12:30.690Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A practical guide to shift-left testing using Cursor AI, automated sprint clarifications, and pre-coded test plans</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UD3Sxv150Qya9YN02d4waA.png" /></figure><h3><strong>The End-of-Sprint QA Crunch</strong></h3><p>There is nothing worse than the end-of-sprint QA crunch. The code is written. The developers are already mentally moving to the next feature. And suddenly a mountain of 50+ manual test cases stands between you and production.</p><p>Your developers just finished a complex checkout flow. The PR is ready for review. But before it ships, someone needs to:</p><ul><li>Write 50+ test cases manually</li><li>Document all edge cases</li><li>Plan the automation strategy</li><li>Actually write the automated tests</li></ul><p>By the time QA is done, the sprint is over, and developers have moved on to the next feature. Sound familiar?</p><p>Learn how to use AI-powered skills and instructions to generate comprehensive test cases, edge cases, and automation plans during development — not after. Reduce test case generation from 5 days to 1 hour and ship with confidence.</p><p><strong>The Traditional Cycle</strong></p><p><strong>Sprint Goal: </strong>Guest Checkout Feature (E-commerce Example)</p><ul><li>Week 1–2: Development (Backend + Frontend)</li><li>Week 3: QA manually writes test cases</li><li>Week 4: QA starts test automation (often incomplete)</li><li>Week 5: Bugs found during testing, fix cycle begins</li></ul><p><strong>Result:</strong> A 5-week cycle for what should be a 2-week sprint. The core problem? Testing activities happen <strong>after</strong> development, when they should happen <strong>during</strong> development.</p><p><strong>The Solution: AI-Assisted Test Generation Workflow</strong></p><p>What if test cases, edge cases, and automation plans were generated <strong>while code is being reviewed</strong>? Here’s how we implemented an AI-assisted workflow using Cursor AI and structured skills.</p><p><strong>The Three-Phase Approach</strong></p><ul><li><strong>Phase 1:</strong> Automated Clarifications (Before Development)</li><li><strong>Phase 2:</strong> Test Case Generation (During Development)</li><li><strong>Phase 3:</strong> Automation Plan (During Code Review)</li></ul><p>Let’s dive into each phase.</p><p><strong>Phase 1: Automated Clarifications (Before Development)</strong></p><p><strong>What It Does</strong></p><p>Reads product requirement documents or Jira tickets</p><ul><li>Identifies ambiguities and missing requirements</li><li>Generates targeted clarification questions</li><li>Flags potential edge cases early</li><li>Creates assumptions document for team alignment</li></ul><h4><strong>Why It Matters</strong></h4><p>Catching ambiguities <strong>before</strong> coding starts saves massive rework. A missing requirement caught in planning takes 5 minutes to fix. The same issue caught in QA takes 5 days.</p><h4><strong>Example: Task Management App</strong></h4><p><strong>Feature Request:</strong> “Add bulk task assignment functionality”</p><p><strong>AI-Generated Clarifications:</strong></p><pre>## Feature: Bulk Task Assignment<br><br>### Critical Questions Requiring PM Input:<br><br>1. **Scale Limits**<br>   - What&#39;s the maximum number of tasks that can be assigned in one bulk operation?<br>   - Should there be a warning threshold (e.g., &gt; 25 tasks)?<br><br>2. **Failure Handling**<br>   - If 50 tasks are selected and 1 fails validation, should:<br>     - All assignments be rolled back (atomic)?<br>     - Successful assignments proceed, failed ones reported?<br>   - What error message format is expected?<br><br>3. **Permission Model**<br>   - Are permissions checked per-task or at bulk operation level?<br>   - Can users bulk-assign to projects they don&#39;t own?<br>   - Does bulk operation require special role/permission?<br><br>4. **User Experience**<br>   - Should there be a confirmation dialog for bulk actions?<br>   - Is an undo feature required?<br>   - Should assignment notifications be batched or individual?<br><br>5. **Edge Cases**<br>   - What happens if assigning to deactivated users?<br>   - Can tasks already assigned to someone be reassigned in bulk?<br>   - Should locked/archived tasks be excluded automatically?<br><br>### Proposed Assumptions (Require Approval):<br><br>- Max 50 tasks per bulk operation<br>- Operation is atomic: all succeed or all fail<br>- Admin/Project Manager role required<br>- Confirmation dialog required for &gt; 10 tasks<br>- Deactivated users automatically filtered from assignee list</pre><h3>The Cursor AI Skill Structure</h3><p><strong>Key Takeaway:</strong> This skill configuration tells AI exactly what questions to ask and how to format the output.</p><p><strong>File:</strong> .cursor/skills/sdlc-1-clarifications/SKILL.md</p><pre>Read the product spec from the provided file or Jira ticket<br>&gt; <br>&gt; Analyze for:<br>&gt;   - Ambiguous requirements that could lead to different implementations<br>&gt;   - Missing error handling scenarios<br>&gt;   - Unclear user flows or navigation paths<br>&gt;   - Integration points not specified<br>&gt;   - Permission/security implications<br>&gt;   - Scale/performance requirements not defined<br>&gt;   - Accessibility requirements<br>&gt;<br>&gt; Group questions by category: Critical, Important, Nice-to-have<br>&gt; <br>&gt; Output: clarifications.md with:<br>&gt;   - Numbered questions requiring PM/stakeholder input<br>&gt;   - Proposed assumptions (mark clearly as &quot;REQUIRES APPROVAL&quot;)<br>&gt;   - Identified edge cases<br>&gt;   - Risk areas flagged</pre><p><strong>Usage:</strong></p><pre>User: &quot;@product-spec.md generate clarifications&quot;<br><br>AI: <br>1. Reads the spec<br>2. Identifies gaps<br>3. Creates clarifications.md<br>4. Flags it for PM review</pre><h3>Phase 2: Test Case Generation (During Development)</h3><h4>What It Does</h4><ul><li>Takes approved product specs + clarifications</li><li>Generates comprehensive test cases with unique IDs</li><li>Tags by type (unit / integration / e2e)</li><li>Assigns priorities (P0 = blocker, P1 = major, P2 = minor)</li><li>Includes preconditions, steps, expected results</li><li>Covers positive paths, negative paths, and edge cases</li></ul><h3>Example: E-commerce Shopping Cart</h3><p><strong>Input:</strong> Product spec for shopping cart feature</p><p><strong>AI-Generated Test Cases (excerpt):</strong></p><p><strong>Key Takeaway:</strong> AI generates complete test cases in standardized format — positive flows, negative flows, edge cases, and performance tests. Below is a sample of 10 test cases from a typical 40–60 test case output.</p><pre>## Test Cases: Shopping Cart Feature<br><br>### Positive Test Cases<br><br>#### TC-CART-001: Add Single Item to Empty Cart<br>- **Priority:** P0 (Blocker)<br>- **Type:** integration<br>- **Preconditions:** <br>  - User authenticated<br>  - Product in stock (quantity &gt; 0)<br>  - Cart is empty<br>- **Steps:**<br>  1. Navigate to product detail page for &quot;Wireless Mouse&quot;<br>  2. Verify &quot;Add to Cart&quot; button is enabled<br>  3. Click &quot;Add to Cart&quot; button<br>  4. Verify cart icon updates with badge showing &quot;1&quot;<br>  5. Open cart drawer/page<br>- **Expected Result:**<br>  - Product appears in cart with correct:<br>    - Product name: &quot;Wireless Mouse&quot;<br>    - Unit price: $29.99<br>    - Quantity: 1<br>    - Subtotal: $29.99<br>  - Cart total: $29.99<br>  - Success notification: &quot;Item added to cart&quot;<br>  - User remains on product page (cart opens as overlay)<br><br>---<br><br>#### TC-CART-002: Add Multiple Quantities of Same Item<br>- **Priority:** P0<br>- **Type:** integration<br>- **Preconditions:** <br>  - User authenticated<br>  - Product in stock (quantity &gt;= 3)<br>  - Cart is empty<br>- **Steps:**<br>  1. Navigate to product detail page<br>  2. Change quantity selector to &quot;3&quot;<br>  3. Click &quot;Add to Cart&quot;<br>  4. Open cart<br>- **Expected Result:**<br>  - Single cart line item with quantity: 3<br>  - Subtotal correctly calculated (unit price × 3)<br>  - Inventory decremented by 3 (verify via API)<br><br>---<br><br>### Negative Test Cases<br><br>#### TC-CART-003: Add Out-of-Stock Item<br>- **Priority:** P0<br>- **Type:** integration<br>- **Preconditions:** <br>  - Product inventory = 0<br>- **Steps:**<br>  1. Navigate to product with zero inventory<br>  2. Observe &quot;Add to Cart&quot; button state<br>- **Expected Result:**<br>  - &quot;Add to Cart&quot; button is disabled OR<br>  - Button shows &quot;Out of Stock&quot; text<br>  - Hovering shows tooltip: &quot;Currently unavailable&quot;<br>  - No cart modification occurs if user somehow triggers action<br><br>---<br><br>#### TC-CART-004: Exceed Maximum Quantity Limit<br>- **Priority:** P1<br>- **Type:** integration<br>- **Preconditions:** <br>  - Product has max-per-order limit (e.g., 5)<br>  - Cart is empty<br>- **Steps:**<br>  1. Add 5 items to cart successfully<br>  2. Attempt to add 6th item of same product<br>- **Expected Result:**<br>  - Error toast notification: &quot;Maximum 5 items per order&quot;<br>  - Cart contains only 5 items<br>  - Add to Cart button disabled or shows max reached<br>  - Cart total reflects only 5 items<br><br>---<br><br>### Edge Cases<br><br>#### TC-CART-006: Concurrent Cart Modification<br>- **Priority:** P1<br>- **Type:** integration<br>- **Preconditions:** <br>  - Same user session on two devices/tabs<br>- **Steps:**<br>  1. Device A: Add &quot;Keyboard&quot; to cart<br>  2. Device B: Add &quot;Mouse&quot; to cart<br>  3. Device A: Refresh and verify cart<br>- **Expected Result:**<br>  - Both items present in cart<br>  - No item lost due to race condition<br>  - Cart state synced across sessions<br><br>---<br><br>#### TC-CART-007: Price Change While Item in Cart<br>- **Priority:** P2<br>- **Type:** integration<br>- **Preconditions:** <br>  - Item in cart at price $29.99<br>  - Admin changes price to $24.99<br>- **Steps:**<br>  1. User opens cart after price change<br>- **Expected Result:**<br>  - Cart shows updated price: $24.99<br>  - Notification: &quot;Price updated: Wireless Mouse now $24.99&quot;<br>  - User benefits from price reduction<br><br>---<br><br>### Performance Test Cases<br><br>#### TC-CART-010: Large Cart (100 Items)<br>- **Priority:** P2<br>- **Type:** performance<br>- **Preconditions:** <br>  - Cart with 100 unique items<br>- **Steps:**<br>  1. Open cart page<br>  2. Measure load time<br>- **Expected Result:**<br>  - Cart loads within 2 seconds<br>  - No UI lag when scrolling<br>  - Pagination if &gt; 50 items<br><br>---<br><br>## Test Data Requirements<br><br>### Seed Data Needed:<br>- **Users:** <br>  - Standard user (authenticated)<br>  - Guest user (unauthenticated)<br>- **Products:**<br>  - In-stock product (qty: 100)<br>  - Low-stock product (qty: 2)<br>  - Out-of-stock product (qty: 0)<br>  - Max-limit product (max: 5 per order)<br>- **Pricing:**<br>  - Standard product ($29.99)<br>  - Discounted product (was $39.99, now $29.99)<br><br>### Test Fixtures:<br>- `createEmptyCart(userId)`<br>- `createCartWithItems(userId, itemCount)`<br>- `setProductInventory(productId, quantity)`<br>- `expireUserSession(userId)`</pre><h3>The Cursor AI Test Case Generation Skill</h3><p><strong>Key Takeaway:</strong> This skill template ensures consistent test case format and comprehensive coverage across all feature areas.</p><p><strong>File:</strong> .cursor/skills/sdlc-5-test-cases/SKILL.md</p><pre>&gt; Based on product-specs.md and clarifications.md, generate test-cases.md covering:<br>&gt;<br>&gt; **Functional Test Cases:** Every user story and acceptance criterion<br>&gt;   - Positive paths (happy flows)<br>&gt;   - Negative paths (error conditions)<br>&gt;   - Alternative flows<br>&gt;<br>&gt; **Edge Cases:** Boundary conditions, unusual states, race conditions<br>&gt;<br>&gt; **Integration Tests:** Cross-service interactions, API contracts, event flows<br>&gt;<br>&gt; **Regression Scope:** Existing functionality that could break<br>&gt;<br>&gt; **Test Data Requirements:** Seed data, fixtures, factory definitions<br>&gt;<br>&gt; Format each test case:<br>&gt;   - ID: TC-&lt;AREA&gt;-&lt;NUMBER&gt;<br>&gt;   - Title: Clear, descriptive<br>&gt;   - Priority: P0 (blocker) / P1 (major) / P2 (minor)<br>&gt;   - Type: unit | integration | e2e | performance<br>&gt;   - Preconditions: State before test<br>&gt;   - Steps: Numbered, actionable steps<br>&gt;   - Expected Result: Observable, measurable outcome<br>&gt;<br>&gt; Tag appropriately and organize by feature area.</pre><p><strong>Usage:</strong></p><pre>User: &quot;@product-spec.md @clarifications.md generate test cases&quot;<br><br>AI:<br>1. Reads approved specs<br>2. Generates 40-60 test cases<br>3. Covers positive, negative, edge cases<br>4. Ready for review before coding completes</pre><h3>Phase 3: Automation Plan Generation (During Code Review)</h3><h3>What It Does</h3><ul><li>Maps test cases to specific test files</li><li>Suggests test framework patterns</li><li>Identifies reusable fixtures and mocks</li><li>Plans test data setup and teardown</li><li>References existing test patterns from codebase</li><li>Provides code snippets for complex scenarios</li></ul><h3>Example: API Test Automation Plan</h3><p><strong>Input:</strong> test-cases.md + existing test patterns</p><p><strong>AI-Generated Automation Plan (excerpt):</strong></p><p><strong>Key Takeaway:</strong> AI maps every test case to implementation files, provides working code snippets, and identifies all fixtures/mocks needed — ready for developers to execute.</p><p><strong>Test File Structure</strong></p><pre>tests/<br>  integration/<br>    cart/<br>      add-to-cart.test.ts          # TC-CART-001, 002, 003, 004, 005<br>      cart-sync.test.ts             # TC-CART-006<br>      cart-pricing.test.ts          # TC-CART-007<br>      cart-persistence.test.ts      # TC-CART-008<br>      cart-checkout-flow.test.ts    # TC-CART-009<br>  fixtures/<br>    cart-fixtures.ts                # Shared test data<br>    product-factory.ts              # Product creation<br>    user-factory.ts                 # User management<br>  performance/<br>    cart-load.test.ts               # TC-CART-010</pre><h3>Test Implementation Example: TC-CART-001</h3><p><strong>File:</strong> tests/integration/cart/add-to-cart.test.ts</p><pre>import { test, expect } from &#39;@playwright/test&#39;;<br>import { createUser, createProduct, clearCart } from &#39;../../fixtures&#39;;<br><br>test.describe(&#39;Add to Cart - Positive Flows&#39;, () =&gt; {<br>  <br>  test.beforeEach(async ({ request }) =&gt; {<br>    // Setup: Create test user and ensure clean state<br>    await clearCart(request, testUser.id);<br>  });<br><br>  test(&#39;TC-CART-001: Add single item to empty cart&#39;, async ({ request }) =&gt; {<br>    <br>    await test.step(&#39;Setup test data&#39;, async () =&gt; {<br>      // Create product with sufficient inventory<br>      const product = await createProduct({<br>        name: &#39;Wireless Mouse&#39;,<br>        price: 29.99,<br>        inventory: 100<br>      });<br>    });<br><br>    await test.step(&#39;Add product to cart via API&#39;, async () =&gt; {<br>      const response = await request.post(&#39;/api/cart/add&#39;, {<br>        data: { <br>          productId: product.id, <br>          quantity: 1 <br>        }<br>      });<br>      <br>      expect(<br>        response.status(), <br>        &#39;Add to cart should return 200 OK&#39;<br>      ).toBe(200);<br>    });<br><br>    await test.step(&#39;Verify cart state&#39;, async () =&gt; {<br>      const cartResponse = await request.get(&#39;/api/cart&#39;);<br>      const cart = await cartResponse.json();<br>      <br>      expect(<br>        cart.items,<br>        &#39;Cart should contain exactly 1 item&#39;<br>      ).toHaveLength(1);<br>      <br>      expect(<br>        cart.items[0].productId,<br>        &#39;Cart item should match added product&#39;<br>      ).toBe(product.id);<br>      <br>      expect(<br>        cart.items[0].quantity,<br>        &#39;Cart item quantity should be 1&#39;<br>      ).toBe(1);<br>      <br>      expect(<br>        cart.total,<br>        &#39;Cart total should equal product price&#39;<br>      ).toBe(29.99);<br>    });<br><br>    await test.step(&#39;Verify inventory decremented&#39;, async () =&gt; {<br>      const productResponse = await request.get(`/api/products/${product.id}`);<br>      const updatedProduct = await productResponse.json();<br>      <br>      expect(<br>        updatedProduct.inventory,<br>        &#39;Product inventory should be decremented by 1&#39;<br>      ).toBe(99);<br>    });<br>  });<br>});</pre><h3>Fixtures and Mocks</h3><p><strong>File:</strong> tests/fixtures/cart-fixtures.ts</p><pre>export async function clearCart(request: APIRequestContext, userId: string) {<br>  await request.delete(`/api/cart/${userId}`);<br>}</pre><pre>export async function createCartWithItems(<br>  request: APIRequestContext, <br>  userId: string, <br>  itemCount: number<br>) {<br>  const products = [];<br>  for (let i = 0; i &lt; itemCount; i++) {<br>    const product = await createProduct({<br>      name: `Test Product ${i}`,<br>      price: 19.99 + i,<br>      inventory: 50<br>    });<br>    products.push(product);<br>  }</pre><pre>  for (const product of products) {<br>    await request.post(&#39;/api/cart/add&#39;, {<br>      data: { productId: product.id, quantity: 1 }<br>    });<br>  }</pre><pre>  return products;<br>}</pre><h3>Implementation Guide</h3><h3>Step 1: Set Up Skill Structure</h3><p>Create this directory structure in your project:</p><pre>.cursor/<br>  skills/<br>    sdlc-1-clarifications/<br>      SKILL.md<br>    sdlc-5-test-cases/<br>      SKILL.md<br>    sdlc-8-test-plan/<br>      SKILL.md<br>  rules/<br>    test-standards.mdc</pre><h3>Step 2: Define Your Test Standards</h3><p><strong>Key Takeaway:</strong> Document your testing conventions once, and AI will follow them automatically in every test case generated.</p><p><strong>File:</strong> .cursor/rules/test-standards.mdc</p><pre># Test Standards for AI-Generated Tests</pre><pre>## Test Structure Requirements</pre><pre>- All tests MUST use test.step() for clear reporting<br>- Every expect() MUST include a descriptive failure message<br>- Use test.beforeEach for setup, test.afterEach for cleanup<br>- Never use hardcoded waits (waitForTimeout) - use expect() auto-retry<br>- Tag tests by type: @unit @integration @e2e</pre><pre>## Locator Strategy</pre><pre>Preference order:<br>1. data-testid attributes<br>2. Role + accessible name<br>3. Visible text<br>4. CSS selectors<br>5. XPath (last resort only)</pre><pre>## Test Data</pre><pre>- Never hardcode test data in test files<br>- Use fixtures from tests/fixtures/<br>- Use factories for complex object creation<br>- Clean up test data in afterEach hooks</pre><pre>## Naming Conventions</pre><pre>- Test files: feature-name.test.ts<br>- Test descriptions: &quot;TC-XXX: Should [expected behavior]&quot;<br>- Fixture functions: createX(), clearX(), setupX()</pre><h3>Step 3: Run the Workflow</h3><p><strong>Scenario:</strong> New feature “User Notifications Settings”</p><pre>Step 1: User provides product spec<br>User: &quot;@notification-settings-spec.md generate test cases&quot;</pre><pre>Step 2: AI reads spec and generates<br>AI: <br>- Creates test-cases.md with 35 test cases<br>- Covers: enable/disable notifications, email preferences, push preferences, quiet hours, etc.<br>- Includes edge cases: invalid email, concurrent updates, timezone handling</pre><pre>Step 3: QA reviews and approves<br>QA reviews test-cases.md, adds 3 more edge cases</pre><pre>Step 4: Generate automation plan<br>User: &quot;@test-cases.md generate automation plan&quot;</pre><pre>AI:<br>- Creates test-automation-plan.md<br>- Maps 35 test cases to 8 test files<br>- Suggests fixtures and mocks<br>- Includes code snippets for complex scenarios</pre><pre>Step 5: Development begins<br>Developer uses automation plan during implementation<br>Tests are written alongside features, not after</pre><h3>Real-World Impact</h3><h3>Quantitative Results</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pFyhFmtdlCrwOYxxIC7dgw.png" /><figcaption>q</figcaption></figure><h3>Qualitative Benefits</h3><p>✅ <strong>Shift-Left Testing:</strong> Test cases exist before code review, not after<br>✅ <strong>Developer Self-Review:</strong> Devs can validate against test cases during PR<br>✅ <strong>Consistent Quality:</strong> AI ensures no edge cases are forgotten<br>✅ <strong>Knowledge Preservation:</strong> Test cases document behavior permanently<br>✅ <strong>QA Focus:</strong> QA spends time on exploratory testing, not documentation</p><h3>Team Feedback</h3><blockquote><em>“Before, I spent 3 days writing test cases manually. Now AI generates 80% of them in 30 minutes, and I spend my time on the creative testing work — exploratory testing and finding unusual scenarios the AI might miss.” — QA Engineer</em></blockquote><h3>Getting Started: Your First Implementation</h3><h3>Week 1: Proof of Concept</h3><ol><li>Pick one small feature (e.g., “Add sorting to user list”)</li><li>Create the test-cases skill</li><li>Run it on your feature spec</li><li>Review output with your QA team</li><li>Measure: How long did it take vs manual approach?</li></ol><h3>Week 2: Expand Scope</h3><ol><li>Add the clarifications skill</li><li>Run on a more complex feature</li><li>Use AI-generated clarifications in planning meeting</li><li>Generate test cases from refined spec</li></ol><h3>Week 3: Full Automation Planning</h3><ol><li>Add the test-plan skill</li><li>Generate complete automation plan for a feature</li><li>Have developers implement tests from the plan</li><li>Collect feedback on plan quality</li></ol><h3>Week 4: Integrate into Workflow</h3><ol><li>Make it standard: All new features use the skills</li><li>Update team process documentation</li><li>Train team on skill usage</li><li>Measure and iterate</li></ol><h3>Common Pitfalls and How to Avoid Them</h3><h3>Pitfall 1: Treating AI Output as Final</h3><p><strong>Problem:</strong> Using AI-generated test cases without human review</p><p><strong>Solution:</strong></p><ul><li>AI generates 80–90% of the work</li><li>Human QA reviews for domain-specific edge cases</li><li>Use AI as a copilot, not autopilot</li></ul><h3>Pitfall 2: Not Encoding Your Standards</h3><p><strong>Problem:</strong> AI generates tests that don’t match your framework patterns</p><p><strong>Solution:</strong></p><ul><li>Create .cursor/rules/test-standards.mdc with your conventions</li><li>Include examples from your existing tests</li><li>AI will follow your patterns automatically</li></ul><h3>Pitfall 3: Ignoring Clarifications Phase</h3><p><strong>Problem:</strong> Generating test cases from ambiguous specs</p><p><strong>Solution:</strong></p><ul><li>Always run clarifications skill first</li><li>Get PM/stakeholder answers before test case generation</li><li>Garbage in = garbage out; clean specs = great test cases</li></ul><h3>Pitfall 4: Not Maintaining Test Data Fixtures</h3><p><strong>Problem:</strong> AI suggests fixtures that don’t exist</p><p><strong>Solution:</strong></p><ul><li>Document your existing fixtures in automation-research.md</li><li>AI will reference real fixtures in automation plans</li><li>Update fixture library as you grow</li></ul><h3>Measuring Success</h3><h3>Key Metrics to Track</h3><p><strong>Efficiency Metrics:</strong></p><ul><li>Time to generate test cases (target: &lt; 1 hour per feature)</li><li>Time to create automation plan (target: &lt; 30 min)</li><li>Test case count per feature (AI should increase by 2x)</li></ul><p><strong>Quality Metrics:</strong></p><ul><li>Test coverage % (should increase)</li><li>Bugs found in development vs QA (shift left)</li><li>Bugs found in production (should decrease)</li></ul><p><strong>Team Metrics:</strong></p><ul><li>QA satisfaction with test case quality</li><li>Developer usage of test cases during development</li><li>Time saved per sprint</li></ul><h3>Sample Dashboard</h3><pre>Sprint 23 Results:<br>- Features: 8<br>- Test cases generated by AI: 342<br>- Test cases added by human: 58 (17%)<br>- Total automation plan creation time: 4 hours (was: 16 days)<br>- Bugs found pre-QA: 45 (was: 15)<br>- Sprint on-time delivery: 100% (was: 60%)</pre><h3>Conclusion</h3><p>AI-powered test case generation isn’t about replacing QA engineers — it’s about <strong>amplifying their impact</strong>. By automating the repetitive documentation work, QA can focus on what humans do best: creative thinking, exploratory testing, and finding the edge cases AI might miss.</p><p><strong>The result?</strong></p><ul><li>Test cases ready during development, not after</li><li><strong>40x faster</strong> test documentation</li><li>2.5x better coverage</li><li>50% faster sprint cycles</li></ul><p>Start small, prove the value, and scale. Your first AI-generated test case suite is just a skill file away.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b0e919bc3f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Selenium + Java to Playwright + TypeScript: Why We Migrated — and Why AI Changed the Equation]]></title>
            <link>https://vinayksharma.medium.com/from-selenium-java-to-playwright-typescript-why-we-migrated-and-why-ai-changed-the-equation-f6f65f2ffbd8?source=rss-309800f31509------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6f65f2ffbd8</guid>
            <category><![CDATA[playwright-automation]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[migration]]></category>
            <dc:creator><![CDATA[Vinay Sharma]]></dc:creator>
            <pubDate>Sat, 02 May 2026 19:32:22 GMT</pubDate>
            <atom:updated>2026-05-02T19:32:22.279Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A practical look at modernizing test automation — and why AI-assisted development fundamentally changed how we evaluated frameworks.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DsojlBgruqHwkmKmFfcuQw.png" /></figure><p>For years, our Selenium + Java suite worked reasonably well. But over time, the maintenance cost kept increasing:</p><ul><li>flaky waits</li><li>Grid overhead</li><li>slow feedback loops</li><li>debugging friction</li><li>engineers spending more time stabilizing tests than writing them</li></ul><p>We eventually realized the problem wasn’t a single flaky test. It was that the framework architecture itself had become expensive to operate.</p><p>So we migrated to <strong>Playwright + TypeScript</strong>.</p><p>Not just because Playwright is faster or cleaner — but because modern AI-assisted engineering workflows work dramatically better with it.</p><h3>What pushed us away from Selenium</h3><p>This wasn’t about Selenium being “bad.” It solved real problems for us for years.</p><p>But modern frontend applications are heavily asynchronous, and over time our Selenium suite accumulated layers of synchronization infrastructure:</p><ul><li>WebDriverWait</li><li>retry wrappers</li><li>stale element handling</li><li>polling utilities</li><li>defensive Thread.sleep(...)</li></ul><p>A typical interaction looked like this:</p><pre>wait.until(ExpectedConditions.elementToBeClickable(loginButton)).click();</pre><p>In Playwright:</p><pre>await page.getByRole(&#39;button&#39;, { name: &#39;Log in&#39; }).click();</pre><p>That difference matters more than syntax.</p><p>Playwright already waits for elements to become actionable:</p><ul><li>visible</li><li>stable</li><li>enabled</li><li>attached</li></ul><p>We deleted large amounts of wait-related framework code simply because Playwright already handled problems we previously solved ourselves.</p><h3>Why Playwright won for us</h3><p>Auto-waiting, tracing, and parallel workers were all important.<br>But the real deciding factor was this:</p><h4><em>Playwright + TypeScript fits naturally into AI-assisted development workflows.</em></h4><p>That changed how we evaluated tooling entirely.</p><h3>Why AI changed the migration equation</h3><p>Modern engineering increasingly involves AI agents:</p><ul><li>Cursor</li><li>Claude Code</li><li>Copilot</li><li>IDE-native assistants</li></ul><p>Those systems perform noticeably better when:</p><ul><li>tests use TypeScript</li><li>selectors are semantic</li><li>traces are structured</li><li>the app and tests share the same ecosystem</li></ul><p>With Selenium + Java, tests felt isolated from the frontend stack.</p><p>With Playwright + TypeScript:</p><ul><li>frontend engineers could contribute directly</li><li>AI systems could reason about app + test code together</li><li>Playwright traces became machine-readable debugging artifacts</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*slNO0caCW4Kp-2UGfgGA-w.png" /></figure><p>A failed Playwright trace contains:</p><ul><li>DOM snapshots</li><li>network logs</li><li>console output</li><li>action timelines</li></ul><p>Instead of debugging from stack traces alone, both humans and AI systems can inspect what actually happened during execution.</p><h3>The biggest migration decision: redesign, don’t port</h3><p>We intentionally avoided a line-by-line migration.</p><p>A direct port would have preserved the same architectural problems in a newer framework.</p><p>Instead, we simplified aggressively.</p><p>We moved toward composition over inheritance, replaced layered setup chains with fixtures, and standardized on semantic selectors instead of XPath-heavy patterns.</p><p>One architectural change that paid off immediately was splitting large E2E flows into reusable workflows + strategies:</p><pre>const workflow = new AmbientNoteWorkflow(page, {<br>  navigation: navigateFromHomePage(),<br>  ambientCreation: createAmbientFromPatientProfile(),<br>});<br><br>await workflow.runFrom(<br>  AmbientNoteStep.NAVIGATE_TO_HOME,<br>  AmbientNoteStep.END<br>);</pre><p>This made tests:</p><ul><li>easier to debug</li><li>easier to reuse</li><li>easier to partially execute</li></ul><p>Instead of rerunning an entire flow, engineers could start directly from intermediate steps.</p><p>That became especially useful during debugging.</p><h3>What was harder than expected</h3><p>The migration was successful, but not effortless.</p><p>The hardest parts were:</p><ul><li>Chrome extension automation</li><li>multi-tab workflows</li><li>async/await adoption</li><li>deciding what old utilities should simply be deleted</li></ul><p>Some workflows that looked “simple” in Selenium turned out to be deeply coupled to years of framework assumptions.</p><p>That last point mattered the most.</p><p>Many Selenium abstractions didn’t need migration because Playwright already solved the underlying problem differently.</p><p>The difficult part wasn’t translation.</p><p>It was deciding what to stop carrying forward.</p><h3>Where AI genuinely helped</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U5zX0hs_VJekDrQd-0U6qA.png" /></figure><p>AI did a significant amount of the mechanical migration work:</p><ul><li>page object conversion</li><li>selector cleanup</li><li>assertion migration</li><li>repetitive refactors</li><li>boilerplate generation</li></ul><p>A typical prompt looked like:</p><blockquote><em>Convert this Selenium page object into Playwright + TypeScript following our framework conventions. Replace XPath selectors where possible.</em></blockquote><p>In many cases, the first draft was surprisingly good.</p><p>But one thing became very clear during the migration:</p><blockquote>AI reduced implementation effort, not engineering responsibility.</blockquote><p>AI did most of the typing. Engineers still had to do most of the thinking.</p><p>The migration still required:</p><ul><li>strong framework understanding</li><li>architectural judgment</li><li>disciplined reviews</li><li>clear coding conventions</li></ul><p>In practice, engineers spent less time typing code and more time:</p><ul><li>reviewing generated changes</li><li>validating abstractions</li><li>refining workflows</li><li>deciding what should not be migrated</li></ul><p>That last part mattered the most.</p><p>AI will faithfully port bad architecture if you let it.</p><p>The quality of the outcome depended heavily on whether the team understood:</p><ul><li>the old framework’s pain points</li><li>the new framework’s strengths</li><li>and what simplifications were actually possible</li></ul><p>The biggest gains came not from generating more code, but from deleting unnecessary complexity during the migration.</p><h3>Final takeaway</h3><p>The biggest lesson from this migration wasn’t:</p><blockquote><em>“Playwright is better than Selenium.”</em></blockquote><p>It was this:</p><blockquote><em>Modern automation frameworks should also be evaluated by how well they integrate with AI-assisted engineering workflows.</em></blockquote><p>Because increasingly, you are not just designing automation for humans.</p><blockquote>You are designing it for the humans and the agents building it together.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6f65f2ffbd8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When Automation Starts Lying]]></title>
            <link>https://vinayksharma.medium.com/when-automation-starts-lying-d9f27cf510d7?source=rss-309800f31509------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9f27cf510d7</guid>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[maintenance]]></category>
            <dc:creator><![CDATA[Vinay Sharma]]></dc:creator>
            <pubDate>Sat, 17 Jan 2026 17:43:02 GMT</pubDate>
            <atom:updated>2026-01-17T17:43:02.171Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5UmzHPeGF4Twxp1uGrxBHA.png" /></figure><p>Test automation is often celebrated for one thing — coverage numbers. Dashboards glow green, percentages climb, and teams feel a sense of victory. But behind every reliable automation suite lies something far less glamorous and far more important: test maintenance.</p><blockquote>Test maintenance isn’t just a task.<br>It’s an art.</blockquote><h3>The Joy of High Automation Coverage</h3><p>There’s real satisfaction in achieving high automation coverage.<br>It feels like progress. Like maturity.</p><p>You look at the suite and think:</p><p><em>We’ve automated almost everything that matters.</em></p><p>And that joy is deserved. Automation saves time, catches regressions early, and helps teams ship faster. But this is also where many teams slip — assuming the work is done.</p><p><em>Automation coverage is not the finish line.<br>It’s the starting point.</em></p><h3>Faith in Automation (But Not Blind Faith)</h3><p>A strong automation suite earns trust over time:</p><ul><li>Critical flows feel protected</li><li>Regressions are caught early</li><li>Releases move faster with confidence</li></ul><p>This trust is powerful — but fragile.</p><p><em>Automation isn’t self-healing.<br>Without care and validation, trust slowly turns into false confidence.</em></p><h3>Ignored Failures Slowly Kill Automation</h3><p>One ignored failure seems harmless.</p><blockquote>“It’s flaky.”<br>“It’s just a test issue.”<br>“We’ll fix it later.”</blockquote><p>But ignored failures quietly decay automation.</p><p>Soon:</p><ul><li>Red builds feel normal</li><li>Failures stop getting attention</li><li>Real bugs hide behind noise</li></ul><p><em>Good automation rarely dies suddenly.<br>It fades when failure becomes acceptable.</em></p><h3>Maintenance Takes Real Effort</h3><p>Maintaining automation is harder than writing it.</p><p>It means:</p><ul><li>Refactoring brittle tests</li><li>Updating locators and assertions</li><li>Removing redundant coverage</li><li>Improving stability and clarity</li></ul><p>This work isn’t flashy. It doesn’t boost test counts.<br>But without it, automation becomes slow, flaky, and unreliable.</p><p><em>Good teams plan for maintenance.<br>Great teams prioritize it.</em></p><h3>Subtle Changes Expose Weak Tests</h3><p>The most dangerous changes aren’t breaking ones — they’re subtle.</p><ul><li>Minor UI text updates</li><li>Small workflow shifts</li><li>Slight API response changes</li><li>Timing or performance variations</li></ul><p>The product still works, but weak tests start failing.</p><p><em>Well-maintained automation adapts.<br>Neglected automation collapses.</em></p><h3>Why Test Maintenance Is an Art</h3><p>Test maintenance demands:</p><ul><li>Judgment over rigidity</li><li>Balance over obsession</li><li>Learning over static scripts</li></ul><p>It’s knowing what to fix, what to remove, and what to trust.</p><p><em>Anyone can write automated tests.<br>Keeping them reliable, meaningful, and trusted — that’s the art.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9f27cf510d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building an AI-Powered Slack Bot for Enterprise Integration (Part 1): Architecture and…]]></title>
            <link>https://vinayksharma.medium.com/building-an-ai-powered-slack-bot-for-enterprise-integration-part-1-architecture-and-b806caaf20c9?source=rss-309800f31509------2</link>
            <guid isPermaLink="false">https://medium.com/p/b806caaf20c9</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[jira]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[slack]]></category>
            <dc:creator><![CDATA[Vinay Sharma]]></dc:creator>
            <pubDate>Sun, 10 Aug 2025 08:32:15 GMT</pubDate>
            <atom:updated>2025-08-10T08:32:15.103Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building an AI-Powered Slack Bot for Enterprise Integration (Part 1): Architecture and Conversational AI</h3><p><em>The AI Slack Bot That Knows Your Projects: Our Journey to Building a Conversational Brain for Enterprise Integration</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y3KXmnQUiopotQzwLlSxSg.png" /></figure><h4>Introduction</h4><p>In any modern software development lifecycle, engineers and QA professionals live in a dozen different browser tabs. Juggling JIRA for tickets, TestRail for results, GitHub for pull requests, and Confluence for documentation creates a constant tax on productivity. This “context-switching” is a silent killer of focus and efficiency.</p><p>What if you could command your entire toolchain from a single, intelligent interface right within Slack? That’s the exact challenge we decided to tackle. We built an AI-powered Slack bot that understands natural language, maintains conversational context, and seamlessly integrates with the essential tools our teams use every day.</p><p>In this first part of our two-part series, we’ll dive into the core architecture, the multi-layered Natural Language Processing (NLP) approach, and the context-aware conversational engine that forms the brain of our bot.</p><h4>The Problem: A Tale of Too Many Tabs</h4><p>Of course. Here is the article broken down into two logical parts.</p><h3>Part 1: Architecture and Conversational AI</h3><p>This first part covers the “why” and the core “how,” focusing on the foundational architecture and the intelligent services that power the bot.</p><h3>Building an AI-Powered Slack Bot for Enterprise Integration (Part 1): Architecture and Conversational AI</h3><p><em>How we designed the core architecture and conversational brain for a bot that integrates with JIRA, TestRail, GitHub, and more.</em></p><h3>🚀 Introduction</h3><p>In any modern software development lifecycle, engineers and QA professionals live in a dozen different browser tabs. Juggling JIRA for tickets, TestRail for results, GitHub for pull requests, and Confluence for documentation creates a constant tax on productivity. This “context-switching” is a silent killer of focus and efficiency.</p><p>What if you could command your entire toolchain from a single, intelligent interface right within Slack? That’s the exact challenge we decided to tackle. We built an AI-powered Slack bot that understands natural language, maintains conversational context, and seamlessly integrates with the essential tools our teams use every day.</p><p>In this first part of our two-part series, we’ll dive into the core architecture, the multi-layered Natural Language Processing (NLP) approach, and the context-aware conversational engine that forms the brain of our bot.</p><h3>The Problem: A Tale of Too Many Tabs</h3><p>Before we built our bot, a simple question could trigger a frustrating digital scavenger hunt.</p><h4>Before: The Tool-Switching Nightmare</h4><ul><li><strong>“What’s the status of that ticket?”</strong> → Stop work, switch to browser, open JIRA, search for the ticket.</li><li><strong>“What were the test results for the last regression run?”</strong> → Open a new tab, navigate to TestRail, find the right test plan, and parse the results.</li><li><strong>“Is the hotfix PR merged yet?”</strong> → Navigate to GitHub, find the repository, and check the pull request status.</li></ul><p>Each step breaks a developer’s flow. We knew there had to be a better way.</p><h4>After: One Bot, All Tools</h4><p>Our solution centralizes these workflows into a simple conversation.</p><pre>@QA-Bot Can you share test results for latest regression run?</pre><pre>🤔 Let me check that for you...<br>I need a bit more information to help you:<br>• Run ID (e.g., R1234, 5678)<br>• Test ID (e.g., T12345, 12345)<br>• Plan ID (e.g., P1234, 5678)</pre><p><em>This interaction demonstrates not just command execution, but a bot that can understand ambiguity and ask for clarification — a core concept we’ll explore.</em></p><h4>Technical Architecture</h4><p>To build a robust and scalable bot, we chose a modern, containerized stack.</p><h4>Core Technologies</h4><ul><li><strong>Backend</strong>: Python Flask with SQLAlchemy for a lightweight, powerful web framework and ORM.</li><li><strong>AI/ML</strong>: OpenAI GPT for state-of-the-art natural language understanding and generation.</li><li><strong>Containerization</strong>: Docker with Gunicorn for consistent, production-ready deployments.</li><li><strong>Database</strong>: SQLite for easy development, with full support for PostgreSQL in production.</li><li><strong>API Integration</strong>: Standard RESTful API calls to communicate with all external services.</li></ul><h4>System Architecture</h4><p>At a high level, the system consists of three main components: the Slack API interface, our core Flask application, and the external services we integrate with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*HdEl3rz329HYk-xXZi73kA.png" /></figure><p><em>The flow is simple: Slack sends an event to our Flask app, which uses its NLP and conversation services to understand the request. It then calls the appropriate external API, processes the data, and sends a formatted response back to Slack.</em></p><h4>Intelligent Natural Language Processing</h4><p>The “magic” of our bot lies in its ability to understand human language. We achieved this with a multi-layered NLP approach that balances speed, cost, and accuracy.</p><h4>Multi-Layer NLP Approach</h4><p>Instead of sending every message to the AI, we first try to match it against a set of predefined patterns. This is extremely fast and cost-effective for common commands. If no pattern matches, we then leverage the power of OpenAI’s GPT for more complex intent recognition.</p><p>Here’s a simplified look at the NLPService logic:</p><pre>class NLPService:<br>    def process_message(self, message: str, user_id: str = None, <br>                       conversation_context: Dict[str, Any] = None):<br>        # 1. Pattern Matching (Fast, Rule-based)<br>        intent, entities = self._pattern_match(message)<br>        <br>        # 2. AI Understanding (When patterns fail)<br>        if intent == &#39;unknown&#39;:<br>            intent, entities = self._ai_intent_recognition(message)<br>        <br>        # 3. Context-Aware Processing (For follow-up questions)<br>        if conversation_context and conversation_context.get(&#39;needs_clarification&#39;):<br>            intent, entities = self._extract_follow_up_info(message, <br>                                                          previous_intent, <br>                                                          previous_entities)<br>        <br>        return intent, entities</pre><h4>Smart Intent Recognition</h4><p>We defined over 15 distinct “intents” that the bot can recognize. An intent is the user’s goal (e.g., get_testrail_results), and &quot;entities&quot; are the specific details (e.g., a plan_id). Our pattern-matching layer uses regular expressions for this.</p><pre>INTENT_PATTERNS = {<br>    &#39;get_testrail_results&#39;: [<br>        r&#39;(?:get|show|share)\s+(?:testrail\s+)?test\s+results?(?:\s+for\s+(.+))?&#39;,<br>        r&#39;(?:run\s+id|runid)\s*[-:]\s*([A-Z0-9]+)&#39;,<br>    ],<br>    &#39;trigger_buildkite_build&#39;: [<br>        r&#39;trigger\s+(?:buildkite\s+)?(?:pipeline|build)\s+(.+)&#39;,<br>        r&#39;run\s+(?:buildkite\s+)?(?:pipeline|build)\s+(.+)&#39;<br>    ],<br>    # ... ...<br>}</pre><h3>Conversational AI with Context Awareness</h3><p>A truly smart assistant needs to remember the conversation. Our bot maintains state, allowing for natural, multi-turn interactions.</p><h4>Multi-Turn Conversations</h4><p>If a user makes a request with missing information, the bot doesn’t just fail; it asks for clarification. This is handled by our ConversationService.</p><pre>class ConversationService:<br>    def get_clarification_prompt(self, intent: str, missing_info: List[str]) -&gt; str:<br>        prompts = {<br>            &#39;get_testrail_results&#39;: {<br>                &#39;run_id,test_id,plan_id&#39;: &quot;I need **either a Run ID, Test ID, OR Plan ID** to fetch the test results. Please provide one of these:\n\n**Run ID formats:**\n• `run ID - R2529`\n• `runid: R2529`&quot;<br>            }<br>            # ... other prompts<br>        }</pre><h4>Smart Follow-up Processing</h4><p>Once the bot asks for more information, it needs to intelligently parse the user’s next response. The NLP service checks the conversation context and applies specific logic to extract the missing piece of data, then re-triggers the original intent.</p><pre>def _extract_follow_up_info(self, message: str, previous_intent: str, <br>                           previous_entities: Dict[str, Any]):<br>    if previous_intent == &#39;get_testrail_results&#39;:<br>        # Look for run_id, test_id, or plan_id in the message<br>        plan_id_match = re.search(r&#39;(?:plan\s*id|planid)\s*[-:]\s*([A-Z0-9]+)&#39;, message, re.IGNORECASE)<br>        <br>        if plan_id_match:<br>            entities[&#39;plan_id&#39;] = plan_id_match.group(1).upper()<br>            return &#39;get_testrail_results&#39;, entities<br>        # ... handle other cases</pre><h3>Next Steps</h3><p>We’ve now laid the foundation of our AI-powered Slack bot. We’ve seen how the high-level architecture works and how its brain uses a hybrid NLP model and a stateful service to understand and manage conversations.</p><p><strong>In Part 2, we will get our hands dirty</strong> with the practical implementation details. We’ll cover:</p><ul><li><strong>Specific code</strong> for JIRA, TestRail, and Buildkite/Jenkins integrations.</li><li><strong>Production-ready features</strong> like event deduplication and cost optimisation.</li><li><strong>Deployment and scaling</strong> using Docker and Gunicorn.</li><li>The <strong>real-world impact and results</strong> the bot has had on our team’s productivity.</li></ul><p>Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b806caaf20c9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TestGen UI: AI-Powered Test Case Generation That Actually Works]]></title>
            <link>https://vinayksharma.medium.com/testgen-ui-ai-powered-test-case-generation-that-actually-works-a326df65d7a4?source=rss-309800f31509------2</link>
            <guid isPermaLink="false">https://medium.com/p/a326df65d7a4</guid>
            <dc:creator><![CDATA[Vinay Sharma]]></dc:creator>
            <pubDate>Fri, 18 Jul 2025 18:54:45 GMT</pubDate>
            <atom:updated>2025-07-18T18:54:45.265Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aVzBpL24kvhUO27TigA4_g.png" /></figure><p><em>We’ve all been there.</em></p><p>A new feature is ready to ship. The code is pristine. The deadline is breathing down your neck. But one last hurdle looms large: <strong>writing the tests</strong>.</p><p><em>Crucial? Absolutely.<br> Fun? Not really.</em></p><p>The process is repetitive, time-consuming, and often feels like a necessary evil. So we asked ourselves: <em>What if writing tests didn’t feel like a chore?</em></p><blockquote>What if it felt… automated, intelligent, even a little magical?</blockquote><h4><strong>The Pain of Traditional Testing</strong></h4><p>Before we dive into the solution, let’s talk about the reality most teams silently endure:</p><ul><li><strong>The Never-Ending Repetition</strong><br> Writing test cases for every single user story or feature burns time and brainpower. It’s creativity on a treadmill.</li><li><strong>Inconsistent Coverage</strong><br> Human-written tests often miss edge cases, negative paths, or boundary conditions. These blind spots lead to costly bugs.</li><li><strong>Scattered Knowledge</strong><br> Requirements live in Confluence, mockups in Figma, test cases in Excel (still?!). This siloed information results in outdated tests and duplicated effort.</li><li><strong>Bloated Test Suites</strong><br> As projects grow, test suites balloon. Without pruning and optimization, they turn into unmaintainable monsters.</li></ul><p>We realized that a simple chatbot wouldn’t solve these deep-seated workflow issues. We needed a tool that was built for testers, by testers.</p><h4>Why a Chatbot Won’t Fix This</h4><p>We tried the existing AI tools. They generate something. But they don’t understand <em>your</em> product, <em>your</em> workflows, or the <em>context</em> behind what needs to be tested.</p><blockquote>So we built what we actually needed.</blockquote><h4>Introducing <strong>TestGen UI</strong></h4><p><strong>TestGen UI</strong> is an end-to-end test case generation and optimisation platform powered by GPT-4, built specifically for software testers, by software testers.</p><h3>Architecture Overview</h3><p>We built TestGen UI to be robust, scalable, and lightning-fast:</p><ul><li><strong>Backend:</strong> Python + FastAPI + GPT-4 (via OpenAI API)</li><li><strong>Vector Storage &amp; Search:</strong> ChromaDB</li><li><strong>Knowledge Retrieval:</strong> Custom RAG (Retrieval-Augmented Generation) system</li><li><strong>Frontend:</strong> Lightweight, clean web UI (HTML, CSS, JS — no bloated frameworks)</li></ul><p>This setup allows us to parse complex documentation, understand your domain, and generate high-quality test cases that actually make sense.</p><h3>Key Features</h3><p><strong>Multi-Format Test Generation:</strong> <br>Got your requirements in a Word doc? Markdown? PDF? Or even just screenshots of a Figma design?<br> We support them all — upload, parse, and generate.</p><p><strong>Context-Aware Knowledge Base: <br></strong>Our RAG-powered knowledge base doesn’t just <em>store</em> your test cases — it <em>understands</em> them. It learns from:</p><ul><li>Your requirements</li><li>Past test cases</li><li>API definitions</li><li>UI patterns</li></ul><p>It intelligently deduplicates and versions your test cases so your test suite stays lean and relevant.</p><p><strong>Visual + API Testing</strong></p><ul><li>Upload mockups (PNG, JPG) → Get visual test scenarios.</li><li>Upload your OpenAPI or Swagger spec → Get a full API test suite: functionality, security, error handling, and more.</li></ul><p><strong>AI-Powered Test Optimization</strong></p><p>Already have a test suite? Let AI review it.<br> TestGen UI suggests:</p><ul><li>Consolidation of similar cases</li><li>Missing edge conditions</li><li>Smarter prioritization</li></ul><p>It’s like having a QA lead that never sleeps.</p><h4>Enough of the Theory — Let’s See It in Action</h4><p>Here’s a quick walkthrough of TestGen UI in action:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fk5pU2Dbe5Co%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dk5pU2Dbe5Co&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fk5pU2Dbe5Co%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1ef7abaad3075f30e6558d82ba1a891d/href">https://medium.com/media/1ef7abaad3075f30e6558d82ba1a891d/href</a></iframe><h3>Final Thoughts</h3><p>If testing is the bottleneck, maybe it’s time to let AI shoulder some of that load.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a326df65d7a4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ AI-Driven Locators in Selenium: No More Broken Tests!]]></title>
            <link>https://vinayksharma.medium.com/ai-driven-locators-in-selenium-no-more-broken-tests-2f49a924bf51?source=rss-309800f31509------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f49a924bf51</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[openai-chatgpt]]></category>
            <dc:creator><![CDATA[Vinay Sharma]]></dc:creator>
            <pubDate>Wed, 28 May 2025 19:50:25 GMT</pubDate>
            <atom:updated>2025-05-28T19:51:31.887Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jKJ4RdOqhwhKt7MK" /></figure><p>Maintaining test locators is like playing whack-a-mole — just when you think your automation suite is stable, someone tweaks the DOM and everything falls apart.</p><p>But what if your tests could heal themselves? What if AI could understand your app’s structure and generate locators dynamically?</p><blockquote>Let’s talk about how I built a system using <strong>OpenAI’s GPT-4</strong> to <em>reimagine</em> locator maintenance.</blockquote><h3><strong>The Locator Problem We’ve All Faced</strong></h3><p>In traditional Selenium tests, locators are usually hardcoded:</p><pre>By loginButton = By.id(&quot;login-button&quot;);<br>By emailField = By.cssSelector(&quot;input[name=&#39;email&#39;]&quot;);</pre><p>It works — until it doesn’t.</p><p>Your test breaks when:</p><ul><li>IDs change</li><li>Class names are renamed by another team</li><li>The DOM is slightly restructured</li><li>You shift environments or themes</li></ul><p><em>And suddenly, you’re digging through HTML trying to fix what should’ve been simple.</em></p><h3>🤖 The AI-Powered Breakthrough</h3><p>Imagine if instead of hardcoding locators, you could <em>ask</em> an AI to look at your page and return smart, descriptive selectors. That’s exactly what I built.</p><p>Here’s the core idea:</p><ol><li>Grab the page’s HTML source</li><li>Send it to <strong>GPT-4</strong> with a prompt to extract usable locators</li><li>Receive a clean JSON array of {name, selector, type}</li><li>Cache results to avoid repeated API calls</li></ol><p>No more brittle locators. Just resilient, intelligent element selection.</p><h3><strong>🛠️ How It Works (Under the Hood)</strong></h3><p><strong>1. Integration with OpenAI</strong></p><p>We send the full page source to GPT-4 with a carefully crafted prompt:</p><pre>public static String GetLocatorsForPageAsJson(String pageSource) {<br>    String normalizedSource = normalizePageSource(pageSource);<br>    String cached = LocatorCache.getCachedLocators(normalizedSource);<br>    if (cached != null) return cached;<br><br>    var client = OpenAIOkHttpClient.builder().apiKey(openAIKey).build();<br>    ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()<br>      .addUserMessage(<br>        &quot;Return only a JSON array of locators from page source &quot; + pageSource + &quot;. &quot; +<br>        &quot;Each locator should be an object with {\&quot;locatorName\&quot;:\&quot;descriptive name\&quot;,&quot; +<br>        &quot;\&quot;locator\&quot;:\&quot;selector value\&quot;,\&quot;locatorType\&quot;:\&quot;xpath or css or id...\&quot;}&quot;)<br>      .model(ChatModel.GPT_4_1)<br>      .build();<br><br>    String response = client.chat().completions().create(params)<br>        .choices().get(0).message()._content().toString();<br><br>    LocatorCache.cacheLocators(normalizedSource, response);<br>    return response;<br>}</pre><p><strong>2. Reading &amp; Using Locators</strong></p><p>Once the JSON is back, we convert it into Selenium By locators:</p><pre>public static void loadLocatorsFromJson(String jsonFilePath) {<br>    ObjectMapper objectMapper = new ObjectMapper();<br>    List&lt;Locators&gt; locators = objectMapper.readValue(jsonFilePath, <br>        new TypeReference&lt;List&lt;Locators&gt;&gt;() {});<br><br>    locatorsMap.clear();<br>    for (Locators locator : locators) {<br>        String key = locator.getLocator();<br>        String type = locator.getLocatorType();<br><br>        By by = switch (type.toLowerCase()) {<br>            case &quot;xpath&quot; -&gt; By.xpath(key);<br>            case &quot;css&quot; -&gt; By.cssSelector(key);<br>            case &quot;id&quot; -&gt; By.id(key);<br>            default -&gt; throw new IllegalArgumentException(&quot;Unsupported type: &quot; + type);<br>        };<br>        locatorsMap.put(locator.getLocatorName(), by);<br>    }<br>}</pre><h3>🚀 Using AI-Generated Locators in Tests</h3><p>Once loaded, your tests can work with descriptive names:</p><pre>String pageSource = driver.getPageSource();<br>String json = OpenAIHelper.GetLocatorsForPageAsJson(pageSource);<br>LocatorReader.loadLocatorsFromJson(json);<br><br>By loginButton = LocatorReader.findLocatorByPartialName(&quot;Login button&quot;);<br>By emailField = LocatorReader.findLocatorByPartialName(&quot;email&quot;);<br>By passwordField = LocatorReader.findLocatorByPartialName(&quot;password&quot;);<br><br>driver.findElement(emailField).sendKeys(&quot;user@example.com&quot;);<br>driver.findElement(passwordField).sendKeys(&quot;password123&quot;);<br>driver.findElement(loginButton).click();</pre><p><em>No brittle selectors. No maintenance headaches. Just adaptive automation.</em></p><h3>🎁 What You Gain</h3><ul><li><strong>Self-Healing Tests</strong> — Tests adapt as your UI evolves</li><li><strong>No More Locator Guesswork</strong> — GPT returns clean, usable selectors</li><li><strong>Fewer Code Updates</strong> — No need to recompile every time the DOM changes</li><li><strong>Natural Language Mapping</strong> — Find elements by intent, not syntax</li><li><strong>Smarter Caching</strong> — Don’t waste API calls — just reuse what works</li></ul><h3>⚠️ What to Watch Out For</h3><p>Before you dive in, consider:</p><ul><li><strong>API Costs</strong> — GPT-4 isn’t free. Batch calls and cache smartly.</li><li><strong>Rate Limits</strong> — Avoid hammering OpenAI during CI/CD runs.</li><li><strong>Inconsistent Pages</strong> — Complex, dynamic pages might trip the model.</li><li><strong>Security</strong> — Never send sensitive data to external APIs.</li></ul><h3>🔮 Final Thoughts: AI + Automation = Future</h3><p>This is more than a clever hack — it’s a <strong>mindset shift</strong>.</p><p>We’re no longer coding around the DOM. We’re telling an intelligent system <em>what we need</em>, and letting it figure out <em>how to get it</em>. Just like we moved from assembly to high-level languages — this is the next leap.</p><p>If you’re tired of brittle locators and want tests that <em>actually</em> keep up with your app, it might be time to invite AI into your automation pipeline.</p><p><em>Let’s stop writing tests that break. Let’s start writing tests that learn. 🧠✨</em></p><p>Thank you for reading this!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f49a924bf51" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrate BrowserStack with flutter integration Android test]]></title>
            <link>https://vinayksharma.medium.com/integrate-browserstack-with-flutter-integration-android-test-2b7e1d7416c2?source=rss-309800f31509------2</link>
            <guid isPermaLink="false">https://medium.com/p/2b7e1d7416c2</guid>
            <category><![CDATA[flutter-integration-test]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[cloud-testing]]></category>
            <category><![CDATA[flutter-testing]]></category>
            <category><![CDATA[browserstack]]></category>
            <dc:creator><![CDATA[Vinay Sharma]]></dc:creator>
            <pubDate>Wed, 13 Mar 2024 08:53:59 GMT</pubDate>
            <atom:updated>2024-03-14T07:05:40.720Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, we’ll explore how to run Flutter integration tests for <strong>Android</strong> on BrowserStack, a cloud-based testing platform. Before we begin, make sure you have the following prerequisites in place:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*MQTxJu4Vwo0eqvnfE1nczw.png" /><figcaption>Flutter integration test</figcaption></figure><ol><li>Flutter installed on your machine. You can follow the installation guide <a href="https://www.geeksforgeeks.org/flutter-installation-on-macos/">here</a>.</li><li>Ensure all required libraries are installed by running flutter doctor in your terminal. This command should list all necessary libraries with proper checkmarks.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*vhb2H6Im9FZ1MEedTff7Pw.png" /></figure><p>Additionally, you’ll need:</p><ul><li>A working Flutter project. If you don’t have one, you can clone a sample project.</li><li>A BrowserStack account. You can sign up for a free account <a href="https://www.browserstack.com/users/sign_up">here</a>.</li></ul><p>With these prerequisites met, let’s dive into the steps to integrate BrowserStack with Flutter for Android integration testing.</p><p><strong>Step 1: <br>Dependencies Setup</strong>: Update your android/app/build.gradle file to ensure it uses AndroidX&#39;s version of AndroidJUnitRunner and includes AndroidX libraries as dependencies.</p><pre>android {<br>  ...<br>  defaultConfig {<br>    ...<br>    testInstrumentationRunner &quot;androidx.test.runner.AndroidJUnitRunner&quot;<br>  }<br>}</pre><pre>dependencies {<br>    testImplementation &#39;junit:junit:4.12&#39;<br>    androidTestImplementation &#39;androidx.test:runner:1.2.0&#39;<br>    androidTestImplementation &#39;androidx.test.espresso:espresso-core:3.2.0&#39;<br>}</pre><p><strong>Step 2:<br></strong>Create a new file named MainActivityTest.java under android/app/src/androidTest/java/com/example/myapp/. Customize the package structure (com.example.myapp) to match your app&#39;s actual package name.</p><p>These steps will help you prepare your Flutter project and set up BrowserStack for running integration tests on Android devices</p><pre>package com.example.myApp;<br>    import androidx.test.rule.ActivityTestRule;<br>    import dev.flutter.plugins.integration_test.FlutterTestRunner;<br>    import org.junit.Rule;<br>    import org.junit.runner.RunWith;<br>    import com.example.myApp.MainActivity;<br>    @RunWith(FlutterTestRunner.class)<br>    public class MainActivityTest {<br>      @Rule<br>      public ActivityTestRule&lt;MainActivity&gt; rule = new ActivityTestRule&lt;&gt;(MainActivity.class, true, false);<br>    }java</pre><p><strong>Step 3:<br>Build Instrumentation test .apk file : </strong>Use the following Gradle commands to build an instrumentation test.apk file(test suite) using the MainActivityTest.java created in the androidTest directory as mentioned in step 1.</p><pre># Go to the android folder which contains the &quot;gradlew&quot; script used for building Android apps from the terminal<br>      pushd android<br>    # Build an Android test APK (uses the MainActivityTest.java file created in step 1)<br>        ./gradlew app:assembleAndroidTest<br>    # Build a debug APK by passing the integration test file<br>        ./gradlew app:assembleDebug -Ptarget=`pwd`/integration_test/app_test.dart&quot;<br>    # Go back to the root of the project<br>        popd<br>  ```</pre><p><strong>Step 4:<br>Executing Tests Locally</strong>: After integrating the necessary dependencies as per the documentation, you can locally run the tests using Gradle to validate the Android setup.<br><strong>Please remember</strong>: Navigate to your app’s android directory to run Gradle commands. Use cd android to move to the android directory, then execute the following command:</p><pre>flutter build apk --debug<br>./gradlew app:assembleDebugAndroidTest<br>./gradlew app:connectedDebugAndroidTest -Ptarget=integration_test/tests/&lt;testcase_name&gt;.dart</pre><p>If your setup is successful, the test cases will begin running on your local device.</p><blockquote>Ready to Rock: Your Setup is Set, Let’s Test on BrowserStack!</blockquote><p><strong>Step 4:<br>Upload Your Apps to BrowserStack:</strong> As per Step 3, we’ve generated two APKs — the <em>Android test APK</em> and the <em>Android debug APK</em>. Now, let’s upload both these APKs to BrowserStack to obtain the corresponding urls. Execute the following curl command to upload the Android test APK:”</p><pre>curl -u &quot;bs_accessKey:bs_pass&quot; \<br>-X POST &quot;https://api-cloud.browserstack.com/app-automate/flutter-integration-tests/v2/android/app&quot; \<br>-F &quot;file=@/path/to/app/file/Application-debug.apk&quot;</pre><p>Depending on your internet speed, the upload process may take some time. Once completed, you will receive a unique urls, for example: &quot;app_url&quot;:&quot;bs://j3c874f21852ea50957a3fdc33f47514288c4ba4&quot;,</p><p>Follow the same process to upload the Android debug APK and extract its URL as well.”</p><pre>curl -u &quot;bs_accessKey:bs_pass&quot; \<br>-X POST &quot;https://api-cloud.browserstack.com/app-automate/flutter-integration-tests/v2/android/test-suite&quot; \<br>-F &quot;file=@/path/to/app/file/Application-debug-test.apk&quot;</pre><p><em>Extracted url:</em> &quot;test_suite_url&quot;:&quot;bs://f7c874f21852ba57957a3fde31f47514288c4ba4&quot;</p><p><strong>Step 5:</strong><br><strong>Run Android Flutter integration tests</strong>: To complete the process, use another curl command to trigger a test. This command will require both the URLs obtained earlier as parameters, along with any other customized parameters according to your requirements. <em>This will initiate the Android Flutter integration tests</em></p><pre>curl -u &quot;bs_accessKey:bs_pass&quot; \<br>-X POST &quot;https://api-cloud.browserstack.com/app-automate/flutter-integration-tests/v2/android/build&quot; \<br>-d &#39;{&quot;app&quot;: &quot;bs://j3c874f21852ea50957a3fdc33f47514288c4ba4&quot;, &quot;testSuite&quot;: &quot;bs://f7c874f21852ba57957a3fde31f47514288c4ba4&quot;, &quot;devices&quot;: [&quot;Samsung Galaxy S9 Plus-9.0&quot;]}&#39; \<br>-H &quot;Content-Type: application/json&quot; </pre><p><em>A sample response:</em></p><pre>{<br>    &quot;message&quot; : &quot;Success&quot;,<br>    &quot;build_id&quot; : &quot;4d2b4deb810af077d5aed98f479bfdd2e64f36c3&quot;<br>}</pre><p><strong>message — success</strong> means you have successfully triggered the flutter automation test on Browserstack and if you want to view the test result head to the flutter dashboard on <a href="https://app-automate.browserstack.com/dashboard/v2/builds/f6e8ef5d67cdc84f4a43eb61ff2990a9211d3342">https://app-automate.browserstack.com/dashboard/v2/builds/</a>&lt;build_id&gt;</p><p>Just to simplify, you can add all the above steps in an single runner.sh</p><p><strong>Step 6:<br>Runner.sh:</strong></p><pre>flutter build apk --debug <br><br>pushd android<br>    ./gradlew app:assembleDebugAndroidTest<br>    ./gradlew app:assembleDebug -Ptarget=`pwd`/../integration_test/tests/&lt;testCase_name&gt;.dart<br>popd<br><br>apk_path=$(pwd)/build/app/outputs/apk/debug/app-debug.apk<br>test_apk_path=$(pwd)/build/app/outputs/apk/androidTest/debug/app-debug-androidTest.apk<br><br># 1. Upload app<br>echo &quot;Uploading test app to BrowserStack&quot;<br>app_upload=$(curl -u &quot;$BROWSERSTACK_USER:$BROWSERSTACK_ACCESS_KEY&quot; -X POST &quot;https://api-cloud.browserstack.com/app-automate/flutter-integration-tests/v2/android/app&quot; \<br>  -F &quot;file=@$apk_path&quot;)<br>app_url=$(jq -r .app_url &lt;&lt;&lt; &quot;$app_upload&quot;)<br>echo -e &quot;\napp_url: $app_url\n&quot;<br><br># 2. Upload test<br>echo &quot;Upload debug app to BrowserStack&quot;<br>test_upload=$(curl -u &quot;$BROWSERSTACK_USER:$BROWSERSTACK_ACCESS_KEY&quot; -X POST &quot;https://api-cloud.browserstack.com/app-automate/flutter-integration-tests/v2/android/test-suite&quot; \<br> -F &quot;file=@$test_apk_path&quot;)<br>test_url=$(jq -r .test_suite_url &lt;&lt;&lt; &quot;$test_upload&quot;)<br>echo -e &quot;\ntest_url: $test_url\n&quot;<br><br># 3. Trigger test<br>trigger_tests=$(curl -u &quot;$BROWSERSTACK_USER:$BROWSERSTACK_ACCESS_KEY&quot; \<br>    -X POST &quot;https://api-cloud.browserstack.com/app-automate/flutter-integration-tests/v2/android/build&quot; \<br>    -d &quot;{\&quot;buildName\&quot;: \&quot;$build_name\&quot;, \&quot;buildTag\&quot;: \&quot;$build_tag\&quot;, \&quot;deviceLogs\&quot;: $device_logs, \&quot;networkLogs\&quot;: $network_logs,\&quot;project\&quot;: \&quot;$project\&quot;, ,\&quot;autoGrantPermissions\&quot;:true, \&quot;devices\&quot;: $devices, \&quot;app\&quot;: \&quot;$app_url\&quot;, \&quot;testSuite\&quot;: \&quot;$test_url\&quot;}&quot; \<br>    -H &quot;Content-Type: application/json&quot;)<br>build_id=$(jq -r .build_id &lt;&lt;&lt; &quot;$trigger_tests&quot;)<br>echo -e &quot;\ntrigger_tests: $trigger_tests\n&quot;<br>echo -e &quot;\nbuild_id: $build_id\n&quot;<br><br>test_result_url=&quot;https://app-automate.browserstack.com/dashboard/v2/builds/$build_id&quot;<br>echo -e &quot;\nTest Execution is started and can be found on this link\n - $test_result_url&quot;<br>exit $exit_code</pre><p>After executing the runner.sh script, it will handle everything from generating the necessary APKs to uploading the tests to Browserstack, extracting the required information, triggering the tests, and finally displaying the results on the dashboard. Everything is set up for you to seamlessly run tests on Browserstack for Android.</p><p><strong><em>Perfect! You are all good to run tests on the browserstack for Android.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2b7e1d7416c2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scaling Selenium tests using Selenoid & Selenosis]]></title>
            <link>https://vinayksharma.medium.com/scaling-selenium-tests-using-selenoid-selenosis-2528d0ff0442?source=rss-309800f31509------2</link>
            <guid isPermaLink="false">https://medium.com/p/2528d0ff0442</guid>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[selenoid]]></category>
            <category><![CDATA[selenium-test-automation]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[scalable]]></category>
            <dc:creator><![CDATA[Vinay Sharma]]></dc:creator>
            <pubDate>Tue, 15 Aug 2023 16:14:59 GMT</pubDate>
            <atom:updated>2023-08-15T16:18:58.824Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GSwy0Q9rwOOltciAHytowQ.png" /></figure><p><em>Looking to Execute Selenium Tests Across Multiple Containers?</em></p><p><em>Interested in Concurrent and Scalable Execution of Your Selenium Tests?</em></p><p>In this blog, we will delve into the art of scaling test automation, tapping into the potential of Kubernetes and Docker through Selenoid and the prowess of Selenosis.</p><p>To begin, let’s delve into the reasons behind adopting Selenoid and Selenosis.</p><p><strong><em>Selenoid</em>: </strong>Streamlined Selenium Hub with Docker Efficiency. Selenoid revolutionizes the Selenium hub experience by leveraging Docker containers for browser launches. This ingenious approach simplifies Selenium hub implementation, eliminating the need for dual management of both Selenium hub and Docker. With Selenoid, the emphasis shifts solely to implementing the tool, while its internal mechanisms seamlessly handle all the complexities.</p><blockquote>According to the documentation of <strong>Aerokube</strong>, selenoid is not recommended for the Kubernetes platform. And <strong>Moon</strong> is pay per use model. So in this article, we are going to explore <strong>Selenosis </strong>— a<strong> </strong>scalable, stateless selenium hub for the Kubernetes cluster.</blockquote><p><strong><em>Selenosis</em></strong>: Empowering Scalable, Stateless Selenium Hub for Kubernetes Clusters. Harnessing the capabilities of a Kubernetes cluster, Selenosis seamlessly scales test automation. It intelligently distributes the load across available pods, ensuring efficient execution, and gracefully removes them post-completion. In essence, it blends Kubernetes’ orchestration prowess with the essence of test automation.</p><p>Enough of theory, Let us dive in to some action &amp; see how it works.</p><h4><strong><em>Pre-requistes:</em></strong></h4><ul><li><a href="https://docs.docker.com/">Docker</a></li><li><a href="https://formulae.brew.sh/formula/kubernetes-cli">kubectl</a></li><li><a href="https://kubernetes.io/docs/tasks/tools/install-minikube/">Minikube</a> — For this blog, I will be using a <a href="https://kubernetes.io/docs/tasks/tools/install-minikube/">Minikube</a> cluster which is the easiest and simplest way to spin up a K8s cluster on your local machine.</li><li>Selenium code (Basic parallel tests)</li><li>Basic understanding of <a href="https://kubernetes.io/docs/home/">Kubernetes</a> will be plus.</li><li>Start Minikube by running the below command (docker should be up &amp; running)</li></ul><pre><br>minikube start - vm-driver=docker - insecure-registry=&quot;gcr.io&quot;</pre><p>With all prerequisites in place, let’s begin.</p><ol><li><strong>Creating a namespace: </strong><a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/"><em>Namespaces</em></a> are Kubernetes objects which help in organising resources and partition a single Kubernetes cluster into multiple virtual clusters. It provides a degree of isolation from the other parts of the cluster.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/acbc8f7806fd491c840d5cbb0217c600/href">https://medium.com/media/acbc8f7806fd491c840d5cbb0217c600/href</a></iframe><p><strong>2. Creating service: </strong>Service is actually a method for exposing a network application that is running as one or more <a href="https://kubernetes.io/docs/concepts/workloads/pods/">Pods</a> in your cluster.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c59e535b7a8b360cf52af60f3480cf0c/href">https://medium.com/media/c59e535b7a8b360cf52af60f3480cf0c/href</a></iframe><p>3. <strong>Creating Selenosis deployment</strong>: It will actually create a deployment object to manage the pods and also it will create a service which will act like a load balancer for balancing the traffic coming from all the registered nodes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/60c9c8cde7fce475431bb6a24a8477af/href">https://medium.com/media/60c9c8cde7fce475431bb6a24a8477af/href</a></iframe><p><strong><em>Note</em></strong><em>: In the above yaml file, I have kept browser limit to </em><strong><em>15</em></strong><em>. You can increase or decrease based on your requirement &amp; CPU capacity</em></p><p>4. <strong>Selenoid — UI: </strong>The purpose of Selenoid UI is to offer an intuitive interface that enables seamless management and visualization of Selenium containers within the Selenoid ecosystem.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d5a2eee7ddea86260d8a501f5e9ef876/href">https://medium.com/media/d5a2eee7ddea86260d8a501f5e9ef876/href</a></iframe><p><strong>5. Selenosis HPA</strong>: <a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/"><strong><em>Horizontal Pod Autoscaler</em></strong></a><strong><em> </em></strong>automatically scales the number of Pods in a replication controller, deployment, replica set or stateful set based on observed CPU utilisation.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7247f427afc173c3a671bc0ecb09b763/href">https://medium.com/media/7247f427afc173c3a671bc0ecb09b763/href</a></iframe><p>6. Finally, an option is to maintain a <a href="https://gist.github.com/Vinay08sharma/a138096b60ee9bb5394a3ed5d63b0c9b">browser</a> file housing image files of various browsers along with their respective versions.</p><p>With all the necessary files in place, the next step involves setting up the services and exposing them to initiate the desired actions.</p><p>To streamline the process, I’ve compiled all the required commands into a convenient shell file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b309482ea4e1c20129c6027ab907f0f7/href">https://medium.com/media/b309482ea4e1c20129c6027ab907f0f7/href</a></iframe><p>To execute these commands effortlessly, simply run the following shell command.</p><pre>sh start.sh</pre><p>You can now check the Minikube dashboard to confirm all the pods are up &amp; running.</p><pre>minikube dashboard</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_c4T1m98rdACP1LcLMDRWA.png" /><figcaption>Minikube dashboard</figcaption></figure><p>Now, proceed to your web browser and access <a href="http://127.0.0.1:8080/">http://127.0.0.1:8080/</a></p><p>Likewise, you can employ this identical address as your remote web URL within your Selenium tests. This setup empowers you to execute tests concurrently, with tests distributing across accessible nodes and queuing up. As soon as a browser node becomes available, the next queued test will seamlessly commenced.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*95IuRFcMY_dlrM5xLJ1mZw.png" /><figcaption>Selenoid ui</figcaption></figure><p>The source code of this blog post can be found <a href="https://github.com/Vinay08sharma/selenosis-deploy"><strong><em>here</em></strong></a><strong>.</strong></p><h4><strong>Future Scope:</strong></h4><ol><li>Creating the cluster in AWS/GCP</li><li>Creating scalable mobile test automation with Selenoid &amp; Selenosis…</li></ol><h4>Reference:</h4><ol><li><a href="https://medium.com/testvagrant/scaling-tests-on-google-kubernetes-engine-with-cloud-build-624d955f6698">https://medium.com/testvagrant/scaling-tests-on-google-kubernetes-engine-with-cloud-build-624d955f6698</a></li><li><a href="https://github.com/alcounit/selenosis">https://github.com/alcounit/selenosis</a></li><li><a href="https://github.com/alcounit/selenosis-deploy">https://github.com/alcounit/selenosis-deploy</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2528d0ff0442" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lighthouse integration with playwright]]></title>
            <link>https://vinayksharma.medium.com/lighthouse-integration-with-playwright-d2b58386f77?source=rss-309800f31509------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2b58386f77</guid>
            <category><![CDATA[webpage]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[lighthouse]]></category>
            <category><![CDATA[seo]]></category>
            <category><![CDATA[playwrights]]></category>
            <dc:creator><![CDATA[Vinay Sharma]]></dc:creator>
            <pubDate>Fri, 09 Dec 2022 20:29:27 GMT</pubDate>
            <atom:updated>2022-12-12T17:36:46.128Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iYnZqTeI1C9bvgNLrOPTNA.jpeg" /></figure><ol><li><em>Want to test the performance on the webpage with your playwright test?</em></li><li><em>Want to check the status of your </em><a href="https://developers.google.com/search/docs/fundamentals/seo-starter-guide"><em>SEO</em></a><em>?</em></li><li><em>Want to get the performance benchmarks with best practices that will happen automagically?</em></li><li><em>looking for an open-source tool that will do the job for you &amp; easy to integrate with your current playwright test?</em></li></ol><p>if the answer to all the above questions is <strong>Yes! t</strong>hen,</p><p>Today, We will understand how we can make use of Google lighthouse to test the performance benchmark of the webpage and steps on how we can integrate with the current playwright tests.</p><blockquote>Google Lighthouse is an open-source, automated tool for measuring the quality of web pages. Lighthouse audits performance, accessibility, and search engine optimisation of web pages.</blockquote><h4><strong>Pre - requisites:</strong></h4><ol><li>Node installation</li><li>IDE (VsCode, atom, sublime etc).</li></ol><h4>Setup:</h4><ol><li>Create a playwright project.</li></ol><pre>npm init playwright</pre><p>2. Add <a href="https://www.npmjs.com/package/playwright-lighthouse">playwright-lighthouse</a> dependency</p><pre>npm i playwright-lighthouse</pre><p>That&#39;s it.. We are done with the setup part. Now, Let&#39;s get into the action of integrating the lighthouse with playwright.</p><h4>Steps:</h4><ol><li>Create a test/Spec file under the test folder.</li><li>Initialize the browser that the playwright will be launching to run on a specific port. So the code will look like this:</li></ol><pre>test(&quot;Ligthouse performance test&quot;, async () =&gt; {<br>    const browser = await chromium.launch({<br>        args: [&#39;--remote-debugging-port=9222&#39;],<br>        headless: true<br>      });<br>});</pre><p><em>In the above code snippet, We actually have created a test block under which we have initialized the </em><strong><em>chromium</em></strong><em> browser to run on </em><strong><em>PORT 9222</em></strong></p><p>3. Create a JSON file that will hold all your URLs.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a2e07f0ac4f0c37dc4f75080ee47cbfa/href">https://medium.com/media/a2e07f0ac4f0c37dc4f75080ee47cbfa/href</a></iframe><p>4. Create a <strong>js</strong> or <strong>ts</strong> file to keep all your threshold data at one single location this will be used to audit the webpage &amp; results will be marked based on these data.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d4b14160f4b7203aa08f2be9cffd8f71/href">https://medium.com/media/d4b14160f4b7203aa08f2be9cffd8f71/href</a></iframe><p><em>You can add more audits like “</em><strong><em>PWA”</em></strong><em> n others in this file refer to </em><a href="https://www.npmjs.com/package/playwright-lighthouse"><em>https://www.npmjs.com/package/playwright-lighthouse</em></a></p><p>5. Now, we just need to add all the configs in play audit function</p><pre>await playAudit({<br>            page: page,<br>            config: lighthouseDesktopConfig,<br>            thresholds: thresholds,<br>            port: 9222,<br>            opts: options,<br>            reports: {<br>                formats: {<br>                    html: true, //defaults to false<br>                },<br>                name: `ligthouse-${new Date().toISOString()}`, //defaults to `lighthouse-${new Date().getTime()}`<br>                directory: `${process.cwd()}/lighthouse`, //defaults to `${process.cwd()}/lighthouse`<br>            },<br>});</pre><p><strong>Breaking down playAudit()</strong>:</p><ol><li>page: page context.</li><li>config: Lighthouse by default works on Mobile layout, But if you want to run the test on Desktop layout we need to pass the inbuilt configuration file as <strong>lighthouseDesktopConfig.</strong></li><li>threshold: Here we will import the threshold file to set the threshold values.</li><li>opts: These are nothing but if you want to set some option in lighthouse eg: loglevel: true; this will print all the logs while running the tests.<em> (optional)</em></li><li>port: We need to specify the same port on which we are running the browser so that Lighthouse gets connected and runs the audits.</li><li>report: We can get reports in multiple formats eg: HTML, JSON &amp; XML. Also, setting the directory name under which we need the reports.</li></ol><p>Once we are done with all the above settings. The final code will look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/673600ae9f1322e8d49a9cfe9d4c1cf1/href">https://medium.com/media/673600ae9f1322e8d49a9cfe9d4c1cf1/href</a></iframe><p>6. Now the last &amp; final step is to run this test.</p><pre>npx playwright test</pre><p>7. All the tests will be performed in a headless mode by default (<em>Can be changed in browser context</em>) &amp; after a successful run, we will be able to see the final report.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IMD3NLfc3FnfjHmNnLufWw.png" /><figcaption>Lighthouse Detailed report</figcaption></figure><h4><strong>Future Scope:</strong></h4><ol><li>We can add this with multiple URLs and run it as a separate pipeline &amp; get the results. So that we can improve with SEO standards.</li><li>Parallel support to run with multiple workers &amp; get the results faster.</li></ol><h4>References:</h4><ul><li><a href="https://www.npmjs.com/package/playwright-lighthouse">playwright-lighthouse</a></li><li><a href="https://playwright.dev/">Fast and reliable end-to-end testing for modern web apps | Playwright</a></li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FRr6-Wt-G0TY%3Fstart%3D821%26feature%3Doembed%26start%3D821&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DRr6-Wt-G0TY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FRr6-Wt-G0TY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9bbeff4d7896f186500ab3d4cbe52b56/href">https://medium.com/media/9bbeff4d7896f186500ab3d4cbe52b56/href</a></iframe><p>We are all set &amp; now we can get the results of our webpage within seconds.</p><p>I hope this was informative, If you have any queries, Please feel free to drop them in here.</p><p>Thank you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2b58386f77" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>