<?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 Manish Dhakeria on Medium]]></title>
        <description><![CDATA[Stories by Manish Dhakeria on Medium]]></description>
        <link>https://medium.com/@m4manishd?source=rss-6b1a18de2335------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*7e1grngNOZtSqDo0</url>
            <title>Stories by Manish Dhakeria on Medium</title>
            <link>https://medium.com/@m4manishd?source=rss-6b1a18de2335------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 04:22:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@m4manishd/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[HTTP QUERY: Why QA Engineers Should Care About the New HTTP Method]]></title>
            <link>https://medium.com/@m4manishd/http-query-why-qa-engineers-should-care-about-the-new-http-method-04e2c6c8b65b?source=rss-6b1a18de2335------2</link>
            <guid isPermaLink="false">https://medium.com/p/04e2c6c8b65b</guid>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[api-testing]]></category>
            <category><![CDATA[restassured]]></category>
            <category><![CDATA[qa-automation]]></category>
            <category><![CDATA[http-methods]]></category>
            <dc:creator><![CDATA[Manish Dhakeria]]></dc:creator>
            <pubDate>Mon, 06 Jul 2026 06:53:54 GMT</pubDate>
            <atom:updated>2026-07-06T06:53:54.729Z</atom:updated>
            <content:encoded><![CDATA[<p>When the new HTTP <strong>QUERY</strong> method was standardized, most discussions focused on how it helps backend developers.</p><p>But as a QA engineer or SDET, this new method can also make your job easier by making API behavior more predictable and testable.</p><p>Let’s understand why.</p><h3>The Problem We’ve Had for Years</h3><p>Suppose you’re testing a product search API.</p><p>Most applications today use one of these approaches.</p><h3>Option 1: GET</h3><pre>GET /products?category=Laptop&amp;brand=Dell&amp;minPrice=50000&amp;maxPrice=100000</pre><p>This works well for simple filters.</p><p>But what if users need:</p><ul><li>Multiple brands</li><li>Nested filters</li><li>Price ranges</li><li>Availability</li><li>Seller ratings</li><li>Specifications</li><li>Boolean conditions</li></ul><p>The URL quickly becomes long and difficult to maintain.</p><h3>Option 2: POST</h3><p>Most developers solve it like this:</p><pre>POST /products/search<br>Content-Type: application/json</pre><pre>{<br>  &quot;category&quot;: &quot;Laptop&quot;,<br>  &quot;brands&quot;: [&quot;Dell&quot;, &quot;HP&quot;],<br>  &quot;price&quot;: {<br>    &quot;min&quot;: 50000,<br>    &quot;max&quot;: 100000<br>  }<br>}</pre><p>It works.</p><p>But there’s a problem.</p><p>POST is generally associated with creating or modifying data.</p><p>As a tester, the first question becomes:<br><em>Does this endpoint change anything?</em></p><p>Even if it’s only performing a search.</p><h3>Introducing HTTP QUERY</h3><p>The new HTTP method allows exactly this:</p><pre>QUERY /products<br>Content-Type: application/json</pre><pre>{<br>  &quot;category&quot;: &quot;Laptop&quot;,<br>  &quot;brands&quot;: [&quot;Dell&quot;, &quot;HP&quot;],<br>  &quot;price&quot;: {<br>    &quot;min&quot;: 50000,<br>    &quot;max&quot;: 100000<br>  }<br>}</pre><p>The request contains a body like POST.</p><p>But the method clearly communicates:</p><ul><li>Read-only</li><li>Safe</li><li>Idempotent</li></ul><p>That small change makes API behavior much clearer.</p><h3>Why This Matters for QA</h3><h3>1. Better Test Planning</h3><p>When you see:</p><pre>POST /products/search</pre><p>Questions immediately arise.</p><ul><li>Does it create audit logs?</li><li>Does it update timestamps?</li><li>Does it modify search history?</li><li>Does it increment counters?</li></ul><p>With:</p><pre>QUERY /products</pre><p>The expectation is simple:</p><p><strong>Nothing should be modified.</strong></p><p>That gives testers a much clearer contract.</p><h3>2. Easier Idempotency Testing</h3><p>One important property of QUERY is that it is <strong>idempotent</strong>.</p><p>This means sending the same request multiple times should produce the same result without changing server state.</p><p>Example:</p><pre>QUERY /products</pre><p>Execute it:</p><ul><li>Once</li><li>Ten times</li><li>One hundred times</li></ul><p>Expected outcome:</p><ul><li>Same response</li><li>Same database state</li><li>No duplicate records</li><li>No unintended side effects</li></ul><h3>3. Stronger Database Validation</h3><p>Consider this test case.</p><h3>Before execution</h3><pre>Products = 1,250<br>Orders = 2,140<br>Customers = 890</pre><p>Execute:</p><pre>QUERY /products</pre><p>After execution:</p><p>Expected:</p><pre>Products = 1,250<br>Orders = 2,140<br>Customers = 890</pre><p>If any data changes, you’ve found a defect.</p><h3>4. Cleaner Automation Scripts</h3><p>Today, many automation scripts look like this:</p><pre>given()<br>    .body(request)<br>.when()<br>    .post(&quot;/products/search&quot;);</pre><p>Even though you’re only searching.</p><p>With QUERY, the intent becomes much clearer.</p><p>The HTTP method itself tells anyone reading the test:<br><em>This request retrieves data only.</em></p><p>That improves readability and maintainability.</p><h3>5. Better Performance Testing</h3><p>Search APIs are often tested under heavy load.</p><p>Since QUERY is designed for read-only operations, performance tests become easier to reason about.</p><p>Typical scenarios include:</p><ul><li>1,000 concurrent searches</li><li>Repeated identical requests</li><li>Response time consistency</li><li>Large request payloads</li></ul><p>Since the operation shouldn’t modify data, testers can safely execute the same request repeatedly.</p><h3>6. Better Security Testing</h3><p>Security validation becomes more straightforward.</p><p>Examples:</p><h3>Unauthorized access</h3><pre>QUERY /customers</pre><p>Expected:</p><pre>401 Unauthorized</pre><p>or</p><pre>403 Forbidden</pre><h3>Authorized access</h3><p>The request should return only the data the authenticated user is allowed to see.</p><p>Most importantly, a QUERY endpoint should never modify resources.</p><h3>Example Test Cases for QUERY</h3><p>Test CaseExpected ResultValid requestCorrect response returnedInvalid payloadValidation errorMissing required fieldsAppropriate error messageRepeat request 100 timesSame response, no data modificationUnauthorized user401/403 responseDatabase validationNo records created, updated, or deletedPerformance testStable response time under load</p><h3>Will Everyone Start Using QUERY Tomorrow?</h3><p>Probably not.</p><p>Although QUERY is now standardized, many frameworks, API gateways, proxies, and client libraries are still catching up.</p><p>For the foreseeable future, you’ll continue seeing:</p><ul><li>GET for simple searches</li><li>POST /search for complex searches</li></ul><p>As tooling evolves, QUERY is likely to become a cleaner and more expressive alternative.</p><h3>Final Thoughts</h3><p>The introduction of HTTP QUERY doesn’t change how QA engineers test APIs overnight.</p><p>What it does change is <strong>clarity</strong>.</p><p>Instead of relying on naming conventions like:</p><pre>POST /search</pre><p>the HTTP method itself now communicates the intent:</p><ul><li>This is a search.</li><li>It is read-only.</li><li>It should not modify server state.</li><li>It is safe to repeat.</li></ul><p>For QA teams, that means simpler test design, clearer API contracts, and fewer assumptions about endpoint behavior.</p><p>Sometimes, the biggest improvements in software engineering aren’t new frameworks or AI tools — they’re small protocol changes that make systems easier to understand and test.</p><p><strong>Have you tested APIs that used </strong><strong>POST /search for read-only operations? Do you think </strong><strong>QUERY will become the new standard as framework support grows? Share your thoughts below.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=04e2c6c8b65b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Meet HTTP QUERY: The New HTTP Method That Finally Fixes Complex Read-Only Requests]]></title>
            <link>https://medium.com/@m4manishd/meet-http-query-the-new-http-method-that-finally-fixes-complex-read-only-requests-1ef3efd18b6c?source=rss-6b1a18de2335------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ef3efd18b6c</guid>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[query]]></category>
            <category><![CDATA[restassured]]></category>
            <category><![CDATA[http-methods]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Manish Dhakeria]]></dc:creator>
            <pubDate>Mon, 06 Jul 2026 06:46:46 GMT</pubDate>
            <atom:updated>2026-07-06T06:46:46.024Z</atom:updated>
            <content:encoded><![CDATA[<p>For years, REST API developers have had an awkward choice to make.</p><ul><li>Use <strong>GET</strong> and cram everything into the URL.</li><li>Use <strong>POST</strong> even though you’re only reading data.</li></ul><p>Neither option was ideal.</p><p>Now, there’s a better solution: <strong>HTTP </strong><strong>QUERY</strong>.</p><p>Recently standardized in <strong>RFC 10008</strong>, the QUERY method fills a long-standing gap in HTTP by allowing clients to send <strong>complex request bodies for read-only operations</strong>.</p><p>Let’s understand why this matters.</p><h3>The Problem with GET</h3><p>Imagine you’re building an e-commerce API where users can filter products using multiple criteria.</p><p>A typical GET request might look like this:</p><pre>GET /products?category=laptop&amp;brand=Dell&amp;brand=HP&amp;minPrice=50000&amp;maxPrice=100000&amp;ram=16&amp;storage=512&amp;sort=price</pre><p>This works initially.</p><p>But what happens when users want:</p><ul><li>Nested filters</li><li>Multiple categories</li><li>Boolean logic</li><li>Complex search rules</li></ul><p>The URL quickly becomes difficult to read, maintain, and may even hit length limits imposed by browsers, proxies, or servers.</p><h3>Why POST Was Never the Right Solution</h3><p>Many APIs solved this problem like this:</p><pre>POST /products/search<br>Content-Type: application/json</pre><pre>{<br>  &quot;category&quot;: &quot;Laptop&quot;,<br>  &quot;brands&quot;: [&quot;Dell&quot;, &quot;HP&quot;],<br>  &quot;price&quot;: {<br>    &quot;min&quot;: 50000,<br>    &quot;max&quot;: 100000<br>  },<br>  &quot;ram&quot;: 16,<br>  &quot;storage&quot;: 512<br>}</pre><p>Technically, it works.</p><p>Semantically, it doesn’t.</p><p>The request isn’t creating or updating anything.</p><p>It’s simply asking the server:</p><blockquote><em>“Give me matching products.”</em></blockquote><p>Using POST for read-only operations has always blurred the intent of the API.</p><h3>Enter HTTP QUERY</h3><p>The new QUERY method allows exactly that:</p><pre>QUERY /products<br>Content-Type: application/json</pre><pre>{<br>  &quot;category&quot;: &quot;Laptop&quot;,<br>  &quot;brands&quot;: [&quot;Dell&quot;, &quot;HP&quot;],<br>  &quot;price&quot;: {<br>    &quot;min&quot;: 50000,<br>    &quot;max&quot;: 100000<br>  }<br>}</pre><p>Now the request body remains structured while the HTTP method clearly communicates that the operation is <strong>read-only</strong>.</p><h3>Key Characteristics</h3><p>QUERY is:</p><ul><li>✅ Safe</li><li>✅ Idempotent</li><li>✅ Designed for read operations</li><li>✅ Supports request bodies</li></ul><p>Unlike POST, repeating the same QUERY request should not modify server state.</p><h3>When Should You Use QUERY?</h3><p>It’s ideal for APIs involving:</p><ul><li>Product search</li><li>Analytics queries</li><li>Reporting</li><li>Filtering dashboards</li><li>Search engines</li><li>AI search APIs</li><li>Business intelligence platforms</li></ul><p>Anywhere you have complex filters without modifying server data.</p><h3>Should You Start Using It Today?</h3><p>Not necessarily.</p><p>Although QUERY is now an official HTTP method, support across:</p><ul><li>API gateways</li><li>Frameworks</li><li>Reverse proxies</li><li>Client libraries</li><li>Browsers</li><li>Developer tools</li></ul><p>is still evolving.</p><p>Most production APIs today will continue using:</p><ul><li>GET for simple queries</li><li>POST /search for complex searches</li></ul><p>until broader ecosystem support arrives.</p><h3>Why This Matters</h3><p>The introduction of QUERY is less about replacing GET or POST and more about making API design more expressive.</p><p>For the first time, developers have a standard HTTP method that combines:</p><ul><li>the safety of GET,</li><li>the flexibility of POST,</li><li>and semantics that accurately describe a complex read-only operation.</li></ul><p>It’s a small addition to HTTP, but one that solves a design compromise developers have lived with for decades.</p><p>As frameworks and API tooling adopt it over the coming years, don’t be surprised if QUERY becomes the preferred choice for advanced search endpoints.</p><p><strong>What do you think?</strong></p><p>Will your next API use QUERY, or will you stick with POST /search until ecosystem support catches up?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ef3efd18b6c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DSA Simplified Series: Part 3 — Binary Search on Answer Space (Java)]]></title>
            <link>https://medium.com/@m4manishd/dsa-simplified-series-part-3-binary-search-on-answer-space-java-9526842f5c4a?source=rss-6b1a18de2335------2</link>
            <guid isPermaLink="false">https://medium.com/p/9526842f5c4a</guid>
            <category><![CDATA[sdet]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[binary-search]]></category>
            <category><![CDATA[sad]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Manish Dhakeria]]></dc:creator>
            <pubDate>Thu, 30 Apr 2026 02:03:10 GMT</pubDate>
            <atom:updated>2026-04-30T02:03:10.560Z</atom:updated>
            <content:encoded><![CDATA[<p>In the previous part, we saw how Binary Search works on a sorted array.But in real interview questions, things are not always that straightforward.</p><p>What if:</p><ul><li>There’s no sorted array?</li><li>You’re asked to find a minimum or maximum value?</li><li>Trying all possibilities feels too slow?</li></ul><p>This is where a very important concept comes in :<strong>Binary Search on Answer Space</strong>.</p><h3>What does “Answer Space” mean?</h3><p>Instead of searching for an element, we search for the correct answer within a range.</p><p>For example:</p><ul><li>Minimum capacity → between max element and total sum</li><li>Maximum distance → between 0 and some upper bound</li></ul><p>We don’t know the exact answer, but we know:<br> It lies somewhere within a defined range.</p><h3>Why does Binary Search work here?</h3><p>Because the problem follows a monotonic pattern.</p><p>In simple terms:</p><ul><li>At some point, the answer starts becoming valid</li><li>And after that, it remains valid</li></ul><p>Example:</p><pre>false → false → false → true → true → true</pre><p>Binary Search helps us find the <strong>first true</strong> efficiently.</p><h3>Example Problem</h3><h4>Capacity to Ship Packages in D Days</h4><p>You’re given an array of package weights and a number ‘D’.</p><p>Your task is to find the minimum capacity of a ship so that all packages can be shipped within D days.</p><h4>Brute Force Approach</h4><p>Try every possible capacity:</p><pre>1 → 2 → 3 → ... → max</pre><p>This works, but it’s too slow for large inputs.</p><h4>Optimized Approach</h4><p>We apply Binary Search on the answer.</p><p>Step 1: Define the search space</p><ul><li>low = max(weights)</li><li>high = sum(weights)</li></ul><p>Step 2: Check feasibility</p><p>For a given capacity:<br> Can we ship everything within D days?</p><h4>Java Implementation</h4><pre>  public int shipWithinDays(int[] weights, int days) {<br>    int low = 0, high = 0;<br>    for (int w : weights) {<br>            low = Math.max(low, w);<br>            high += w;<br>        }<br>        int answer = high;<br>        while (low &lt;= high) {<br>            int mid = low + (high - low) / 2;<br>            if (canShip(weights, days, mid)) {<br>                answer = mid;<br>                high = mid - 1;<br>            } else {<br>                low = mid + 1;<br>            }<br>        }<br>        return answer;<br>    }<br>    private boolean canShip(int[] weights, int days, int capacity) {<br>        int current = 0;<br>        int requiredDays = 1;<br>        for (int w : weights) {<br>            if (current + w &gt; capacity) {<br>                requiredDays++;<br>                current = 0;<br>            }<br>            current += w;<br>        }<br>        return requiredDays &lt;= days;<br>    }</pre><h4>Pattern to Remember</h4><p>Most problems using this technique follow the same structure:</p><ol><li>Define the answer range</li><li>Apply Binary Search</li><li>Write a condition function</li><li>Narrow down the range</li></ol><h4>When should you think of this approach?</h4><p>Look for phrases like:</p><ul><li>“Minimum possible…”</li><li>“Maximum possible…”</li><li>“Find the smallest value such that…”</li></ul><p>These are strong hints.</p><h4>Common Problems to Practice</h4><ul><li>Allocate Books</li><li>Aggressive Cows</li><li>Koko Eating Bananas</li><li>Minimum Days to Make Bouquets</li></ul><h4>Common Mistakes</h4><ul><li>Choosing the wrong search space</li><li>Writing incorrect condition logic</li><li>Getting stuck in infinite loops</li></ul><h4>What’s Next?</h4><p><strong>Part 4 :Advanced Binary Search Patterns (Java)</strong></p><p>We’ll cover:</p><ul><li>First and Last Occurrence</li><li>Lower Bound / Upper Bound</li><li>Search in Rotated Sorted Array</li></ul><p>If this helped you, follow the series , more practical DSA concepts coming next</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9526842f5c4a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DSA Simplified Series: Part 2— Binary Search Algorithm (Java)]]></title>
            <link>https://medium.com/@m4manishd/dsa-simplified-series-part-2-binary-search-algorithm-java-f2c21c958fe8?source=rss-6b1a18de2335------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2c21c958fe8</guid>
            <category><![CDATA[dsa-courses]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[sdet]]></category>
            <category><![CDATA[dsa-problem]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Manish Dhakeria]]></dc:creator>
            <pubDate>Sat, 24 Jan 2026 18:38:17 GMT</pubDate>
            <atom:updated>2026-01-24T18:38:17.304Z</atom:updated>
            <content:encoded><![CDATA[<p>Searching is one of the most common operations in programming.<br> While Linear Search checks elements one by one, it becomes inefficient as the data size grows.</p><p>This is where <strong>Binary Search</strong> comes in.</p><p>Binary Search is a powerful algorithm that reduces the search space by half in every step, making it extremely fast for large datasets.</p><h3>What is Binary Search?</h3><p>Binary Search is a searching algorithm used to find a target element in a <strong>sorted array</strong>.</p><p>Instead of scanning every element, it:</p><ul><li>Compares the target with the middle element</li><li>Eliminates half of the array</li><li>Repeats the process until the element is found</li></ul><h3>Important Condition</h3><blockquote><strong><em>Binary Search works only on sorted arrays.</em></strong></blockquote><p>If the data is not sorted, the result will be incorrect.</p><h3>How Binary Search Works</h3><p>Consider the following sorted array:</p><pre>[5, 9, 13, 18, 22, 27, 31, 36]</pre><p>We want to search for <strong>22</strong>.</p><p>Step-by-step:</p><ol><li>Find the middle element → 18</li><li>Since 22 &gt; 18, search the right half</li><li>New middle → 22</li><li>Element found ✅</li></ol><p>In just a few steps, the search is complete.</p><h3>Algorithm Steps</h3><ol><li>Set two pointers:</li></ol><ul><li>low = 0</li><li>high = n - 1</li></ul><p>2. Find middle index:</p><ul><li>mid = (low + high) / 2</li></ul><p>3. Compare:</p><ul><li>If arr[mid] == target → found</li><li>If target &gt; arr[mid] → search right</li><li>Else → search left</li></ul><p>4. Repeat until low &gt; high</p><h3>What actually happens</h3><p>Array:</p><pre>[5, 9, 13, 18, 22, 27, 31, 36]</pre><p>Indexes:</p><pre>0  1   2   3   4   5   6   7</pre><h4>Step 1</h4><p>Low = 0, High = 7</p><pre>mid = (0 + 7) / 2 = 3<br>arr[3] = 18</pre><h4>Step 2</h4><p>Since 22 &gt; 18, we move right:</p><pre>low = mid + 1 = 4<br>high = 7</pre><p>Now the search space is:</p><pre>[22, 27, 31, 36]</pre><h4>Step 3</h4><p>Now we calculate mid again:</p><pre>mid = (4 + 7) / 2 = 5<br>arr[5] = 27</pre><p>❌ Not 22 yet.</p><h4>Step 4</h4><p>Since 22 &lt; 27, move left:</p><pre>high = mid - 1 = 4</pre><h4>Step 5</h4><p>Now:</p><pre>low = 4, high = 4<br>mid = 4<br>arr[4] = 22</pre><p>✅ Found.</p><h3>Binary Search Implementation in Java</h3><h4>Iterative Approach</h4><pre>public class BinarySearch {<br>  public static int binarySearch(int[] arr, int target) {<br>          int low = 0;<br>          int high = arr.length - 1;<br>          while (low &lt;= high) {<br>              int mid = low + (high - low) / 2;<br>              if (arr[mid] == target) {<br>                  return mid;<br>              } <br>              else if (arr[mid] &lt; target) {<br>                  low = mid + 1;<br>              } <br>              else {<br>                  high = mid - 1;<br>              }<br>          }<br>          return -1; // element not found<br>      }<br>      public static void main(String[] args) {<br>          int[] arr = {5, 9, 13, 18, 22, 27, 31, 36};<br>          int target = 22;<br>          int result = binarySearch(arr, target);<br>          if (result != -1)<br>              System.out.println(&quot;Element found at index: &quot; + result);<br>          else<br>              System.out.println(&quot;Element not found&quot;);<br>      }<br>}</pre><h3>Recursive Binary Search (Java)</h3><pre>public static int binarySearchRecursive(int[] arr, int low, int high, int target) {<br>  if (low &gt; high) {<br>          return -1;<br>      }<br>      int mid = low + (high - low) / 2;<br>      if (arr[mid] == target) {<br>          return mid;<br>      } <br>      else if (target &gt; arr[mid]) {<br>          return binarySearchRecursive(arr, mid + 1, high, target);<br>      } <br>      else {<br>          return binarySearchRecursive(arr, low, mid - 1, target);<br>      }<br>}</pre><h3>Time Complexity</h3><p>Best caseO(1)</p><p>Average caseO(log n)</p><p>Worst caseO(log n)</p><p>This efficiency makes Binary Search ideal for large datasets.</p><h3>When to Use Binary Search</h3><p>Binary Search is useful when:</p><ul><li>Data is sorted</li><li>Fast searching is required</li><li>Large input size</li><li>Repeated searches are performed</li></ul><p>Used in:</p><ul><li>Database indexing</li><li>Searching algorithms</li><li>Interview problems</li><li>System design fundamentals</li></ul><h3>Common Mistakes</h3><ul><li>Applying binary search on unsorted array</li><li>Wrong mid calculation causing infinite loop</li><li>Ignoring boundary conditions</li><li>Using (low + high) / 2 leading to overflow (in some cases)</li></ul><p>Safer approach:</p><pre>mid = low + (high - low) / 2;</pre><h3>Practice Problems</h3><p>Try solving these using Binary Search:</p><ul><li>Find an element in a sorted array</li><li>Find the first and last occurrence of a target</li><li>Count occurrences of a number in a sorted array</li><li>Find the smallest element greater than or equal to target</li><li>Implement Binary Search using recursion</li><li>Search in a rotated sorted array</li></ul><p>These problems will strengthen your understanding of how Binary Search behaves in different conditions.</p><h3>What’s Next in This Series?</h3><p><strong>Part 3: Binary Search on Answer Space (Java)</strong><br> Learn how Binary Search is used even when the array itself is not directly searchable, a powerful interview concept.</p><p>If you found this helpful, feel free to <strong>clap</strong>, <strong>share</strong>, or <strong>bookmark</strong> this post for later. Happy coding! 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2c21c958fe8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DSA Simplified Series: Part 1 — Linear Search Algorithm (Java)]]></title>
            <link>https://medium.com/@m4manishd/dsa-simplified-series-part-1-linear-search-algorithm-java-2d8309051bc2?source=rss-6b1a18de2335------2</link>
            <guid isPermaLink="false">https://medium.com/p/2d8309051bc2</guid>
            <category><![CDATA[dsa-courses]]></category>
            <category><![CDATA[dsa-training]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[sdet]]></category>
            <category><![CDATA[dsa-problem]]></category>
            <dc:creator><![CDATA[Manish Dhakeria]]></dc:creator>
            <pubDate>Thu, 15 Jan 2026 06:58:07 GMT</pubDate>
            <atom:updated>2026-01-15T06:58:07.174Z</atom:updated>
            <content:encoded><![CDATA[<h3>DSA Simplified Series: Part 1 — Linear Search Algorithm (Java)</h3><p>Data Structures and Algorithms (DSA) often feel overwhelming at the beginning.<br> Big terms, complex logic, and performance discussions can scare off even motivated developers.</p><p>This <strong>DSA Simplified Series</strong> is meant to change that.</p><p>We’ll start small, build intuition, and focus on <strong>clarity before optimization</strong>.<br> In <strong>Part 1</strong>, we cover the most basic searching technique: <strong>Linear Search</strong>, implemented in <strong>Java</strong>.</p><h3>What Is Linear Search?</h3><p>Linear Search is the simplest way to find an element in a list.</p><p>It works by:</p><ul><li>Checking elements <strong>one by one</strong></li><li>Starting from the beginning</li><li>Stopping when the target is found or the list ends</li></ul><p>No assumptions about order.<br> No extra data structures.<br> Just a straight scan.</p><h3>Real-Life Analogy</h3><p>Imagine searching for a name in a handwritten attendance register.</p><p>You:</p><ol><li>Start from the first page</li><li>Check each name</li><li>Stop once you find the match</li></ol><p>That’s <strong>Linear Search</strong>.</p><h3>How Linear Search Works</h3><p>Given:</p><ul><li>An array</li><li>A target value</li></ul><p>Steps:</p><ol><li>Start from index 0</li><li>Compare the current element with the target</li><li>If equal → return the index</li><li>Otherwise → move to the next element</li><li>If the array ends → return -1</li></ol><h3>Example</h3><p>Array:</p><pre>[10, 25, 5, 8, 40]</pre><p>Target:</p><pre>8</pre><p>Steps:</p><ul><li>Check 10 → not a match</li><li>Check 25 → not a match</li><li>Check 5 → not a match</li><li>Check 8 → match found ✔</li></ul><p>Result:</p><pre>Index = 3</pre><h3>Linear Search Implementation in Java</h3><h3>Basic Java Example</h3><pre>public class LinearSearch {<br>  public static int linearSearch(int[] arr, int target) {<br>          for (int i = 0; i &lt; arr.length; i++) {<br>              if (arr[i] == target) {<br>                  return i; // target found<br>              }<br>          }<br>          return -1; // target not found<br>      }<br>      public static void main(String[] args) {<br>          int[] numbers = {10, 25, 5, 8, 40};<br>          int target = 8;<br>          int result = linearSearch(numbers, target);<br>          if (result != -1) {<br>              System.out.println(&quot;Element found at index: &quot; + result);<br>          } else {<br>              System.out.println(&quot;Element not found&quot;);<br>          }<br>      }<br>}</pre><h3>Output</h3><pre>Element found at index: 3</pre><h3>Time and Space Complexity</h3><h3>Time Complexity</h3><ul><li><strong>Best Case:</strong> O(1)<br> (element found at the first index)</li><li><strong>Worst Case:</strong> O(n)<br> (element at last index or not present)</li><li><strong>Average Case:</strong> O(n)</li></ul><h3>Space Complexity</h3><ul><li><strong>O(1)</strong><br> (no extra memory used)</li></ul><h3>When Should You Use Linear Search?</h3><p>Linear Search is ideal when:</p><ul><li>The array is <strong>small</strong></li><li>The data is <strong>unsorted</strong></li><li>Simplicity is more important than performance</li><li>You need quick implementation with minimal overhead</li></ul><p>For large datasets or sorted data, more efficient algorithms like <strong>Binary Search</strong> are preferred.</p><h3>Why Linear Search Matters</h3><p>Even though it’s simple, Linear Search teaches:</p><ul><li>Loop fundamentals</li><li>Array traversal</li><li>Conditional logic</li><li>Time complexity basics</li><li>How searching works at a core level</li></ul><p>Every advanced search algorithm builds on this understanding.</p><h3>Practice Problems</h3><p>Try solving these:</p><ol><li>Find the first occurrence of an element in an array</li><li>Count how many times a target appears</li><li>Search in a String[] array</li><li>Return all indices where the target exists</li></ol><h3>What’s Next in This Series?</h3><p>👉 <strong>Part 2: Binary Search Algorithm (Java)</strong><br> Learn how searching becomes faster when data is sorted.</p><p>If you found this helpful, feel free to <strong>clap</strong>, <strong>share</strong>, or <strong>bookmark</strong> this post for later. Happy coding! 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d8309051bc2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Smart Locators with GPT- 4 in Selenium using Java]]></title>
            <link>https://medium.com/@m4manishd/automating-smart-locators-with-gpt-4-in-selenium-using-java-876a0f3b93ae?source=rss-6b1a18de2335------2</link>
            <guid isPermaLink="false">https://medium.com/p/876a0f3b93ae</guid>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[locators-in-selenium]]></category>
            <category><![CDATA[uiautomation]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[web-automation]]></category>
            <dc:creator><![CDATA[Manish Dhakeria]]></dc:creator>
            <pubDate>Sat, 14 Jun 2025 08:23:58 GMT</pubDate>
            <atom:updated>2025-06-14T08:23:58.529Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hRsH4G7HCT78-G1cUah_8w.jpeg" /></figure><p>Hardcoded locators in Selenium are brittle. One small DOM change and your tests crumble. But what if your test framework could adapt?</p><p>Here’s how I built an AI-powered locator engine using Java, Selenium, and GPT-4.</p><h3>The Problem: Locator Fragility</h3><p>Classic test locators look like this:</p><pre>By searchBox = By.id(&quot;search_input&quot;);<br>By submitButton = By.cssSelector(&quot;button.submit&quot;);</pre><p>These locators work until:</p><ul><li>The developer changes the id</li><li>A class is renamed</li><li>Elements are wrapped in another div</li></ul><p>And now you’re stuck rewriting tests.</p><h3>The AI-Driven Idea</h3><p>Instead of hardcoding locators, why not:</p><ol><li><strong>Capture the HTML page source</strong></li><li><strong>Send it to GPT 4</strong> to extract relevant locators</li><li><strong>Parse the AI response as JSON</strong></li><li><strong>Use the locators dynamically</strong> in your Selenium tests</li></ol><h4>Step 1: Java Code to Send Page Source to OpenAI</h4><pre>public class AILocatorExtractor {<br>    private static final String OPENAI_API_KEY = System.getenv(&quot;OPENAI_KEY&quot;);<br>    public static String fetchLocatorJson(String pageSource) {<br>        String prompt = &quot;Extract all meaningful UI element locators from this HTML. &quot; +<br>                        &quot;Return as JSON array with &#39;name&#39;, &#39;locator&#39;, &#39;type&#39; fields only: &quot; + pageSource;// Use your HTTP client or OpenAI SDK here<br>        String response = OpenAIClient.sendPrompt(prompt, OPENAI_API_KEY);return response; // JSON string<br>    }<br>}</pre><h4>What’s happening here?</h4><ul><li>We’re sending the entire page source to OpenAI’s GPT-4</li><li>The prompt is designed to return structured locators</li><li>GPT-4 responds with a JSON array like:</li></ul><pre>[<br>  {&quot;name&quot;: &quot;Search Box&quot;, &quot;locator&quot;: &quot;#search-input&quot;, &quot;type&quot;: &quot;css&quot;},<br>  {&quot;name&quot;: &quot;Submit&quot;, &quot;locator&quot;: &quot;//button[text()=&#39;Go&#39;]&quot;, &quot;type&quot;: &quot;xpath&quot;}<br>]</pre><h4>Step 2: Parsing JSON and Creating Selenium Locators</h4><pre>public class LocatorLoader {<br>    private static final Map&lt;String, By&gt; locatorsMap = new HashMap&lt;&gt;();<br>    public static void load(String json) throws IOException {<br>        ObjectMapper mapper = new ObjectMapper();<br>        List&lt;Locator&gt; locatorList = mapper.readValue(json, new TypeReference&lt;&gt;() {});<br>        for (Locator locator : locatorList) {<br>            By by = switch (locator.getType().toLowerCase()) {<br>                case &quot;css&quot; -&gt; By.cssSelector(locator.getLocator());<br>                case &quot;xpath&quot; -&gt; By.xpath(locator.getLocator());<br>                case &quot;id&quot; -&gt; By.id(locator.getLocator());<br>                default -&gt; throw new IllegalArgumentException(&quot;Unsupported type&quot;);<br>            };<br>            locatorsMap.put(locator.getName(), by);<br>        }<br>    }<br>     public static By getBy(String name) {<br>        return locatorsMap.get(name);<br>    }<br>}</pre><h4>What this does:</h4><ul><li>Deserializes JSON into Java objects</li><li>Converts each to a By object</li><li>Stores them in a map for easy access</li></ul><h4>Step 3: Using Locators in Your Tests</h4><pre>@Test<br>public void testSearchFunctionality() throws IOException {<br>    driver.get(&quot;https://example.com/search&quot;);<br>    String html = driver.getPageSource();<br>    String locatorJson = AILocatorExtractor.fetchLocatorJson(html);<br>    LocatorLoader.load(locatorJson);<br>    driver.findElement(LocatorLoader.getBy(&quot;Search Box&quot;)).sendKeys(&quot;Selenium AI&quot;);<br>    driver.findElement(LocatorLoader.getBy(&quot;Submit&quot;)).click();<br>    Assertions.assertTrue(driver.getTitle().contains(&quot;Results&quot;));<br>}</pre><h4>Advantages</h4><ul><li><strong>Zero Hardcoded Locators</strong></li><li><strong>Locators Adapt Automatically</strong> as the DOM changes</li><li><strong>Natural Naming</strong> via “Search Box&quot; , &quot;Submit&quot;, etc.</li><li><strong>One-Time OpenAI Usage</strong> per unique page (cache it!)</li></ul><h4>Considerations</h4><ul><li><strong>OpenAI Cost</strong>: Cache results using HTML hashes</li><li><strong>Security</strong>: Never send sensitive HTML to external APIs</li><li><strong>Rate Limits</strong>: Avoid overloading GPT during CI</li></ul><h4>Final Word</h4><p>This technique shifts automation from rigid code to adaptive intelligence.</p><p>You’re not just writing tests , you’re enabling the system to understand UI changes and adjust accordingly.</p><blockquote><em>Let’s stop writing brittle tests. Let’s write tests that learn.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=876a0f3b93ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Essential MySQL Built-in Functions Every QA Should Know]]></title>
            <link>https://medium.com/@m4manishd/essential-mysql-built-in-functions-every-qa-should-know-1671451da4d1?source=rss-6b1a18de2335------2</link>
            <guid isPermaLink="false">https://medium.com/p/1671451da4d1</guid>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[sql-server]]></category>
            <category><![CDATA[built-in-function]]></category>
            <category><![CDATA[functions-in-sql]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[Manish Dhakeria]]></dc:creator>
            <pubDate>Tue, 01 Apr 2025 17:22:38 GMT</pubDate>
            <atom:updated>2025-04-01T17:22:38.968Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*8YdNZ5NCphp6uFzJAlIqnw.png" /><figcaption>MySQL</figcaption></figure><p>MySQL comes packed with powerful built-in functions that make data manipulation, calculations, and transformations easier. Whether you’re working with strings, numbers, dates, or complex aggregations, MySQL has a function to help.</p><p>Here’s a breakdown of the most useful MySQL functions categorized by their purpose.</p><h3>String Functions</h3><p><strong>1. CONCAT() — Combine Strings</strong></p><pre>SELECT CONCAT(first_name, &#39; &#39;, last_name) AS full_name FROM employees;</pre><p>Merges two or more strings into one.</p><p><strong>2. SUBSTRING() / SUBSTR() — Extract Part of a String</strong></p><pre>SELECT SUBSTRING(&#39;Hello World&#39;, 1, 5); -- Returns &#39;Hello&#39;</pre><p>Extracts a portion of a string.</p><p><strong>3. TRIM() — Remove Unwanted Spaces</strong></p><pre>SELECT TRIM(&#39;   MySQL   &#39;); -- Returns &#39;MySQL&#39;</pre><p>Removes leading and trailing spaces.</p><p><strong>4. UPPER() / LOWER() — Change Case</strong></p><pre>SELECT UPPER(&#39;hello&#39;); -- Returns &#39;HELLO&#39;<br>SELECT LOWER(&#39;SQL&#39;);   -- Returns &#39;sql&#39;</pre><p><strong>5. REPLACE() — Find and Replace Text</strong></p><pre>SELECT REPLACE(&#39;I like apples&#39;, &#39;apples&#39;, &#39;oranges&#39;); -- &#39;I like oranges&#39;</pre><p><strong>6. LENGTH() / CHAR_LENGTH() — Get String Length</strong></p><pre>SELECT LENGTH(&#39;MySQL&#39;); -- Returns 5 (bytes)<br>SELECT CHAR_LENGTH(&#39;SQL&#39;); -- Returns 3 (characters)</pre><h3>Numeric Functions</h3><p><strong>1. ROUND() — Round a Number</strong></p><pre>SELECT ROUND(123.4567, 2); -- Returns 123.46</pre><p><strong>2. CEIL() / FLOOR() — Round Up or Down</strong></p><pre>SELECT CEIL(5.3); -- Returns 6<br>SELECT FLOOR(5.9); -- Returns 5</pre><p><strong>3. ABS() — Absolute Value</strong></p><pre>SELECT ABS(-10); -- Returns 10</pre><p><strong>4. MOD() — Remainder of Division</strong></p><pre>SELECT MOD(10, 3); -- Returns 1 (10 ÷ 3 = 3 with remainder 1)sq</pre><p><strong>5. RAND() — Generate Random Number</strong></p><pre>SELECT RAND(); -- Returns a random float between 0 and 1</pre><h3>Date &amp; Time Functions</h3><p><strong>1. NOW() / CURDATE() / CURTIME() — Current Date &amp; Time</strong></p><pre>SELECT NOW();    -- &#39;2025-04-02 15:30:45&#39;<br>SELECT CURDATE(); -- &#39;2025-04-02&#39;<br>SELECT CURTIME(); -- &#39;15:30:45&#39;</pre><p><strong>2. DATE_FORMAT() — Format Date</strong>s</p><pre>SELECT DATE_FORMAT(NOW(), &#39;%W, %M %d, %Y&#39;); -- &#39;Wednesday, April 02, 2025&#39;</pre><p><strong>3. DATEDIFF() — Difference Between Dates</strong></p><pre>SELECT DATEDIFF(&#39;2025-12-31&#39;, &#39;2025-01-01&#39;); -- Returns 364</pre><p><strong>4. DATE_ADD() / DATE_SUB() — Add or Subtract Time</strong></p><pre>SELECT DATE_ADD(NOW(), INTERVAL 7 DAY); -- Adds 7 days<br>SELECT DATE_SUB(NOW(), INTERVAL 3 MONTH); -- Subtracts 3 months</pre><p><strong>5. EXTRACT() — Get Part of a Date</strong></p><pre>SELECT EXTRACT(YEAR FROM NOW()); -- Returns 2025</pre><h3>Aggregate Functions (for GROUP BY)</h3><p><strong>1. COUNT() — Count Rows</strong></p><pre>SELECT COUNT(*) FROM users; -- Total users</pre><p><strong>2. SUM() — Sum of Values</strong></p><pre>SELECT SUM(salary) FROM employees; -- Total salary expenditure</pre><p><strong>3. AVG() — Average Value</strong></p><pre>SELECT AVG(price) FROM products; -- Average product price</pre><p><strong>4. MIN() / MAX() — Smallest &amp; Largest Values</strong></p><pre>SELECT MIN(age), MAX(age) FROM customers;</pre><p><strong>5. GROUP_CONCAT() — Concatenate Grouped Values</strong></p><pre>SELECT department, GROUP_CONCAT(employee_name) <br>FROM employees <br>GROUP BY department;</pre><h3>Conditional &amp; Advanced Functions</h3><p><strong>1. IF() — Simple Conditional Logic</strong></p><pre>SELECT IF(salary &gt; 50000, &#39;High&#39;, &#39;Low&#39;) AS salary_level FROM employees;</pre><p><strong>2. CASE WHEN — Multi-Condition Logic</strong></p><pre>SELECT <br>    name,<br>    CASE <br>        WHEN score &gt;= 90 THEN &#39;A&#39;<br>        WHEN score &gt;= 80 THEN &#39;B&#39;<br>        ELSE &#39;C&#39;<br>    END AS grade<br>FROM students;</pre><p><strong>3. COALESCE() — Return First Non-NULL Value</strong></p><pre>SELECT COALESCE(NULL, NULL, &#39;Fallback&#39;, &#39;MySQL&#39;); -- Returns &#39;Fallback&#39;</pre><p><strong>4. NULLIF() — Return NULL if Values Match</strong></p><pre>SELECT NULLIF(10, 10); -- Returns NULL<br>SELECT NULLIF(10, 5);  -- Returns 10</pre><h3>Final Thoughts</h3><p>MySQL’s built-in functions save time and simplify complex operations. Whether you’re formatting strings, calculating dates, or aggregating data, these functions are essential for efficient database queries.</p><p><strong>Pro Tip:</strong> Combine functions for powerful transformations!</p><pre>SELECT CONCAT(UPPER(SUBSTRING(name, 1, 1)), LOWER(SUBSTRING(name, 2))) <br>FROM users;</pre><p>💬 <strong>Which MySQL function do you use most often? Let me know in the comments!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1671451da4d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Different Ways to Write Cucumber Step Definitions for DataTables]]></title>
            <link>https://medium.com/@m4manishd/different-ways-to-write-cucumber-step-definitions-for-datatables-bd405edecd64?source=rss-6b1a18de2335------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd405edecd64</guid>
            <category><![CDATA[gherkin]]></category>
            <category><![CDATA[cucumber]]></category>
            <category><![CDATA[datatables]]></category>
            <category><![CDATA[bdd]]></category>
            <dc:creator><![CDATA[Manish Dhakeria]]></dc:creator>
            <pubDate>Sun, 23 Feb 2025 18:36:55 GMT</pubDate>
            <atom:updated>2025-02-23T18:36:55.530Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/275/1*lTm4P-7-BFRTXewRajzhPg.jpeg" /></figure><p>Cucumber’s <strong>DataTable</strong> feature is powerful for passing structured data into step definitions. Whether handling lists, maps, or complex objects, DataTables provide flexibility in writing efficient step definitions.</p><p>In this post, we will explore different approaches to handling DataTables in Cucumber with Java.</p><h3>1. Using List&lt;List&lt;String&gt;&gt; (Raw Data)</h3><p>If your table contains simple values (like a list of names or IDs), you can use a List&lt;List&lt;String&gt;&gt;.</p><h4>Gherkin Scenario</h4><pre>Given the following users exist:<br>  | Name    | Age |<br>  | Alice   | 25  |<br>  | Bob     | 30  |</pre><h4>Step Definition</h4><pre>@Given(&quot;the following users exist:&quot;)<br>public void usersExist(DataTable dataTable) {<br>    List&lt;List&lt;String&gt;&gt; rows = dataTable.asLists();<br>    for (List&lt;String&gt; row : rows) {<br>        System.out.println(&quot;User: &quot; + row.get(0) + &quot;, Age: &quot; + row.get(1));<br>    }<br>}</pre><p><strong>Use Case:</strong> Works best for small data sets where column headers are not needed.</p><h3>2. Using List&lt;Map&lt;String, String&gt;&gt; (Key-Value Mapping)</h3><p>For structured data with column headers, using a <strong>list of maps</strong> is more readable.</p><h4>Gherkin Scenario</h4><pre>Given the following users exist:<br>  | Name  | Age |<br>  | Alice | 25  |<br>  | Bob   | 30  |</pre><h4>Step Definition</h4><pre>@Given(&quot;the following users exist:&quot;)<br>public void usersExist(DataTable dataTable) {<br>    List&lt;Map&lt;String, String&gt;&gt; users = dataTable.asMaps();<br>    for (Map&lt;String, String&gt; user : users) {<br>        System.out.println(&quot;User: &quot; + user.get(&quot;Name&quot;) + &quot;, Age: &quot; + user.get(&quot;Age&quot;));<br>    }<br>}</pre><p><strong>Use Case:</strong> Suitable for tabular data with meaningful headers.</p><h3>3. Using List&lt;CustomObject&gt; (POJO Conversion)</h3><p>For structured data, we can map DataTables to Java objects using dataTable.asList(Class.class).</p><h4>Gherkin Scenario</h4><pre>Given the following users exist:<br>  | name  | age |<br>  | Alice | 25  |<br>  | Bob   | 30  |</pre><h4>Step Definition</h4><pre>@Given(&quot;the following users exist:&quot;)<br>public void usersExist(List&lt;User&gt; users) {<br>    for (User user : users) {<br>        System.out.println(&quot;User: &quot; + user.getName() + &quot;, Age: &quot; + user.getAge());<br>    }<br>}</pre><h4>User Class (POJO)</h4><pre>public class User {<br>    private String name;<br>    private int age;<br>    <br>    public User(String name, int age) {<br>        this.name = name;<br>        this.age = age;<br>    }<br>    <br>    public String getName() { return name; }<br>    public int getAge() { return age; }<br>}</pre><p><strong>Use Case:</strong> Best for complex objects and structured data handling.</p><h3>4. Using DataTableTransformer (Custom Conversion)</h3><p>If you need a custom way to transform DataTables, you can implement a transformer.</p><h4>Step Definition with Transformer</h4><pre>@Given(&quot;the following users exist:&quot;)<br>public void usersExist(DataTable dataTable) {<br>    List&lt;User&gt; users = dataTable.asList(User.class);<br>    users.forEach(user -&gt; System.out.println(user.getName() + &quot; - &quot; + user.getAge()));<br>}</pre><h4>Custom Transformer Class</h4><pre>public class UserTransformer implements TableEntryTransformer&lt;User&gt; {<br>    @Override<br>    public User transform(Map&lt;String, String&gt; entry) {<br>        return new User(entry.get(&quot;name&quot;), Integer.parseInt(entry.get(&quot;age&quot;)));<br>    }<br>}</pre><p><strong>Use Case:</strong> When dealing with complex transformations or different data formats.</p><h3>Conclusion</h3><p>Each approach has its <strong>use case</strong>, and choosing the right one depends on the complexity of your test data. Using POJO mapping and transformers can make your tests more maintainable in the long run.</p><p>Happy Testing with Cucumber &amp; DataTables!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd405edecd64" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Configure ChainTest LP Reports for Your Automation Framework]]></title>
            <link>https://medium.com/@m4manishd/how-to-configure-chaintest-lp-reports-for-your-automation-framework-66c52f0a0d55?source=rss-6b1a18de2335------2</link>
            <guid isPermaLink="false">https://medium.com/p/66c52f0a0d55</guid>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[report]]></category>
            <category><![CDATA[reporting]]></category>
            <category><![CDATA[testng]]></category>
            <category><![CDATA[extentreport]]></category>
            <dc:creator><![CDATA[Manish Dhakeria]]></dc:creator>
            <pubDate>Wed, 15 Jan 2025 08:07:35 GMT</pubDate>
            <atom:updated>2025-01-15T08:07:35.195Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*kexLw4iowwKSNWKtDn1kVA.png" /></figure><p><strong>ChainTest</strong> is a modern reporting tool designed to replace legacy solutions like Extent Reports. It provides customizable, user-friendly, and performance-efficient reports, making it an excellent choice for automation frameworks. This guide will walk you through the configuration of ChainTest LP reports in your project.</p><h3>1. Prerequisites</h3><p>Before starting, ensure you have the following installed:</p><ul><li><strong>Java</strong> (version 8 or higher)</li><li><strong>Docker</strong> (installed and running)</li><li><strong>Maven</strong> or <strong>Gradle</strong></li><li>Basic knowledge of TestNG or JUnit</li></ul><h3>2. Download the yml files</h3><p>The files are available here:</p><blockquote><a href="https://github.com/anshooarora/chaintest/tree/main/chainlp/docker">https://github.com/anshooarora/chaintest/tree/main/chainlp/docker</a></blockquote><p>Navigate to the directory in your terminal and follow step 3 next.</p><h3>3. Download and Run Chain Test Report Server</h3><h4>a. Pull the Docker Image and run the server</h4><p>Chain Test Report requires a server to handle test result processing and report generation. Use Docker to set up the server:</p><pre>docker compose -f docker-compose-h2.yml up</pre><p>The server will now be accessible at <a href="http://localhost:8080.">http://localhost:8080.</a></p><h4>b. Verify the Server</h4><p>Open your browser and navigate to http://localhost:8080. You should see the Chain Test Report dashboard.</p><h3>4. Add ChainTest Dependency</h3><p>First, add the ChainTest library to your project dependencies.</p><h4>For Maven:</h4><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;com.aventstack&lt;/groupId&gt;<br>    &lt;artifactId&gt;chaintest&lt;/artifactId&gt;<br>    &lt;version&gt;1.0.4&lt;/version&gt;<br>&lt;/dependency&gt;</pre><h4>For Gradle:</h4><pre>implementation &#39;com.aventstack:chaintest:1.0.4&#39;</pre><p>If you’re using Maven, add the following dependencies for SLF4J and Logback:</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;org.slf4j&lt;/groupId&gt;<br>    &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;<br>    &lt;version&gt;1.7.36&lt;/version&gt;<br>&lt;/dependency&gt;<br>&lt;dependency&gt;<br>    &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;<br>    &lt;artifactId&gt;logback-classic&lt;/artifactId&gt;<br>    &lt;version&gt;1.2.11&lt;/version&gt;<br>&lt;/dependency&gt;</pre><p>For Gradle:</p><pre>implementation &#39;org.slf4j:slf4j-api:1.7.36&#39;<br>implementation &#39;ch.qos.logback:logback-classic:1.2.11&#39;</pre><h3>5. Setup properties file</h3><p>Create a chaintest.properties file in your project’s resources directory. Add the following configurations:</p><pre># chaintest configuration<br>chaintest.project.name=Project name<br><br># storage<br>chaintest.storage.service.enabled=false<br># [azure-blob, aws-s3]<br>chaintest.storage.service=azure-blob<br># s3 bucket or azure container name<br>chaintest.storage.service.container-name=<br><br># generators:<br>## chainlp<br>chaintest.generator.chainlp.enabled=true<br>chaintest.generator.chainlp.class-name=com.aventstack.chaintest.generator.ChainLPGenerator<br>chaintest.generator.chainlp.host.url=http://localhost/<br>chaintest.generator.chainlp.client.request-timeout-s=30<br>chaintest.generator.chainlp.client.expect-continue=false<br>chaintest.generator.chainlp.client.max-retries=3<br><br>## simple<br>chaintest.generator.simple.enabled=true<br>chaintest.generator.simple.document-title=chaintest<br>chaintest.generator.simple.class-name=com.aventstack.chaintest.generator.ChainTestSimpleGenerator<br>#chaintest.generator.simple.output-file=target/chaintest/Index.html<br>chaintest.generator.simple.output-file=reports/Index.html<br>chaintest.generator.simple.offline=false<br>chaintest.generator.simple.dark-theme=true<br>chaintest.generator.simple.datetime-format=yyyy-MM-dd hh:mm:ss a<br>chaintest.generator.simple.js=<br>chaintest.generator.simple.css=<br><br>## email<br>chaintest.generator.email.enabled=true<br>chaintest.generator.email.class-name=com.aventstack.chaintest.generator.ChainTestEmailGenerator<br>chaintest.generator.email.output-file=target/chaintest/Email.html<br>chaintest.generator.email.datetime-format=yyyy-MM-dd hh:mm:ss a</pre><h3>5. Configure Logback</h3><p>Create a logback.xml file in your src/main/resources directory to define logging behavior:</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;configuration&gt;<br>    &lt;!-- Console Appender --&gt;<br>    &lt;appender name=&quot;CONSOLE&quot; class=&quot;ch.qos.logback.core.ConsoleAppender&quot;&gt;<br>        &lt;encoder&gt;<br>            &lt;pattern&gt;%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n&lt;/pattern&gt;<br>        &lt;/encoder&gt;<br>    &lt;/appender&gt;<br><br>    &lt;!-- Root Logger --&gt;<br>    &lt;root level=&quot;INFO&quot;&gt;<br>        &lt;appender-ref ref=&quot;CONSOLE&quot; /&gt;<br>    &lt;/root&gt;<br>&lt;/configuration&gt;</pre><h3>6. Util method for logging messages</h3><p>Here’s a Java class called LogAndInfo that encapsulates logging functionality using SLF4J. This class provides utility methods for logging messages at different levels and can be used across your project.</p><pre>package com.example.utils;<br><br>import org.slf4j.Logger;<br>import org.slf4j.LoggerFactory;<br><br>/**<br> * Utility class for logging and informational messages.<br> */<br>public class LogAndInfo {<br>    private final Logger logger;<br><br>    /**<br>     * Constructor to initialize the logger for the given class.<br>     *<br>     * @param clazz the class for which the logger is being created<br>     */<br>    public LogAndInfo(Class&lt;?&gt; clazz) {<br>        this.logger = LoggerFactory.getLogger(clazz);<br>    }<br><br>    /**<br>     * Logs an informational message.<br>     *<br>     * @param message the message to log<br>     */<br>    public void info(String message) {<br>        logger.info(message);<br>    }<br><br>    /**<br>     * Logs a debug message.<br>     *<br>     * @param message the message to log<br>     */<br>    public void debug(String message) {<br>        logger.debug(message);<br>    }<br><br>    /**<br>     * Logs a warning message.<br>     *<br>     * @param message the message to log<br>     */<br>    public void warn(String message) {<br>        logger.warn(message);<br>    }<br><br>    /**<br>     * Logs an error message.<br>     *<br>     * @param message the message to log<br>     */<br>    public void error(String message) {<br>        logger.error(message);<br>    }<br><br>    /**<br>     * Logs an error message with an exception.<br>     *<br>     * @param message the message to log<br>     * @param throwable the exception to log<br>     */<br>    public void error(String message, Throwable throwable) {<br>        logger.error(message, throwable);<br>    }<br><br>    /**<br>     * Logs a trace message.<br>     *<br>     * @param message the message to log<br>     */<br>    public void trace(String message) {<br>        logger.trace(message);<br>    }<br>}</pre><h3>7. Implement Logging in Your Code</h3><p>Incorporate logging into your classes by initializing a logger instance and using it to log messages at appropriate levels:</p><pre>import org.slf4j.Logger;<br>import org.slf4j.LoggerFactory;<br><br>public class YourClass {<br>    private static final LogAndInfo log = new LogAndInfo(YourClass.class);<br><br>    public void yourMethod() {<br>        log.info(&quot;Method yourMethod started.&quot;);<br><br>        try {<br>            // Your code logic here<br>            log.debug(&quot;Processing with value: {}&quot;, someValue);<br>        } catch (Exception e) {<br>            log.error(&quot;An error occurred: &quot;, e);<br>        }<br><br>        log.info(&quot;Method yourMethod completed.&quot;);<br>    }<br>}</pre><h3>8. Add ChainTestListener in the list of @Listeners of the test class Or directly in your testng xml file.</h3><pre>import org.testng.annotations.Listeners;<br>import com.aventstack.chaintest.plugins.ChainTestListener;<br>import org.testng.Assert;<br>import org.testng.annotations.Test;<br><br>@Listeners(ChainTestListener.class)<br>public class TestClass { <br>  @Test<br>  public void sum() {<br>    Assert.assertTrue(true);<br>  }<br>}</pre><p>or</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;!DOCTYPE suite SYSTEM &quot;https://testng.org/testng-1.0.dtd&quot;&gt;<br><br>&lt;suite name=&quot;Your suite name&quot;&gt;<br>&lt;listeners&gt;<br>        &lt;listener class-name=&quot;com.aventstack.chaintest.plugins.ChainTestListener&quot;/&gt;<br>&lt;/listeners&gt;</pre><h3>9. Run Your Tests mvn test</h3><h4>a. Execute the Tests</h4><p>Run your test suite using Maven or Gradle:</p><pre>mvn test</pre><h4>b. Verify Logs</h4><p>The logs will automatically be sent to the Chain Test Report server.</p><h3>10. View the Report</h3><h4>a. Access the Dashboard</h4><p>Open your browser and navigate to <a href="http://localhost:8080.">http://localhost:8080.</a></p><h4>b. Analyze Test Results</h4><p>The dashboard provides:</p><ul><li><strong>Test Summary</strong>: Pass, fail, and skip counts.</li><li><strong>Detailed Logs</strong>: Per-test logs with screenshots and stack traces.</li><li><strong>Interactive Filtering</strong>: Filter results by test status, environment, or build version.</li></ul><p>By following these steps, you can seamlessly set up and use Chain Test Report for your automation projects. Let me know if you need further clarification!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66c52f0a0d55" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Connecting BrowserStack for Android Automation]]></title>
            <link>https://medium.com/@m4manishd/connecting-browserstack-for-android-automation-1fba09eb2710?source=rss-6b1a18de2335------2</link>
            <guid isPermaLink="false">https://medium.com/p/1fba09eb2710</guid>
            <category><![CDATA[cross-browser-testing]]></category>
            <category><![CDATA[browserstack]]></category>
            <category><![CDATA[android-automation]]></category>
            <category><![CDATA[browserstack-setup-guide]]></category>
            <category><![CDATA[mobile-test-automation]]></category>
            <dc:creator><![CDATA[Manish Dhakeria]]></dc:creator>
            <pubDate>Sat, 04 Jan 2025 14:46:57 GMT</pubDate>
            <atom:updated>2025-01-04T14:46:57.510Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/310/1*fOQdU7idJzvcj3PV0NP79A.png" /></figure><p>In the world of mobile app testing, BrowserStack is a game-changer, offering a cloud-based platform that lets you test your Android apps on real devices. This guide walks you through setting up and connecting to BrowserStack for Android automation, ensuring your tests run seamlessly.</p><h3>Prerequisites</h3><p>Before diving into automation, ensure you have the following:</p><ol><li><strong>BrowserStack Account</strong>: Sign up for a free trial or paid plan at <a href="https://www.browserstack.com/">BrowserStack</a>.</li><li><strong>Java Development Kit (JDK)</strong>: Installed and configured on your system.</li><li><strong>Appium</strong>: Installed. You can use npm install -g appium to set it up.</li><li><strong>Android SDK</strong>: Installed and properly configured.</li><li><strong>App File</strong>: The .apk or .aab file of your Android application.</li><li><strong>BrowserStack Access Key</strong>: Found in your BrowserStack dashboard.</li></ol><h3>Step 1: Upload Your App to BrowserStack</h3><p>Before running tests, upload your app to BrowserStack.</p><h4>Using the REST API:</h4><p>Run the following curl command to upload your app:</p><pre>curl -u &quot;&lt;username&gt;:&lt;access_key&gt;&quot; \<br>-X POST &quot;https://api-cloud.browserstack.com/app-automate/upload&quot; \<br>-F &quot;file=@/path/to/your/app.apk&quot;</pre><ul><li>Replace &lt;username&gt; and &lt;access_key&gt; with your BrowserStack credentials.</li><li>Replace /path/to/your/app.apk with the path to your app file.</li></ul><p>The response will include an app_url, which you&#39;ll use in your test scripts.</p><h3>Step 2: Set Up Desired Capabilities</h3><p>Desired capabilities define the device and app configurations for your tests. Below is an example configuration:</p><pre>import org.openqa.selenium.remote.DesiredCapabilities;<br><br>DesiredCapabilities caps = new DesiredCapabilities();<br>caps.setCapability(&quot;browserstack.user&quot;, &quot;&lt;username&gt;&quot;);<br>caps.setCapability(&quot;browserstack.key&quot;, &quot;&lt;access_key&gt;&quot;);<br>caps.setCapability(&quot;app&quot;, &quot;&lt;app_url&gt;&quot;);<br>caps.setCapability(&quot;device&quot;, &quot;Google Pixel 6&quot;);<br>caps.setCapability(&quot;os_version&quot;, &quot;12.0&quot;);<br>caps.setCapability(&quot;project&quot;, &quot;Android Automation Project&quot;);<br>caps.setCapability(&quot;build&quot;, &quot;Build 1.0&quot;);<br>caps.setCapability(&quot;name&quot;, &quot;Sample Test&quot;);</pre><p>Replace &lt;username&gt;, &lt;access_key&gt;, and &lt;app_url&gt; with your BrowserStack credentials and app URL.</p><h3>Step 3: Write Your Test Script</h3><p>Here’s a sample Appium test script to launch the app and interact with it:</p><pre>import io.appium.java_client.MobileElement;<br>import io.appium.java_client.android.AndroidDriver;<br>import org.openqa.selenium.remote.DesiredCapabilities;<br>import java.net.URL;<br><br>public class BrowserStackTest {<br>    public static void main(String[] args) throws Exception {<br>        DesiredCapabilities caps = new DesiredCapabilities();<br>        // Set BrowserStack credentials<br>        caps.setCapability(&quot;browserstack.user&quot;, &quot;&lt;username&gt;&quot;);<br>        caps.setCapability(&quot;browserstack.key&quot;, &quot;&lt;access_key&gt;&quot;);<br>        // Set app URL<br>        caps.setCapability(&quot;app&quot;, &quot;&lt;app_url&gt;&quot;);<br>        // Set device and OS version<br>        caps.setCapability(&quot;device&quot;, &quot;Google Pixel 6&quot;);<br>        caps.setCapability(&quot;os_version&quot;, &quot;12.0&quot;);<br>        // Set project details<br>        caps.setCapability(&quot;project&quot;, &quot;Android Automation Project&quot;);<br>        caps.setCapability(&quot;build&quot;, &quot;Build 1.0&quot;);<br>        caps.setCapability(&quot;name&quot;, &quot;Sample Test&quot;);<br>        // Initialize Appium driver<br>        AndroidDriver&lt;MobileElement&gt; driver = new AndroidDriver&lt;&gt;(<br>            new URL(&quot;https://hub-cloud.browserstack.com/wd/hub&quot;), caps);<br>        // Interact with the app<br>        MobileElement element = driver.findElementById(&quot;com.example:id/button&quot;);<br>        element.click();// Quit the driver<br>        driver.quit();<br>    }<br>}</pre><h3>Step 4: Execute the Test</h3><ol><li>Save the script in a .java file.</li><li>Compile the file using javac:</li></ol><p>javac BrowserStackTest.java</p><p>3. Run the test:</p><p>java BrowserStackTest</p><h3>Step 5: Analyze Results</h3><ol><li>Log in to your BrowserStack dashboard.</li><li>Navigate to the <strong>App Automate</strong> section.</li><li>View detailed test reports, including logs, screenshots, and videos.</li></ol><h3>Best Practices</h3><h4>1. Organize Tests</h4><p>Using frameworks like TestNG or JUnit helps structure and manage your test suite efficiently. These frameworks allow grouping tests, setting dependencies, and generating detailed reports.</p><p><strong>Example with TestNG:</strong></p><pre>import org.testng.annotations.Test;<br>import org.testng.annotations.BeforeClass;<br>import org.testng.annotations.AfterClass;<br>import io.appium.java_client.MobileElement;<br>import io.appium.java_client.android.AndroidDriver;<br>import org.openqa.selenium.remote.DesiredCapabilities;<br>import java.net.URL;<br><br>public class BrowserStackTestNG {<br>    AndroidDriver&lt;MobileElement&gt; driver;<br>    @BeforeClass<br>    public void setUp() throws Exception {<br>        DesiredCapabilities caps = new DesiredCapabilities();<br>        caps.setCapability(&quot;browserstack.user&quot;, &quot;&lt;username&gt;&quot;);<br>        caps.setCapability(&quot;browserstack.key&quot;, &quot;&lt;access_key&gt;&quot;);<br>        caps.setCapability(&quot;app&quot;, &quot;&lt;app_url&gt;&quot;);<br>        caps.setCapability(&quot;device&quot;, &quot;Google Pixel 6&quot;);<br>        caps.setCapability(&quot;os_version&quot;, &quot;12.0&quot;);<br>        driver = new AndroidDriver&lt;&gt;(<br>            new URL(&quot;https://hub-cloud.browserstack.com/wd/hub&quot;), caps);<br>    }<br><br>    @Test<br>    public void sampleTest() {<br>        MobileElement element = driver.findElementById(&quot;com.example:id/button&quot;);<br>        element.click();<br>    }<br><br>    @AfterClass<br>    public void tearDown() {<br>        if (driver != null) {<br>            driver.quit();<br>        }<br>    }<br>}</pre><h4>2. Parameterize Configurations</h4><p>Store sensitive information and configurations in environment variables or external files to enhance security and flexibility.</p><p><strong>Example:</strong></p><pre>import java.util.Properties;<br>import java.io.FileInputStream;<br><br>public class ConfigLoader {<br>    public static Properties loadConfig(String filePath) throws Exception {<br>        Properties props = new Properties();<br>        FileInputStream fis = new FileInputStream(filePath);<br>        props.load(fis);<br>        fis.close();<br>        return props;<br>    }<br><br>public static void main(String[] args) throws Exception {<br>        Properties config = loadConfig(&quot;config.properties&quot;);<br>        System.out.println(&quot;User: &quot; + config.getProperty(&quot;browserstack.user&quot;));<br>    }<br>}</pre><h4>3. Parallel Testing</h4><p>BrowserStack supports parallel test execution, enabling you to test on multiple devices simultaneously, reducing overall testing time.</p><p><strong>Example with TestNG Parallel Execution:</strong></p><pre>&lt;suite name=&quot;Parallel Tests&quot; parallel=&quot;tests&quot; thread-count=&quot;2&quot;&gt;<br>    &lt;test name=&quot;Test on Pixel 6&quot;&gt;<br>        &lt;classes&gt;<br>            &lt;class name=&quot;com.example.BrowserStackTestNG&quot;/&gt;<br>        &lt;/classes&gt;<br>    &lt;/test&gt;<br>    &lt;test name=&quot;Test on Samsung S21&quot;&gt;<br>        &lt;classes&gt;<br>            &lt;class name=&quot;com.example.BrowserStackTestNG&quot;/&gt;<br>        &lt;/classes&gt;<br>    &lt;/test&gt;<br>&lt;/suite&gt;</pre><p>By following this guide, you can seamlessly connect to BrowserStack and run automated tests on Android devices. This approach not only ensures comprehensive testing but also saves time and resources, making your development process more efficient.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1fba09eb2710" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>