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

# Automated Test Generation

> Generate test code in 8 frameworks with a 5-dimension quality score and targeted regeneration.

# Automated Test Generation

## Supported frameworks

| Framework      | Language                        |
| -------------- | ------------------------------- |
| **Playwright** | TypeScript / Python / C# (.NET) |
| **Selenium**   | Java (JUnit 5)                  |
| **Cypress**    | JavaScript                      |
| **Cucumber**   | JavaScript / Java / Python      |

## Code quality score

Before you push any code, TestForge calculates a **local quality score** (no extra LLM call) across 5 dimensions:

| Dimension        | Weight | What it checks                                     |
| ---------------- | ------ | -------------------------------------------------- |
| **Syntax**       | 30%    | Language-specific structure                        |
| **AC Coverage**  | 25%    | Keywords from acceptance criteria found in code    |
| **POM Pattern**  | 20%    | Page Object separation detected (N/A for Cucumber) |
| **Traceability** | 15%    | US ID annotation present in comments (`@us-{id}`)  |
| **Readability**  | 10%    | Line length, comments, naming conventions          |

**Score ≥ 70**: good quality, push with confidence. **Score \< 60**: Regenerate button is highlighted.

## Regenerate with corrections

Click **Regenerate** to run a new generation. TestForge automatically collects all quality warnings from the previous result and sends them to the LLM as a `CORRECTIONS REQUIRED` section. You don't need to describe the issues manually.

## Cucumber: feature files from Gherkin

When you select a Cucumber framework:

1. **Feature files** are derived directly from the `gherkinScenario` fields of your manual tests — **zero extra LLM call**.
2. **Step definitions** are generated by the LLM from those scenarios.

<Warning>
  For Cucumber, generate manual tests first. If no Gherkin scenarios are available, TestForge cannot proceed.
</Warning>

***

## Getting started with your generated code

After generation, TestForge displays a **"How to use this code"** panel with the exact steps for your framework. Here is the full reference for all 8 frameworks.

<h3 id="playwright-ts">
  Playwright TypeScript \\
</h3>

```bash theme={null}
# Install
npm i -D @playwright/test
npx playwright install
```

**Project structure**

```
tests/          ← generated test files
pages/          ← Page Object classes
playwright.config.ts
```

```bash theme={null}
# Run
npx playwright test
```

***

<h3 id="playwright-python">
  Playwright Python \\
</h3>

```bash theme={null}
# Install
pip install pytest-playwright
playwright install
```

**Project structure**

```
tests/          ← generated test files
pages/          ← Page Object classes
pytest.ini
```

```bash theme={null}
# Run
pytest
```

***

<h3 id="playwright-dotnet">
  Playwright .NET (C#) \\
</h3>

```bash theme={null}
# Install
dotnet add package Microsoft.Playwright
playwright install
```

**Project structure**

```
Tests/          ← generated test files
Pages/          ← Page Object classes
*.csproj
```

```bash theme={null}
# Run
dotnet test
```

***

<h3 id="selenium-java">
  Selenium Java \\
</h3>

Add to your `pom.xml`:

```xml theme={null}
<dependencies>
  <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>4.x</version>
  </dependency>
  <dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter</artifactId>
    <version>5.x</version>
    <scope>test</scope>
  </dependency>
  <dependency>
    <groupId>io.github.bonigarcia</groupId>
    <artifactId>webdrivermanager</artifactId>
    <version>5.x</version>
    <scope>test</scope>
  </dependency>
</dependencies>
```

**Project structure**

```
src/test/java/
  tests/        ← generated test files
  pages/        ← Page Object classes
pom.xml
```

```bash theme={null}
# Run
mvn test
```

***

<h3 id="cypress-js">
  Cypress JavaScript \\
</h3>

```bash theme={null}
# Install
npm i -D cypress
```

**Project structure**

```
cypress/
  e2e/          ← generated test files
  support/      ← commands and fixtures
cypress.config.js
```

```bash theme={null}
# Run
npx cypress run
```

***

<h3 id="cucumber-js">
  Cucumber JavaScript \\
</h3>

```bash theme={null}
# Install
npm i -D @cucumber/cucumber
```

**Project structure**

```
features/             ← generated .feature files
step-definitions/     ← generated step definitions
.cucumberrc.yml
```

```bash theme={null}
# Run
npx cucumber-js
```

***

<h3 id="cucumber-java">
  Cucumber Java \\
</h3>

Add to your `pom.xml`:

```xml theme={null}
<dependencies>
  <dependency>
    <groupId>io.cucumber</groupId>
    <artifactId>cucumber-java</artifactId>
    <version>7.x</version>
    <scope>test</scope>
  </dependency>
  <dependency>
    <groupId>io.cucumber</groupId>
    <artifactId>cucumber-junit</artifactId>
    <version>7.x</version>
    <scope>test</scope>
  </dependency>
</dependencies>
```

**Project structure**

```
src/test/resources/features/    ← generated .feature files
src/test/java/steps/            ← generated step definitions
pom.xml
```

```bash theme={null}
# Run
mvn test
```

***

<h3 id="cucumber-python">
  Cucumber Python \\
</h3>

```bash theme={null}
# Install
pip install pytest-bdd
```

**Project structure**

```
features/       ← generated .feature files
step_defs/      ← generated step definitions
pytest.ini
```

```bash theme={null}
# Run
pytest
```

<Info>
  The inline **"How to use this code"** accordion in the QA Hub links directly to each section above. Keep this page up to date whenever framework versions are bumped.
</Info>
