Quick Start
Write and run your first tests in under 5 minutes.
Step 1: Initialize Oorty
If you haven't already, run the init command in your project:
npx oorty@latest initStep 2: Add a Unit Test
Create your first unit test using the add command:
npx oorty add unit --name utilsThis creates a test file at tests/unit/utils.test.ts. Open it and you'll see:
1import { describe, it, expect } from 'vitest'23describe('utils', () => {4 it('should pass a basic test', () => {5 expect(true).toBe(true)6 })78 it('should perform addition correctly', () => {9 const add = (a: number, b: number) => a + b10 expect(add(2, 3)).toBe(5)11 })1213 it('should handle edge cases', () => {14 expect([]).toHaveLength(0)15 expect('').toBeFalsy()16 expect(null).toBeNull()17 })18})Step 3: Run Your Tests
Run your unit tests with Vitest:
npm testOr run in watch mode for development:
npm test -- --watchStep 4: Add a Component Test
Create a component test for your React components:
npx oorty add component --name buttonEdit the generated file to test your actual component:
1import { describe, it, expect, vi } from 'vitest'2import { render, screen } from '@testing-library/react'3import userEvent from '@testing-library/user-event'4import { Button } from '@/components/ui/button'56describe('Button', () => {7 it('renders correctly', () => {8 render()9 expect(screen.getByRole('button', { name: /click me/i })).toBeInTheDocument()10 })1112 it('handles click events', async () => {13 const user = userEvent.setup()14 const handleClick = vi.fn()1516 render()17 await user.click(screen.getByRole('button'))1819 expect(handleClick).toHaveBeenCalledTimes(1)20 })2122 it('can be disabled', () => {23 render()24 expect(screen.getByRole('button')).toBeDisabled()25 })26})Step 5: Add an E2E Test
Create an end-to-end test to verify user flows:
npx oorty add e2e --name smokeEdit the generated file to test your application:
1import { test, expect } from '@playwright/test'23test.describe('smoke', () => {4 test('homepage loads successfully', async ({ page }) => {5 await page.goto('/')6 7 // Verify page loaded8 await expect(page).toHaveTitle(/.+/)9 10 // Check for main content11 const main = page.locator('main')12 await expect(main).toBeVisible()13 })1415 test('navigation works correctly', async ({ page }) => {16 await page.goto('/')17 18 // Click a navigation link19 await page.click('nav a[href="/about"]')20 await expect(page).toHaveURL('/about')21 })22})Run your E2E tests:
npx playwright testOr run with the UI for debugging:
npx playwright test --uiStep 6: Verify Your Setup
Run the doctor command to ensure everything is configured correctly:
npx oorty doctorYou should see all checks passing:
Oorty DoctorChecking your test setup... ✓ Configuration file: oorty.json found ✓ Configuration valid: oorty.json is valid ✓ .oorty directory: .oorty/ exists ✓ Vitest config: vitest.config.ts found ✓ Playwright config: playwright.config.ts found ✓ vitest installed ✓ @playwright/test installedAll 7 checks passed. Your setup looks great!Vitest coverage (Free)
After you have tests, run oorty coverage for a Vitest V8 report and per-file summary. No Pro license or AI API key is required.
npx oorty coverage# Optional: full HTML or browser viewer# npx oorty coverage --html# npx oorty coverage --open-htmlPro: AI-Powered Test Generation
With an active Pro subscription, create an API key in the dashboard, then analyze your codebase and generate tests through the Oorty hosted API:
# Create a key at https://oorty.dev/dashboard/keys then:export OORTY_API_KEY="oorty_sk_..."# Generate a test plannpx oorty plan# Generate all tests from the plannpx oorty generateNext Steps
- Learn about the CLI commands in detail
- Configure your oorty.json for custom settings
- Set up CI/CD with GitHub Actions
- Explore framework-specific guides
Next: CLI Commands
Learn about all available Oorty commands.