<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Shivam Maurya</title>
    <description>The latest articles on Forem by Shivam Maurya (@shivam2k25).</description>
    <link>https://forem.com/shivam2k25</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3455295%2Fde06ac40-dcda-40be-adbe-dd02a837c3b6.jpg</url>
      <title>Forem: Shivam Maurya</title>
      <link>https://forem.com/shivam2k25</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/shivam2k25"/>
    <language>en</language>
    <item>
      <title>🚀 AI-Driven Failure Intelligence for 1000+ API Test Cases</title>
      <dc:creator>Shivam Maurya</dc:creator>
      <pubDate>Mon, 02 Mar 2026 23:39:56 +0000</pubDate>
      <link>https://forem.com/shivam2k25/ai-driven-failure-intelligence-for-1000-api-test-cases-3pj9</link>
      <guid>https://forem.com/shivam2k25/ai-driven-failure-intelligence-for-1000-api-test-cases-3pj9</guid>
      <description>&lt;p&gt;In large-scale API automation environments (1000+ scenarios), even 50–100 failures in a CI run can take hours to manually analyze.&lt;/p&gt;

&lt;p&gt;I recently implemented an AI-assisted failure analysis layer within our CI pipeline to automatically interpret failed test cases and generate structured root-cause reasoning.&lt;/p&gt;

&lt;p&gt;🔹 Standard Test Execution (Before AI Layer)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;🟢 Test Execution Summary
-------------------------------------------------
Feature                      | Passed | Failed | Total
Customer Identity Suite      | 842 ✅  | 18 ❌  | 860
Order Processing Suite       | 97 ✅   | 12 ❌  | 109
Payment Validation Suite     | 31 ✅   | 5 ❌   | 36
-------------------------------------------------
TOTAL                        | 970    | 35     | 1005
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When failures scale to 50–100+ cases:&lt;/p&gt;

&lt;p&gt;Engineers typically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open HTML reports&lt;/li&gt;
&lt;li&gt;Scan raw logs&lt;/li&gt;
&lt;li&gt;Compare expected vs actual response&lt;/li&gt;
&lt;li&gt;Identify assertion mismatches&lt;/li&gt;
&lt;li&gt;Interpret schema failures&lt;/li&gt;
&lt;li&gt;Trace backend logic impact&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This increases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Debug cycle time&lt;/li&gt;
&lt;li&gt;Developer back-and-forth&lt;/li&gt;
&lt;li&gt;CI triage effort&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🔹 What Changed (AI Layer Enabled)&lt;/p&gt;

&lt;p&gt;When optional AI analysis is enabled:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;🚀 Running AI Failure Analysis...

📊 FINAL EXECUTION SUMMARY
----------------------------------
🚨 Total Failed Cases Analyzed: 35
🧠 AI Structured Reports Generated: 35
----------------------------------
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example AI-Generated Output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;📂 Feature Name  : Customer Identity Suite
❌ Scenario Name : Validate getProfile API with expired token
💥 Failure Reason:
Assertion failed: expected HTTP 401 but received 200.
Possible cause: Token validation middleware not enforced.
Impact: Security validation gap in authentication flow.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;📂 Feature Name  : Order Processing Suite
❌ Scenario Name : Validate order creation with invalid SKU
💥 Failure Reason:
Schema mismatch in response.data.errorCode.
Backend validation layer likely bypassed.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🔹 Behind the Scenes – Execution Flow&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User Triggers CI Pipeline
        │
        ▼
Run 1000+ API Test Scenarios
        │
        ▼
Generate Standard Reports (HTML / JSON)
        │
        ▼
Extract failedScenarios.json (Only Failed Cases)
        │
        ▼
Build Structured Failure Payload
        │
        ▼
Send to AI Agent (Optimized Token Usage)
        │
        ▼
Async Polling Until Completion
        │
        ▼
Validate Structured Schema Output
        │
        ▼
Print Feature-Level Failure Intelligence Summary
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🔹 Engineering Design Considerations&lt;/p&gt;

&lt;p&gt;✅ Non-blocking integration (AI failure does not fail pipeline)&lt;br&gt;
✅ Optional execution toggle&lt;br&gt;
✅ Token optimization (only failed scenarios analyzed)&lt;br&gt;
✅ Structured schema enforcement&lt;br&gt;
✅ Feature-level grouping&lt;br&gt;
✅ Polling-based async agent handling&lt;br&gt;
✅ No impact to primary execution time&lt;/p&gt;

&lt;p&gt;🔥 Real Impact (Measured)&lt;/p&gt;

&lt;p&gt;In runs with 80–100 failures:&lt;/p&gt;

&lt;p&gt;Before AI:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;2–3 hours manual debugging&lt;/li&gt;
&lt;li&gt;Multiple log scans&lt;/li&gt;
&lt;li&gt;Repetitive analysis effort&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After AI:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;40–60% reduction in manual triage time&lt;/li&gt;
&lt;li&gt;Immediate structured reasoning&lt;/li&gt;
&lt;li&gt;Faster developer alignment&lt;/li&gt;
&lt;li&gt;Reduced QA–Backend iteration cycle&lt;/li&gt;
&lt;li&gt;Improved CI observability&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🔹 What This Enabled&lt;/p&gt;

&lt;p&gt;Instead of:&lt;/p&gt;

&lt;p&gt;“Test Failed — Check Logs”&lt;/p&gt;

&lt;p&gt;We now have:&lt;/p&gt;

&lt;p&gt;“Test Failed — Here is structured reasoning and probable cause.”&lt;/p&gt;

&lt;p&gt;This shifted automation from:&lt;/p&gt;

&lt;p&gt;Execution-focused&lt;br&gt;
to&lt;br&gt;
Intelligence-enabled.&lt;/p&gt;

&lt;p&gt;🔹 Tech Stack Blend&lt;/p&gt;

&lt;p&gt;Test Automation × CI/CD × Structured AI Reasoning × Observability&lt;/p&gt;

</description>
      <category>ai</category>
      <category>api</category>
      <category>automation</category>
      <category>testing</category>
    </item>
    <item>
      <title>Build a Scalable Karate API Automation Framework using Node.js &amp; GitLab CI/CD</title>
      <dc:creator>Shivam Maurya</dc:creator>
      <pubDate>Sun, 24 Aug 2025 02:25:19 +0000</pubDate>
      <link>https://forem.com/shivam2k25/build-a-scalable-karate-api-automation-framework-using-nodejs-gitlab-cicd-35pi</link>
      <guid>https://forem.com/shivam2k25/build-a-scalable-karate-api-automation-framework-using-nodejs-gitlab-cicd-35pi</guid>
      <description>&lt;p&gt;📘 Karate API Automation Framework using Node.js + GitLab CI/CD&lt;br&gt;
    Author: [Shivam Maurya]&lt;br&gt;
    Repo Purpose: 🚀 A clean, modular, and scalable Karate test automation framework using Node.js, GitLab pipelines, and full parallel execution with tagging and logging support.&lt;br&gt;
    Tech Stack: Karate 🥋 | Node.js | GitLab CI/CD | Java (runtime only) | Markdown Docs&lt;/p&gt;

&lt;p&gt;✅ STEP 1: Local Setup in VS Code (Node.js Environment)&lt;br&gt;
 We'll set up a modern Karate test automation framework using Node.js and VS Code — no Java coding needed, everything handled via npm.&lt;/p&gt;

&lt;p&gt;🔧 1.1 Prerequisites&lt;br&gt;
   Make sure you have the following installed:&lt;br&gt;
    ✅ Node.js (v18+ recommended)&lt;br&gt;
    ✅ VS Code&lt;br&gt;
    ✅ Java (JDK 11+ is used by Karate internally — not for coding, but for execution)&lt;/p&gt;

&lt;p&gt;🔍 Check if installed&lt;br&gt;
     node -v&lt;br&gt;
     npm -v&lt;br&gt;
     java -version&lt;/p&gt;

&lt;p&gt;✅ Sample Output:&lt;br&gt;
    v22.18.0&lt;br&gt;
    10.9.3&lt;br&gt;
    java version "11.0.18"&lt;br&gt;
📦 If not installed, download Node.js (LTS version) from  nodejs.org&lt;/p&gt;

&lt;p&gt;🏗️ 1.2 Project Folder Structure&lt;br&gt;
  Run the following to set up a basic Node project:&lt;br&gt;
   mkdir Karate-Framework&lt;br&gt;
   cd Karate-Framework&lt;br&gt;
   npm init -y&lt;/p&gt;

&lt;p&gt;Now, create the structure below:&lt;/p&gt;

&lt;p&gt;Karate-Framework/&lt;br&gt;
    ├── features/&lt;br&gt;
    │   └── sample.feature&lt;br&gt;
    ├── utility/&lt;br&gt;
    │   └── karate.js&lt;br&gt;
    ├── karate-config.js&lt;br&gt;
    ├── package.json&lt;/p&gt;

&lt;p&gt;Screenshot: &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fewj5ccweozx47l7k5bn5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fewj5ccweozx47l7k5bn5.png" alt=" " width="552" height="859"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;📦 1.3 Install Karate via NPM&lt;br&gt;
    npm install &lt;a class="mentioned-user" href="https://dev.to/karatelabs"&gt;@karatelabs&lt;/a&gt;/karate --save-dev&lt;/p&gt;

&lt;p&gt;📁 This installs the CLI &amp;amp; dependencies locally (no global install needed). You’ll see:&lt;br&gt;
    node_modules/&lt;br&gt;
    package-lock.json&lt;/p&gt;

&lt;p&gt;🧠 1.4 Create Sample Test&lt;/p&gt;

&lt;p&gt;📄 features/sample.feature&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Feature: Sample API Test
       @sample
        Scenario: Call a public API
        Given url "https://jsonplaceholder.typicode.com/posts/1"
        When method get
        Then status 200
        And match response.id == 1

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🧪 1.5 Create Config File (karate-config.js)&lt;br&gt;
   📄 karate-config.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; function fn() {
    karate.configure('connectTimeout', 200000);
    karate.configure('readTimeout', 200000);
    karate.configure('printEnabled', true);
    karate.configure('logPrettyResponse', true);
    karate.configure('logPrettyRequest', true);

    var env = karate.env || 'dev';
    var config = {
        env: env
    };

    return config;
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🎯 This sets timeouts, logging preferences, and environment variables.&lt;br&gt;
   🧑‍💻 1.6 Create utility/karate.js (Programmatic Runner)&lt;br&gt;
   📄 utility/karate.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Utility script to execute Karate tests with dynamic args
    import karate from '@karatelabs/karate';
    const cliArgs = process.argv.slice(2);
    let threads = '5'; // Default thread count
    // Find numeric thread count passed as CLI arg
    const idx = cliArgs.findIndex(arg =&amp;gt; /^\d+$/.test(arg));
    if (idx !== -1) {
    threads = cliArgs[idx];
    cliArgs.splice(idx, 1);
    }
    const options = `-T=${threads}` + (cliArgs.length ? ' ' + cliArgs.join(' ') : '');
    console.log('🎯 Running Karate with args:', options);
    karate.exec(options);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;💡 Example:&lt;br&gt;
  node utility/karate.js ./features -t=&lt;a class="mentioned-user" href="https://dev.to/sample"&gt;@sample&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;📝 1.7 Add Scripts in package.json&lt;br&gt;
  📄 package.json&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "name": "karate-framework",
    "version": "1.0.0",
    "description": "Test Automation Framework for API",
    "type": "module",
    "scripts": {
        "karate": "node ./utility/karate.js",
        "test": "npm run karate -- ./features -f html,cucumber:json,junit:xml"
    },
    "devDependencies": {
        "@karatelabs/karate": "^0.3.2"
    }
    }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🚀 1.8 Run Karate Tests (With Tags &amp;amp; Parallel)&lt;br&gt;
  Run all tests:&lt;br&gt;
    npm test&lt;br&gt;
  Run tagged test with parallelism:&lt;br&gt;
    npm test -- -t=&lt;a class="mentioned-user" href="https://dev.to/sample"&gt;@sample&lt;/a&gt; 10&lt;/p&gt;

&lt;p&gt;✅ STEP 2: Push Karate Project to GitLab&lt;/p&gt;

&lt;p&gt;🧱 2.1 Create GitLab Repository&lt;br&gt;
   Go to 👉 &lt;a href="https://gitlab.com" rel="noopener noreferrer"&gt;https://gitlab.com&lt;/a&gt;&lt;br&gt;
   Create new project: karate-api-automation&lt;br&gt;
    (Do not initialize with README or .gitignore if present locally)&lt;/p&gt;

&lt;p&gt;💻 2.2 Initialize Git Locally&lt;br&gt;
    git init&lt;br&gt;
    git remote add origin &lt;a href="https://gitlab.com/" rel="noopener noreferrer"&gt;https://gitlab.com/&lt;/a&gt;/karate-api-automation.git&lt;/p&gt;

&lt;p&gt;📦 2.3 Commit All Files&lt;br&gt;
    git add .&lt;br&gt;
    git commit -m "🚀 Initial commit - Karate Framework setup"&lt;/p&gt;

&lt;p&gt;✅ This includes:&lt;br&gt;
    package.json&lt;br&gt;
    karate-config.js&lt;br&gt;
    utility/karate.js&lt;br&gt;
    features/sample.feature&lt;br&gt;
    .gitlab-ci.yml (in next step)&lt;br&gt;
    README.md&lt;/p&gt;

&lt;p&gt;🚀 2.4 Push to GitLab&lt;br&gt;
    git push -u origin main&lt;/p&gt;

&lt;p&gt;📦 Now your entire framework is versioned and pipeline-ready.&lt;br&gt;
    Screenshot: &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvm6k4lu6vm3veenasnp5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvm6k4lu6vm3veenasnp5.png" alt=" " width="800" height="537"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;✅ STEP 3: GitLab CI/CD Pipeline Setup&lt;/p&gt;

&lt;p&gt;📁 3.1 Create pipeline/ Folder&lt;br&gt;
     mkdir pipeline&lt;/p&gt;

&lt;p&gt;📄 pipeline/.gitlab-ci.yml&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;image: node:20

    stages:
    - test

    variables:
    NODE_ENV: "dev"
    KARATE_TAG: "@sample"
    KARATE_PARALLEL: "5"

    cache:
    paths:
        - node_modules/

    before_script:
    - echo "Using Node.js version:"
    - node -v
    - echo "Installing dependencies..."
    - npm install

    karate_test:
    stage: test
    script:
        - echo "Running Karate tests with tag: $KARATE_TAG and parallelism: $KARATE_PARALLEL"
        - node ./utility/karate.js ./features -f html,cucumber:json,junit:xml $KARATE_PARALLEL -t=$KARATE_TAG
    artifacts:
        paths:
        - target/karate-reports/
        when: always
    retry: 1

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🧩 3.2 Root .gitlab-ci.yml to Include Pipeline&lt;br&gt;
  📄 .gitlab-ci.yml&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;include:
    - local: 'pipeline/.gitlab-ci.yml'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ This structure allows multiple modular .yml files later.&lt;/p&gt;

&lt;p&gt;🆓 3.3 Push CI Setup&lt;br&gt;
   git add .gitlab-ci.yml pipeline/.gitlab-ci.yml&lt;br&gt;
   git commit -m "🚀 Setup GitLab CI pipeline in pipeline folder  with dynamic variables"&lt;br&gt;
   git push&lt;/p&gt;

&lt;p&gt;✅ 🎉 Done!&lt;br&gt;
 Your Karate tests now run in GitLab CI/CD with:&lt;br&gt;
    Dynamic tag-based execution (&lt;a class="mentioned-user" href="https://dev.to/sample"&gt;@sample&lt;/a&gt;)&lt;br&gt;
    Configurable parallelism (via GitLab UI or .env)&lt;br&gt;
    Modular pipeline structure&lt;/p&gt;

&lt;p&gt;Execute Pipeline Screenshot: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsnts96jy7iiddkvy2y61.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsnts96jy7iiddkvy2y61.png" alt=" " width="800" height="344"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Pipeline Result Screenshot:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa8p0tr3n4rr6jnbqt5wl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa8p0tr3n4rr6jnbqt5wl.png" alt=" " width="800" height="384"&gt;&lt;/a&gt;   &lt;/p&gt;

&lt;p&gt;Execution Report Screenshot:&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp85xjntunkbqahgajdwx.png" alt=" " width="800" height="143"&gt;
&lt;/h1&gt;

&lt;p&gt;🔮 What’s next?&lt;br&gt;
I’ll be sharing deeper insights on:&lt;/p&gt;

&lt;p&gt;🔥 Advanced API testing scenarios with Karate Common utilities&lt;br&gt;
🔐 Authentication flows and security testing&lt;br&gt;
⚙️ Custom reusable functions and framework enhancements&lt;br&gt;
📂 Real-world project examples and best practices&lt;/p&gt;

&lt;p&gt;Stay tuned 🔔 and follow for updates! 🚀✨&lt;/p&gt;

</description>
      <category>karate</category>
      <category>cicd</category>
      <category>automation</category>
      <category>api</category>
    </item>
  </channel>
</rss>
