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.
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…?
Robot Framework Language Server is the one I use, so hopefully I can be of help
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:
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.
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
I can’t be of too much assistance as I am now using the RobotCode extension instead of Robot Framework LSP. I do recommend switching to RobotCode as the RF LSP extension will likely not be maintained in the future (and currently does not support RF v7) due to robocorp moving away from Robot Framework.
As for your issue, I would investigate why it isn’t finding that tag. Are there any tests using that tag? Are those tests in the suite you are running? Is there a typo (I see “no tests” both with and without an underscore in your post)? If that doesn’t help, I suggest posting your configuration file for someone to look at.
Indeed as stated in RF documentation underscore should be ignored :
“When tags are compared, for example, to collect statistics, to select test to be executed, or to remove duplicates, comparisons are case, space and underscore insensitive.”
So maybe the way args are parsed from launch.json leads to the issue.
Try maybe to use notests just to verify.