Command Palette

Search for a command to run...

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:

Terminal
npx oorty@latest init

Step 2: Add a Unit Test

Create your first unit test using the add command:

Terminal
npx oorty add unit --name utils

This creates a test file at tests/unit/utils.test.ts. Open it and you'll see:

tests/unit/utils.test.ts
1import { describe, it, expect } from 'vitest'
2
3describe('utils', () => {
4 it('should pass a basic test', () => {
5 expect(true).toBe(true)
6 })
7
8 it('should perform addition correctly', () => {
9 const add = (a: number, b: number) => a + b
10 expect(add(2, 3)).toBe(5)
11 })
12
13 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:

Terminal
npm test

Or run in watch mode for development:

Terminal
npm test -- --watch

Step 4: Add a Component Test

Create a component test for your React components:

Terminal
npx oorty add component --name button

Edit the generated file to test your actual component:

tests/component/button.test.tsx
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'
5
6describe('Button', () => {
7 it('renders correctly', () => {
8 render()
9 expect(screen.getByRole('button', { name: /click me/i })).toBeInTheDocument()
10 })
11
12 it('handles click events', async () => {
13 const user = userEvent.setup()
14 const handleClick = vi.fn()
15
16 render()
17 await user.click(screen.getByRole('button'))
18
19 expect(handleClick).toHaveBeenCalledTimes(1)
20 })
21
22 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:

Terminal
npx oorty add e2e --name smoke

Edit the generated file to test your application:

tests/e2e/smoke.spec.ts
1import { test, expect } from '@playwright/test'
2
3test.describe('smoke', () => {
4 test('homepage loads successfully', async ({ page }) => {
5 await page.goto('/')
6
7 // Verify page loaded
8 await expect(page).toHaveTitle(/.+/)
9
10 // Check for main content
11 const main = page.locator('main')
12 await expect(main).toBeVisible()
13 })
14
15 test('navigation works correctly', async ({ page }) => {
16 await page.goto('/')
17
18 // Click a navigation link
19 await page.click('nav a[href="/about"]')
20 await expect(page).toHaveURL('/about')
21 })
22})

Run your E2E tests:

Terminal
npx playwright test

Or run with the UI for debugging:

Terminal
npx playwright test --ui

Step 6: Verify Your Setup

Run the doctor command to ensure everything is configured correctly:

Terminal
npx oorty doctor

You should see all checks passing:

Terminal
Oorty Doctor
Checking 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 installed
All 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.

Terminal
npx oorty coverage
# Optional: full HTML or browser viewer
# npx oorty coverage --html
# npx oorty coverage --open-html

Pro: 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:

Terminal
# Create a key at https://oorty.dev/dashboard/keys then:
export OORTY_API_KEY="oorty_sk_..."
# Generate a test plan
npx oorty plan
# Generate all tests from the plan
npx oorty generate

Learn more about the plan and generate commands.

Next Steps

Next: CLI Commands

Learn about all available Oorty commands.

CLI Reference