6 Software Testing Templates: How This AI Tool Replaced Traditional Scripting with Plain English Commands.

6 Software Testing Templates: How This AI Tool Replaced Traditional Scripting with Plain English Commands.

AI Meets Software Testing

Listen up, developers.

Remember those endless hours writing repetitive testing scripts? Debugging line after line of code? Manually creating test scenarios that feel like you're solving a Rubik's cube blindfolded?

Those days are officially over.

We’re standing at the edge of a testing revolution that's about to flip everything you know upside down. Traditional scripting isn’t just changing, it’s being completely reshaped by a new wave of smarter testing tools.

Let's break it down. The traditional testing workflow looks like a nightmare:

  • Write complex scripts manually

  • Spend hours creating test scenarios

  • Manage multiple frameworks

  • Struggle with cross-platform compatibility

  • Waste time debugging infrastructure instead of actual problems

But what if you could just... talk to your testing tool?

Imagine telling an AI, "Test the login flow for this banking website" and watching it generate comprehensive test scripts automatically. No more wrestling with Selenium. No more configuring endless testing environments.

This isn't science fiction. This is happening right now.

The AI testing movement isn't just an upgrade, it's a complete system reboot. We're talking about a tool that can:

  • Generate test scripts using natural language

  • Create multi-platform test scenarios in seconds

  • Automatically adapt to different frameworks

  • Learn from previous test executions

  • Predict potential failure points before they happen

The numbers are mind-blowing:

  • Companies lose $2.41 trillion annually to software failures (Source: Consortium for Information and Software Quality).

  • Traditional testing consumes 25-35% (average) of development time.

  • Manual testing introduces human error in 15-20% of scenarios.

But here's the real kicker: AI-driven testing tools have shown the potential to reduce testing time by up to 90% while also increasing defect detection rates by over 40%.

Introducing KaneAI: The Next-Generation Testing Solution

KaneAI isn't just another testing tool. It's the world's first end-to-end software testing agent powered by advanced Large Language Models.

What makes it special?

  • Test Generation & Evolution: Effortlessly create tests using natural language inputs

  • Multi-Language Code Export: Convert automated tests across major languages and frameworks

  • Intelligent Test Planner: Automatically generate and automate test steps from high-level objectives

  • Smart Show-Me Mode: Convert your actions into natural language instructions

  • Sophisticated Testing Capabilities: Express complex conditions and assertions naturally

  • Resilient Tests: Built-in smart capabilities and auto-healing

  • Cross-Platform Coverage: Develop tests for web and mobile platforms

Unique features like tagging KaneAI in JIRA, Slack, and GitHub issues, 2-way test editing, and smart versioning make it a game-changer.

In this guide, we're not just showing you a tool. We're giving you a weapon.

We'll touch:

  • Natural language test generation

  • JavaScript interaction templates

  • API testing strategies

  • Real-world scenarios using actual demo sites

These aren't just templates - they're your ticket to changing how you do testing. Think of them as a treasure map to better ways of working. Each script and interaction is like a blank page waiting for you to create something awesome.

Picture yourself breaking free from old-school testing limits. You're not just writing tests anymore - you're building smart ways to check things automatically.

Tip

Think of these templates like building blocks. You're the creator.

Your mission is to make them fit exactly what you need, try out tricky ways of checking things, show everyone how cool automated testing can be, and turn boring testing into something exciting.

Practical Testing Templates

In the world of software development, testing is more than finding bugs—it's about creating systems that survive real-world challenges. This section breaks down practical testing templates that transform complex development problems into smart, actionable solutions across various scenarios.

Before moving to JavaScript and NLP templates, let's start with KaneAI’s Web Agent for creating test cases. Here's how to get started:

  1. Sign Up at KaneAI

  2. Access the Web Agent

  3. Create a Web Test

    • Click on "Create a Web Test" to open the Web Agent.

Next, let’s move on to using JavaScript and NLP templates to enhance your test creation.

I. Web Interaction Templates: JavaScript and NLP

1. OrangeHRM Interaction Template

NLP Commands

  1. go to https://opensource-demo.orangehrmlive.com/

  2. type "Admin" in username field

  3. type "admin123" in password field

  4. click on login button

  5. wait for 2 seconds

JavaScript Code

function simulateTyping(element, text) {
    element.value = '';

    for (let i = 0; i < text.length; i++) {
        let char = text[i];
        let keyDownEvent = new KeyboardEvent('keydown', { key: char });
        element.dispatchEvent(keyDownEvent);
        element.value += char;

        let inputEvent = new Event('input', { bubbles: true });
        element.dispatchEvent(inputEvent);

        let keyUpEvent = new KeyboardEvent('keyup', { key: char });
        element.dispatchEvent(keyUpEvent);
    }

    let changeEvent = new Event('change', { bubbles: true });
    element.dispatchEvent(changeEvent);
}

function handleDashboardInteractions() {
    const searchInput = document.querySelector('input.oxd-input.oxd-input--active[placeholder="Search"]');

    if (searchInput) {
        simulateTyping(searchInput, "Test Search Query");

        const quickLaunch = document.querySelectorAll('.orangehrm-quick-launch-card');

        if (quickLaunch.length > 0) {
            const firstCard = quickLaunch[0];
            firstCard.style.backgroundColor = 'red';
            firstCard.click();
        }
    }

    const pathElement = document.querySelector('path.cls-1');

    if (pathElement) {
        pathElement.style.fill = 'red';
    }

    return {
        status: "Dashboard interaction complete",
        timestamp: new Date().toISOString()
    };
}

const result = handleDashboardInteractions();
return result;

Explanation:

  • This template simulates advanced user interactions on web interfaces

  • Demonstrates precise control over typing, event triggering, and element manipulation

  • Uses keyboard and input events to mimic human-like interactions

  • Suitable for automated testing, web scraping, and interaction simulation scenarios

Production Use Cases:

  • Automated web testing frameworks

  • Website interaction monitoring

  • User behavior simulation

  • Accessibility testing tools

  • Performance testing of web applications

2. DemoQA Form Interaction Template

NLP Commands

  1. go to https://demoqa.com/elements

  2. click on "Text Box" option

  3. wait for 2 seconds

JavaScript Code

async function handleDemoQAForms() {
    const formData = {
        fullName: "John Doe",
        email: "john@example.com",
        currentAddress: "123 Test Street",
        permanentAddress: "456 Demo Avenue"
    };

    const inputs = {
        "userName": formData.fullName,
        "userEmail": formData.email,
        "currentAddress": formData.currentAddress,
        "permanentAddress": formData.permanentAddress
    };

    for (const [id, value] of Object.entries(inputs)) {
        const input = document.getElementById(id);
        if (input) {
            input.focus();
            await new Promise(r => setTimeout(r, 300));
            input.value = value;
            input.dispatchEvent(new Event('input', { bubbles: true }));
            input.dispatchEvent(new Event('change', { bubbles: true }));
            await new Promise(r => setTimeout(r, 500));
        }
    }

    return formData;
}

const result = handleDemoQAForms();
return result;

Explanation:

  • Demonstrates asynchronous form filling with controlled timing

  • Simulates realistic user interactions with form fields

  • Uses event dispatching to trigger validation and input mechanisms

Production Use Cases:

  • Form automation testing

  • Data entry validation

  • Browser extension development

  • Automated user registration processes

3. Infinite Scroll Handling Template

NLP Commands

  1. go to https://the-internet.herokuapp.com/infinite-scroll

  2. wait for 2 seconds

  3. scroll to bottom of page

JavaScript Code

async function handleInfiniteScroll() {
    let scrollCount = 0;
    let isScrolling = false;

    const smoothScroll = async () => {
        if (isScrolling) return;
        isScrolling = true;

        const scrollStep = async () => {
            if (scrollCount >= 5) {
                isScrolling = false;
                return;
            }

            window.scrollBy({
                top: 100,
                behavior: 'smooth'
            });

            await new Promise(r => setTimeout(r, 100));

            if (window.innerHeight + window.scrollY >= document.body.offsetHeight - 200) {
                scrollCount++;
                await new Promise(r => setTimeout(r, 1000)); // Wait for new content to load
            }

            if (isScrolling) {
                requestAnimationFrame(scrollStep);
            }
        };

        requestAnimationFrame(scrollStep);
    };

    return smoothScroll();
}


handleInfiniteScroll().then(() => {
    return {
        status: "Infinite scrolling completed",
        timestamp: new Date().toISOString()
    };
});

Explanation:

  • Advanced infinite scroll simulation

  • Implements smooth scrolling with controlled iterations

  • Detects page bottom and manages scroll loading

Production Use Cases:

  • Performance testing of infinite scroll websites

  • Content loading verification

  • Social media feed simulators

  • Web application interaction testing

4. Dashboard Metrics Extraction Template

NLP Commands

  1. go to https://demo.opencart.com/admin/

  2. type "demo" in username field

  3. type "demo" in password field

  4. click on login button

  5. wait for 2 seconds

Note : Occasionally, the platform may encounter issues due to captcha restrictions or unstable Wi-Fi connectivity. Please ensure these are addressed before proceeding.

JavaScript Code

async function analyzeDashboardMetrics() {
    const metrics = {
        totalOrders: 0,
        totalSales: 0,
        customerCount: 0
    };

    const waitForElement = (selector, timeout = 10000) => {
        return new Promise((resolve, reject) => {
            const interval = setInterval(() => {
                const element = document.querySelector(selector);
                if (element) {
                    clearInterval(interval);
                    resolve(element);
                }
            }, 500);

            setTimeout(() => {
                clearInterval(interval);
                reject(new Error(`Timeout: Element ${selector} not found`));
            }, timeout);
        });
    };

    await waitForElement('.tile');

    const tiles = document.querySelectorAll('.tile');
    if (tiles.length > 0) {
        if (tiles[0]) {
            const value = tiles[0].querySelector('.tile-body h2')?.textContent || '0';
            metrics.totalOrders = parseFloat(value.replace(/[^0-9.]/g, '')) * (value.includes('K') ? 1000 : 1);
        }
        if (tiles[1]) {
            const value = tiles[1].querySelector('.tile-body h2')?.textContent || '0';
            metrics.totalSales = parseFloat(value.replace(/[^0-9.]/g, '')) * (value.includes('K') ? 1000 : 1);
        }
        if (tiles[2]) {
            const value = tiles[2].querySelector('.tile-body h2')?.textContent || '0';
            metrics.customerCount = parseFloat(value.replace(/[^0-9.]/g, '')) * (value.includes('K') ? 1000 : 1);
        }
    }

    return metrics;
}


const result = analyzeDashboardMetrics();
return result;

Explanation:

  • Robust dashboard metrics extraction

  • Handles dynamic content loading

  • Converts string-based metrics to numeric values

  • Supports 'K' notation for thousands

Production Use Cases:

  • Business intelligence dashboards

  • Automated reporting systems

  • Performance monitoring tools

  • Data extraction and analysis

II. API Testing Templates

A. JSONPlaceholder CRUD Operations

Base URL: https://jsonplaceholder.typicode.com

  1. Create Post
Method: POST
Endpoint: /posts
Body:
{
    "title": "Test Post",
    "body": "Test Content",
    "userId": 1
}

  1. Get Posts
Method: GET
Endpoint: /posts
Query Parameters:
    userId: 1
    _limit: 5
  1. Update Post
Method: PUT  
Endpoint: /posts/1  
Body:  
{  
    "id": 1,  
    "title": "Updated API Testing Guide",  
    "body": "Enhanced testing strategies for APIs",  
    "userId": 10  
}

  1. Delete Post
Method: DELETE  
Endpoint: /posts/1

B. Fake Store API E-commerce Operations

Base URL: https://fakestoreapi.com

  1. Get Products
Method: GET
Endpoint: /products
Query Parameters:
    limit: 5
    sort: desc

  1. Get Single Product
Method: GET
Endpoint: /products/1
  1. Get Categories
Method: GET
Endpoint: /products/categories

Explanation:

  • Robust dashboard metrics extraction

  • Handles dynamic content loading

  • Converts string-based metrics to numeric values

  • Supports 'K' notation for thousands

Production Use Cases:

  • Business intelligence dashboards

  • Automated reporting systems

  • Performance monitoring tools

  • Data extraction and analysis

Why KaneAI Stands Out

  1. JavaScript Execution

    • Create highly detailed testing scripts and manage complex user flows effortlessly, breaking past traditional limitations.
  2. Geolocation Support

    • Test from any location globally and ensure your app performs consistently, no matter where your users are.
  3. Advanced Scroll Controls

    • Navigate sidebars, hidden content, or infinite lists with natural commands. KaneAI makes dealing with tricky web elements simple.
  4. Seamless Jira Integration

    • Generate test cases directly from Jira tickets, streamlining your workflow and reducing manual effort.
  5. API Testing

    • Get into backend testing with robust API capabilities that go beyond the basics.

KaneAI Command Guide: Your Testing Companion

Testing doesn't have to be complicated. With KaneAI's natural language commands, you can transform complex testing scenarios into simple interactions.

Navigation Commands

  • go to https://example.com

  • open new tab

  • switch to 2nd tab

  • go back

  • refresh page

  • navigate forward

Interaction Commands

  • click on login button

  • hover on profile menu

  • type "username@email.com"

  • clear email field

  • search for "product"

  • press enter

Advanced Interaction Techniques

  • Conditional Actions

    • if pop-up exists, click close

    • if product price < $200, add to cart

    • if error message appears, take screenshot

  • Scroll Commands

    • scroll to bottom

    • scroll by 100px

    • scroll to element

    • scroll 3 times

Smart Assertions

  • assert if button text is "Submit"

  • verify element is present

  • query current URL

  • check page title

Best Practices for Command Writing

  1. Be specific and clear

  2. Break complex tasks into simple steps

  3. Use descriptive language

  4. Leverage variables for dynamic testing

  5. Always validate your test flows

Bonus Resources

Final Takeaway

The future of testing isn't about doing more, it's about doing it smarter. KaneAI turns testing into a streamlined, intelligent process that works with you, not against you.

Testing isn't just easier; it's smarter. KaneAI is leading the way, making automation, intelligence, and efficiency the new normal.

Ready to transform the way you test? Give KaneAI a try and step into the future of automated testing! Have you used AI testing tools before? Share your thoughts or experiences in the comments

Stay Connected 👋

For more blogs, insights, and updates, follow me:

Let’s learn and grow together!

Did you find this article valuable?

Support Muhammad Noorani by becoming a sponsor. Any amount is appreciated!