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

Incorrect Test Case Matching with Double Quotes #159

Closed
Anker101 opened this issue Aug 2, 2023 · 3 comments
Closed

Incorrect Test Case Matching with Double Quotes #159

Anker101 opened this issue Aug 2, 2023 · 3 comments
Labels
Agent Issue Affects the Agent bug Something isn't working
Milestone

Comments

@Anker101
Copy link

Anker101 commented Aug 2, 2023

Describe the bug
When executing test cases with double quotes in the test case name using the Robot Framework, the test cases are not matched correctly, resulting in an error.

To Reproduce
Steps to reproduce the behavior:

Create a test case with double quotes in the name, like:

Test Case Send GET on API "${endpoint}" on "${env}" for "${tenant}" should be 200

Execute the following command:

$ robot -t "Send GET on API "${endpoint}" on "${env}" for "${tenant}" should be 200" "Anker01_variables.robot"

The test case is not matched correctly, and the output is as follows:

[ ERROR ] Suite 'Anker01 variables' contains no tests matching name 'Send GET on API ${endpoint} on ${env} for ${tenant} should be 200'.

Expected behavior
The test case should be matched and executed successfully.

Additional context
The issue seems to be related to how the Robot Framework handles escaped double quotes in the command for specifying test cases with double quotes in their names. Manually including escaped double quotes in the command allows the test case to be matched correctly and executed.
$ robot -t "Send GET on API "${endpoint}" on "${env}" for "${tenant}" should be 200" "Anker01_variables.robot"

This correctly identifies the test case and executes it, as seen in the output:

Send GET on API "my endpoint" on "QAENV" for "Anker02" should be 200 | PASS |

This bug affects users who need to work with test case names containing double quotes in their projects.

@Anker101 Anker101 added the potential bug Might be a bug, requires further clarification label Aug 2, 2023
@damies13 damies13 added bug Something isn't working Agent Issue Affects the Agent and removed potential bug Might be a bug, requires further clarification labels Aug 2, 2023
@damies13 damies13 added this to the v1.1.5 milestone Aug 2, 2023
@damies13
Copy link
Owner

damies13 commented Aug 6, 2023

Info from chat on Discord


Anker01 — 02/08/2023 18:25

Hello ,
The log says : [ ERROR ] Suite 'API' contains no tests matching name 'Send GET on API ${endpoint} on ${env} for ${tenant} should be 200'.
But in my scenario i specified that the name of the test case is :
Send GET on API "${endpoint}" on "${env}" for "${tenant}" should be 200
with quotation marks


damies13 — 02/08/2023 19:13

Thanks, I'll try to reproduce that


damies13 — 02/08/2023 19:30

OK found the issue, looks like I need to escape the double quotes as well

$ robot -t "Send GET on API "\${endpoint}" on "\${env}" for "\${tenant}" should be 200"  "Anker01_variables.robot"
[ ERROR ] Suite 'Anker01 variables' contains no tests matching name 'Send GET on API ${endpoint} on ${env} for ${tenant} should be 200'.

Try --help for usage information.

vs

$ robot -t "Send GET on API \"\${endpoint}\" on \"\${env}\" for \"\${tenant}\" should be 200"  "Anker01_variables.robot"
==============================================================================
Anker01 variables                                                             
==============================================================================
Send GET on API "my endpoint" on "QAENV" for "Anker02" should be 200  | PASS |
------------------------------------------------------------------------------
Anker01 variables                                                     | PASS |
1 test, 1 passed, 0 failed
==============================================================================

@damies13
Copy link
Owner

damies13 commented Aug 7, 2023

Confirmed the Double Quotes also need to be escaped on Window, but as I expected the ${ shouldn't be escaped on Windows

damies13 added a commit that referenced this issue Aug 7, 2023
…lies to all platforms not just Unix style platforms (MaxOS and Linux)

Issue #159 should be resolved with this change
github-actions bot pushed a commit that referenced this issue Aug 7, 2023
github-actions bot pushed a commit that referenced this issue Aug 7, 2023
github-actions bot pushed a commit that referenced this issue Aug 7, 2023
github-actions bot pushed a commit that referenced this issue Aug 7, 2023
@damies13
Copy link
Owner

damies13 commented Aug 7, 2023

Merged into release branch v1.1.5

@damies13 damies13 closed this as completed Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Agent Issue Affects the Agent bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants