Metadata-Version: 2.3
Name: codemie-test-harness
Version: 0.1.755
Summary: Autotest for CodeMie backend and UI
License: Apache-2.0
Author: CodeMie Test Harness Team
Requires-Python: >=3.12,<4.0
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: PyHamcrest (>=2.1.0,<3.0.0)
Requires-Dist: aws-assume-role-lib (>=2.10.0,<3.0.0)
Requires-Dist: boto3 (>=1.39.8,<2.0.0)
Requires-Dist: click (>=8.1.7,<9.0.0)
Requires-Dist: codemie-plugins (>=0.1.123,<0.2.0)
Requires-Dist: codemie-sdk-python (==0.1.705)
Requires-Dist: filelock (>=3.16,<4.0)
Requires-Dist: msal (>=1.31.1,<2.0.0)
Requires-Dist: opentelemetry-proto (>=1.45.1,<2.0.0)
Requires-Dist: pandas (>=2.3.3,<3.0.0)
Requires-Dist: playwright (>=1.61.0,<2.0.0)
Requires-Dist: protobuf (>=5.0,<8.0)
Requires-Dist: pypdf (>=6.1.0,<7.0.0)
Requires-Dist: pytest (>=8.4.1,<9.0.0)
Requires-Dist: pytest-playwright (>=0.8.0,<0.9.0)
Requires-Dist: pytest-repeat (>=0.9.3,<0.10.0)
Requires-Dist: pytest-reportportal (>=5.5.2,<6.0.0)
Requires-Dist: pytest-rerunfailures (>=15.1,<16.0)
Requires-Dist: pytest-timeout (>=2.4.0,<3.0.0)
Requires-Dist: pytest-xdist (>=3.6.1,<4.0.0)
Requires-Dist: python-docx (>=1.2.0,<2.0.0)
Requires-Dist: python-dotenv (>=1.1.0,<2.0.0)
Requires-Dist: python-gitlab (>=5.6.0,<6.0.0)
Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
Requires-Dist: questionary (>=2.1.0,<3.0.0)
Requires-Dist: rich (>=14.0.0,<15.0.0)
Requires-Dist: tzlocal (>=5.3.1,<6.0.0)
Description-Content-Type: text/markdown

# CodeMie Test Harness

End-to-end, integration, and UI test suite for CodeMie services. Test LLM assistants, workflows, tools, and integrations with a user-friendly CLI or pytest.

## Quick Start

```bash
# Install and launch interactive mode
pip install codemie-test-harness
codemie-test-harness

# Or run without installing
uvx codemie-test-harness
```

**First time?** The CLI guides you through setup. Just select **Configuration → Setup** and follow the prompts.

**Running tests?** Choose **Run Tests → Run Test Suite → smoke** for a quick 5-10 minute validation.

## Requirements

- **Python**: 3.9 or higher
- **Platform**: Linux, macOS, Windows (WSL recommended)
- **For UI tests**: Playwright browsers (`playwright install`)
- **Settings**: every setting comes from a source you control (environment variable, config file, `.env`). An AWS Parameter Store is used only when you enable it (see [Settings sources and secret store](#settings-sources-and-secret-store)).

> **No AWS account is needed by default.** The harness makes no AWS call unless `HARNESS_SECRET_STORE=aws-parameter-store` is set.

## Table of Contents

- [Quick Start](#quick-start)
- [Requirements](#requirements)
- [Part 1: Interactive CLI (Recommended)](#part-1-interactive-cli-recommended)
  - [Installation](#installation)
  - [Getting Started](#getting-started)
  - [Navigation Tips](#navigation-tips)
  - [Configuration](#configuration)
  - [Running Tests](#running-tests)
  - [Interactive Features](#interactive-features)
  - [Configuration File Reference](#configuration-file-reference)
- [Complete Example: First Test Run](#complete-example-first-test-run)
- [Part 2: Running with pytest](#part-2-running-with-pytest)
  - [Installation for Contributors](#installation-for-contributors)
  - [Configuration with .env File](#configuration-with-env-file)
  - [Running Tests with pytest](#running-tests-with-pytest)
- [Troubleshooting](#troubleshooting)
- [Quick Reference Card](#quick-reference-card)
- [Support](#support)

---

## Part 1: Interactive CLI (Recommended)

The easiest way to use the test harness. No command memorization required - just navigate menus and follow prompts.

> **For developers**: See [Part 2: Running with pytest](#part-2-running-with-pytest) for direct pytest commands and `.env` configuration.
>
> **For technical details**: See `CLAUDE.md` in the repository for architecture and development patterns.

### Installation

**Option 1: Install with pip (persistent installation)**

```bash
pip install codemie-test-harness
```

**Option 2: Run with uvx (no installation needed)**

```bash
uvx codemie-test-harness
```

**Verify installation:**

```bash
codemie-test-harness --help
```

### Getting Started

Launch the interactive CLI:

```bash
codemie-test-harness
```

You'll see the main menu:

```
╔═══════════════════════════════════════════════╗
║    CodeMie Test Harness - Interactive Mode    ║
╚═══════════════════════════════════════════════╝

? What would you like to do?
  🚀 Run Tests
❯ ⚙️ Configuration
  🤖 Chat with Assistant
  🔄 Execute Workflow
  ❌ Exit
```

**First-time setup:** Navigate to **Configuration** → **Setup (Quick Configuration)** to configure your environment.

### Navigation Tips

Before diving into configuration, here's how to navigate the interactive CLI:

- **Arrow Keys**: Navigate menu options
- **Enter**: Select an option
- **Ctrl+C**: Cancel/Exit at any time
- **Back Options**: Every submenu has a "Back" option
- **Menu Loops**: Configuration menus loop until you select "Back"
- **Smart Defaults**: Pre-filled values for common configurations
- **Validation**: Input validation prevents invalid values

### Configuration

The interactive CLI guides you through configuration with smart defaults and validation.

#### Quick Setup Wizard

Select: **Configuration** → **Setup (Quick Configuration)**

The wizard will guide you through:

**1. Select Environment**

```
? Select environment:
  Localhost - http://localhost:8080
  Custom - Enter URL manually
```

**2. Authentication Setup**

The wizard automatically detects localhost and skips authentication setup. For remote environments (Preview/Production), it prompts for:

- Auth Server URL (default provided)
- Client ID (default provided)
- Realm Name (default provided)
- Client Secret
- Optional: Username/Password authentication

**3. AWS Parameter Store credentials (optional)**

Only needed when you enable the AWS Parameter Store (`HARNESS_SECRET_STORE=aws-parameter-store`, see [Settings sources and secret store](#settings-sources-and-secret-store)). Skip this step otherwise:

```
? How would you like to configure AWS Parameter Store credentials?
  📁 Use existing AWS profile
  ➕ Create new AWS profile
  🔑 Enter access keys directly
  ⏭️ Skip AWS configuration
  ⬅️ Back
```

**4. Summary & Confirmation**

The wizard displays all configured values with masked sensitive data.

#### Configuration for Localhost

**Minimal localhost setup:**

1. Select **Configuration** → **Setup**
2. Choose **Localhost** environment
3. Authentication is automatically skipped ✓
4. Set integration settings with `config set` (or enable the secret store, see below)
5. Done! Ready to run tests

**What you need:**
- CodeMie API running on localhost:8080
- Integration settings for the suites you run (configured by you; AWS is optional)

#### Configuration for Preview/Production

**Remote environment setup:**

1. Select **Configuration** → **Setup**
2. Choose **Preview** or **Production** environment
3. Configure authentication:
   - Accept default Auth Server URL or enter custom
   - Accept default Client ID or enter custom
   - Accept default Realm Name or enter custom
   - Enter Client Secret
   - Optional: Configure username/password
4. Set integration settings with `config set` (or enable the secret store, see below)
5. Done! Ready to run tests

#### AWS Credentials Setup

AWS credentials are used only when the AWS Parameter Store is enabled (`HARNESS_SECRET_STORE=aws-parameter-store`). They are the credentials the harness uses to read the store. With the store disabled, they are never read.

**When do you need AWS?**
- Only if you keep your settings in an AWS Parameter Store and enable it (see [Settings sources and secret store](#settings-sources-and-secret-store)).
- Otherwise set the settings yourself (`config set`, environment variables or `.env`).

**Navigate to:** Configuration → AWS Management

**Option 1: Use Existing AWS Profile** (Recommended)

Select your profile from `~/.aws/credentials`:

```
? Select AWS profile:
❯ default
  my-profile
  other-profile
```

**Option 2: Create New AWS Profile**

The CLI guides you through:
1. Enter profile name (e.g., "codemie")
2. Enter AWS Access Key ID
3. Enter AWS Secret Access Key
4. Profile is saved to `~/.aws/credentials` with secure permissions

**Option 3: Enter Access Keys Directly**

Keys are stored in the test harness configuration file (`~/.codemie/test-harness.json`).

**Option 4: Remove AWS Credentials**

Clears all AWS configuration from the test harness.

#### Integrations Management

Manage credentials for 86+ integration variables across 10 categories.

**Navigate to:** Configuration → Integrations Management

**Features:**

1. **📋 View Current Integrations** - See all configured integrations (masked or real values)
2. **📂 View Categories** - List all integration categories:
   - Version Control (GitLab, GitHub)
   - Project Management (JIRA Server/Cloud, Confluence Server/Cloud)
   - Cloud Providers (AWS, Azure, GCP)
   - Code Quality (SonarQube, SonarCloud)
   - DevOps (Azure DevOps)
   - Access Management (Keycloak)
   - Notifications (Email, OAuth, Telegram)
   - Data Management (MySQL, PostgreSQL, MSSQL, LiteLLM, Elasticsearch)
   - IT Service (ServiceNow)
   - Quality Assurance (Report Portal, Kubernetes)
3. **⚙️ Setup by Category** - Interactive wizard for specific category
4. **✅ Validate Integrations** - Check configuration completeness

**Example: Setup GitLab Integration**

1. Select **Configuration** → **Integrations Management** → **Setup by Category**
2. Choose **Version Control**
3. Enter values for each prompt (or press Enter to skip):
   ```
   GITLAB_URL: https://gitlab.example.com
   GITLAB_TOKEN: **********************
   GITLAB_PROJECT: https://gitlab.example.com/group/project
   GITLAB_PROJECT_ID: 12345
   ```

### Running Tests

#### Test Suites (Recommended)

**Navigate to:** Run Tests → Run Test Suite

Choose from 6 predefined test suites optimized for different use cases:

| Suite | Use Case | Description | Workers | Reruns | Time |
|-------|----------|-------------|---------|--------|------|
| **sanity** | DevOps CI/CD | Fastest - API sanity checks for deployment validation | 8 | 2 | ~2 min |
| **smoke** | Local Dev | All smoke tests (API + UI) for rapid feedback | 8 | 2 | 8-12 min |
| **smoke-api** | Local Dev | API-only smoke tests - fast backend validation | 8 | 2 | 3-5 min |
| **smoke-ui** | Local Dev | UI-only smoke tests - critical user paths | 4 | 2 | 3-5 min |
| **api** | QA Regression | Full API regression (parallel-safe tests) | 10 | 2 | 30-45 min |
| **ui** | QA UI Tests | Full UI regression with Playwright | 4 | 2 | 20-30 min |
| **opensource** | Feature Testing | Non-enterprise (open-source) features | 10 | 2 | 25-35 min |
| **enterprise** | Feature Testing | Enterprise-only features | 10 | 2 | 15-25 min |

**Interactive Flow:**

1. Select suite from the list with descriptions
2. Configure number of parallel workers (default provided)
3. Configure number of reruns on failure (default provided)
4. Review execution summary with marks, workers, and reruns
5. Confirm to start execution
6. Tests run with live output
7. See completion status

**Example: Running Smoke Tests**

```
? Select a test suite:
❯ smoke        - Quick smoke tests for local development
  sanity       - Sanity check for DevOps CI/CD pipelines
  api          - Full API regression suite
  [...]

? Number of parallel workers: 8
? Number of test reruns on failure: 2

Running test suite: smoke
Description: Quick smoke tests for local development
Marks: smoke
Workers: 8
Reruns: 2

? Proceed with test execution? Yes

[pytest output...]

✓ Test execution completed!
```

#### Capability and Setting Gating

A test can declare what it needs: `@pytest.mark.requires_capability("retrieval")` (a component of `GET /v1/config`) or `@pytest.mark.requires_setting("JIRA_URL")` (a harness setting; an integration name such as `jira` expands to its keys). In a **gated run** a test whose need is missing is skipped, and the reason names it: `missing capability 'retrieval'` or `missing setting 'JIRA_URL'`. The terminal summary groups these skips by reason.

Most tests need no declaration, because their existing markers count:

- `datasource` needs the `retrieval` capability.
- An integration marker needs that integration's settings, so a suite tests the integrations you configured and skips the others. For example, with `SERVICENOW_URL` and `SERVICENOW_TOKEN` set, the `servicenow` tests run; without them, they are skipped.

| Integration marker | Settings |
|---|---|
| `jira` / `jira_cloud` | `JIRA_URL`, `JIRA_TOKEN` / `JIRA_CLOUD_URL`, `JIRA_CLOUD_TOKEN` |
| `confluence` / `confluence_cloud` | `CONFLUENCE_URL`, `CONFLUENCE_TOKEN` / `CONFLUENCE_CLOUD_URL`, `CONFLUENCE_CLOUD_TOKEN` |
| `gitlab` | `GITLAB_URL`, `GITLAB_TOKEN` |
| `github` | `GITHUB_TOKEN` |
| `ado` | `AZURE_DEVOPS_URL`, `AZURE_DEVOPS_TOKEN` |
| `servicenow` | `SERVICENOW_URL`, `SERVICENOW_TOKEN` |
| `xwiki` | `XWIKI_URL` |
| `keycloak` | `KEYCLOAK_URL`, `KEYCLOAK_CLIENT_SECRET` |
| `report_portal` | `REPORT_PORTAL_URL`, `REPORT_PORTAL_API_KEY` |
| `kubernetes` | `KUBERNETES_URL`, `KUBERNETES_TOKEN` |
| `telegram` | `TELEGRAM_TOKEN` |
| `aws` | `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_REGION` |
| `azure` | `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_SUBSCRIPTION_ID` |
| `gcp` | `GCP_SA_KEY_BASE64` |

Tests of other integrations (Sonar, e-mail, Elasticsearch, SQL, InfluxDB) are not gated yet and run as before.

A test that needs something its markers do not say carries an explicit declaration. Example: a Git tools test creates a code datasource, so it has `requires_capability("retrieval")` without the `datasource` marker, which would add it to the datasource suites. A test can carry several markers; it runs only when all of its needs are met.

| Run | Gated |
|---|---|
| `codemie-test-harness run <suite>`, bare `run`, `pytest -m ...` over the whole test path | yes |
| `run --marks ...` (passes `--no-gate`), a path, `-k`, a node id | no - tests show their real result |

Add `--no-gate` to a raw `pytest` run to turn the gate off.

A `MissingRequiredSettingError` in a gated test also becomes a skip. Add `--strict` (`--strict-requirements` for pytest, or `HARNESS_STRICT=1`) to fail instead of skip.

| Capability | `/v1/config` component ids (any enabled) |
|---|---|
| `retrieval` | `features:knowledgeBases`, `features:datasources`, `features:codeIndexing` |

The tables live in `codemie_test_harness/capability_gate.py` (`CAPABILITIES`, `INTEGRATION_SETTINGS`). A name that is not a key of `CAPABILITIES` is read as a `/v1/config` component id (for example `requires_capability("features:webSearch")`). A component missing from `/v1/config` counts as unavailable. The run reads `GET /v1/config` once at start; if that fails, it exits with code 2 before any test.

**Minimal standalone run** (no AWS, no secret store):

```bash
export CODEMIE_API_DOMAIN=https://your-codemie.example.com AUTH_USERNAME=... AUTH_PASSWORD=...
codemie-test-harness run smoke-api --strict
```

#### Running by Custom Marks

**Navigate to:** Run Tests → Run with Custom Marks

**Interactive Flow:**

1. **Optional:** View available marks first
   - Choose format: List view (simple) or Table view (with file details)
2. Enter pytest marks expression with logical operators
3. Configure workers and reruns
4. Review summary and confirm
5. Execute tests

**Common Mark Examples:**

```
# Single mark
api

# Multiple marks with AND
smoke and api

# Multiple marks with OR
jira or confluence

# Exclude marks with NOT
api and not ui

# Complex expressions with parentheses
(gitlab or github) and code_kb

# Multiple exclusions
api and not (ui or not_for_parallel_run)
```

**📋 Available Marks by Category:**

Before running custom marks, view all available marks:
```bash
codemie-test-harness marks          # List view
codemie-test-harness marks --verbose # Detailed view with file locations
```

**🏗️ Architecture**
- `api` - API integration tests
- `ui` - UI tests with Playwright
- `mcp` - Model Context Protocol tests

**💨 Speed**
- `smoke` - Quick smoke tests
- `sanity` - Sanity checks (fastest)

**🔐 License**
- `enterprise` - Enterprise features
- `opensource` - Non-enterprise features (implied by absence of `enterprise`)

**🔗 Integrations**
- `gitlab`, `github`, `git` - Version control systems
- `jira`, `jira_cloud` - JIRA integrations
- `confluence`, `confluence_cloud` - Confluence integrations
- `ado` - Azure DevOps
- `servicenow` - ServiceNow

**📚 Knowledge Bases**
- `jira_kb` - JIRA knowledge base tests
- `confluence_kb` - Confluence knowledge base tests
- `code_kb` - Code knowledge base tests

**🤖 Features**
- `assistant` - Assistant functionality
- `workflow` - Workflow execution
- `llm` - LLM model tests
- `datasource` - Datasource management
- `conversations` - Conversation API

**⚠️ Special**
- `not_for_parallel_run` - Sequential execution required

### Interactive Features

#### Configuration Management

**List Settings**
- View all configured settings
- Sensitive values are masked by default
- See total count of configured values

**Set Specific Value**
- Set any configuration key manually
- Autocomplete suggestions for common keys
- Secure password input for sensitive values

**Get Specific Value**
- View a single configuration value
- Shows masked value for sensitive keys

**Unset Specific Value**
- Remove specific configuration keys
- Confirmation prompt before removal

#### Assistant Chat

**Navigate to:** Chat with Assistant

**Features:**
- Start new conversations or continue existing ones
- Stream responses in real-time
- Langfuse tracing support
- Interactive message input

**Usage:**
1. Enter assistant ID
2. Optional: Enter conversation ID to continue previous chat
3. Optional: Enable streaming or Langfuse tracing
4. Type your message
5. View assistant response
6. Continue conversation

#### Workflow Execution

**Navigate to:** Execute Workflow

**Features:**
- Execute workflows by ID
- Provide user input
- Custom execution IDs
- View execution results

**Usage:**
1. Enter workflow ID
2. Optional: Provide user input for the workflow
3. Optional: Specify custom execution ID
4. Execute and view results

### Configuration File Reference

All configuration is stored in: `~/.codemie/test-harness.json`

**Priority Order** (highest to lowest):
1. CLI flags (temporary, for single run)
2. Environment variables (set in the shell)
3. Configuration file (`~/.codemie/test-harness.json`). It fills only variables that are not already set.
4. `.env` file
5. AWS Parameter Store (only if enabled)
6. Default value given by the code
7. Not configured: `get_parameter` returns the default (`""` if none is given); `get_required_parameter` fails the test with `MissingRequiredSettingError` naming the setting

**Viewing the file:**
```bash
cat ~/.codemie/test-harness.json | jq
```

**Manual editing** (advanced):
```bash
# Backup first
cp ~/.codemie/test-harness.json ~/.codemie/test-harness.json.backup

# Edit with your preferred editor
nano ~/.codemie/test-harness.json
```

**Resetting configuration:**
```bash
rm ~/.codemie/test-harness.json
codemie-test-harness  # Start fresh
```

---

## Complete Example: First Test Run

Here's a complete walkthrough for first-time users:

**1. Install**
```bash
pip install codemie-test-harness
```

**2. Launch interactive mode**
```bash
codemie-test-harness
```

**3. Configure (first time only)**
```
Select: ⚙️ Configuration
Select: Setup (Quick Configuration)
Choose: Preview environment
Accept defaults for Auth Server, Client ID, Realm
Enter: Your Client Secret
Choose: Use existing AWS profile (or enter credentials)
Confirm configuration
```

**4. Run tests**
```
Select: 🚀 Run Tests
Select: Run Test Suite
Choose: smoke (Quick smoke tests)
Workers: 8 (press Enter for default)
Reruns: 2 (press Enter for default)
Confirm: Yes
Wait: 5-10 minutes
Result: See test results!
```

**5. Explore results**
- Check `~/.codemie/test-harness.json` for saved configuration
- Test results are displayed in terminal
- `junit.xml` and `results.json` are written to `./codemie-test-reports/` (see "Test results")
- If ReportPortal is configured, view results there

---

## Part 2: Running with pytest

For contributors working from the repository or users preferring direct pytest commands.

### Licensing

Every tracked `.py` file under `test-harness/` must carry the Apache-2.0 licence header from `scripts/license_template.txt` in its first 50 lines (shebang and coding cookie stay above it).

- `make license-check` lists files without the header and exits 1 if any are found.
- `make license-fix` inserts the header.
- `make license-scan` checks dependency licences against `allow-only` in `[tool.pip-licenses]` in `pyproject.toml`.

To except a dependency from the scan, add it to `ignore-packages` in `pyproject.toml` with a comment that gives the reason. The change is reviewed in the PR. Do not exempt copyleft or doubtful licences without that review.

### Installation for Contributors

**1. Clone the repository:**

```bash
git clone <repository-url>
cd test-harness
```

**2. Install:**

```bash
make install
```

This runs `poetry install`, so `codemie-sdk-python` is the version pinned in
`poetry.lock` — the same as CI (build-codemie-autotests-python). To reproduce a
bug against a specific SDK release:

```bash
make install SDK_VERSION=0.1.648
```

This never writes to `pyproject.toml` or `poetry.lock` — they only change
what's installed in the virtualenv.

**3. Install the pre-commit hook (recommended):**

```bash
make install-hooks
```

This runs `ruff check` and `ruff format --check` on staged `test-harness/*.py`
files before each commit, catching lint/format issues (like the CI
`build-codemie-autotests-python` job would) before they reach a pull request.
It is a plain git hook, not the `pre-commit` framework — no extra dependency
— and only touches files under `test-harness/`, so it is safe alongside the
other `codemie-sdk` subprojects that share the same `.git/hooks` directory.

**Working against an unpublished SDK change:**

The SDK is developed in <https://github.com/codemie-ai/codemie-sdk>, not in
this repository. The harness always installs the published
`codemie-sdk-python`. If you need an SDK change that is not released yet,
install your local clone on top of the Poetry environment:

```bash
poetry run pip install -e <path-to-codemie-sdk>/sdk/codemie-python
```

This changes only the virtualenv, not `pyproject.toml` or `poetry.lock`. Run
`make install` again to go back to the published SDK. `pip` may print a
dependency-conflict warning for `codemie-sdk-python`; it does not break the
environment. Before you merge, release the SDK change and bump the SDK pin in
`pyproject.toml` (and relock).

#### Publishing: SDK dependency pin

`test-harness/pyproject.toml` pins `codemie-sdk-python` to one exact PyPI
version (`0.1.705`) instead of a local path dependency, so a real user of
`codemie-test-harness` installs the same published SDK a contributor tests
against (see [Installation for Contributors](#installation-for-contributors)).

**Where each package is published.**

- `codemie-sdk-python` is published from GitHub
  (<https://github.com/codemie-ai/codemie-sdk>), by the `publish-python.yml`
  workflow on a release tag `python-vX.Y.Z`. The tag names the version, and it
  must be on the base line (`MAJOR.MINOR`) set in the SDK's `pyproject.toml`.
  That base line is `0.1` now. The latest release is `0.1.705`.
- `codemie-test-harness` is still published from this repository, by a Tekton
  pipeline (`build-codemie-sdk-main-*`) in KubeRocketCI, namespace
  `edp-delivery`. On GitLab it surfaces as the
  `auto_epmd-edp_vcs` bot's "Build Pipeline" status on the merge commit. This
  repo has no read access to that pipeline's configuration, so what follows
  about it is inferred from PyPI, not from its source.
- The two version numbers are no longer the same: the harness has its own
  `0.1.N` build number (`0.1.707` on 2026-10-19), the SDK has the GitHub tag
  (`0.1.698`).

**Why an exact pin.** The SDK ships every release, breaking ones included, on
the `0.1.x` line. A range would let `uvx codemie-test-harness` install SDK
releases the harness was never tested against, and CI runs from the lock and
would not catch it. Bump the pin (and relock) when the harness needs a newer SDK.

**Post-merge verification checklist** (run once after the first `main` build
following a change to this dependency):

- The GitLab "Build Pipeline" status is PASSED on the merge commit.
- `codemie-test-harness` has a new `0.1.N` release on PyPI.
- The published harness's `requires_dist` shows `codemie-sdk-python==0.1.N` with
  an `N` that exists for the SDK on PyPI. It must not show a local
  `@ file://...` path:

  ```bash
  curl -s https://pypi.org/pypi/codemie-test-harness/json \
    | python3 -c "import json,sys; print([r for r in json.load(sys.stdin)['info']['requires_dist'] if 'sdk' in r])"
  ```

- `uvx codemie-test-harness --help` installs and runs against the newly
  published package.

**3. Install Playwright browsers (for UI tests):**

```bash
playwright install
```

### Configuration with .env File

Create a `.env` file in the `codemie_test_harness` directory. If no `.env` exists, the harness
falls back to the shipped `.env.template` (defaults for a local stack: `localhost:8080`, `admin@codemie.ai`),
so `uvx codemie-test-harness` works against a local stack without setup. Copy the template to `.env`
to override values.

#### Configuration for Localhost

**Minimal localhost setup:**

```properties
CODEMIE_API_DOMAIN=http://localhost:8080
TEST_USER_FULL_NAME=dev-codemie-user


# Integration settings you need, for example:
# GITLAB_URL=<url>
# GITLAB_TOKEN=<token>
```

AWS is optional: see [Settings sources and secret store](#settings-sources-and-secret-store).

#### Configuration for Preview/Production

**Full remote setup:**

```properties
# API Configuration
CODEMIE_API_DOMAIN=https://codemie.example.invalid/code-assistant-api

# Authentication
AUTH_SERVER_URL=https://auth.example.com/
AUTH_CLIENT_ID=<client_id>
AUTH_REALM_NAME=<realm>
AUTH_USERNAME=<username>
AUTH_PASSWORD=<password>
# Keycloak provisioning account (master realm). Only needed by tests that create
# or delete temporary platform users (budgets, projects, roles, ...).
KEYCLOAK_ADMIN_USERNAME=<provisioning_account>
KEYCLOAK_KEY=<provisioning_account_password>

# Optional: Test configuration
DEFAULT_TIMEOUT=60
CLEANUP_DATA=True

# Optional: UI Testing
FRONTEND_URL=https://codemie.example.invalid
HEADLESS=True
```

#### Integration Configuration

Configure integrations in `.env`, with `config set`, or with the opt-in AWS Parameter Store.

**Version Control:**

```properties
GIT_ENV=gitlab  # or github

# GitLab
GITLAB_URL=https://gitlab.example.com
GITLAB_TOKEN=<token>
GITLAB_PROJECT=https://gitlab.example.com/group/project
GITLAB_PROJECT_ID=12345

# GitHub
GITHUB_URL=https://github.com
GITHUB_TOKEN=<token>
GITHUB_PROJECT=https://github.com/org/repo

# Azure DevOps
AZURE_DEVOPS_URL=https://dev.azure.com
AZURE_DEVOPS_ORGANIZATION_NAME=org
AZURE_DEVOPS_PROJECT_NAME=project
AZURE_DEVOPS_TOKEN=<personal_access_token>
```

VCS tool tests create a persistent seed in each configured repository on first run and reuse it afterwards: a GitHub issue named `CodeMie Test Harness Seed Issue`, a GitLab MR named `CodeMie Test Harness Seed MR` (from a branch/file pair also named for the harness), and an Azure DevOps PR named `CodeMie Test Harness Seed PR`. Do not delete, merge or close these; cleanup never removes them.

**Project Management:**

```properties
# JIRA Server
JIRA_URL=https://jira.example.com
JIRA_TOKEN=<token>
# project for the seed issue
JIRA_PROJECT_KEY=PROJ
# optional; otherwise discovered
# JIRA_CUSTOM_FIELD_1=customfield_10010
# JIRA_CUSTOM_FIELD_2=customfield_10011

# JIRA Cloud
JIRA_CLOUD_URL=https://company.atlassian.net
JIRA_CLOUD_EMAIL=user@company.com
JIRA_CLOUD_TOKEN=<api_token>
# project for the seed issue
JIRA_CLOUD_PROJECT_KEY=PROJ
# JIRA_CLOUD_CUSTOM_FIELD_1 / JIRA_CLOUD_CUSTOM_FIELD_2 work like the Server ones

# Confluence Server
CONFLUENCE_URL=https://confluence.example.com
CONFLUENCE_TOKEN=<token>
# space for the seed page
CONFLUENCE_SPACE_KEY=SPACE

# Confluence Cloud
CONFLUENCE_CLOUD_URL=https://company.atlassian.net/wiki
CONFLUENCE_CLOUD_EMAIL=user@company.com
CONFLUENCE_CLOUD_TOKEN=<api_token>
# space for the seed page
CONFLUENCE_CLOUD_SPACE_KEY=SPACE

# xWiki
XWIKI_URL=https://xwiki.example.com/xwiki
XWIKI_TOKEN=<token>
# space for the seed page
XWIKI_SPACE=SPACE
```

**Google Docs Datasource:**

```properties
# Document used by the Google Docs datasource tests. Must be readable by
# the service account configured for the Google OAuth
# integration (see google_oauth_credentials in credentials_manager.py). The
# expected-content assertions in google_datasource_test_data.py depend on
# this document's content, so update them too if you point this at a
# different document. A UI test (create_edit_datasource_page.py's
# should_see_google_fields) separately asserts that the product's own
# "View Format Example" link points at this same URL, so it must also equal
# whatever example document the product UI links to — not just any document
# with matching content. Falls back to AWS Parameter Store
# (/codemie/autotests/integrations/google_docs, key document_url) when unset.
GOOGLE_DOC_URL=https://docs.google.com/document/d/<doc-id>/edit
```

**Quality Assurance:**

```properties
# Report Portal
REPORT_PORTAL_URL=https://reportportal.example.com
REPORT_PORTAL_PROJECT=PROJECT
REPORT_PORTAL_API_KEY=<api_key>
```

Jira tests create a persistent seed issue named `CodeMie Test Harness Seed Issue` in the configured project on first run (issue type `Task`) and reuse it afterwards. Two plain-text custom fields on the project are discovered and filled with `harness-cf-1` / `harness-cf-2`. Do not delete or edit that issue; cleanup never removes it.

Confluence tests create a persistent seed page named `CodeMie Test Harness Seed Page` in the configured space on first run and reuse it afterwards. Do not delete or edit that page; cleanup never removes it.

xWiki tests write a seed page named `CodeMie Test Harness Seed Page` into the configured `XWIKI_SPACE` on every run, with a known token value. The page is rewritten with the same content each time, so repeated runs never create duplicates. The datasource tests assert against that token, and they are skipped when `XWIKI_URL` is not set. Do not edit that page.

Azure DevOps tests create persistent seed data in the configured project on first run and reuse it afterwards: work items `CodeMie Test Harness Seed Work Item` and `CodeMie Test Harness Seed Parent Work Item` (with a comment), wiki pages `CodeMie Test Harness Seed Parent Page` and `CodeMie Test Harness Seed Child Page` (with two comments), and test plan `CodeMie Test Harness Seed Test Plan`. The datasource work-items query matches only the seed work item. Do not delete or edit these items; cleanup never removes them. Creating the test plan needs a token with Test Plans write access.

Cloud tool tests (AWS, GCP, Kubernetes) create nothing. Instead of asserting on full listings of the shared account/cluster, each one is narrowed to one existing, long-lived resource: S3 bucket `codemie-bucket`, Cloud Storage bucket `009fb622-4e29-42aa-bafd-584c61f5e1e1` and service `argo-cd-argocd-server` in namespace `argocd`. The "list" prompts still ask for all buckets/services but assert only on that resource, and the direct-tool tests query it directly. Expected values (creation date, region, generation, etag, timestamps, UIDs, resourceVersion, ...) are read from the live resource at session start, so read access is enough. Do not delete or edit these resources. Set `verifySsl: false` in the `/codemie/autotests/integrations/kubernetes` parameter if the cluster API uses a private CA (or `KUBERNETES_VERIFY_SSL=false` locally).

Report Portal tests create a persistent seed launch named `CodeMie Test Harness Seed Launch` in the configured project on first run, with one passed, one failed and one skipped test item, and reuse it afterwards. Expected pass/fail/skip counts and duration are read from that launch instead of being hardcoded, so the tests no longer break when the project's real launches are rerun and replaced. Do not delete or edit that launch; cleanup never removes it.

Keycloak tool tests create a persistent seed user `codemie-test-harness-seed@example.com` (first name `CodeMie`, last name `Test Harness Seed`) in the realm configured by `KEYCLOAK_URL` / `KEYCLOAK_REALM` on first run and reuse it afterwards, using the `KEYCLOAK_CLIENT_ID` / `KEYCLOAK_CLIENT_SECRET` client, whose service account must be allowed to manage users. The "get all users" tests ask for all users but assert only on the seed user (ID and creation timestamp are read from the live user), so they no longer break when other users are added to or removed from the realm. Do not delete or edit that user; cleanup never removes it.

InfluxDB data-management tool tests write a fresh point into a `codemie_harness_seed` measurement at session start and query it back to confirm the write landed, instead of relying on a point hand-seeded once into a sandbox-only instance. The query task and expected response are read from that point, so an InfluxDB retention-policy expiry or a sandbox reset never leaves the fixture stale. Other Database-backed MCP tool tests (PostgreSQL, SQLite) were audited for the same hand-seeded/personal-data pattern and use only generic, synthetic fixture data already; no further instances were found.

Sonar tests (`CodeBaseTool.SONAR` / `SONAR_CLOUD`) create no seed project. The SonarQube project behind these tests is the live codemie codebase, and the SonarCloud project is a third-party GitHub repo, so neither can be frozen; instead the direct-tool tests assert on the *shape* of an `/api/issues/search` response (required fields, their types, and Sonar's documented enum values for severity/status/type) via `sonar_seed.assert_issue_search_response`, rather than on a hardcoded snapshot of counts, issue keys or dates that a rescan would invalidate. The assistant/workflow-level Sonar tests already asked only whether the assistant has Sonar access, so they needed no change.

**Credential Priority:** see [Settings sources and secret store](#settings-sources-and-secret-store).

### Settings sources and secret store

The harness takes every setting from a source you control. Highest priority first:

1. Environment variable.
2. Config file `~/.codemie/test-harness.json` (`codemie-test-harness config set KEY VALUE`). It fills only variables that are not already set.
3. `.env` file.
4. AWS Parameter Store, only if you enable it.
5. Default given by the code.
6. Not configured: `CredentialsManager.get_parameter(key, default)` returns the default (`""` if none is given). A test that cannot run without a setting calls `CredentialsManager.get_required_parameter(key)`, which raises `MissingRequiredSettingError` naming the setting.

A downloaded `.env` is applied in memory and never written to disk, so a rotated value applies on the next run. It never overwrites or removes a value that is already set.

**AWS Parameter Store (opt-in).** The store is used only when `HARNESS_SECRET_STORE=aws-parameter-store`. If AWS variables such as `AWS_PROFILE` are set in your shell but this setting is not, the harness makes no AWS call and assumes no role. Settings:

| Setting | Required | Purpose |
|---|---|---|
| `HARNESS_SECRET_STORE` | yes | Set to `aws-parameter-store` to enable the store |
| `AWS_PS_REGION` | when enabled | AWS region of the store |
| `AWS_PS_PATH_PREFIX` | when enabled | Prefix of the parameter names (for example `/my-team/integrations/`); leading and trailing slashes are added if missing. A setting group such as `jira` is read from `<prefix>jira` as a JSON document |
| `AWS_PS_ROLE_ARN` | no | Role to assume before reading. A role is assumed only if this is set |
| `AWS_PS_DOTENV_PATH` | no | Full name of a parameter that holds a `.env` file. It is downloaded at start. If unset, nothing is downloaded |

Store credentials are `AWS_PROFILE`, or `AWS_ACCESS_KEY` and `AWS_SECRET_KEY` (with an optional `AWS_SESSION_TOKEN`). The harness reads them only when the store is enabled. These settings are listed by `codemie-test-harness config` in the `secret-store` category.

If the store is enabled and a required setting is missing, the store is unreachable, or it rejects the credentials, the run stops before any test. The message names the store, region, prefix and reason, for example `Secret store 'aws-parameter-store' failed (region=..., prefix=...): ...`. A single missing parameter or JSON path is not a failure: that setting is "not configured".

Scheduled jobs that read the shared store must set `HARNESS_SECRET_STORE`, `AWS_PS_REGION`, `AWS_PS_PATH_PREFIX`, `AWS_PS_ROLE_ARN` and `AWS_PS_DOTENV_PATH` in the job environment.

### Internal-value scan

`scripts/scan_internal_values.py` checks the tracked files under `test-harness/` for blocked internal values (hosts, email domains, ticket-key patterns, customer names). The script has no built-in patterns. You supply them at run time and keep them outside the repository:

- `HARNESS_SCAN_PATTERNS`: regular expressions (Python `re` syntax), matched case-insensitively.
- `HARNESS_SCAN_CUSTOMER_NAMES`: customer names. Each name is a case-insensitive literal, not a regex.

Format for both: a newline-separated list, one entry per line. Blank lines and lines that start with `#` are ignored. The value is either the list itself or the path to a file that holds the list.

```bash
export HARNESS_SCAN_PATTERNS=~/private/harness-scan-patterns.txt
export HARNESS_SCAN_CUSTOMER_NAMES=~/private/harness-scan-customers.txt
make scan-internal
```

The scan prints `file:line: [rule]` for each match. It does not print the matched text. Exit codes: `0` clean, `1` at least one match, `2` no pattern configured (the scan never passes silently). The paths `docs/superpowers/**`, `qa-factory/**`, `.claude/**`, `.codegraph/**`, `test_screenshots/**`, `AGENTS.md` and `CLAUDE.md` are not scanned.

The pre-commit hook (`make install-hooks`) runs the scan on every commit. If neither variable is set, the hook prints a notice and skips the scan; the commit goes on. If a match is found, the commit stops.

### Running Tests with pytest

#### Test Suites with pytest

Run the same test suites using pytest directly:

**Smoke Tests (Local Development)**

```bash
# All smoke tests (API + UI)
pytest -n 8 -m "smoke" --reruns 2

# API smoke tests only (fast backend validation)
pytest -n 8 -m "smoke and api and not ui" --reruns 2

# UI smoke tests only (critical user paths)
pytest -n 4 -m "smoke and ui" --reruns 2
```

**Sanity Tests (CI/CD)**

```bash
pytest -n 8 -m "sanity" --reruns 2
```

**Full API Regression**

```bash
# Parallel-safe tests
pytest -n 10 -m "api" --reruns 2

# Sequential tests (run separately)
pytest -m "api and not_for_parallel_run" --reruns 2
```

**UI Tests**

```bash
pytest -n 4 -m "ui" --reruns 2
```

**Open Source Features**

```bash
pytest -n 10 -m "not enterprise and api" --reruns 2
```

**Enterprise Features**

```bash
pytest -n 10 -m "enterprise" --reruns 2
```

#### Test Suite Comparison

| Suite | CLI Command | pytest Command                                        |
|-------|-------------|-------------------------------------------------------|
| **sanity** | `codemie-test-harness run sanity` | `pytest -n 8 -m "sanity" --reruns 2`                  |
| **smoke** | `codemie-test-harness run smoke` | `pytest -n 8 -m "smoke" --reruns 2`                   |
| **api** | `codemie-test-harness run api` | `pytest -n 10 -m "api" --reruns 2`                    |
| **ui** | `codemie-test-harness run ui` | `pytest -n 4 -m "ui" --reruns 2`                      |
| **opensource** | `codemie-test-harness run opensource` | `pytest -n 10 -m "not enterprise and api" --reruns 2` |
| **enterprise** | `codemie-test-harness run enterprise` | `pytest -n 10 -m "enterprise" --reruns 2`             |

#### Custom Mark Selection with pytest

**Single Mark:**

```bash
pytest -n 8 -m "gitlab" --reruns 2
```

**AND Operator (both marks required):**

```bash
pytest -n 8 -m "api and jira" --reruns 2
pytest -n 4 -m "gitlab and code_kb" --reruns 2
```

**OR Operator (either mark):**

```bash
pytest -n 8 -m "jira or confluence" --reruns 2
pytest -n 6 -m "jira_kb or confluence_kb" --reruns 2
```

**NOT Operator (exclude marks):**

```bash
pytest -n 10 -m "api and not ui" --reruns 2
pytest -n 8 -m "not not_for_parallel_run" --reruns 2
```

**Complex Expressions:**

```bash
# Multiple conditions with parentheses
pytest -n 8 -m "(gitlab or github) and code_kb" --reruns 2

# Exclude multiple marks
pytest -n 10 -m "api and not (ui or not_for_parallel_run)" --reruns 2

# Knowledge base tests only
pytest -n 8 -m "(jira_kb or confluence_kb or code_kb)" --reruns 2
```

#### Common Testing Scenarios

**Testing Specific Integrations:**

```bash
# GitLab integration
pytest -n 8 -m "api and gitlab" --reruns 2

# JIRA integration
pytest -n 8 -m "api and jira" --reruns 2

# Confluence integration
pytest -n 8 -m "api and confluence" --reruns 2

# All Git providers
pytest -n 8 -m "gitlab or github or git" --reruns 2
```

**Testing Specific Components:**

```bash
# Workflows
pytest -n 8 -m "api and workflow" --reruns 2

# Assistants
pytest -n 8 -m "api and assistant" --reruns 2

# LLM models
pytest -n 8 -m "api and llm" --reruns 2

# MCP (Model Context Protocol)
pytest -n 8 -m "api and mcp" --reruns 2
```

**Testing Without Full Backend:**

```bash
# Exclude MCP tests (when mcp-connect is not running)
pytest -n 8 -m "api and not mcp" --reruns 2
```

#### pytest Flags Explained

| Flag | Description | Example |
|------|-------------|---------|
| `-n <number>` | Number of parallel workers (pytest-xdist) | `-n 8` |
| `-m "<expression>"` | Select tests by marks | `-m "api and not ui"` |
| `--reruns <number>` | Retry failed tests N times (pytest-rerunfailures) | `--reruns 2` |
| `--count <number>` | Run each test N times (pytest-repeat) | `--count 50` |
| `--timeout <seconds>` | Per-test timeout in seconds (pytest-timeout) | `--timeout 600` |
| `-v` | Verbose output | `-v` |
| `-s` | Show print statements | `-s` |
| `-x` | Stop on first failure | `-x` |
| `--lf` | Run last failed tests | `--lf` |
| `--reportportal` | Report results to ReportPortal | `--reportportal` |

#### Test Timeout Configuration

Control per-test timeout to prevent hanging tests.

**In .env file:**

```properties
TEST_TIMEOUT=600  # 10 minutes per test
```

**Via pytest command:**

```bash
# Set timeout for this run
pytest -n 8 -m "api" --timeout 900 --reruns 2

# Disable timeout (debugging only)
pytest -m "slow_tests" --timeout 0
```

**Default:** 300 seconds (5 minutes) per test

When a test exceeds the timeout:
- Test is terminated immediately
- Marked as FAILED with timeout message
- Stack trace shows where execution stopped
- Other tests continue normally

#### UI Tests with Playwright

**Install browsers (one-time):**

```bash
playwright install
```

**Run UI tests:**

```bash
pytest -n 4 -m "ui" --reruns 2
```

**Headless mode:**

Set `HEADLESS=True` in `.env` or:

```bash
HEADLESS=True pytest -n 4 -m "ui" --reruns 2
```

#### Test results (JUnit XML and JSON)

Every run started through `codemie-test-harness` writes two files to a results
folder: `junit.xml` (pytest `--junitxml`) and `results.json`.

- Default folder: `codemie-test-reports/` under the directory you start the command from.
- `--results-dir PATH` sets another folder. A relative path is resolved against
  your current directory. If the folder cannot be created or written, the run
  stops with exit code 1 before any test starts.
- `--no-junit-xml` skips `junit.xml`. `--no-json` skips `results.json`. With both
  flags no folder is created.
- Unless both formats are off, each run first deletes `junit.xml` and
  `results.json` of an earlier run from the folder, also for a format that is
  turned off. A file in the folder is then always from the current run. With
  `--no-junit-xml --no-json` nothing is created or deleted.
- If you pass `--junitxml=...` as an extra pytest argument, your file is used and
  the harness does not write its own `junit.xml`. `results.json` is not affected.
- `duration` in `results.json` is setup + call + teardown, like `time` in
  `junit.xml`. For a test that was rerun it is the sum of all attempts, also like
  `junit.xml`. If a test fails in the call and again in teardown, it stays `failed`.
- ReportPortal: screenshots of failed UI tests are sent to ReportPortal when the
  `pytest-reportportal` plugin is active for the run. The plugin reads the endpoint
  and the project from `--rp-endpoint` / `--rp-project` or the `rp_endpoint` /
  `rp_project` ini keys, and the API key from `RP_API_KEY` (or `RP_UUID`) in the
  environment.
- The exit code of pytest is not changed.

```bash
codemie-test-harness run smoke --results-dir ./out
codemie-test-harness --smoke --no-json
```

`results.json` has this shape. A test that is rerun appears once, with its final
outcome and the number of `reruns`. Skipped and xfail tests are `skipped`;
setup, teardown and collection failures are `error`. A test that started but did
not finish (Ctrl-C, cancelled job) is also `error`. A module skipped at collection
is one `skipped` entry.

`collected` is the number of tests selected to run and `exitstatus` is the pytest
exit code. The run is complete only when `exitstatus` is 0 or 1 and `total` is not
less than `collected`.

```json
{
  "summary": {"total": 2, "collected": 2, "exitstatus": 0, "passed": 1, "failed": 0, "skipped": 1, "error": 0},
  "tests": [
    {"nodeid": "path/test_a.py::test_x", "outcome": "passed", "duration": 1.2, "reruns": 1}
  ]
}
```

Unit tests of the harness itself (no live platform needed):

```bash
make unit-test   # poetry run pytest -c unit_tests/pytest.ini unit_tests
```

#### ReportPortal Integration

**Configure the API key in .env** (the pinned `pytest-reportportal==5.5.2` only reads
`RP_API_KEY` from the environment — `RP_ENDPOINT` and `RP_PROJECT` are **not** read
from `.env` and must be passed as CLI flags or set in `pytest.ini`, see below):

```properties
RP_API_KEY=<api_key>
```

**Run with ReportPortal:**

```bash
pytest -n 10 -m "api" --reruns 2 --reportportal \
  --rp-endpoint="https://reportportal.example.com" \
  --rp-project="codemie_tests"
```

## Troubleshooting

### Common Issues

**"Command not found: codemie-test-harness"**
- Run `pip install codemie-test-harness` or use `uvx codemie-test-harness`
- Check that pip's bin directory is in your PATH

**"Authentication failed"**
- Verify AUTH_CLIENT_SECRET is correct
- Check AUTH_SERVER_URL is accessible
- For localhost, authentication is automatically skipped

**"AWS Parameter Store access denied"**
- Verify AWS credentials with `aws sts get-caller-identity`
- Check that your AWS user has Parameter Store read permissions
- Required path: `<AWS_PS_PATH_PREFIX>*` (the store is read only when `HARNESS_SECRET_STORE=aws-parameter-store`)
- The run stops before any test and the message names the store, region, prefix and reason

**"Tests hanging or timing out"**
- Check DEFAULT_TIMEOUT in configuration (default: 300 seconds)
- Increase timeout: `pytest --timeout 600 -m "slow_tests"`
- For debugging, disable timeout: `pytest --timeout 0`

**"Playwright browser not found"**
- Run `playwright install` to download browsers
- For specific browser: `playwright install chromium`

**"Integration tests failing"**
- Verify integration credentials in Configuration → Integrations Management
- Run validation: Configuration → Integrations Management → Validate Integrations
- Check if integration services (GitLab, JIRA, etc.) are accessible

**Stopping tests mid-run**
- Press `Ctrl+C` to gracefully stop pytest
- Running tests will complete their current test
- Cleanup happens automatically even on interrupt

**Configuration not persisting**
- Configuration is stored in `~/.codemie/test-harness.json`
- Check file permissions: `ls -la ~/.codemie/test-harness.json`
- Use Configuration → List Settings to verify saved values

## Quick Reference Card

### Most Common Commands

```bash
# Interactive mode (easiest)
codemie-test-harness

# Quick test runs
codemie-test-harness run sanity     # Fastest (2 min)
codemie-test-harness run smoke      # Quick (5-10 min)
codemie-test-harness run api        # Full regression (30-45 min)

# Configuration
codemie-test-harness config list    # View all settings
codemie-test-harness marks          # List available marks

# With pytest
pytest -n 8 -m "smoke" --reruns 2                    # Smoke tests
pytest -n 10 -m "api" --reruns 2                     # API tests
pytest -n 4 -m "ui" --reruns 2                       # UI tests
pytest -m "api and gitlab" --reruns 2                # GitLab tests
```

### Files & Paths

```bash
~/.codemie/test-harness.json        # Configuration file
~/.aws/credentials                  # AWS credentials
codemie_test_harness/.env           # Environment variables (for pytest)
```

### Quick Setup

```bash
# Install
pip install codemie-test-harness

# First run
codemie-test-harness                # Interactive setup wizard

# Or quick config
codemie-test-harness config set CODEMIE_API_DOMAIN http://localhost:8080
codemie-test-harness config set AWS_PROFILE my-profile
```

## Support

For issues, questions, or contributions:
- Create an issue in the repository


### Notes on settings names and the secret store

- Settings without a store mapping (the generic `LITE_LLM_API_KEY`, generic `MYSQL_*` / `POSTGRES_*` keys) are read from the environment or config only.
- Renamed settings: `SMTP_USERNAME/PASSWORD` are now `GMAIL_USER_EMAIL/PASSWORD`, and `MSSQL_*` are now `SANDBOX_MSSQL_*`. The old names still work from the environment and the config file.
- A downloaded `.env` (`AWS_PS_DOTENV_PATH`) is applied in memory only; it fills variables that are still unset and writes no file.
- At startup the store is probed with one `ssm:GetParameter` read under `AWS_PS_PATH_PREFIX` (a missing parameter is fine), so the role needs no other permission. With `AWS_PS_ROLE_ARN` the credentials are renewed once if they expire during a run.

