Skip to content
Go back

Introducing MetronForge - Modern Test Automation Framework

Why MetronForge?

Test automation has come a long way, but many frameworks still struggle with maintainability, flakiness, and scalability. MetronForge is our answer to these challenges - a modern approach to building test frameworks that are:

Table of contents

Open Table of contents

The Problem

Traditional test automation often looks like this:

// Tightly coupled to UI
test('user login', async () => {
  await page.goto('/login');
  await page.fill('#username', 'test@example.com');
  await page.fill('#password', 'password123');
  await page.click('button[type="submit"]');
  await expect(page.locator('.welcome-message')).toBeVisible();
});

Issues:

The MetronForge Approach

1. Backend-for-Frontend (BFF) Pattern

Create a test-specific backend layer that abstracts complexity:

// BFF for authentication
class AuthBFF {
  async login(credentials: Credentials): Promise<Session> {
    // Can use UI, API, or both
    return this.adapter.login(credentials);
  }
  
  async ensureAuthenticated(user: User): Promise<void> {
    // Intelligent: checks state, uses fastest path
    if (await this.isAuthenticated(user)) return;
    await this.login(user.credentials);
  }
}

// Test becomes domain-focused
test('user dashboard access', async () => {
  const session = await authBFF.ensureAuthenticated(testUser);
  const dashboard = await dashboardBFF.load(session);
  
  expect(dashboard.widgets).toContain('revenue-chart');
});

2. Adapter Pattern for Flexibility

Switch between UI and API seamlessly:

interface AuthAdapter {
  login(creds: Credentials): Promise<Session>;
}

class UIAuthAdapter implements AuthAdapter {
  async login(creds: Credentials) {
    await page.goto('/login');
    await loginPage.submit(creds);
    return extractSession();
  }
}

class APIAuthAdapter implements AuthAdapter {
  async login(creds: Credentials) {
    const response = await fetch('/api/auth/login', {
      method: 'POST',
      body: JSON.stringify(creds)
    });
    return response.json();
  }
}

// Configure which adapter to use
const authBFF = new AuthBFF(
  config.useUI ? new UIAuthAdapter() : new APIAuthAdapter()
);

3. Domain-Facing Flows

Tests read like business requirements:

test('purchase premium subscription', async () => {
  const user = await userBFF.createFreeUser();
  await authBFF.authenticate(user);
  
  const subscription = await billingBFF.upgradeToPremium({
    plan: 'pro-monthly',
    paymentMethod: testCard
  });
  
  expect(subscription.status).toBe('active');
  expect(subscription.features).toInclude('advanced-analytics');
});

Built-in Intelligence

Metrics & Flaky Detection

MetronForge automatically tracks:

{
  testId: 'checkout-flow',
  executions: 100,
  failures: 3,
  flakyScore: 0.03, // 3% failure rate
  avgDuration: 2.5s,
  slowestStep: 'payment-processing',
  failurePatterns: [
    { step: 'payment-processing', rate: 0.02 },
    { step: 'inventory-check', rate: 0.01 }
  ]
}

Automatic Retry Logic

// Smart retries based on failure patterns
await metronforge.run('flaky-test', {
  retries: 3,
  retryIf: (error) => error.isTransient,
  backoff: 'exponential'
});

Technology Stack

MetronForge works with:

Reports Pipeline

Comprehensive reporting out of the box:

Getting Started

npm install @metronforge/core @metronforge/playwright

# Initialize config
npx metronforge init

Example test:

import { test } from '@metronforge/core';
import { userBFF, authBFF } from './bff';

test.describe('User Onboarding', () => {
  test('new user completes signup flow', async ({ context }) => {
    const user = await userBFF.createPendingUser();
    await authBFF.completeSignup(user);
    
    const profile = await userBFF.getProfile(user.id);
    expect(profile.status).toBe('active');
  });
});

Open Source Roadmap

MetronForge will be released as open source. Planned features:

Join the Journey

We’re building MetronForge in the open. Follow along:

Conclusion

Test automation doesn’t have to be painful. With the right architecture patterns - BFF, Adapters, and domain-driven design - we can build test suites that are:

That’s the vision behind MetronForge. We hope you’ll join us.


Have questions or ideas? Reach out: contact@metronforge.dev


Share this post on:

Next Post
Adding new posts in AstroPaper theme