robotcode icon indicating copy to clipboard operation
robotcode copied to clipboard

[ENHANCEMENT] Provide a way to mark test suites and tests with same long name

Open mardukbp opened this issue 2 years ago • 7 comments

Describe the bug When test.robot and test_.robot are present in the same directory only the former can be executed in RobotCode.

To Reproduce Steps to reproduce the behavior:

  1. Add the files test.robot and test_.robot to the current workspace
  2. When test.robot is the active tab the test cases can be executed
  3. When test_.robot is the active tab the test cases cannot be executed (no green triangles in the gutter)

Both files have the same content:

*** Test Cases ***
First Test
    Log To Console    Hello

Expected behavior It should be possible to execute the test cases in both files.

Screenshots/ Videos If applicable, add screenshots or videos to help explain your problem.

Logs Copy the messages from VSCode "Output" view for RobotCode and RobotCode Language Server for the specific folder/workspace.

Activate RobotCode Extension.
Try to activate python extension
Python Extension is active
create Language client: RobotCode Language Server mode=pipe for folder "RF"
trying to start Language client: RobotCode Language Server mode=pipe for folder "RF"
client  file:///c%3A/Users/mardukb/Desktop/RF ready.

Desktop (please complete the following information):

  • VS Code Version 1.64.2
  • RobotCode Version 0.6.0
  • OS: Windows
  • Python Version 3.8.10
  • RobotFramework Version 4.1.3
  • Additional tools like robocop, robotidy: None

Additional context I believe the problem is that RobotCode considers test.robot and test_.robot to be the same test suite. And the one that is read last takes precedence.

mardukbp avatar Mar 03 '22 10:03 mardukbp

Yes, that's because Robotframework generates the same longname for both test(_).robot files. see here

Try to execute the test in test_.robot with the -t option like robot -t "*.test.first test" alwas both tests are executed. You will get the same, if you put the underscore there.

So the suites are ambiguous and that results from how robotframework handles suite names.

I will try to find a way, that we can mark this as with a hint or so, thats maybe the best solution. What do you think?

The problem is, that I don't want to introduce a behaviour with RobotCode that you can't execute with robot on commandline.

d-biehl avatar Mar 03 '22 12:03 d-biehl

I see. Thanks a lot for the detailed explanation! I agree that the ambiguity prevents the execution of the test cases individually (and the user should be notified about this). But one should still be able to execute the whole test suite (a single .robot file as well as the whole directory), just like in the CLI.

mardukbp avatar Mar 03 '22 17:03 mardukbp

Try "Run" menu and "Start Debugging" or "Run without Debugging".

You can create a Launch config according to your wishes.

d-biehl avatar Mar 03 '22 18:03 d-biehl

After some invesitagtion I opened these issues 4253 and 4249 on robotframework for this. And allready fixed 4249.

With this commit RobotCode shows a run/debug triangle before every testcase, also when there is another test case with the same name.

d-biehl avatar Mar 05 '22 00:03 d-biehl

Awesome! Thanks a lot! Looking forward to the next release that includes this commit :)

mardukbp avatar Mar 06 '22 10:03 mardukbp

Both issues on RobotFramework (4253 and 4249) are fixed and closed. Starting with version 5.0 of RobotFramework warns if there are suites with same name are executed.

d-biehl avatar Mar 11 '22 14:03 d-biehl

Need to find a way, to show these warnings in Editor.

d-biehl avatar Mar 12 '22 10:03 d-biehl

this is done with the new test discoverer, which displays warnings about multiple suites and tests with the same name.

d-biehl avatar Aug 13 '23 21:08 d-biehl