diff --git a/qase-python-commons/changelog.md b/qase-python-commons/changelog.md index 0667c939..60fbb4d0 100644 --- a/qase-python-commons/changelog.md +++ b/qase-python-commons/changelog.md @@ -1,4 +1,4 @@ -# qase-python-commons@3.2.0 +# qase-python-commons@3.2.1 ## What's new diff --git a/qase-robotframework/README.md b/qase-robotframework/README.md index 1ea152d1..9c9b388f 100644 --- a/qase-robotframework/README.md +++ b/qase-robotframework/README.md @@ -29,7 +29,7 @@ Configuration options are described in the ```json { - "mode": "testops", + "mode": "testops", "fallback": "report", "debug": true, "testops": { @@ -45,12 +45,12 @@ Configuration options are described in the "size": 100 } }, - "report": { + "report": { "driver": "local", "connection": { "local": { "path": "./build/qase-report", - "format": "json" + "format": "json" } } }, @@ -58,12 +58,12 @@ Configuration options are described in the } ``` - ## Usage ### Link tests with test cases in Qase TestOps -To link the automated tests with the test cases in Qase TestOps, use the tags in form like `Q-`. +To link the automated tests with the test cases in Qase TestOps, use the tags in form like +`Q-`. Example: ```robotframework @@ -96,6 +96,7 @@ Subtraction 12 - 2 - 2 8 Listener supports reporting steps results: Example: + ```robotframework Quick Get A JSON Body Test ## Test case: "Quick Get A JSON Body Test" [Tags] Q-3 @@ -107,7 +108,30 @@ Initializing the test case ## T Set To Dictionary ${info} field1=A sample string ## 1-st step - "Set To Dictionary" ``` +### Working with parameters + +Listener supports reporting parameters: + +Example: + +```robotframework +*** Variables *** +${var1} 1 +${var2} 1 +${var3} 2 + +*** Test Cases *** +Simple test + [Arguments] ${var1} ${var2} ${var3} + [Tags] qase.params:[var1, var2] + Should Be Equal As Numbers ${var1} ${var2} + Should Be Equal As Numbers ${var3} ${var3} +``` + +Only `var1` and `var2` will be sent to Qase. + ### Execution: + ``` robot --listener qase.robotframework.Listener someTest.robot ``` diff --git a/qase-robotframework/changelog.md b/qase-robotframework/changelog.md index f9d0aecd..92db9628 100644 --- a/qase-robotframework/changelog.md +++ b/qase-robotframework/changelog.md @@ -1,3 +1,25 @@ +# qase-robotframework 3.2.2 + +## What's new + +Support `qase.params` tag. You can specify the params that you want to send to Qase. + +```robotframework +*** Variables *** +${var1} 1 +${var2} 1 +${var3} 2 + +*** Test Cases *** +Simple test + [Arguments] ${var1} ${var2} ${var3} + [Tags] qase.params:[var1, var2] + Should Be Equal As Numbers ${var1} ${var2} + Should Be Equal As Numbers ${var3} ${var3} +``` + +Only `var1` and `var2` will be sent to Qase. + # qase-robotframework 3.2.1 ## What's new @@ -25,7 +47,7 @@ Formatted Return RETURN ${value} ``` -Previously, the `RETURN` keyword was presented as `RETURN` in the Qase test run. +Previously, the `RETURN` keyword was presented as `RETURN` in the Qase test run. Now, the keyword is presented as `RETURN ${value}`. # qase-robotframework 3.2.0b2 diff --git a/qase-robotframework/pyproject.toml b/qase-robotframework/pyproject.toml index 5f8973b4..0a8a6b6f 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.2.1" +version = "3.2.2" 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/master/qase-robotframework"} requires-python = ">=3.7" dependencies = [ - "qase-python-commons~=3.2.0", + "qase-python-commons~=3.2.1", "filelock~=3.12.2", ] diff --git a/qase-robotframework/src/qase/robotframework/listener.py b/qase-robotframework/src/qase/robotframework/listener.py index e4fdc563..e5cd67b5 100644 --- a/qase-robotframework/src/qase/robotframework/listener.py +++ b/qase-robotframework/src/qase/robotframework/listener.py @@ -32,7 +32,6 @@ def __init__(self): config = ConfigManager() self.reporter = QaseCoreReporter(config) self.runtime = QaseRuntimeSingleton.get_instance() - self.step_uuid = None self.tests = {} self.pabot_index = None @@ -81,8 +80,6 @@ def start_test(self, test, result): def end_test(self, test, result): logger.debug("Finishing test '%s'", test.name) - self.step_uuid = None - test_metadata = TagParser.parse_tags(test.tags) if test_metadata.ignore: @@ -100,6 +97,12 @@ def end_test(self, test, result): steps = self.__parse_steps(result) self.runtime.result.add_steps(steps) + if len(test_metadata.params) > 0: + params: dict = {} + for param in test_metadata.params: + params[param] = BuiltIn().get_variable_value(f"${{{param}}}") + self.runtime.result.params = params + if hasattr(test, "doc"): self.runtime.result.add_field(Field("description", test.doc)) diff --git a/qase-robotframework/src/qase/robotframework/models.py b/qase-robotframework/src/qase/robotframework/models.py index a1d8565d..7762ede4 100644 --- a/qase-robotframework/src/qase/robotframework/models.py +++ b/qase-robotframework/src/qase/robotframework/models.py @@ -91,8 +91,10 @@ class TestMetadata: qase_id: Union[int, None] ignore: bool fields: dict + params: list[str] def __init__(self) -> None: self.qase_id = None self.ignore = False self.fields = {} + self.params = [] diff --git a/qase-robotframework/src/qase/robotframework/tag_parser.py b/qase-robotframework/src/qase/robotframework/tag_parser.py index 0a9a4928..1b2ed0da 100644 --- a/qase-robotframework/src/qase/robotframework/tag_parser.py +++ b/qase-robotframework/src/qase/robotframework/tag_parser.py @@ -21,6 +21,9 @@ def parse_tags(tags: list[str]) -> TestMetadata: if tag.lower().startswith("qase.fields"): metadata.fields = TagParser.__extract_fields(tag) + if tag.lower().startswith("qase.params"): + metadata.params = TagParser.__extract_params(tag) + return metadata @staticmethod @@ -39,3 +42,13 @@ def __extract_fields(tag: str) -> dict: except ValueError as e: TagParser.__logger.error(f"Error parsing fields from tag '{tag}': {e}") return {} + + @staticmethod + def __extract_params(tag: str) -> list[str]: + value = tag.split(':', 1)[-1].strip() + try: + return [item.strip() for item in value[1:-1].split(",")] + # return value.replace('[', '').replace(']', '').split(',') + except ValueError as e: + TagParser.__logger.error(f"Error parsing params from tag '{tag}': {e}") + return []