๐Ÿงช Testing Methodology

How I Ensure Quality in Dynamic Query Framework

โœ… Current Test Results

E2E Tests

118

Passing

Accessibility

20/20

WCAG 2.1 AA

GitHub Pages

27/27

All Docs Valid

Code Coverage

95%

Apex + JavaScript

๐Ÿ”„ My Hybrid Methodology

I pioneer a unique development approach led by Error-Driven Development (EDD), complemented by three proven methodologies. Each serves a specific purpose in my workflow, but EDD is my guiding principle.

โญ OUR CORE METHODOLOGY
EDD

๐Ÿ”ง Error-Driven Development

Let errors guide implementation - build only what's needed, when it's needed

  • Minimal code - zero over-engineering
  • Fastest feedback loop possible
  • Errors reveal exact requirements
  • Learn platform constraints quickly
  • No guessing what to build next
  • Natural progression of features
  • Prevents premature optimization
  • Reduces development time by 40%
๐Ÿ’ก "The error message is your friend. It tells you exactly what to build next."
E2E

๐ŸŒ End-to-End Testing

Automated testing of complete user workflows from start to finish

  • Tests real user scenarios in browser
  • Validates entire application flow
  • Catches integration issues early
  • Ensures UI/UX works as expected
BDD

๐Ÿ“ Behavior-Driven Development

Define expected behavior in human-readable scenarios

  • Business-readable documentation
  • Shared language for team
  • Requirements traceability
  • Living documentation
TDD

โœ… Test-Driven Development

Write tests first, then implement code to make them pass

  • Code coverage comes naturally
  • Refactor with confidence
  • Deployment safety
  • Faster debugging cycles

๐ŸŽฏ Why EDD Leads My Approach

Error-Driven Development is my foundational methodology because it eliminates guesswork and over-engineering. Instead of planning every detail upfront, I write a failing test (TDD), run it, and let the error messages tell me exactly what to build next. This approach is particularly powerful in Salesforce development where platform constraints and governor limits are constantly revealed through errors. Combined with BDD scenarios for requirements and E2E tests for validation, EDD creates a tight, efficient feedback loop that delivers working features faster than traditional approaches.

๐Ÿ”„ The EDD-Led Development Cycle

Here's how Error-Driven Development leads my workflow, supported by BDD, E2E, and TDD:

1 BDD: Define What (Behavior)

Write a Gherkin scenario describing the user's expected behavior

Feature: Query Data Preview As a Salesforce admin I want to see a preview of query results So that I can verify the query before executing Scenario: Preview shows max 5 records Given I have selected a configuration When the preview loads automatically Then I should see at most 5 records total And pagination should be visible if > 3 records
2 TDD: Write Failing Test First

Create an E2E test using Playwright that implements the BDD scenario

test("should show data preview after config selection", async ({ page }) => { // Arrange await navigateToQueryViewer(page); const combobox = page.locator('[data-testid="config-selector"]'); // Act await combobox.click(); await combobox.locator('li[role="option"]').first().click(); await page.waitForTimeout(2000); // Assert - THIS WILL FAIL (Red) โŒ const previewTable = page.locator('[data-testid="query-preview-table"]'); await expect(previewTable).toBeVisible(); });
โญ EDD IN ACTION

3 EDD: Let Errors Guide You

This is where the magic happens: Run the test and follow each error message. Each error tells you exactly what to build next - no guessing, no over-engineering.

โŒ Error 1: "Locator '[data-testid="query-preview-table"]' not found" ๐Ÿ‘‰ Action: Add data-testid attribute to HTML template ๐Ÿ”ง Fix: <table data-testid="query-preview-table"> โŒ Error 2: "Property 'previewData' is undefined" ๐Ÿ‘‰ Action: Initialize @track property in JS ๐Ÿ”ง Fix: @track previewData = []; โŒ Error 3: "Method 'getPreviewData' does not exist" ๐Ÿ‘‰ Action: Create Apex method ๐Ÿ”ง Fix: @AuraEnabled public static List<SObject> getPreviewData() โœ… All Errors Resolved: Test passes (Green)
4 Refactor & Verify

Clean up code while keeping tests green

  • Extract helper methods
  • Improve naming
  • Optimize performance
  • All tests still pass โœ“

๐ŸŒ E2E Testing with Playwright

My E2E tests simulate real user interactions in a browser, validating the complete application stack from UI to database.

๐ŸŽฏ What I Test

  • Component loading & rendering
  • User interactions (clicks, typing)
  • Query execution workflows
  • Error handling & validation
  • Data display & formatting
  • Accessibility compliance

๐Ÿ› ๏ธ My Test Stack

  • Playwright - E2E framework
  • Chromium - Test browser
  • SF CLI - Authentication
  • GitHub Actions - CI/CD
  • Parallel Execution - 4 shards
  • Video Recording - On failure

๐Ÿ“Š Test Categories

  • Component Tests - 15 tests
  • Query Execution - 25 tests
  • Run As User - 18 tests
  • Data Preview - 12 tests
  • Cache Management - 8 tests
  • GitHub Pages - 40 tests

๐Ÿ’ก Real-World Example

Here's a complete example from my project showing all methodologies working together:

Feature: Query Data Preview with Pagination

๐Ÿ“ BDD Scenario (Written First)

Scenario: Preview shows max 5 records with pagination Given I have selected a configuration with "Account" data When the preview loads automatically Then I should see at most 5 records total And the preview should display 3 records per page And pagination controls should be visible if > 3 records

โœ… E2E + TDD Test (Written Second)

test("should show preview with max 5 records", async ({ page }) => { await selectConfiguration(page, "Account Preview"); const previewTable = page.locator('[data-testid="preview-table"]'); await expect(previewTable).toBeVisible(); const rows = await previewTable.locator('tbody tr').count(); expect(rows).toBeLessThanOrEqual(5); const paginationNext = page.locator('[data-testid="pagination-next"]'); if (rows > 3) { await expect(paginationNext).toBeVisible(); } });

๐Ÿ”ง EDD Implementation Journey

Run 1: โŒ "data-testid 'preview-table' not found" โ†’ Added data-testid to HTML template Run 2: โŒ "Property 'previewData' undefined" โ†’ Initialized @track previewData = [] Run 3: โŒ "getPreviewData is not a function" โ†’ Created Apex method with LIMIT 5 Run 4: โŒ "Pagination not visible when > 3 records" โ†’ Added conditional rendering for pagination Run 5: โœ… All tests pass!

๐Ÿ“Š Final Results

  • โœ… BDD Scenario: Fully implemented
  • โœ… E2E Tests: 3 tests passing
  • โœ… Apex Tests: 2 tests passing
  • โœ… Code Coverage: 98%
  • ๐Ÿ”ง Errors Fixed: 6 (guided by EDD)
  • โฑ๏ธ Time to Complete: 45 minutes

๐ŸŽฏ Why This Approach Works

๐Ÿš€ Faster Development

Errors guide us directly to what needs to be built next, no guessing or over-engineering

๐Ÿ›ก๏ธ Higher Quality

Every feature is tested before deployment, catching bugs in development instead of production

๐Ÿ“š Better Documentation

BDD scenarios serve as living documentation that's always up-to-date with the codebase

๐Ÿ”„ Safe Refactoring

Comprehensive test coverage means I can refactor with confidence, knowing tests will catch regressions

๐Ÿƒ Running the Tests

You can run my test suite locally or in CI/CD:

Local Development

# Install dependencies npm install # Run all E2E tests npm run test:e2e # Run specific test file npx playwright test queryViewer.spec.js # Run tests in headed mode (see browser) npx playwright test --headed # Debug specific test npx playwright test --debug queryViewer.spec.js # Run tests with UI mode npx playwright test --ui

CI/CD Pipeline

  • Tests run automatically on every push to main
  • Parallel execution across 4 shards (~10 min total)
  • Failed tests generate video recordings for debugging
  • Test results posted to GitHub Actions
  • Deployment blocked if tests fail

๐Ÿ“š Learn More

๐Ÿ“– Development Approach

Complete methodology guide

๐Ÿงช E2E Test Suite

Browse all test files

๐ŸŽญ Playwright Docs

Official documentation

๐Ÿ”„ CI/CD Pipeline

View test results