> For the complete documentation index, see [llms.txt](https://docs.mozark.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mozark.ai/mcp/mozark-mcp-docs/guides/generate-test-cases.md).

# Generate test cases

Create grounded test coverage with the Author Agent.

Mozark's **Author Agent** writes test cases grounded in *your* app—its screenshots, PRDs, and user stories—rather than generic templates.

## How it works

```
Your prompt ──► Knowledge base lookup ──► Author Agent ──► Review in chat ──► Save to TCM
                (screenshots, docs)       (generate)                          (with AI tag)
```

## Walkthrough

{% stepper %}
{% step %}

## Ask for what you want

> *"Generate test cases for the password-reset journey."*
> {% endstep %}

{% step %}

## Answer three quick questions

The assistant always asks these—it never guesses them:

| Question       | Options                                                         |
| -------------- | --------------------------------------------------------------- |
| Knowledge base | Use existing content, or upload new screenshots/documents first |
| Test type      | **Functional** · **Edge** · **Automation**                      |
| Polarity       | **Positive** · **Negative** · **Both**                          |

You can pre-empt the questions by putting everything in one prompt:

> *"Using the existing knowledge base, generate **negative edge** test cases for **password reset**."*
> {% endstep %}

{% step %}

## The assistant checks context

It searches the knowledge base for your feature (`retrieve_from_knowledge_base`).

* ✅ *Found context for password reset* — generation proceeds.
* ⚠️ *No context found* — you'll be advised to upload screenshots or a document first. You can still proceed, but results will be more generic.
  {% endstep %}

{% step %}

## Review the draft

Generated cases appear in chat with title, preconditions, numbered steps, and expected results. Ask for changes freely:

> *"Make step 3 more specific about the OTP timeout."*

> *"Drop the last two, they duplicate TC-41."*
> {% endstep %}

{% step %}

## Save—only when you say so

> *"Save these to the Auth folder."*

The assistant calls `save_test_cases`, which writes them to TCM **and** tags them as AI-generated, then embeds them for semantic search.

{% hint style="info" %}
Nothing is written to your project until you explicitly ask to save.
{% endhint %}
{% endstep %}
{% endstepper %}

## Tips for better output

* **Feed the knowledge base first.** Two or three screenshots of the flow plus the relevant PRD section make a large difference. See [Build your knowledge base](/mcp/mozark-mcp-docs/guides/build-your-knowledge-base.md).
* **Name the feature the way your team does.** Retrieval is semantic, but matching your own terminology ("Checkout v2", "Guest login") helps.

## Related tools

`generate_test_cases` · `save_test_cases` · `retrieve_from_knowledge_base` · `get_skill_instructions` · `search_test_cases` · `embed_test_cases`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.mozark.ai/mcp/mozark-mcp-docs/guides/generate-test-cases.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
