ADS KUL
ADS KUL

Reputation: 312

How to change the name and folder of robot logs/report file?

I am new to robot framework.

I am using Robot framework-Python-Red editor plugin-eclipse to run my automation script. Got the result as;

Output:  C:\Users\eclipse-workspace\MyProject\output.xml
Log:     C:\Users\eclipse-workspace\MyProject\log.html
Report:  C:\Users\eclipse-workspace\MyProject\report.html

I need 2 changes in the reports:

I tried running it using command line like

robot -t login.robot

but it is not running giving an error of required argument. I was checking to change the folder by using

robot -d C:\myfolder

It looks it is working with only RED editor and not with the eclipse. Please guide step by step.

Upvotes: 0

Views: 3312

Answers (1)

pavelsaman
pavelsaman

Reputation: 8362

Welcome.

Output dir

To change an output dir, you need to use --outputdir command line option, e.g. --outputdir Results/ to save outputs into Results directory. Beware that it matters where you run the command from, so if your tests are in <project_dir>/Tests and you execute your tests like so:

$ cd Tests/
$ robot ...

then the outputdir option should be --outputdir ../Results.

Timestamped filenames

Robot has another command line option --timestampoutput for that.

How to put it together?

It's a bit annoying when you have to always type these options on the command line. And even if you run your tests in a pipeline, it's a little less error prone to set your command line options separately, not directly in the command. For that, you can create e.g. arguments.txt file in your project dir and include command line options in it, one per line like so:

--variable language:cz
--outputdir ../Results
--timestampoutput
--console verbose
--consolemarkers on
--loglevel TRACE:INFO
--tagdoc *:See *README.md*
--tagstatcombine smokeANDregression

then you can execute your tests with only $ robot ..\arguments.txt which is much shorter.

You can read more about creating outputs in the official dcumentation here.

Upvotes: 2

Related Questions