Metadata-Version: 2.4
Name: qatest
Version: 1.0.4
Summary: Test case management tool for uploading JSON test cases to QATest
Home-page: https://github.com/yourusername/qatest-cli
Author: QATest Team
Author-email: 
License-Expression: MIT
Project-URL: Homepage, https://github.com/yourusername/qatest-cli
Project-URL: Bug Reports, https://github.com/yourusername/qatest-cli/issues
Project-URL: Source, https://github.com/yourusername/qatest-cli
Keywords: testing,qa,test-cases,test-management,json-upload
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Testing
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.1.0
Requires-Dist: requests>=2.31.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: rich>=13.0.0
Requires-Dist: pyyaml>=6.0.0
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# QATest CLI

A command-line tool for validating and uploading JSON test cases to QATest management system.

## Features

- 🔍 **Validate** test case JSON files for correct structure and format
- 📤 **Bulk upload** test cases to QATest API with automatic batching
- 📁 **Recursive scanning** of directories for test case files
- 🎨 **Rich terminal output** with progress indicators and colored formatting
- ⚙️ **Configurable** via config files or command-line arguments

## Installation

```bash
pip install qatest
```

## Quick Start

### 1. Initialize Configuration

Create a configuration file with your project credentials:

```bash
qatest init <project_key>
```

This creates a `qatest-config.yml` file in your current directory.

### 2. Configure API Endpoint

Edit the generated `qatest-config.yml`:

```yaml
api_endpoint: https://your-api-endpoint.com
project_key: your-project-key
```

### 3. Validate Test Cases

Check your test case JSON files for correct structure:

```bash
qatest validate ./test_cases
```

### 4. Upload Test Cases

Upload validated test cases to QATest:

```bash
qatest upload ./test_cases
```

## Test Case Format

Test cases must be JSON files with the following structure:

```json
{
  "id": 442,
  "title": "User login flow",
  "description": "Test successful user authentication",
  "preconditions": "User account exists",
  "steps": [
    {
      "action": "Enter username and password",
      "expected_result": "Credentials are accepted"
    },
    {
      "action": "Click login button",
      "expected_result": "User is redirected to dashboard"
    }
  ]
}
```

**Required fields:**
- `id` (integer): Unique test case identifier
- `title` (string): Test case title
- `steps` (array): Test steps with `action` and `expected_result`

**Optional fields:**
- `description` (string): Detailed test description
- `preconditions` (string): Test prerequisites

## Commands

### `qatest init`

Initialize configuration file with project credentials:

```bash
qatest init <project_key> [--force]
```

Options:
- `--force`: Overwrite existing configuration

### `qatest validate`

Validate test case JSON files:

```bash
qatest validate <directory> [--pattern PATTERN]
```

Options:
- `--pattern`: File pattern to match (default: `*.json`)

### `qatest upload`

Upload test cases to QATest API:

```bash
qatest upload <directory> [OPTIONS]
```

Options:
- `--no-validate`: Skip validation before upload
- `--batch-size`: Number of test cases per API request (default: 50)
- `--config`: Path to custom configuration file

## Configuration

Configuration is managed through `qatest-config.yml`:

```yaml
api_endpoint: https://api.qatest.com  # Required
project_key: your-api-key             # Required
batch_size: 50                        # Optional (default: 50)
validate_first: true                  # Optional (default: true)
```

## Error Handling

The CLI provides detailed error messages for common issues:

- **Missing configuration**: Prompts to run `qatest init`
- **Invalid JSON**: Shows line numbers and parsing errors
- **Missing fields**: Lists all missing required fields
- **API errors**: Displays HTTP status codes and error details

## License

MIT License

## Support

For issues and feature requests, please visit the [GitHub repository](https://github.com/yourusername/qatest-cli).
