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:
- Maintainable - Clean separation of concerns through adapters
- Scalable - BFF (Backend-for-Frontend) architecture for complex flows
- Intelligent - Built-in metrics and flaky test analysis
- Domain-driven - Tests that speak your business language
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:
- Brittle - Breaks when UI changes
- Not reusable - Can’t test same flow via API
- Hard to maintain - Locators scattered everywhere
- Slow - Always goes through UI
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:
- Playwright - Primary driver
- WebDriver - Legacy support
- TypeScript - Type-safe tests
- Any test runner - Jest, Vitest, Mocha
Reports Pipeline
Comprehensive reporting out of the box:
- HTML reports with screenshots
- JSON artifacts for CI/CD
- Flaky test dashboard
- Performance metrics
- Failure categorization
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:
- 🟢 Q1 2025: Core framework & Playwright adapter
- 🟡 Q2 2025: Metrics dashboard & flaky analysis
- 🟡 Q3 2025: WebDriver adapter & CI/CD integrations
- ⚪ Q4 2025: Visual testing integration
Join the Journey
We’re building MetronForge in the open. Follow along:
- GitHub: github.com/metronforge
- Discussions: Share ideas and feedback
- Documentation: Coming soon at docs.metronforge.dev
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:
- Fast and reliable
- Easy to maintain
- Pleasant to work with
- Actually valuable to the team
That’s the vision behind MetronForge. We hope you’ll join us.
Have questions or ideas? Reach out: contact@metronforge.dev