Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[robotframework] Make tags case insensitive #10

Merged
merged 2 commits into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions qase-robotframework/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ pip install qase-robotframework
## Usage

You must add Qase case IDs to robot framework tests.
They should be added as a tags in form like `Q-<case id without project code>`. Examples:
They should be added as a tags in form like `Q-<case id without project code>`. You can use upper and lower case to indicate the test case IDs. Example:

```robotframework
*** Test Cases ***
Push button
[Tags] Q-2
[Tags] q-2
Push button 1
Result should be 1

Expand Down Expand Up @@ -60,7 +60,7 @@ Quick Get A JSON Body Test ## T
Should Be Equal As Strings 1 ${response.json()}[id] ## 2-nd step - "Should Be Equal As Strings"

Initializing the test case ## Test case: "Initializing the test case"
[Tags] Q-4
[Tags] q-4
Set To Dictionary ${info} field1=A sample string ## 1-st step - "Set To Dictionary"
```

Expand All @@ -81,7 +81,6 @@ QASE_API_TOKEN=<API TOKEN> QASE_PROJECT=PRJCODE robot --listener qaseio.robotfra
```
![reporter](./example/screenshot/screenshot2.png "text")
Moving variables to `tox.ini`, example configuration:

```ini
[qase]
qase_api_token=api_key
Expand All @@ -94,7 +93,6 @@ Execution:
```
robot --listener qaseio.robotframework.Listener someTest.robot
```

## Contribution

Install project locally:
Expand Down
4 changes: 2 additions & 2 deletions qase-robotframework/example/someTest.robot
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Quick Get Request Test
${response}= GET https://www.google.com ## Second step in Qase TMS

Quick Get Request With Parameters Test ## ----------------------
[Tags] Q-2
[Tags] q-2
Create Session google http://www.google.com ## First step in Qase TMS
${resp_google}= GET On Session google / expected_status=200 ## Second step in Qase TMS

Expand All @@ -22,7 +22,7 @@ Quick Get A JSON Body Test ## -
Should Be Equal As Strings 1 ${response.json()}[id] ## Second step in Qase TMS

Initializing the test case ## ----------------------
[Tags] Q-4
[Tags] q-4
Set To Dictionary ${info} field1=A sample string ## First step in Qase TMS

*** Variables ***
Expand Down
5 changes: 2 additions & 3 deletions qase-robotframework/src/qaseio/robotframework/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,9 @@ def log_message(self, message):
logger.debug("Log:", message)

def _extract_ids(self, list_of_tags: List[str]) -> List[int]:
id = re.compile(r"Q-(\d+)", re.IGNORECASE)
return [
int(re.match(r"Q-(\d+)", tag).groups()[0])
for tag in list_of_tags
if re.fullmatch(r"Q-\d+", tag)
int(id.match(tag).groups()[0]) for tag in list_of_tags if id.fullmatch(tag)
]

def _get_step_position(
Expand Down