From 33004fd0f7ef5b87d90d70dd5e99fa2f5bfc24b0 Mon Sep 17 00:00:00 2001 From: Dmitrii Gridnev Date: Wed, 9 Jul 2025 18:15:21 +0300 Subject: [PATCH] feat: enhance test run configurations support - Added support for specifying test run configurations in `qase.config.json`, environment variables, and CLI parameters. - Implemented automatic creation of configurations if they do not exist, controlled by the `createIfNotExists` option. - Updated version to 1.1.2 in pyproject.toml for Tavern, 3.4.4 for Robot Framework, 6.3.5 for Pytest, and 1.1.4 for Behave. - Enhanced changelogs and documentation to reflect new features and usage examples. --- examples/pytest/qase.config.json | 15 +++++- qase-behave/changelog.md | 64 +++++++++++++++++++++++ qase-behave/docs/CONFIGURATION.md | 2 + qase-behave/pyproject.toml | 4 +- qase-behave/src/qase/behave/formatter.py | 13 +++++ qase-pytest/changelog.md | 43 +++++++++++++-- qase-pytest/docs/CONFIGURATION.md | 2 + qase-pytest/pyproject.toml | 4 +- qase-pytest/src/qase/pytest/conftest.py | 13 +++++ qase-pytest/src/qase/pytest/options.py | 17 ++++++ qase-robotframework/changelog.md | 62 ++++++++++++++++++++++ qase-robotframework/docs/CONFIGURATION.md | 2 + qase-robotframework/pyproject.toml | 4 +- qase-tavern/changelog.md | 64 +++++++++++++++++++++++ qase-tavern/docs/CONFIGURATION.md | 2 + qase-tavern/pyproject.toml | 4 +- qase-tavern/src/qase/tavern/conftest.py | 13 +++++ qase-tavern/src/qase/tavern/options.py | 17 ++++++ 18 files changed, 331 insertions(+), 14 deletions(-) diff --git a/examples/pytest/qase.config.json b/examples/pytest/qase.config.json index 30678c3c..e31f425b 100644 --- a/examples/pytest/qase.config.json +++ b/examples/pytest/qase.config.json @@ -23,7 +23,20 @@ }, "defect": true, "project": "", - "chunk": 200 + "chunk": 200, + "configurations": { + "values": [ + { + "name": "browser", + "value": "chrome" + }, + { + "name": "environment", + "value": "staging" + } + ], + "createIfNotExists": true + } }, "framework": { "pytest": { diff --git a/qase-behave/changelog.md b/qase-behave/changelog.md index 662f6aad..3523d710 100644 --- a/qase-behave/changelog.md +++ b/qase-behave/changelog.md @@ -1,3 +1,35 @@ +# qase-behave 1.1.4 + +## What's new + +- Added support for test run configurations. You can now specify configurations when creating test runs. +- Configurations can be specified in `qase.config.json`, environment variables, or CLI parameters. +- Support for automatic creation of configurations if they don't exist (controlled by `createIfNotExists` option). + +Example configuration: +```json +{ + "testops": { + "configurations": { + "values": [ + { + "name": "browser", + "value": "chrome" + }, + { + "name": "environment", + "value": "staging" + } + ], + "createIfNotExists": true + } + } +} +``` + +Environment variable format: `QASE_TESTOPS_CONFIGURATIONS_VALUES="browser=chrome,environment=staging"` +CLI parameter format: `--qase-testops-configurations-values="browser=chrome,environment=staging"` + # qase-behave 1.1.3 ## What's new @@ -32,6 +64,38 @@ qase.comment("Test completed successfully") qase.comment("Debug info: user logged in") ``` +# qase-behave 1.1.4 + +## What's new + +- Added support for test run configurations. You can now specify configurations when creating test runs. +- Configurations can be specified in `qase.config.json`, environment variables, or CLI parameters. +- Support for automatic creation of configurations if they don't exist (controlled by `createIfNotExists` option). + +Example configuration: +```json +{ + "testops": { + "configurations": { + "values": [ + { + "name": "browser", + "value": "chrome" + }, + { + "name": "environment", + "value": "staging" + } + ], + "createIfNotExists": true + } + } +} +``` + +Environment variable format: `QASE_TESTOPS_CONFIGURATIONS_VALUES="browser=chrome,environment=staging"` +CLI parameter format: `--qase-testops-configurations-values="browser=chrome,environment=staging"` + # qase-behave 1.1.2 ## What's new diff --git a/qase-behave/docs/CONFIGURATION.md b/qase-behave/docs/CONFIGURATION.md index bb331e3e..7d1ab953 100644 --- a/qase-behave/docs/CONFIGURATION.md +++ b/qase-behave/docs/CONFIGURATION.md @@ -33,6 +33,8 @@ and command line options override both other values. | Batch size for uploading test results | `testops.batch.size` | `QASE_TESTOPS_BATCH_SIZE` | `qase-testops-batch-size` | 200 | No | 1 to 2000 | | Create defects in Qase | `testops.defect` | `QASE_TESTOPS_DEFECT` | `qase-testops-defect` | `False`, don't create defects | No | `True`, `False` | | Test run tags | `testops.run.tags` | `QASE_TESTOPS_RUN_TAGS` | `qase-testops-run-tags` | None, don't add any tags | No | Comma-separated list of tags | +| Test run configurations | `testops.configurations.values` | `QASE_TESTOPS_CONFIGURATIONS_VALUES` | `qase-testops-configurations-values` | None, don't add any configurations | No | Format: "group1=value1,group2=value2" | +| Create configurations if not exists | `testops.configurations.createIfNotExists` | `QASE_TESTOPS_CONFIGURATIONS_CREATE_IF_NOT_EXISTS` | `qase-testops-configurations-create-if-not-exists` | `False`, don't create configurations | No | `True`, `False` | | **Qase Report mode configuration** | | Local path to store report | `report.connection.path` | `QASE_REPORT_CONNECTION_PATH` | `qase-report-connection-path` | `./build/qase-report` | No | Any string | | Report format | `report.connection.format` | `QASE_REPORT_CONNECTION_FORMAT` | `qase-report-connection-format` | `json` | No | `json`, `jsonp` | diff --git a/qase-behave/pyproject.toml b/qase-behave/pyproject.toml index b7086335..3cddd8ea 100644 --- a/qase-behave/pyproject.toml +++ b/qase-behave/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "qase-behave" -version = "1.1.3" +version = "1.1.4" description = "Qase Behave Plugin for Qase TestOps and Qase Report" readme = "README.md" keywords = ["qase", "behave", "plugin", "testops", "report", "qase reporting", "test observability"] @@ -29,7 +29,7 @@ classifiers = [ ] requires-python = ">=3.7" dependencies = [ - "qase-python-commons~=3.5.1", + "qase-python-commons~=3.5.3", "behave>=1.2.6", "more_itertools", ] diff --git a/qase-behave/src/qase/behave/formatter.py b/qase-behave/src/qase/behave/formatter.py index bf974fd1..0d481a97 100644 --- a/qase-behave/src/qase/behave/formatter.py +++ b/qase-behave/src/qase/behave/formatter.py @@ -133,6 +133,19 @@ def __parse_config(userdata) -> ConfigManager: if 'qase-testops-defect' in userdata: cfg_mgr.config.testops.set_defect(userdata['qase-testops-defect']) + if 'qase-testops-configurations-values' in userdata: + # Parse configurations from userdata + # Format: "group1=value1,group2=value2" + config_pairs = userdata['qase-testops-configurations-values'].split(',') + for pair in config_pairs: + if '=' in pair: + name, config_value = pair.split('=', 1) + cfg_mgr.config.testops.configurations.add_value(name.strip(), config_value.strip()) + + if 'qase-testops-configurations-create-if-not-exists' in userdata: + cfg_mgr.config.testops.configurations.set_create_if_not_exists( + userdata['qase-testops-configurations-create-if-not-exists']) + if 'qase-report-driver' in userdata: cfg_mgr.config.report.set_driver(userdata['qase-report-driver']) diff --git a/qase-pytest/changelog.md b/qase-pytest/changelog.md index 50066fdd..b9161f4c 100644 --- a/qase-pytest/changelog.md +++ b/qase-pytest/changelog.md @@ -1,3 +1,36 @@ +# qase-pytest 6.3.5 + +## What's new + +- Added support for test run configurations. You can now specify configurations when creating test runs. +- Configurations can be specified in `qase.config.json`, environment variables, or CLI parameters. +- Support for automatic creation of configurations if they don't exist (controlled by `createIfNotExists` option). + +Example configuration: + +```json +{ + "testops": { + "configurations": { + "values": [ + { + "name": "browser", + "value": "chrome" + }, + { + "name": "environment", + "value": "staging" + } + ], + "createIfNotExists": true + } + } +} +``` + +Environment variable format: `QASE_TESTOPS_CONFIGURATIONS_VALUES="browser=chrome,environment=staging"` +CLI parameter format: `--qase-testops-configurations-values="browser=chrome,environment=staging"` + # qase-pytest 6.3.4 ## What's new @@ -132,11 +165,11 @@ environment variables: "framework": { "pytest": { "captureLogs": true, -+ "xfailStatus": { -+ "xfail": "skipped", -+ "xpass": "passed" -+ } -+ } + "xfailStatus": { + "xfail": "skipped", + "xpass": "passed" + } + } } } ``` diff --git a/qase-pytest/docs/CONFIGURATION.md b/qase-pytest/docs/CONFIGURATION.md index 929b00ea..908656ba 100644 --- a/qase-pytest/docs/CONFIGURATION.md +++ b/qase-pytest/docs/CONFIGURATION.md @@ -33,6 +33,8 @@ and command line options override both other values. | Batch size for uploading test results | `testops.batch.size` | `QASE_TESTOPS_BATCH_SIZE` | `--qase-testops-batch-size` | 200 | No | 1 to 2000 | | Create defects in Qase | `testops.defect` | `QASE_TESTOPS_DEFECT` | `--qase-testops-defect` | `False`, don't create defects | No | `True`, `False` | | Test run tags | `testops.run.tags` | `QASE_TESTOPS_RUN_TAGS` | `--qase-testops-run-tags` | None, don't add any tags | No | Comma-separated list of tags | +| Test run configurations | `testops.configurations.values` | `QASE_TESTOPS_CONFIGURATIONS_VALUES` | `--qase-testops-configurations-values` | None, don't add any configurations | No | Format: "group1=value1,group2=value2" | +| Create configurations if not exists | `testops.configurations.createIfNotExists` | `QASE_TESTOPS_CONFIGURATIONS_CREATE_IF_NOT_EXISTS` | `--qase-testops-configurations-create-if-not-exists` | `False`, don't create configurations | No | `True`, `False` | | **Qase Report mode configuration** | | Local path to store report | `report.connection.path` | `QASE_REPORT_CONNECTION_PATH` | `--qase-report-connection-path` | `./build/qase-report` | No | Any string | | Report format | `report.connection.format` | `QASE_REPORT_CONNECTION_FORMAT` | `--qase-report-connection-format` | `json` | No | `json`, `jsonp` | diff --git a/qase-pytest/pyproject.toml b/qase-pytest/pyproject.toml index cd212180..b9ef02eb 100644 --- a/qase-pytest/pyproject.toml +++ b/qase-pytest/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "qase-pytest" -version = "6.3.4" +version = "6.3.5" description = "Qase Pytest Plugin for Qase TestOps and Qase Report" readme = "README.md" keywords = ["qase", "pytest", "plugin", "testops", "report", "qase reporting", "test observability"] @@ -29,7 +29,7 @@ classifiers = [ ] requires-python = ">=3.7" dependencies = [ - "qase-python-commons~=3.5.0", + "qase-python-commons~=3.5.3", "pytest>=7.4.4", "filelock~=3.12.2", "more_itertools", diff --git a/qase-pytest/src/qase/pytest/conftest.py b/qase-pytest/src/qase/pytest/conftest.py index 6eebab89..cf083b02 100644 --- a/qase-pytest/src/qase/pytest/conftest.py +++ b/qase-pytest/src/qase/pytest/conftest.py @@ -171,6 +171,19 @@ def setup_config_manager(config): config_manager.config.framework.pytest.xfail_status.set_xpass( config.option.__dict__[option]) + if option == "qase_testops_configurations_values" and config.option.__dict__[option] is not None: + # Parse configurations from CLI parameter + # Format: "group1=value1,group2=value2" + config_pairs = config.option.__dict__[option].split(',') + for pair in config_pairs: + if '=' in pair: + name, config_value = pair.split('=', 1) + config_manager.config.testops.configurations.add_value(name.strip(), config_value.strip()) + + if option == "qase_testops_configurations_create_if_not_exists" and config.option.__dict__[option] is not None: + config_manager.config.testops.configurations.set_create_if_not_exists( + config.option.__dict__[option]) + return config_manager diff --git a/qase-pytest/src/qase/pytest/options.py b/qase-pytest/src/qase/pytest/options.py index 1b92b089..ab9479ee 100644 --- a/qase-pytest/src/qase/pytest/options.py +++ b/qase-pytest/src/qase/pytest/options.py @@ -142,6 +142,23 @@ def addoptions(parser, group): help="Create defect if test failed" ) + QasePytestOptions.add_option( + parser, + group, + "--qase-testops-configurations-values", + dest="qase_testops_configurations_values", + help="Configurations for test run. Format: 'group1=value1,group2=value2'" + ) + + QasePytestOptions.add_option( + parser, + group, + "--qase-testops-configurations-create-if-not-exists", + dest="qase_testops_configurations_create_if_not_exists", + type="bool", + help="Create configurations if they don't exist. Default: false" + ) + QasePytestOptions.add_option( parser, group, diff --git a/qase-robotframework/changelog.md b/qase-robotframework/changelog.md index 35e86a6c..d495fb0e 100644 --- a/qase-robotframework/changelog.md +++ b/qase-robotframework/changelog.md @@ -1,3 +1,34 @@ +# qase-robotframework 3.4.4 + +## What's new + +- Added support for test run configurations. You can now specify configurations when creating test runs. +- Configurations can be specified in `qase.config.json` or environment variables. +- Support for automatic creation of configurations if they don't exist (controlled by `createIfNotExists` option). + +Example configuration: +```json +{ + "testops": { + "configurations": { + "values": [ + { + "name": "browser", + "value": "chrome" + }, + { + "name": "environment", + "value": "staging" + } + ], + "createIfNotExists": true + } + } +} +``` + +Environment variable format: `QASE_TESTOPS_CONFIGURATIONS_VALUES="browser=chrome,environment=staging"` + # qase-robotframework 3.4.3 ## What's new @@ -5,6 +36,37 @@ - Added support for test run tags. - Added support for excluding parameters from test results. +# qase-robotframework 3.4.4 + +## What's new + +- Added support for test run configurations. You can now specify configurations when creating test runs. +- Configurations can be specified in `qase.config.json` or environment variables. +- Support for automatic creation of configurations if they don't exist (controlled by `createIfNotExists` option). + +Example configuration: +```json +{ + "testops": { + "configurations": { + "values": [ + { + "name": "browser", + "value": "chrome" + }, + { + "name": "environment", + "value": "staging" + } + ], + "createIfNotExists": true + } + } +} +``` + +Environment variable format: `QASE_TESTOPS_CONFIGURATIONS_VALUES="browser=chrome,environment=staging"` + # qase-robotframework 3.4.2 ## What's new diff --git a/qase-robotframework/docs/CONFIGURATION.md b/qase-robotframework/docs/CONFIGURATION.md index 44ebde65..64537db9 100644 --- a/qase-robotframework/docs/CONFIGURATION.md +++ b/qase-robotframework/docs/CONFIGURATION.md @@ -30,6 +30,8 @@ Environment variables override the values given in the config file. | Batch size for uploading test results | `testops.batch.size` | `QASE_TESTOPS_BATCH_SIZE` | 200 | No | 1 to 2000 | | Create defects in Qase | `testops.defect` | `QASE_TESTOPS_DEFECT` | `False`, don't create defects | No | `True`, `False` | | Test run tags | `testops.run.tags` | `QASE_TESTOPS_RUN_TAGS` | None, don't add any tags | No | Comma-separated list of tags | +| Test run configurations | `testops.configurations.values` | `QASE_TESTOPS_CONFIGURATIONS_VALUES` | None, don't add any configurations | No | Format: "group1=value1,group2=value2" | +| Create configurations if not exists | `testops.configurations.createIfNotExists` | `QASE_TESTOPS_CONFIGURATIONS_CREATE_IF_NOT_EXISTS` | `False`, don't create configurations | No | `True`, `False` | | **Qase Report mode configuration** | | Local path to store report | `report.connection.path` | `QASE_REPORT_CONNECTION_PATH` | `./build/qase-report` | No | Any string | | Report format | `report.connection.format` | `QASE_REPORT_CONNECTION_FORMAT` | `json` | No | `json`, `jsonp` | diff --git a/qase-robotframework/pyproject.toml b/qase-robotframework/pyproject.toml index 8a9f56c3..d6a40300 100644 --- a/qase-robotframework/pyproject.toml +++ b/qase-robotframework/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "qase-robotframework" -version = "3.4.3" +version = "3.4.4" description = "Qase Robot Framework Plugin" readme = "README.md" authors = [{name = "Qase Team", email = "support@qase.io"}] @@ -17,7 +17,7 @@ classifiers = [ urls = {"Homepage" = "https://github.com/qase-tms/qase-python/tree/main/qase-robotframework"} requires-python = ">=3.7" dependencies = [ - "qase-python-commons~=3.5.0", + "qase-python-commons~=3.5.3", "filelock~=3.12.2", ] diff --git a/qase-tavern/changelog.md b/qase-tavern/changelog.md index 795294a5..8cc834fd 100644 --- a/qase-tavern/changelog.md +++ b/qase-tavern/changelog.md @@ -1,3 +1,35 @@ +# qase-tavern 1.1.2 + +## What's new + +- Added support for test run configurations. You can now specify configurations when creating test runs. +- Configurations can be specified in `qase.config.json`, environment variables, or CLI parameters. +- Support for automatic creation of configurations if they don't exist (controlled by `createIfNotExists` option). + +Example configuration: +```json +{ + "testops": { + "configurations": { + "values": [ + { + "name": "browser", + "value": "chrome" + }, + { + "name": "environment", + "value": "staging" + } + ], + "createIfNotExists": true + } + } +} +``` + +Environment variable format: `QASE_TESTOPS_CONFIGURATIONS_VALUES="browser=chrome,environment=staging"` +CLI parameter format: `--qase-testops-configurations-values="browser=chrome,environment=staging"` + # qase-tavern 1.1.1 ## What's new @@ -5,6 +37,38 @@ - Added support for test run tags. - Added support for excluding parameters from test results. +# qase-tavern 1.1.2 + +## What's new + +- Added support for test run configurations. You can now specify configurations when creating test runs. +- Configurations can be specified in `qase.config.json`, environment variables, or CLI parameters. +- Support for automatic creation of configurations if they don't exist (controlled by `createIfNotExists` option). + +Example configuration: +```json +{ + "testops": { + "configurations": { + "values": [ + { + "name": "browser", + "value": "chrome" + }, + { + "name": "environment", + "value": "staging" + } + ], + "createIfNotExists": true + } + } +} +``` + +Environment variable format: `QASE_TESTOPS_CONFIGURATIONS_VALUES="browser=chrome,environment=staging"` +CLI parameter format: `--qase-testops-configurations-values="browser=chrome,environment=staging"` + # qase-tavern 1.1.0 ## What's new diff --git a/qase-tavern/docs/CONFIGURATION.md b/qase-tavern/docs/CONFIGURATION.md index eec32c7b..99e311d9 100644 --- a/qase-tavern/docs/CONFIGURATION.md +++ b/qase-tavern/docs/CONFIGURATION.md @@ -33,6 +33,8 @@ and command line options override both other values. | Batch size for uploading test results | `testops.batch.size` | `QASE_TESTOPS_BATCH_SIZE` | `--qase-testops-batch-size` | 200 | No | 1 to 2000 | | Create defects in Qase | `testops.defect` | `QASE_TESTOPS_DEFECT` | `--qase-testops-defect` | `False`, don't create defects | No | `True`, `False` | | Tags for test run | `testops.run.tags` | `QASE_TESTOPS_RUN_TAGS` | `--qase-testops-run-tags` | None | No | Comma-separated list of tags | +| Test run configurations | `testops.configurations.values` | `QASE_TESTOPS_CONFIGURATIONS_VALUES` | `--qase-testops-configurations-values` | None, don't add any configurations | No | Format: "group1=value1,group2=value2" | +| Create configurations if not exists | `testops.configurations.createIfNotExists` | `QASE_TESTOPS_CONFIGURATIONS_CREATE_IF_NOT_EXISTS` | `--qase-testops-configurations-create-if-not-exists` | `False`, don't create configurations | No | `True`, `False` | | **Qase Report mode configuration** | | Local path to store report | `report.connection.path` | `QASE_REPORT_CONNECTION_PATH` | `--qase-report-connection-path` | `./build/qase-report` | No | Any string | | Report format | `report.connection.format` | `QASE_REPORT_CONNECTION_FORMAT` | `--qase-report-connection-format` | `json` | No | `json`, `jsonp` | diff --git a/qase-tavern/pyproject.toml b/qase-tavern/pyproject.toml index 77bbb175..d1301d17 100644 --- a/qase-tavern/pyproject.toml +++ b/qase-tavern/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "qase-tavern" -version = "1.1.1" +version = "1.1.2" description = "Qase Tavern Plugin for Qase TestOps and Qase Report" readme = "README.md" keywords = ["qase", "tavern", "plugin", "testops", "report", "qase reporting", "test observability"] @@ -29,7 +29,7 @@ classifiers = [ ] requires-python = ">=3.7" dependencies = [ - "qase-python-commons~=3.5.0", + "qase-python-commons~=3.5.3", "pytest>=7,<7.3", "filelock~=3.12.2", "more_itertools", diff --git a/qase-tavern/src/qase/tavern/conftest.py b/qase-tavern/src/qase/tavern/conftest.py index b90b6b6c..06be22ae 100644 --- a/qase-tavern/src/qase/tavern/conftest.py +++ b/qase-tavern/src/qase/tavern/conftest.py @@ -115,6 +115,19 @@ def setup_config_manager(config): config_manager.config.testops.run.set_tags( [tag.strip() for tag in config.option.__dict__[option].split(',')]) + if option == "qase_testops_configurations_values" and config.option.__dict__[option] is not None: + # Parse configurations from CLI parameter + # Format: "group1=value1,group2=value2" + config_pairs = config.option.__dict__[option].split(',') + for pair in config_pairs: + if '=' in pair: + name, config_value = pair.split('=', 1) + config_manager.config.testops.configurations.add_value(name.strip(), config_value.strip()) + + if option == "qase_testops_configurations_create_if_not_exists" and config.option.__dict__[option] is not None: + config_manager.config.testops.configurations.set_create_if_not_exists( + config.option.__dict__[option]) + if option == "qase_testops_defect" and config.option.__dict__[option] is not None: config_manager.config.testops.set_defect(config.option.__dict__[option]) diff --git a/qase-tavern/src/qase/tavern/options.py b/qase-tavern/src/qase/tavern/options.py index 1679be49..6cbea925 100644 --- a/qase-tavern/src/qase/tavern/options.py +++ b/qase-tavern/src/qase/tavern/options.py @@ -142,6 +142,23 @@ def addoptions(parser, group): help="Comma-separated list of tags to add to the test run" ) + QasePytestOptions.add_option( + parser, + group, + "--qase-testops-configurations-values", + dest="qase_testops_configurations_values", + help="Configurations for test run. Format: 'group1=value1,group2=value2'" + ) + + QasePytestOptions.add_option( + parser, + group, + "--qase-testops-configurations-create-if-not-exists", + dest="qase_testops_configurations_create_if_not_exists", + type="bool", + help="Create configurations if they don't exist. Default: false" + ) + QasePytestOptions.add_option( parser, group,