> ## Documentation Index
> Fetch the complete documentation index at: https://onetest.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# AI Best Practices

> Get the most out of the OneTest AI Assistant

Learn how to write better prompts, get more accurate results, and use the AI Assistant effectively.

## Writing Better Prompts

> [card] Be Specific
>
> ❌ "Create a test"
>
> ✅ "Create a test for login with OAuth via Google on mobile"

> [card] Provide Context
>
> ❌ "Generate tests"
>
> ✅ "Generate smoke tests for the checkout flow in our e-commerce app"

> [card] Include Requirements
>
> ❌ "Test the API"
>
> ✅ "Test the POST /users API endpoint with valid and invalid email formats"

> [card] Specify Format
>
> ❌ "Create tests for signup"
>
> ✅ "Create 3 separate tests for signup: happy path, invalid email, and weak password"

## Iteration Techniques

**1. Start Broad**

Begin with a general request:

```
Create tests for user authentication
```

**2. Review and Refine**

Ask the AI to adjust:

```
Add steps for two-factor authentication
Include social login scenarios
Make the test data more specific
```

**3. Expand or Split**

Modify scope as needed:

```
Split this into separate tests for each auth method
```

```
Expand this to cover all error scenarios
```

**4. Save Template**

Once you're happy with the format, use it as a reference:

```
Create more tests like TC-0042
```

## Do's and Don'ts

> [tab] ✅ Do
>
> > [!TIP]
> >
> > Provide examples of what you want
>
> > [!TIP]
> >
> > Mention your product type or industry
>
> > [!TIP]
> >
> > Specify test priorities and tags
>
> > [!TIP]
> >
> > Ask for explanations if unclear
>
> > [!TIP]
> >
> > Request test data to be included
>
> > [!TIP]
> >
> > Mention platform (web, mobile, API)
>
> > [!TIP]
> >
> > Reference user stories or requirements
>
> > [!TIP]
> >
> > Ask the AI to review existing tests

> [tab] ❌ Don't
>
> > [!WARNING]
> >
> > Don't assume the AI knows your internal terminology
>
> > [!WARNING]
> >
> > Don't skip reviewing AI-generated content
>
> > [!WARNING]
> >
> > Don't use vague requests without context
>
> > [!WARNING]
> >
> > Don't forget to specify test type (manual/automated)
>
> > [!WARNING]
> >
> > Don't include sensitive production data in prompts
>
> > [!WARNING]
> >
> > Don't expect perfect results on first try

## Advanced Techniques

> [accordion] Upload Documents
>
> Upload or paste requirements directly:
>
> ```
> Generate tests from this user story:
> [paste entire user story with acceptance criteria]
> ```
>
> Upload API documentation:
>
> ```
> Create API tests from these Swagger docs:
> [attach or paste OpenAPI spec]
> ```

> [accordion] Reference Existing Tests
>
> Use existing tests as templates:
>
> ```
> Create tests similar to TC-0042 but for the signup flow
> ```
>
> ```
> Update TC-0156 to include these new requirements: [paste requirements]
> ```

> [accordion] Ask for Recommendations
>
> Get suggestions:
>
> ```
> What edge cases should I test for file upload?
> ```
>
> ```
> Review my checkout tests and suggest improvements
> ```
>
> ```
> What tests am I missing for this feature?
> ```

> [accordion] Batch Operations
>
> Work with multiple tests:
>
> ```
> Generate a complete test suite for user management including CRUD operations
> ```
>
> ```
> Create tests for all error scenarios in the payment flow
> ```
>
> ```
> Convert these manual tests to automated test scripts
> ```

## Common Patterns

### Pattern 1: Feature-Complete Testing

```
Generate a complete test suite for [feature] including:
- Happy path scenarios
- Error handling
- Edge cases
- Performance requirements
- Accessibility checks
```

### Pattern 2: From User Stories

```
Create tests for this user story:

Title: As a [user type], I want to [action] so that [benefit]

Acceptance Criteria:
- [criterion 1]
- [criterion 2]
- [criterion 3]
```

### Pattern 3: API Testing

```
Generate API tests for [endpoint] including:
- Valid request
- Invalid parameters
- Authentication failures
- Rate limiting
- Response validation
```

### Pattern 4: Regression Suite

```
Create regression tests for [feature] covering:
- Previously reported bugs
- Recent changes
- Integration points
- Critical workflows
```

## Quality Checklist

Before saving AI-generated tests, verify:

> [!TIP]
>
> Title clearly describes what is being tested

> [!TIP]
>
> Steps are specific and actionable

> [!TIP]
>
> Expected results are measurable

> [!TIP]
>
> Preconditions are listed

> [!TIP]
>
> Test data is appropriate

> [!TIP]
>
> Tags and priority are correct

> [!TIP]
>
> Test is atomic (tests one thing)

> [!TIP]
>
> No assumptions about system state

## Troubleshooting

> [accordion] AI doesn't understand my request
>
> **Try:**
>
> * Rephrase your question
> * Provide more context
> * Give an example of what you want
> * Break complex requests into smaller parts

> [accordion] Generated tests are too generic
>
> **Try:**
>
> * Include specific test data
> * Mention your product/industry
> * Reference existing tests as templates
> * Provide acceptance criteria or requirements

> [accordion] Tests don't match my format
>
> **Try:**
>
> * Show an example of your preferred format
> * Specify which fields to include
> * Ask for specific sections to be expanded
> * Request step-by-step refinements

> [accordion] Need more edge cases
>
> **Try:**
>
> ```
> What edge cases am I missing for [feature]?
> ```
>
> ```
> Generate negative test scenarios for [feature]
> ```
>
> ```
> What error conditions should I test?
> ```

## Pro Tips

> [!TIP]
>
> **Save Good Prompts:** When you craft a prompt that works well, save it for future use

> [!TIP]
>
> **Use Templates:** Once you have a test format you like, ask the AI to create more tests using the same structure

> [!TIP]
>
> **Iterate in Conversation:** Don't try to get perfect results in one prompt—refine through conversation

> [!TIP]
>
> **Combine with OQL:** Use the AI to help build complex OQL queries for advanced searches

## What's Next?

> [card] [Generate Tests](https://onetest.ai/ai/generate-tests.md)
>
> Put these practices to use

> [card] [Learn OQL](https://onetest.ai/oql/overview.md)
>
> Master advanced searches


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.