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

# Create a Custom Test

> Learn how to create and upload custom tests using the SDK

<Note>
  **Looking for the fastest way to create tests?** If you've defined [Specifications](/concepts/product/specification), Galtea can [generate tests automatically](/sdk/tutorials/specification-driven-evaluations#step-3-create-tests-from-specifications) — including type, variants, and test cases. Use this tutorial when you need full control over test creation or want to upload your own test data.
</Note>

You can create [Tests](/concepts/product/test) by uploading your own test data or by having Galtea generate test cases from a knowledge file.

## Creating Tests with the SDK

The Galtea SDK provides methods to create [Accuracy Tests](/concepts/product/test/accuracy-tests), [Security & Safety Tests](/concepts/product/test/security-tests), and [Behavior Tests](/concepts/product/test/behavior-tests).

<Tabs>
  <Tab title="Upload Existing Test File">
    If you have a prepared test file in CSV format, you can upload it directly.

    ```python theme={"system"}
    # Upload a pre-existing test file to the Galtea Platform
    test = galtea.tests.create(
        name="financial-qa-test-" + run_identifier,
        type="ACCURACY",
        product_id=product_id,
        test_file_path="path/to/accuracy_test.csv",
    )
    ```

    <Warning>
      The test file must follow the structure specified for:

      * [Accuracy Tests](/concepts/product/test/accuracy-tests#example-accuracy-tests-and-file-format): Standard format with `input`, `expected_output`, etc.
      * [Security & Safety Tests](/concepts/product/test/security-tests#example-security-safety-tests-and-file-format): Standard format with adversarial inputs
      * [Behavior Tests](/sdk/tutorials/simulating-conversations): Conversation simulator format with `goal`, `user_persona`, etc.

      If the file is not correctly formatted, test cases will not be created automatically, but you can still [add them manually](/sdk/api/test-case/create).
    </Warning>

    <Info>
      **Behavior Tests**: Use `type="BEHAVIOR"` to create conversation simulation tests that enable multi-turn dialogue evaluation with simulated users. See the [Conversation Simulator Tutorial](/sdk/tutorials/simulating-conversations) for complete examples.
    </Info>
  </Tab>

  <Tab title="Generate Test from Knowledge Base">
    You can provide a knowledge base file (e.g., PDF, TXT) and have Galtea generate the test cases for you. This is a powerful feature for creating comprehensive tests with minimal effort.

    ```python theme={"system"}
    # Generate a test from a knowledge base file (PDF, TXT, etc.)
    generated_test = galtea.tests.create(
        name="generated-financial-qa-test-" + run_identifier,
        type="ACCURACY",
        product_id=product_id,
        ground_truth_file_path="path/to/knowledge.md",
        language="english",
        max_test_cases=50,  # Limit the number of generated test cases
    )
    ```
  </Tab>
</Tabs>

## Next Steps

<CardGroup cols={2}>
  <Card title="Run Test-Based Evaluations" icon="badge-check" href="/sdk/tutorials/run-test-based-evaluations">
    Run your test against a specific product version.
  </Card>

  <Card title="API Reference" icon="code" href="/sdk/api/test/service">
    View the complete Test Service API reference.
  </Card>
</CardGroup>
