Writing Tests¶
Vectra QA supports multiple ways to define and run tests, from natural language chat to structured API calls.
Method 1: Natural Language (Recommended)¶
The easiest way to run tests is through the chatbot.
Basic Test Request¶
Vectra Chat:
Result: Vectra plans and executes a homepage test automatically.
Multi-Test Request¶
Result: Vectra plans two tests: 1. Navigation test 2. Contact form test
Complex Request¶
Result: Vectra plans: 1. Accessibility test 2. Responsive design test
Follow-Up Questions¶
After tests complete, ask for clarification:
Method 2: Dashboard Form¶
For precise control, use the Launch Test form:
- Open Dashboard:
http://localhost:3000 - Enter URL:
https://example.com - Select Test Type: Choose from dropdown
- Click Initiate
Available Test Types¶
| Type | Best For | Duration |
|---|---|---|
| Homepage | Initial page load verification | ~30s |
| Navigation | Link validation | ~60s |
| Contact Form | Form field testing | ~45s |
| API Monitoring | Backend validation | ~60s |
| Accessibility | WCAG compliance | ~40s |
| Responsive | Multi-device testing | ~50s |
| Full Suite | Comprehensive audit | ~3min |
Method 3: API Calls¶
For CI/CD integration or automation:
cURL¶
curl -X POST http://localhost:3000/api/tests/run \
-d "url=https://example.com" \
-d "test_type=homepage"
Python¶
import requests
response = requests.post("http://localhost:3000/api/tests/run", data={
"url": "https://example.com",
"test_type": "full"
})
result = response.json()
agent_id = result["agent_id"]
print(f"Test started: {agent_id}")
JavaScript¶
const response = await fetch('http://localhost:3000/api/tests/run', {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: 'url=https://example.com&test_type=navigation'
});
const result = await response.json();
console.log('Agent ID:', result.agent_id);
Writing Effective Test Requests¶
Be Specific¶
Good:
Vague:
Include URLs¶
Always provide the full URL including protocol:
Not:
Use Keywords¶
Help Vectra understand your intent:
| Keyword | Test Type |
|---|---|
| "homepage", "main page" | Homepage |
| "navigation", "links", "menu" | Navigation |
| "contact", "form" | Contact Form |
| "api", "backend", "endpoint" | API Monitoring |
| "accessibility", "a11y", "wcag" | Accessibility |
| "mobile", "responsive", "viewport" | Responsive |
| "full", "complete", "all" | Full Suite |
Mention Specific Concerns¶
Multi-Step Testing Workflows¶
Sequential Testing¶
Run tests one after another:
Or simply:
Conditional Testing¶
Based on results, run follow-up tests:
User: Test the homepage
Vectra: ✅ Homepage test passed
User: Now test the navigation
Vectra: Running navigation test...
Regression Testing¶
After fixes, re-run tests:
Test Scenarios¶
E-Commerce Site¶
Test these on https://shop.example.com:
1. Homepage loads correctly
2. Product navigation works
3. Contact form validates email
4. Checkout page is responsive
Portfolio Site¶
API-Heavy Application¶
Understanding Test Coverage¶
Homepage Test Covers:¶
- Page load success/failure
- Title and meta tags
- Navigation structure
- Hero section
- Call-to-action buttons
- Footer presence
- Console errors
- Total link count
Navigation Test Covers:¶
- Internal link validation
- External link count
- Broken link detection
- Page transition success
- Mobile menu functionality
Contact Form Test Covers:¶
- Form field discovery
- Required field validation
- Email format validation
- Form submission flow
- Accessibility attributes
Accessibility Test Covers:¶
- Image alt text
- Heading hierarchy (H1-H6)
- ARIA labels
- Form labels
- Keyboard navigation
- Color contrast (basic)
Responsive Test Covers:¶
- Desktop (1920x1080)
- Tablet (768x1024)
- Mobile (375x667)
- Screenshot comparison
Best Practices¶
1. Start Simple¶
Begin with a homepage test before running full suites:
2. Iterate Based on Results¶
Fix critical issues before running comprehensive tests:
3. Use Chat for Complex Workflows¶
For multi-step testing, chat with Vectra:
I need to test a user registration flow:
1. Homepage
2. Sign up page
3. Form validation
4. Thank you page
4. Save Test Plans¶
Document your testing strategy:
# Test Plan: Example.com
## Phase 1: Homepage
- [x] Load test
- [x] Navigation check
## Phase 2: Features
- [ ] Contact form
- [ ] Search functionality
## Phase 3: Quality
- [ ] Accessibility audit
- [ ] Responsive test
Troubleshooting Tests¶
Test Won't Start¶
- Check if URL is accessible:
curl -I https://example.com - Verify Docker services are running:
docker compose ps - Check agent logs:
docker logs vectra-mcp-server
Test Hangs¶
- Some tests wait for page load (30s timeout)
- Check if site blocks automated browsers
- Try headless=false to see the browser
False Positives¶
- Dynamic content may cause intermittent failures
- Run test multiple times to confirm
- Check screenshots for visual verification