|
| 1 | +# Qase PHP Commons |
| 2 | + |
| 3 | +This module is an SDK for developing test reporters for Qase TMS. |
| 4 | +You should use it if you're developing your own test reporter for a special-purpose framework. |
| 5 | + |
| 6 | +To report results from tests using a popular framework or test runner, |
| 7 | +don't install this module directly and |
| 8 | +use the corresponding reporter module instead: |
| 9 | + |
| 10 | +* [PHPUnit](https://github.com/qase-tms/qase-php/tree/main/packages/qase-phpunit#readme) |
| 11 | + |
| 12 | +## Installation |
| 13 | + |
| 14 | +```bash |
| 15 | +composer require --dev qase/qase-php-commons |
| 16 | +``` |
| 17 | + |
| 18 | +## Configuration |
| 19 | + |
| 20 | +Qase PHP Reporters can be configured in multiple ways: |
| 21 | + |
| 22 | +- using a config file `qase.config.json` |
| 23 | +- using environment variables |
| 24 | + |
| 25 | +All configuration options are listed in the table below: |
| 26 | + |
| 27 | +| Description | Config file | Environment variable | Default value | Required | Possible values | |
| 28 | +|----------------------------------------------------------------------------------------------------------------------------|----------------------------|---------------------------------|-----------------------------------------|----------|----------------------------| |
| 29 | +| **Common** | | | | | | |
| 30 | +| Mode of reporter | `mode` | `QASE_MODE` | `off` | No | `testops`, `report`, `off` | |
| 31 | +| Fallback mode of reporter | `fallback` | `QASE_FALLBACK` | `off` | No | `testops`, `report`, `off` | |
| 32 | +| Environment | `environment` | `QASE_ENVIRONMENT` | undefined | No | Any string | |
| 33 | +| Root suite | `rootSuite` | `QASE_ROOT_SUITE` | undefined | No | Any string | |
| 34 | +| Enable debug logs | `debug` | `QASE_DEBUG` | `False` | No | `True`, `False` | |
| 35 | +| **Qase Report configuration** | | | | | | |
| 36 | +| Driver used for report mode | `report.driver` | `QASE_REPORT_DRIVER` | `local` | No | `local` | |
| 37 | +| Path to save the report | `report.connection.path` | `QASE_REPORT_CONNECTION_PATH` | `./build/qase-report` | | | |
| 38 | +| Local report format | `report.connection.format` | `QASE_REPORT_CONNECTION_FORMAT` | `json` | | `json`, `jsonp` | |
| 39 | +| **Qase TestOps configuration** | | | | | | |
| 40 | +| Token for [API access](https://developers.qase.io/#authentication) | `testops.api.token` | `QASE_TESTOPS_API_TOKEN` | undefined | Yes | Any string | |
| 41 | +| Qase API host. For enterprise users, specify full address: `api-example.qase.io` | `testops.api.host` | `QASE_TESTOPS_API_HOST` | `qase.io` | No | Any string | |
| 42 | +| Qase enterprise environment | `testops.api.enterprise` | `QASE_TESTOPS_API_ENTERPRISE` | `False` | No | `True`, `False` | |
| 43 | +| Code of your project, which you can take from the URL: `https://app.qase.io/project/DEMOTR` - `DEMOTR` is the project code | `testops.project` | `QASE_TESTOPS_PROJECT` | undefined | Yes | Any string | |
| 44 | +| Qase test run ID | `testops.run.id` | `QASE_TESTOPS_RUN_ID` | undefined | No | Any integer | |
| 45 | +| Qase test run title | `testops.run.title` | `QASE_TESTOPS_RUN_TITLE` | `Automated run <Current date and time>` | No | Any string | |
| 46 | +| Qase test run description | `testops.run.description` | `QASE_TESTOPS_RUN_DESCRIPTION` | `<Framework name> automated run` | No | Any string | |
| 47 | +| Qase test run complete | `testops.run.complete` | `QASE_TESTOPS_RUN_COMPLETE` | `True` | | `True`, `False` | |
| 48 | +| Qase test plan ID | `testops.plan.id` | `QASE_TESTOPS_PLAN_ID` | undefined | No | Any integer | |
| 49 | +| Size of batch for sending test results | `testops.batch.size` | `QASE_TESTOPS_BATCH_SIZE` | `200` | No | Any integer | |
| 50 | +| Enable defects for failed test cases | `testops.defect` | `QASE_TESTOPS_DEFECT` | `False` | No | `True`, `False` | |
| 51 | + |
| 52 | +### Example `qase.config.json` config: |
| 53 | + |
| 54 | +```json |
| 55 | +{ |
| 56 | + "mode": "testops", |
| 57 | + "fallback": "report", |
| 58 | + "debug": false, |
| 59 | + "environment": "local", |
| 60 | + "captureLogs": false, |
| 61 | + "report": { |
| 62 | + "driver": "local", |
| 63 | + "connection": { |
| 64 | + "local": { |
| 65 | + "path": "./build/qase-report", |
| 66 | + "format": "json" |
| 67 | + } |
| 68 | + } |
| 69 | + }, |
| 70 | + "testops": { |
| 71 | + "api": { |
| 72 | + "token": "<token>", |
| 73 | + "host": "qase.io" |
| 74 | + }, |
| 75 | + "run": { |
| 76 | + "title": "Regress run", |
| 77 | + "description": "Regress run description", |
| 78 | + "complete": true |
| 79 | + }, |
| 80 | + "defect": false, |
| 81 | + "project": "<project_code>", |
| 82 | + "batch": { |
| 83 | + "size": 100 |
| 84 | + } |
| 85 | + } |
| 86 | +} |
| 87 | +``` |
0 commit comments