|
| 1 | +--- |
| 2 | +id: kaneai-create-pr |
| 3 | +title: Create Pull Requests from KaneAI Test Cases |
| 4 | +hide_title: false |
| 5 | +sidebar_label: Create Pull Requests |
| 6 | +description: Export KaneAI-generated test code directly to GitHub or GitLab as pull requests. Set up repository integration, configure PR settings, and track PR status from Test Manager. |
| 7 | +keywords: |
| 8 | + - kaneai pull request |
| 9 | + - kaneai github integration |
| 10 | + - kaneai gitlab integration |
| 11 | + - kaneai code export |
| 12 | + - create pr from kaneai |
| 13 | + - test case pull request |
| 14 | + - kaneai pr creation |
| 15 | + - auto pr kaneai |
| 16 | + - test manager pull requests |
| 17 | + - code export github |
| 18 | +url: https://www.testmuai.com/support/docs/kaneai-create-pr/ |
| 19 | +site_name: TestMu AI |
| 20 | +slug: kaneai-create-pr/ |
| 21 | +canonical: https://www.testmuai.com/support/docs/kaneai-create-pr/ |
| 22 | +--- |
| 23 | +import BrandName, { BRAND_URL } from '@site/src/component/BrandName'; |
| 24 | + |
| 25 | + |
| 26 | +<script type="application/ld+json" |
| 27 | + dangerouslySetInnerHTML={{ __html: JSON.stringify({ |
| 28 | + "@context": "https://schema.org", |
| 29 | + "@type": "BreadcrumbList", |
| 30 | + "itemListElement": [{ |
| 31 | + "@type": "ListItem", |
| 32 | + "position": 1, |
| 33 | + "name": "Home", |
| 34 | + "item": BRAND_URL |
| 35 | + },{ |
| 36 | + "@type": "ListItem", |
| 37 | + "position": 2, |
| 38 | + "name": "Support", |
| 39 | + "item": `${BRAND_URL}/support/docs/` |
| 40 | + },{ |
| 41 | + "@type": "ListItem", |
| 42 | + "position": 3, |
| 43 | + "name": "Create Pull Requests from KaneAI Test Cases", |
| 44 | + "item": `${BRAND_URL}/support/docs/kaneai-create-pr/` |
| 45 | + }] |
| 46 | + }) |
| 47 | + }} |
| 48 | +></script> |
| 49 | + |
| 50 | +KaneAI lets you export generated test code directly to your GitHub or GitLab repository as a pull request (PR) or merge request (MR). Instead of downloading ZIP files and manually copying code, you can raise PRs from the Test Manager in a few clicks — or automatically whenever code is generated. |
| 51 | + |
| 52 | +This guide covers how to integrate your Git provider, configure PR settings, create pull requests from test cases, and track their status. |
| 53 | + |
| 54 | +:::note Beta Feature |
| 55 | +This feature is currently in **beta** and is not generally available. If you would like access, please reach out to [support@lambdatest.com](mailto:support@lambdatest.com). |
| 56 | +::: |
| 57 | + |
| 58 | +## Prerequisites |
| 59 | + |
| 60 | +- A <BrandName /> account with access to KaneAI and Test Manager. |
| 61 | +- A GitHub or GitLab account with at least one repository. |
| 62 | +- At least one test case with code generated. |
| 63 | +- Admin role to configure integration and PR settings. Users with appropriate permissions can create PRs for their own test cases. |
| 64 | + |
| 65 | +## Supported Platforms and Frameworks |
| 66 | + |
| 67 | +| Platform | Framework | File Exported | |
| 68 | +|----------|-----------|---------------| |
| 69 | +| Desktop Browser | Selenium (Python) | `test.py` | |
| 70 | +| Mobile Browser | Selenium (Python) | `test.py` | |
| 71 | +| Mobile App | Appium (Python) | `test.py` | |
| 72 | + |
| 73 | +## Step 1: Integrate Your Git Provider |
| 74 | + |
| 75 | +Before you can create pull requests, you need to connect your GitHub or GitLab account to <BrandName />. |
| 76 | + |
| 77 | +### Connect via Integrations Page |
| 78 | + |
| 79 | +Set up your Git provider from the <BrandName /> Integrations page: |
| 80 | + |
| 81 | +- **GitHub**: Supports OAuth, Repo-based OAuth, Cloud/PAT, and Self-Hosted (GitHub Enterprise) connection methods. See the [GitHub Integration guide](/support/docs/github-integration/) for detailed setup instructions. |
| 82 | +- **GitLab**: Supports OAuth, Personal Access Token, and Self-Managed instance connection methods. See the [GitLab Integration guide](/support/docs/gitlab-integration/) for detailed setup instructions. |
| 83 | + |
| 84 | +### Select Platform from Test Manager |
| 85 | + |
| 86 | +When you initiate PR creation for the first time from the Test Manager, a **Select Platform to Create PR** dialog appears. This dialog shows the integration status for each provider. |
| 87 | + |
| 88 | +- If your provider is **not integrated**, click the **Integrate** button to be redirected to the Integrations page. |
| 89 | + |
| 90 | +<img loading="lazy" src={require('../assets/images/kane-ai/features/create-pr/pr-setup-no-integration.png').default} alt="Select Platform dialog showing GitHub as Not Integrated" className="doc_img"/> |
| 91 | + |
| 92 | +- If your provider is already **integrated**, the status shows in green. Click **Setup** to proceed to the repository configuration. |
| 93 | + |
| 94 | +<img loading="lazy" src={require('../assets/images/kane-ai/features/create-pr/pr-setup-integration-done.png').default} alt="Select Platform dialog showing GitHub as Integrated" className="doc_img"/> |
| 95 | + |
| 96 | +:::tip |
| 97 | +Bitbucket support is coming soon. Currently, GitHub and GitLab are the supported providers. |
| 98 | +::: |
| 99 | + |
| 100 | +## Step 2: Configure Repository Settings (First-Time Setup) |
| 101 | + |
| 102 | +After selecting your integrated provider, you are taken to the **Setup Pull Request** page. This is a one-time configuration that defines how test code is organized in your repository. |
| 103 | + |
| 104 | +<img loading="lazy" src={require('../assets/images/kane-ai/features/create-pr/pr-setup-flow.png').default} alt="Setup Pull Request page with repository strategy and configuration options" className="doc_img"/> |
| 105 | + |
| 106 | +### Repository Strategy |
| 107 | + |
| 108 | +Choose how repositories are mapped to your projects: |
| 109 | + |
| 110 | +| Strategy | Description | |
| 111 | +|----------|-------------| |
| 112 | +| **Single Repository** | One repository for the entire organization. All projects push test files to the same repo under project-specific folders. | |
| 113 | +| **Multiple Repositories** | Each project can be linked to its own repository. A default repository handles unmapped and new projects. | |
| 114 | + |
| 115 | +### Configuration Fields |
| 116 | + |
| 117 | +| Field | Description | |
| 118 | +|-------|-------------| |
| 119 | +| **Repository** | The target repository where PRs will be created. In Single mode, all projects use this repo. In Multiple mode, this is the default repo for unmapped projects. | |
| 120 | +| **Folder Structure** | The file path pattern inside the repository. Default: `{project_name}/{test_id}_{test_name}/{version_no}`. The test file (`test.py`) is placed at this path. | |
| 121 | +| **Base Branch (PR Target)** | The branch that PRs are opened against (e.g., `main`, `master`, `develop`). | |
| 122 | +| **Auto-PR** | When enabled, a PR is automatically created whenever new code is generated for a test case. Default: Disabled. | |
| 123 | + |
| 124 | +Click **Complete Setup** to save the configuration. |
| 125 | + |
| 126 | +:::note |
| 127 | +You can change all of these settings later from the [Test Manager Settings > Pull Requests](https://test-manager.lambdatest.com/settings/pull-requests#) tab. |
| 128 | +::: |
| 129 | + |
| 130 | +### Single Repository Mode |
| 131 | + |
| 132 | +In Single Repository mode, all test case PRs across all projects go to one repository. The settings page shows the selected repository, folder structure pattern, base branch, and Auto-PR toggle. |
| 133 | + |
| 134 | +<img loading="lazy" src={require('../assets/images/kane-ai/features/create-pr/pr-setting-single.png').default} alt="Pull Requests settings tab showing Single Repository configuration" className="doc_img"/> |
| 135 | + |
| 136 | +### Multiple Repositories Mode |
| 137 | + |
| 138 | +In Multiple Repositories mode, you can map individual projects to specific repositories. The configuration table shows columns for **Project Name**, **Repository Name**, **Folder Path**, **Base Branch**, and **Auto-PR**. |
| 139 | + |
| 140 | +<img loading="lazy" src={require('../assets/images/kane-ai/features/create-pr/pr-settings-multi.png').default} alt="Pull Requests settings tab showing Multiple Repositories configuration with project mapping" className="doc_img"/> |
| 141 | + |
| 142 | +- **Unmapped Projects** — Any project without a specific mapping uses the default repository configuration. |
| 143 | +- **+ Add Project** — Click to map a specific project to a different repository. Only KaneAI-enabled projects are available for mapping. |
| 144 | + |
| 145 | +Click **Update Setup** to save any changes. |
| 146 | + |
| 147 | +## Step 4: Create a Pull Request |
| 148 | + |
| 149 | +Once the integration and repository settings are configured, you can create PRs directly from the test case listing page or from the code section of an individual test case details page. |
| 150 | + |
| 151 | +### PR Status in the Test Case Listing |
| 152 | + |
| 153 | +Each test case in the listing displays its PR status inline: |
| 154 | + |
| 155 | +- **PR number with icon** (e.g., `#2`, `#3`, `#4`) — A PR exists for this test case. Hover over the PR indicator to see the status (Open, Merged, or Closed), creation details, and a **View on GitHub** link that opens the PR directly. |
| 156 | +- **No PR** — No pull request has been created for this test case yet. |
| 157 | + |
| 158 | +<img loading="lazy" src={require('../assets/images/kane-ai/features/create-pr/tc-listing-page-PR.png').default} alt="Test case listing showing PR status indicators and PR details tooltip" className="doc_img"/> |
| 159 | + |
| 160 | +### How to Create a PR |
| 161 | + |
| 162 | +1. Navigate to your project in **Test Manager**. |
| 163 | +2. Find the test case you want to create a PR for in the test case listing. |
| 164 | +3. Click the **three-dot menu** (actions) on the test case and select **Create PR**. |
| 165 | +4. If this is your first time, you will be prompted to select a platform and complete the setup (see Steps 1-2 above). |
| 166 | +5. Confirm the PR details and submit. The PR is created in your configured repository. |
| 167 | + |
| 168 | +### Diff-Based Updates |
| 169 | + |
| 170 | +KaneAI automatically tracks whether each code export version already has an associated PR. This detection happens in the background — the **Create PR** button only appears for a version when there is no existing PR for it. |
| 171 | + |
| 172 | +In the **Code** section of a test case, each code export version shows its PR status alongside the **Create PR** and **Execute** actions. If a PR already exists for that version, the **Create PR** button is disabled with a tooltip: "PR already exists for this version." |
| 173 | + |
| 174 | +<img loading="lazy" src={require('../assets/images/kane-ai/features/create-pr/pr-diff-code-export.png').default} alt="Code section showing Create PR button for new version and disabled state for version with existing PR" className="doc_img"/> |
| 175 | + |
| 176 | +- **New version without a PR** — The **Create PR** button is active. Click it to raise a PR with that version's code. |
| 177 | +- **Version with an existing PR** — The PR number is shown (e.g., `#2`) and the **Create PR** button is disabled since the code is already synced. |
| 178 | + |
| 179 | +### Auto-PR |
| 180 | + |
| 181 | +When Auto-PR is enabled in your settings, a pull request is automatically created whenever code generation completes for a test case. No manual action is required. |
| 182 | + |
| 183 | +- The PR uses your saved configuration (repository, folder structure, base branch). |
| 184 | + |
| 185 | +## Step 5: Filter by PR Status |
| 186 | + |
| 187 | +Use the **PR Status** filter to quickly find test cases based on their pull request state. Click the **More** filter option in the test case listing toolbar, then select **PR Status**. |
| 188 | + |
| 189 | +<img loading="lazy" src={require('../assets/images/kane-ai/features/create-pr/tc-listing-filter.png').default} alt="PR Status filter dialog with options for Open, Merged, Closed, Diff Available, and No PR" className="doc_img"/> |
| 190 | + |
| 191 | +Available filter options: |
| 192 | + |
| 193 | +| Filter | Description | |
| 194 | +|--------|-------------| |
| 195 | +| **Open** | Test cases with an open PR that has not been merged or closed. | |
| 196 | +| **Merged** | Test cases whose PR has been merged into the base branch. | |
| 197 | +| **Closed** | Test cases whose PR was closed without merging. | |
| 198 | +| **Diff Available** | Test cases where code has changed since the last PR was created. | |
| 199 | +| **No PR** | Test cases that do not have any associated pull request. | |
| 200 | + |
| 201 | +Select one or more filters and click **Apply** to filter the listing. |
| 202 | + |
| 203 | +## Additional Details |
| 204 | + |
| 205 | +### Folder Structure in the Repository |
| 206 | + |
| 207 | +Test files are organized in your repository following the configured folder structure pattern. The default pattern is: |
| 208 | + |
| 209 | +``` |
| 210 | +your-repo/ |
| 211 | +├── {project_name}/ |
| 212 | +│ ├── {test_id}_{test_name}/ |
| 213 | +│ │ └── {version_no}/ |
| 214 | +│ │ └── test.py |
| 215 | +│ └── {test_id}_{test_name}/ |
| 216 | +│ └── {version_no}/ |
| 217 | +│ └── test.py |
| 218 | +``` |
| 219 | + |
| 220 | +- **`{project_name}`** — Derived from the Test Manager project name. |
| 221 | +- **`{test_id}_{test_name}`** — The test case ID and name combined for uniqueness. |
| 222 | +- **`{version_no}`** — The code export version number. |
| 223 | + |
| 224 | +You can customize this pattern during setup or in the Pull Requests settings tab. |
| 225 | + |
| 226 | +### Permissions |
| 227 | + |
| 228 | +| Action | Admin | User | |
| 229 | +|--------|-------|------| |
| 230 | +| Configure Git integration | Yes | No | |
| 231 | +| Modify repository strategy and settings | Yes | No | |
| 232 | +| Toggle Auto-PR | Yes | No | |
| 233 | +| Create PR for own test cases | Yes | Yes | |
| 234 | +| Create PR for permitted folders | Yes | Yes | |
| 235 | +| View PR status | Yes | Yes | |
| 236 | + |
| 237 | +<nav aria-label="breadcrumbs"> |
| 238 | + <ul className="breadcrumbs"> |
| 239 | + <li className="breadcrumbs__item"> |
| 240 | + <a className="breadcrumbs__link" target="_self" href={BRAND_URL}> |
| 241 | + Home |
| 242 | + </a> |
| 243 | + </li> |
| 244 | + <li className="breadcrumbs__item"> |
| 245 | + <a className="breadcrumbs__link" target="_self" href={`${BRAND_URL}/support/docs/`}> |
| 246 | + Support |
| 247 | + </a> |
| 248 | + </li> |
| 249 | + <li className="breadcrumbs__item breadcrumbs__item--active"> |
| 250 | + <span className="breadcrumbs__link"> |
| 251 | + Create Pull Requests from KaneAI Test Cases |
| 252 | + </span> |
| 253 | + </li> |
| 254 | + </ul> |
| 255 | +</nav> |
0 commit comments