Introduction to AI-Powered Test Automation
Traditional test automation faces a persistent challenge: test maintenance. As applications evolve, element locators break, causing flaky tests and requiring constant manual updates. AI-powered platforms like Testim and Mabl address this with self-healing capabilities that automatically adapt to application changes, leveraging AI-powered test generation techniques to reduce maintenance overhead.
These platforms use machine learning to create intelligent element locators that don’t break when minor UI changes occur. They analyze element properties, position, context, and relationships to identify elements reliably, significantly reducing maintenance overhead.
The Self-Healing Revolution
Key Benefits:
- Reduced Maintenance: Tests automatically adapt to UI changes
- Fewer False Failures: Intelligent element location reduces flakiness
- Faster Test Creation: Record tests quickly with codeless interfaces
- AI-Powered Insights: Automatic failure analysis and root cause detection
- Cross-Browser Stability: Self-healing works across different browsers
- Continuous Learning: Algorithms improve with more test executions
Platform Comparison
Feature | Testim | Mabl |
---|---|---|
Type | Cloud SaaS | Cloud SaaS |
Pricing | Trial + Paid | Trial + Paid |
Self-Healing | Advanced AI | Advanced ML |
Test Creation | Record, Code, Hybrid | Primarily Record |
Browser Support | Chrome, Firefox, Edge, Safari | Chrome, Firefox, Edge |
Mobile Testing | Yes (via Sauce Labs/BrowserStack) | Limited |
CI/CD Integration | Excellent | Excellent |
API Testing | Basic | Advanced |
Programming | JavaScript/TypeScript | JavaScript (limited) |
Grid | Built-in + 3rd party | Built-in |
Visual Testing | Yes | Yes |
Testim: AI-Powered Functional Testing
Overview
Testim by Tricentis is an AI-powered test automation platform that combines the speed of codeless testing with the flexibility of code. Its ML-based element locators continuously learn and adapt, making tests resilient to application changes.
Getting Started
// Installation
npm install -g @testim/testim-cli
// Initialize Testim project
testim-cli init
// Login
testim-cli login
// Run tests
testim-cli run --project "My Project" --grid "Testim Grid"
Test Creation Approaches
1. Record and Playback
Testim’s recorder captures user interactions and automatically generates stable locators:
Recording Process:
- Install Testim Chrome Extension
- Click “Record new test”
- Navigate and interact with your application
- Testim records steps with AI-generated locators
- Add validations and assertions
- Save and run
Example Recorded Test:
Test: User Login Flow
├── Navigate to https://example.com/login
├── Type "test@example.com" into Email field (AI locator)
├── Type "password123" into Password field (AI locator)
├── Click "Login" button (AI locator)
├── Verify text "Welcome, Test User" is visible
└── Verify URL contains "/dashboard"
2. Custom JavaScript Steps
Add custom logic with JavaScript:
// Custom step: Generate random email
const email = `test_${Date.now()}@example.com`;
exportsTest.email = email;
// Store in test variable
return email;
// Custom step: API call to create test data
const response = await fetch('https://api.example.com/users', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
name: 'Test User',
email: exportsTest.email,
}),
});
const user = await response.json();
exportsTest.userId = user.id;
// Custom step: Complex validation
const productCards = document.querySelectorAll('.product-card');
const prices = Array.from(productCards).map((card) => {
const priceText = card.querySelector('.price').textContent;
return parseFloat(priceText.replace('$', ''));
});
// Verify all prices are within expected range
const allPricesValid = prices.every((price) => price >= 10 && price <= 1000);
if (!allPricesValid) {
throw new Error('Some product prices are out of expected range');
}
3. Testim CLI for Programmatic Testing
// testim.config.js
module.exports = {
projectId: 'your-project-id',
token: process.env.TESTIM_TOKEN,
grid: 'Testim Grid',
branch: 'master',
suite: 'Regression Suite',
parallel: 3,
tunnelId: 'my-tunnel',
baseUrl: 'https://staging.example.com',
testConfigId: 'chrome-headless',
};
# Run specific suite
testim-cli run --suite "Smoke Tests" --parallel 5
# Run with custom parameters
testim-cli run --params "env=staging,user=admin"
# Run tests matching label
testim-cli run --label "critical"
# Generate JUnit XML report
testim-cli run --report-file results.xml
AI-Powered Self-Healing
How Testim Self-Healing Works:
Multi-Attribute Locators: Testim creates locators using multiple attributes:
- ID, class, name, data attributes
- Text content
- Position in DOM
- Visual properties (size, color)
- Surrounding element context
Dynamic Adaptation: When primary locator fails:
- Testim tries alternative locators
- Uses AI to find element based on learned patterns
- Analyzes element relationships
- Automatically updates locator for future runs
Confidence Scoring: Each element match gets confidence score
- High confidence: Test continues normally
- Medium confidence: Warning logged, test continues
- Low confidence: Test fails with detailed explanation
Example Self-Healing Scenario:
Original Locator: button[data-testid="submit-btn"]
After Developer Changes data-testid to data-test="submit":
Testim's AI:
✓ Detects primary locator failed
✓ Analyzes button text: "Submit"
✓ Checks position: Bottom right of form
✓ Verifies visual properties: Blue background
✓ Finds element with 98% confidence
✓ Updates locator automatically
✓ Test passes without manual intervention
Advanced Testim Features
Shared Steps (Reusable Functions)
// Shared Step: Login
// Parameters: email, password
// Returns: userId
const emailInput = await findElement({ type: 'text', label: 'Email' });
await emailInput.type(email);
const passwordInput = await findElement({ type: 'password', label: 'Password' });
await passwordInput.type(password);
const loginButton = await findElement({ type: 'button', text: 'Login' });
await loginButton.click();
// Wait for dashboard and extract user ID
await waitForUrl('/dashboard');
const userId = await evaluate(() => {
return window.currentUser.id;
});
return userId;
Data-Driven Testing
// Test with CSV data
// File: users.csv
// Columns: email, password, expectedName
// Test step uses data from CSV
// Run test for each row automatically
// Access data via: {{email}}, {{password}}, {{expectedName}}
Conditional Logic
// If element exists, click it
const cookieBanner = await findElement({ selector: '.cookie-banner' }, {
timeout: 2000,
softFail: true
});
if (cookieBanner) {
await cookieBanner.click();
console.log('Cookie banner dismissed');
}
// If/Else based on element state
const cartCount = await getText('.cart-count');
if (parseInt(cartCount) > 0) {
// Cart has items
await click('Checkout');
} else {
// Cart empty
await click('Continue Shopping');
}
Test Configuration Grids
// Multiple browser/device configurations
const configs = [
{ browser: 'Chrome', resolution: '1920x1080' },
{ browser: 'Firefox', resolution: '1920x1080' },
{ browser: 'Edge', resolution: '1366x768' },
{ browser: 'Safari', resolution: '1440x900' },
{ device: 'iPhone 12', orientation: 'portrait' },
{ device: 'iPad Pro', orientation: 'landscape' },
];
// Run test across all configurations in parallel
CI/CD Integration
# .github/workflows/testim.yml
name: Testim E2E Tests
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
schedule:
- cron: '0 */6 * * *' # Every 6 hours
jobs:
testim:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install Testim CLI
run: npm install -g @testim/testim-cli
- name: Run Testim Tests
env:
TESTIM_TOKEN: ${{ secrets.TESTIM_TOKEN }}
run: |
testim-cli run \
--project "E-Commerce App" \
--suite "Regression Suite" \
--grid "Testim Grid" \
--parallel 5 \
--report-file testim-results.xml
- name: Publish Test Results
if: always()
uses: mikepenz/action-junit-report@v3
with:
report_paths: 'testim-results.xml'
check_name: 'Testim Test Results'
Mabl: Intelligent Test Automation
Overview
Mabl is an intelligent test automation platform built on machine learning. It emphasizes low-code test creation, automatic healing, and integrated quality insights. Mabl’s unique strength is its comprehensive approach to test stability and application monitoring.
Getting Started
# Install mabl CLI
npm install -g @mablhq/mabl-cli
# Configure mabl
mabl config set apiKey YOUR_API_KEY
mabl config set workspaceId YOUR_WORKSPACE_ID
# Run tests locally
mabl tests run --environment staging
Test Creation with Mabl Trainer
Mabl Trainer is a Chrome extension for creating tests:
- Install Mabl Trainer Chrome Extension
- Select Application and Environment
- Start Recording interactions
- Add Assertions for validations
- Create Data Tables for data-driven tests
- Save and Execute
Mabl Auto-Healing in Action:
Test: Product Search
├── Navigate to homepage
├── Type "laptop" in search box
│ └── Mabl learns multiple locators:
│ - input[name="search"]
│ - input[placeholder="Search products"]
│ - form.search-form > input
│ - Visual context: top-right header
├── Click search button
│ └── Mabl identifies via:
│ - Button text: "Search"
│ - Icon SVG path
│ - Position relative to search input
└── Verify results container visible
└── Multiple identifiers stored
Advanced Mabl Capabilities
JavaScript Steps
// Custom JS step: Extract and validate data
const productCards = document.querySelectorAll('.product-card');
const products = Array.from(productCards).map(card => ({
title: card.querySelector('.title').textContent,
price: parseFloat(card.querySelector('.price').textContent.replace('$', '')),
inStock: !card.classList.contains('out-of-stock')
}));
// Validate
const inStockCount = products.filter(p => p.inStock).length;
if (inStockCount < 5) {
throw new Error(`Only ${inStockCount} products in stock`);
}
// Store for later use
return { products, inStockCount };
// API call in test
const response = await fetch('https://api.example.com/inventory', {
headers: {
'Authorization': `Bearer ${mabl.env.API_TOKEN}`
}
});
const inventory = await response.json();
// Compare API data with UI
const uiPrices = document.querySelectorAll('.price');
const apiPrices = inventory.items.map(item => item.price);
// Validation logic
DataTables for Data-Driven Testing
# products.csv in Mabl
username,password,expectedProduct
user1@test.com,pass123,Laptop
user2@test.com,pass456,Monitor
user3@test.com,pass789,Keyboard
Test uses DataTable:
- Mabl runs test for each row
- Access via:
{{username}}
,{{password}}
,{{expectedProduct}}
- Parallel execution across rows
- Individual results for each iteration
Mabl Flows (Reusable Sequences)
Flow: Login
├── Navigate to /login
├── Enter {{email}}
├── Enter {{password}}
├── Click "Sign In"
└── Wait for dashboard
Test: Checkout Process
├── Call Flow: Login (email: test@example.com)
├── Search for product
├── Add to cart
├── Proceed to checkout
└── Verify order confirmation
Auto-Healing Intelligence
Mabl’s ML Auto-Healing:
- Visual AI: Learns visual appearance of elements
- Contextual Understanding: Understands element relationships
- Text and Label Analysis: Identifies elements by surrounding text
- Position Intelligence: Remembers relative positions
- Historical Learning: Improves with every execution
Auto-Healing Example:
Original: Find button by ID "btn-submit-order"
After Code Change (ID removed):
Mabl's ML Analysis:
✓ Button text: "Place Order"
✓ Visual appearance: Green, rounded corners
✓ Position: Bottom right of checkout form
✓ Parent: form.checkout-form
✓ Sibling: "Cancel" button to the left
✓ Confidence: 97%
✓ Element found and test passes
✓ Locator auto-updated for next run
Intelligent Insights
Mabl provides AI-powered insights:
- Failure Analysis: Automatic root cause detection
- Pattern Recognition: Identifies recurring issues
- Performance Trends: Tracks application performance
- Coverage Maps: Visualizes test coverage
- Risk Assessment: Highlights high-risk areas
Mabl API Testing
// API Test in Mabl
// Step 1: POST Create User
POST https://api.example.com/users
Headers:
Content-Type: application/json
Authorization: Bearer {{API_TOKEN}}
Body:
{
"email": "{{email}}",
"name": "{{name}}",
"role": "customer"
}
// Assertions
- Status code is 201
- Response time < 2000ms
- JSON path "id" exists
- JSON path "email" equals "{{email}}"
// Extract and save
Extract JSON path "id" as {{userId}}
// Step 2: GET User Details
GET https://api.example.com/users/{{userId}}
Headers:
Authorization: Bearer {{API_TOKEN}}
// Assertions
- Status code is 200
- JSON path "name" equals "{{name}}"
- JSON path "verified" is false
CI/CD Integration
# .github/workflows/mabl.yml
name: Mabl Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
deployment:
types: [completed]
jobs:
mabl-tests:
runs-on: ubuntu-latest
steps:
- name: Run Mabl Tests
uses: mablhq/github-run-tests-action@v1
with:
application-id: ${{ secrets.MABL_APP_ID }}
environment-id: ${{ secrets.MABL_ENV_ID }}
api-key: ${{ secrets.MABL_API_KEY }}
browser-types: 'chrome,firefox'
continue-on-failure: false
- name: Get Test Results
if: always()
run: |
curl -H "Authorization: Token ${{ secrets.MABL_API_KEY }}" \
https://api.mabl.com/executions/${{ steps.mabl.outputs.execution_id }}
Comparing Testim vs Mabl
Test Creation Experience
Testim:
- More flexible: Record, code, or hybrid
- Better for developers with JavaScript skills
- Custom steps with full coding capability
- Faster for complex logic
Mabl:
- Simpler, more low-code focused
- Better for QA without coding background
- Guided test creation workflow
- Easier to onboard non-technical testers
Self-Healing Capabilities
Testim:
- AI locators with multiple fallback strategies
- JavaScript-accessible element finding
- Manual locator refinement possible
- Confidence scores visible
Mabl:
- Visual AI + ML combination
- Stronger visual element recognition
- More automated healing process
- Less manual intervention required
Integration and Ecosystem
Testim:
- Integrates with Sauce Labs, BrowserStack
- Works with any CI/CD
- Better mobile testing (via 3rd party)
- More customizable execution
Mabl:
- Built-in grid (no 3rd party needed)
- Unified insights dashboard
- Better API testing capabilities
- Integrated performance monitoring
Pricing Model
Testim:
- Per user licensing
- Includes unlimited test runs
- Better for small teams with high test volume
Mabl:
- Based on test runs
- Better for large teams with moderate testing
- Includes insights and monitoring
When to Choose Each Platform
Choose Testim If:
- Your team has JavaScript developers
- You need maximum test flexibility
- Mobile testing is important
- You prefer hybrid code/codeless approach
- You want unlimited test executions
Choose Mabl If:
- Your QA team is less technical
- You want simplest onboarding
- Visual AI healing is priority
- You need integrated insights
- API testing is equally important as UI
Best Practices for AI-Powered Testing
1. Trust But Verify Self-Healing
// Monitor healing events
// Review healed locators regularly
// Approve or reject healing suggestions
// Update locators when patterns change significantly
2. Provide Stable Test Data
// Use data-testid for critical elements
<button data-testid="checkout-button">Checkout</button>
// This helps AI establish primary locator
// Falls back to AI when data-testid changes
3. Organize Tests Logically
Tests/
├── Critical User Journeys/
│ ├── Login and Signup
│ ├── Purchase Flow
│ └── Account Management
├── Feature Tests/
│ ├── Search
│ ├── Filtering
│ └── Sorting
└── Integration Tests/
├── Payment Gateway
└── Third-party Services
4. Leverage Reusable Components
// Create flows/shared steps for common actions
// Login, navigation, data setup
// Reduce maintenance surface area
// Update once, affect all tests
5. Monitor AI Confidence Scores
// Set confidence thresholds
// Alert on low-confidence matches
// Review and train AI on failures
// Continuously improve locator strategies
6. Combine with Other Testing Types
Integrate AI-powered testing into a comprehensive strategy:
Testing Strategy:
├── Unit Tests (Jest/JUnit)
├── Integration Tests (API)
├── E2E Tests (Testim/Mabl) ← AI-powered
├── Visual Tests (Percy/Applitools) - See our [visual testing guide](/blog/percy-applitools-backstopjs-visual-regression)
└── Performance (k6/JMeter) - Learn more in our [performance testing guide](/blog/performance-testing-comprehensive-guide)
CI/CD Best Practices
Parallel Execution
# Run tests in parallel for speed
testim-cli run --parallel 10 # Testim
mabl tests run --max-parallel 8 # Mabl
Smart Test Selection
# Run only affected tests on PR
# Run full suite nightly
# Run smoke tests on every commit
on:
pull_request:
run: smoke-tests
push:
branches: [main]
run: regression-suite
schedule:
- cron: '0 2 * * *'
run: full-suite
Failure Handling
# Continue on failure to collect all results
# But mark build as failed
# Generate detailed reports
continue-on-error: true
finally:
upload-artifacts: test-results
notify: slack-channel
Conclusion
Testim and Mabl represent the future of test automation with AI-powered self-healing, dramatically reducing maintenance overhead and false failures. Both platforms excel at making tests resilient to change while providing excellent developer and QA experiences. For teams looking to complement these tools, consider Katalon Studio for an all-in-one solution or Playwright for code-first automation.
Key Takeaways:
- Self-healing reduces maintenance by 60-80%
- AI locators are more stable than traditional XPath/CSS
- Both platforms offer excellent CI/CD integration
- Choice depends on team technical skills and testing needs
Next Steps
- Sign up for free trials of both platforms
- Create proof-of-concept tests for critical user journeys
- Measure maintenance reduction over 30 days
- Evaluate AI healing accuracy and confidence
- Make informed decision based on team needs
The investment in AI-powered testing pays dividends through reduced maintenance, faster test creation, and more reliable test suites that adapt to your evolving application.