简体   繁体   中英

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:

  • All three files I need with name including timestamp. Eg, 11062020_04.30_log.html
  • All three files should be in defined folder

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.

Welcome.

Output dir

To change an output dir, you need to use --outputdir command line option, eg --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 eg 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM