robocorp / robotframework-lsp

Robocorp extensions for VS Code: Robocorp Code and RFW LSP
https://robocorp.com/docs/developer-tools/visual-studio-code
Apache License 2.0
206 stars 93 forks source link

Run Tests Suite doesn't use __init__.robot file #355

Closed Veronit closed 3 years ago

Veronit commented 3 years ago

Describe the bug Run Suite doesn't use for example Suite Setup set in init.robot file. Same happend with Run link in individual test cases

To Reproduce Steps to reproduce the behavior:

  1. Set up Suite Setup in init.robot file
  2. Write some test
  3. Run Test/Tests -> Suite Setup in init.robot file wasn't used when running test

Expected behavior Suite Setup in init.robot is executed similar to when running tests from command prompt

Screenshots image

Versions:

Logs and files Attached is an example test and init.robot file. Also attached is the log.html from an execution

attachment_files.zip

chemstar commented 3 years ago

Could be same issue as described in https://github.com/robocorp/robotframework-lsp/issues/281

fabioz commented 3 years ago

I just took a look at this and it seems to be working correctly (this is how Robot Framework itself works) -- it's not the same thing as https://github.com/robocorp/robotframework-lsp/issues/281.

i.e.:

By running python -m robot lsp_test.robot, the __init__.robot isn't really loaded nor executed (it's only loaded if the folder itself is run in something as python -m robot ., which isn't currently possible by using those shortcuts, it'll always run either all the tests in the module or a selected test).

So, if the __init__.robot should actually be executed in this case, Robot Framework itself should be changed/fixed to support that.

Veronit commented 3 years ago

OK. That seems to be the case... I thought that __init__.robot should be executed in every situation. I have been using Ecipse as an IDE for severeal years and it's RED- plugin (https://github.com/nokia/RED) works that way.

So when developing tests I can run an individual test from the IDE and it executes __init__.robot. It makes writing and testing tests so much easier. Could this be LSP be modified to work the same way? Or maybe add a setting to select whether to execute __init__.robot or not.

fabioz commented 3 years ago

It seems there's a way to make that run (by creating a suite to execute adding the needed directory along with the test).

I'll change the language server to do that in the shortcuts.

Veronit commented 3 years ago

Awesome!! Thank you so much!

fabioz commented 3 years ago

Done for 0.17.0.