SUT version to report file name

Is it possible to set SUT version to report file name?

I am running starting the test’s with *bat file and I can set the date to file name like this in bat file:

set date=%DATE%-%TIME%
…\RESULTS_TAGS_20_20UI
%_date%/original.xml

But it is possible to add some other parameter to report file name (in my case the SUT version data) ?

Hi Pete,

Sure, you just need to have an environment variable for it.

%myvar% is windows syntax for using an environment variable, so if you know (or can get from the command line) the version number of your app, set a variable with that value and use the variable in your output folder / file name as you did with %_date%.

FYI - If you can get the app’s version number from the command line (e.g. appname.exe -v or similar) then with a bit of trickery with for /f you can emulate Command Substitution in Windows, which you can then use the do part of the for to set your environment variable to the version number.

Dave.

Seems like I have a similar use case.
I also rely on environment variable to define which SUT to run my tests on. As well as command line variables to define some tests flavors, such as which browser to use.
Then the need is to have these versions and flavors reflected in the test report. Here are some pointers to some built-in features I am using to this end:

  • “free suite metadata” to display the SUT version (and others CLI variables) in the report.
  • “tagging test cases” with variable in the tag name, to reflect the CLI variables. This way, it is possible to have statistics related to these different versions, which I hope will help when “merging suites executed in pieces”. Also note that I use a fixed prefix for my variable tags, such as: web:browser:${WEBUI TEST BROWSER} so that I can later use “simple patterns” for “generating combined tag statistics”.
  • “suite initialization files” to automatically assign tags to multiples suite directories/subdirectories/files.

Sorry, I could not link all these features to their corresponding section in the RobotFramework User Guide, but I am limited to two links…

1 Like

I have created an environment variable SWX
I can check with cmd>set that it exist and have value: 0.0.0.0

I have used this:
Set Environment Variable SWX ${version}
Set Environment Variable SWW ${version}
Log %{SWX}

When I check the log, there is the correct version with %{SWX}

But when I am trying to use this variable to rename test report file %SWX%…it is 0.0.0.0
Should this now set the value? And should there be also variable SWW created?

I am using azure VM (Windows). Some security issues?

Variable %SWX% is expanded when its passed. At that point, it is already a value and not a variable. Thus, you cannot change it at runtime and expect it to change when you set a new value during robot execution.

This is how environment variables work in every operating system like Linux, Windows and Mac.

1 Like

Hi, so I cannot change the variable that way: Set Environment Variable SWX ${version}

This is how I do it in cmd:
setx SWX “1.1.1.1”

What is the best way to do it with Robot?
So that I can use that value when saving test result

You have to get the SUT version in advance or rename the file afterwards.