> For the complete documentation index, see [llms.txt](https://docs.walnutai.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.walnutai.ai/core-features/intelligence-hub/generate-test-cases/code-repository-to-test-case.md).

# Code (Repository to Test Case)

The **Code** option within the Intelligence Hub allows you to generate structured **test cases** directly from your application's source code. This feature analyzes your connected repository to understand the application's functionality and generate relevant test scenarios, eliminating the need to manually create test cases from existing application behavior.

**When to Use Code-Based Test Case Generation**

Use this option when your application's functionality is already available in a connected source code repository. WalnutAI analyzes the repository and automatically generates structured **test cases**, making it useful for documenting and testing existing applications, legacy systems, or projects with limited test documentation.

* **Existing Connection:** If a repository was configured during project setup (**GitHub, GitLab, Bitbucket, Azure Repos, or AWS CodeCommit**), it will automatically appear under the **Code** option in the Intelligence Hub.
* **Open the Code Repository:** Click the **Code** icon in the Intelligence Hub to view the list of available repositories.

<figure><img src="https://295337183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9aroNmDWVJAmMjkdy0hx%2Fuploads%2FH7LLFMRNd99anZAKSWvt%2FScreenshot%202026-08-17%20at%202.02.29%E2%80%AFPM.png?alt=media&amp;token=0604fd6b-7473-450f-b12c-3ca97298000d" alt=""><figcaption></figcaption></figure>

* **Select a Repository:** Choose the repository you want to use. The selected repository is automatically attached to the WalnutAI Chat for analysis.

<figure><img src="https://295337183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9aroNmDWVJAmMjkdy0hx%2Fuploads%2FnPG5B6rSuHJhfvlTpnMN%2FScreenshot%202026-08-17%20at%201.57.40%E2%80%AFPM.png?alt=media&amp;token=84536abe-72e8-4265-a910-8f613e6632e2" alt=""><figcaption></figcaption></figure>

* **Generate Test Cases:** WalnutAI analyzes the repository and generates relevant **manual test cases** based on the application's source code.

<figure><img src="https://295337183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9aroNmDWVJAmMjkdy0hx%2Fuploads%2FgJkbxP0RJHfsUJEHP1i2%2FScreenshot%202026-08-17%20at%202.05.35%E2%80%AFPM.png?alt=media&amp;token=21252e85-cdec-430f-bbf2-c55d988edfed" alt=""><figcaption></figcaption></figure>

* Review the generated manual test cases and click **Save** to store the generated **test cases**.

{% hint style="info" %}
**Result:** Upon saving, the generated test cases are available in the **Test Cases** module.
{% endhint %}
