Customize behavior of "Code lenses" in Vs Code

Hi there!

Is there a way to customize the robot commands triggered by the “Run test” command in VS code?
Right now, when executing a TC, it generates an output.html, log.html and report.html, but I would like to customize that behavior either by editing the robot command or by adding extra steps in the execution process.
Ideally, I’d like test outputs to be renamed to the TC name + timestamp for instance. Or zipping all generated files into an archive, this kind of stuff.

Which Robot Framework extension for VS Code are you currently using?

Hi sorry, i forgot to specify: I’m using the robocorp extensions (“robocorp code” and “robot framework language server”)
These are the ones I’ve been advised to use tbh i didn’t put any thoughts on which extension is best…?

Thanks for your reply :slight_smile:

Robot Framework Language Server is the one I use, so hopefully I can be of help :slight_smile:

Some configuration can be done in your settings.json file and some can be done in your launch.json file. For configuring the robot command used, I use launch.json (it may or may not be possible to do the same thing in settings.json, I’m not sure).

If you don’t already have a launch.json file, there should be a button to create one when you go the Run and Debug tab on the left of VS Code. Where this file should be located may vary based on your VS Code setup.

Here is a sample launch.json file:
image
Please check line 6. When I’ve had it generate a launch.json file for me, it has used a different name that does not actually work. The screenshot shows what works on my machine.

Then you can use what’s in “args”: to pass in arguments like you would when running the robot command manually (just take a look at the screenshot to check the syntax for this). So you’ll see from my example that I specify the output directory, exclude certain tags, and set the log level.

Hopefully being able to configure the command used will be what you need to then get a result you like.
Timestamping the file names looks to be an option.
I’m not sure about zipping files from the command, but you may want to check out Rebot in case it’s options interest you.

In theory, that should be the information you need, but I know configuring the IDE with RF can be challenging. I’ll try to help with any follow up and clarification.

1 Like

Olay, the line 6 was also my problem
Thanks - I never suspected the name needed to be precise
I would only change one thing in the above syntax:
“args”: [
“–outputdir”,
“${workspaceFolder}/results”
]

each value will be put on a separate line by the auto format
and to make it generic, use the ${workspaceFolder} variable

Hi Silken, I did configure the same configuration with a tag name “no_tests” but I always get the the message :

[ ERROR ] Suite ‘Test’ contains no tests or tasks not matching tag ‘no tests’ in suite ‘test.testname123’.

Do you have an idea what I am doing wrong with my Test Tags.