Test Types
Regression Tests
Verify that bug fixes work and don't break existing functionality.
What Are Regression Tests?
Regression tests ensure that previously fixed bugs don't reappear and that new changes don't break existing functionality. OpenQA automatically creates regression tests when bugs are discovered and fixed.
Example Regression Test
test_issue_123_cart_fix.spec.ts
1import { test, expect } from '@playwright/test';2 3/**4 * Regression test for Issue #1235 * Bug: Cart items were lost on page refresh6 * Fixed: 2024-01-157 */8test.describe('Issue #123 - Cart Persistence', () => {9 test('cart items should persist after page refresh', async ({ page }) => {10 // Add item to cart11 await page.goto('/products/1');12 await page.click('[data-testid="add-to-cart"]');13 14 // Verify item is in cart15 await expect(page.locator('.cart-count')).toContainText('1');16 17 // Refresh the page18 await page.reload();19 20 // Cart should still have the item (this was the bug)21 await expect(page.locator('.cart-count')).toContainText('1');22 23 // Go to cart page and verify24 await page.click('[data-testid="cart-icon"]');25 await expect(page.locator('.cart-item')).toHaveCount(1);26 });27 28 test('cart should persist across sessions', async ({ page, context }) => {29 // Add item to cart30 await page.goto('/products/1');31 await page.click('[data-testid="add-to-cart"]');32 33 // Close and reopen browser (new page in same context)34 await page.close();35 const newPage = await context.newPage();36 37 await newPage.goto('/cart');38 await expect(newPage.locator('.cart-item')).toHaveCount(1);39 });40});Automatic Regression Test Creation
When OpenQA discovers a bug, it automatically:
- Creates a GitHub issue with reproduction steps
- Generates a regression test for the bug
- Runs the test after fixes are deployed
- Alerts if the bug reappears
Generate Regression Tests
bash
1curl -X POST http://localhost:3000/api/brain/generate-test \2 -H "Content-Type: application/json" \3 -d '{4 "type": "regression",5 "target": "Cart persistence bug fix verification",6 "issueId": "123"7 }'