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

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**
    
    * Go to [https://www.lambdatest.com/kane-ai/](https://www.lambdatest.com/kane-ai/) to sign up.
        
2. **Access the Web Agent**
    
    * After signing up, head over to [kaneai.lambdatest.com](http://kaneai.lambdatest.com) and log in.
        
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/](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

```javascript
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
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732729080757/5e81fd0a-f7d7-4442-bd3e-e2fa47d5d7c5.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732729101304/279bb585-bdae-4e1b-9982-db86ffcc8e34.png align="center")

**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](https://demoqa.com/elements)
    
2. click on "Text Box" option
    
3. wait for 2 seconds
    

#### JavaScript Code

```javascript
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
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732729524188/db24c49d-c4e4-46f7-bdc0-95e5efaa3740.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732729535069/3b90e9d0-0597-40be-9d7b-ccb466b1100b.png align="center")

**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](https://the-internet.herokuapp.com/infinite-scroll)
    
2. wait for 2 seconds
    
3. scroll to bottom of page
    

#### JavaScript Code

```javascript
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
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732729565905/4ca49da7-4dcf-4950-a283-4cb7abcc2d76.png align="center")

**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/](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

```javascript
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](https://jsonplaceholder.typicode.com/)

1. **Create Post**
    

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

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732729706483/638ddca7-e6ed-450e-aa3f-df695854d773.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732729850003/9ee9a5a9-d0ab-4f2c-a39d-60c068307751.png align="left")

2. **Get Posts**
    

```basic
Method: GET
Endpoint: /posts
Query Parameters:
    userId: 1
    _limit: 5
```

3. **Update Post**
    

```basic
Method: PUT  
Endpoint: /posts/1  
Body:  
{  
    "id": 1,  
    "title": "Updated API Testing Guide",  
    "body": "Enhanced testing strategies for APIs",  
    "userId": 10  
}
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732729919661/ab4d868a-7e35-402d-9d6c-274711d5a994.png align="center")

4. **Delete Post**
    

```basic
Method: DELETE  
Endpoint: /posts/1
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732729959706/d1a4ba28-f219-4e94-b536-37c5d455e9a9.png align="center")

### B. Fake Store API E-commerce Operations

**Base URL**: [https://fakestoreapi.com](https://fakestoreapi.com/)

1. **Get Products**
    

```basic
Method: GET
Endpoint: /products
Query Parameters:
    limit: 5
    sort: desc
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732730031547/ea9aedd4-cd9b-4b82-a908-98b4728945be.png align="center")

2. **Get Single Product**
    

```basic
Method: GET
Endpoint: /products/1
```

3. **Get Categories**
    

```basic
Method: GET
Endpoint: /products/categories
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732730040871/fa4be866-1c63-4fde-baa5-dffa714a8328.png align="center")

**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

* **Video \[Creator : Muhammad Noorani\]**: [KaneAI: LambdaTest's Answer to Next-Gen Software Testing](https://youtu.be/SXKAltx7SX8)
    
* **Article \[Author : Muhammad Noorani\]**: [Future-Proof Your Web Testing: KaneAI's 5-Phase Roadmap (+ Bonus Analytics Dashboard)](https://blog.muhammadnoorani.com/future-proof-your-web-testing-kaneais-5-phase-roadmap-bonus-analytics-dashboard)
    
* **Additional Resource**: [KaneAI Official DOCS](https://www.lambdatest.com/support/docs/getting-started-with-kane-ai/)
    

## 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:

* [All My Links](https://linktr.ee/muhammadnoorani)
    
* [My Blog](https://blog.muhammadnoorani.com/)
    

Let’s learn and grow together!
