Generating Tests
Create tests using the E2E Builder or code generation.
Paragon generates tests for you. Describe what you want to test, and Paragon writes the code. There are two ways to generate tests depending on the type.
Test Generation Methods
| Test Type | Method | What It Creates |
|---|---|---|
| E2E Tests | E2E Builder | Step-based browser tests |
| Code Tests | Agent | Unit/integration test files |
| Performance | Inline Config | Performance test with budgets |
E2E Builder (Step-Based Tests)
The E2E Builder creates browser-based tests that run against your deployed application.
Creating an E2E Test
- Go to Testing > Tests
- Click New Test
- Select the repository for this test
- Choose E2E as the test type
- You're redirected to the visual builder
Building Steps
The E2E Builder provides a visual interface to create test flows:
Navigation Steps
| Step | Description | Example |
|---|---|---|
| Navigate | Go to a URL | https://myapp.com/login |
| Refresh | Reload current page | — |
| New Tab | Open URL in new tab | — |
| Switch Tab | Switch between tabs | — |
Interaction Steps
| Step | Description | Example |
|---|---|---|
| Click | Click an element | Button, link, checkbox |
| Type | Enter text in input | Form fields |
| Select | Choose dropdown option | Select menus |
| Hover | Hover over element | Dropdown triggers |
| Scroll | Scroll to element | Lazy-loaded content |
| Drag and Drop | Drag element | Kanban boards |
| File Upload | Upload file | File inputs |
Agentic Steps
Use natural language for complex interactions:
| Step | Description | Example |
|---|---|---|
| Paragon Action | Performs an action | "Fill in the login form with test credentials" |
| Paragon Check | Verifies state | "Verify the user is logged in" |
| Paragon Extract | Extracts data | "Get the order ID from the confirmation" |
Agentic steps are powerful for complex flows. Instead of specifying exact selectors, describe what you want in plain English.
Assertion Steps
| Step | Description | Example |
|---|---|---|
| Wait | Wait for time/element | Wait 2 seconds |
| Wait for URL | Wait for navigation | /dashboard appears in URL |
| Element Check | Verify element state | Button is visible/enabled |
| Page Check | Verify page content | Text appears on page |
Data Steps
| Step | Description | Example |
|---|---|---|
| Set Cookie | Inject cookie | Auth cookies |
| Local Storage | Set localStorage | Feature flags |
| Set Header | Add request header | Auth tokens |
Authentication in E2E Tests
If your tests need to access protected pages, you can record your login flow directly in the E2E builder.
Setting Up Auth
In the E2E builder:
- Click the key icon to start recording authentication
- Log in to your app in the browser
- Paragon captures your auth session
- Save your test - the auth is saved with it
Future test runs will use the captured session to authenticate automatically.
Use a dedicated test account when recording authentication.
Running E2E Tests
E2E tests run against your deployed application (production, staging, or preview URL).
E2E tests cannot run on PR events because there's no deployed app yet. They run:
- Manually: Click run button
- On Schedule: Daily, weekly, custom
- On Push: After merge to production (if base URL is production)
E2E Test Results
After running, view:
- Step-by-step breakdown: Each step with pass/fail and duration
- Screenshots: Captured at each step
- Video recording: Full test playback
- Console logs: Browser console output
- Network requests: API calls made during test
- Accessibility violations: WCAG issues detected
Code Test Generation (Unit & Integration)
Generate unit and integration tests that live in your repository.
Creating Code Tests
- Go to Testing > Tests
- Click New Test and select the repository
- Choose Unit or Integration as the test type
- Switch to the Generate New tab
- You're redirected to the agent — describe what to test in natural language
- Review the generated test code
- Save directly or create a PR with the test
Writing Good Prompts
The better your prompt, the better the generated test.
Unit Test Prompts
Be specific about the function and expected behavior:
Test the calculateDiscount function:
- Returns 0 for orders under $50
- Returns 10% off for orders $50-$100
- Returns 20% off for orders over $100
- Throws error for negative amountsIntegration Test Prompts
Specify the endpoint, inputs, and expected outputs:
Test POST /api/users/register:
- Returns 201 and user object for valid email/password
- Returns 400 for invalid email format
- Returns 409 if email already exists
- Password is not included in responseSupported Frameworks
Paragon generates tests in your preferred framework:
| Language | Frameworks |
|---|---|
| JavaScript/TypeScript | vitest, jest, mocha |
| Python | pytest, unittest |
| Go | go test |
| Rust | cargo test |
| Ruby | rspec, minitest |
| Java | junit, testng |
| C# | xunit, nunit, mstest |
| C++ | gtest, catch2, ctest |
Framework is detected from your project config or can be manually specified.
Code Test Results
After running, view:
- Test output: Standard framework output
- Assertion results: Each assertion with pass/fail
- Coverage (if enabled): Lines covered by test
- Duration: Time to run each test
Performance Tests
Create tests that measure page load performance.
Creating Performance Tests
- Go to Testing > Tests
- Click New Test and select the repository
- Choose Performance as the test type
- Enter the pages to test
- Configure performance thresholds (budgets)
- Set network and CPU throttling conditions
- Run the test
Performance Budgets
Set thresholds for key metrics:
| Metric | Description | Good Target |
|---|---|---|
| LCP | Largest Contentful Paint | < 2.5s |
| FCP | First Contentful Paint | < 1.8s |
| CLS | Cumulative Layout Shift | < 0.1 |
| TTFB | Time to First Byte | < 0.8s |
Test Conditions
Simulate real-world conditions:
Network Throttling:
- 4G (typical mobile)
- Fast 3G
- Slow 3G
- No throttling
CPU Throttling:
- No throttle
- 2x slowdown
- 4x slowdown
- 6x slowdown
Iterations:
- Run 1-10 times for consistent results
Test Organization
Suites
Tests are organized into suites (folders):
Repository: my-app
├── Suite: Authentication
│ ├── Test: Login flow (E2E)
│ ├── Test: Registration (E2E)
│ └── Test: validateEmail (Unit)
├── Suite: API
│ ├── Test: GET /users (Integration)
│ └── Test: POST /orders (Integration)
└── Suite: Performance
└── Test: Homepage load
When creating a test:
- Add to an existing suite
- Create a new suite
Editing Tests
Click any test to:
- Update name or description
- Regenerate code with new prompt
- Move to different suite
- Delete test
Next Steps
Test Runner
Learn how tests run on PRs and pushes