I have a python code that is taking some info from a website by selenium and then write them into a json file, after I created an '.exe' file by pyinstaller and run it I don't know where this json file is saved.
Where could be saved, should be in the initial directory?
I am trying to save the logs with the particular name in robot framework but not able to do that . Do we have a way to save the log name with the name as we want? If yes then how to do that ?
You have the following options to configure your output files:
-d, --outputdir <dir> Defines where to create output files.
-o, --output <file> Sets the path to the generated output file.
-l, --log <file Sets the path to the generated log file.
-r, --report <file> Sets the path to the generated report file.
So to change the name of the log file launch your tests like this:
robot --log logxyz --report abcreport my_robot.robot
You can check all command line options in Robot Framework User Guide to learn more.
With -T, --timestampoutputs you can add a timestamp to the name of the output files as well. An example name with --log and --timestampoutputs: my_log_file_name-20190103-102712.html.
I have a rebot command usage which otherwise works fine for following;
rebot --reporttitle "Test Report" --outputdir /logs --output output.xml --report report.html /logs/api.xml /logs/ff.xml /logs/chrome.xml
But one of the test suites doesn't have the api tests hence there is no api.xml getting generated. For this rebot commands doesn't generated the output.xml. Is there a way to pass the xml files as optionals or not necessary to be checked by rebot?
No, there is not. You need to put that logic in a script that calls rebot. Though, if all of your logs (and only your logs) are written to /logs, you can use /logs/*.xml on the command line and it will process all of the .xml files in that directory.
I am getting the below error while generating report through command line report generation tool.
Exception in thread "main" ru.yandex.qatools.allure.data.ReportGenerationExcepti on: Could not find any allure results at ru.yandex.qatools.allure.data.AllureReportGenerator.generate(AllureRe portGenerator.java:58) at ru.yandex.qatools.allure.data.AllureReportGenerator.generate(AllureRe portGenerator.java:53) at ru.yandex.qatools.allure.AllureMain.main(AllureMain.java:48)
You should provide the Allure results directory to commandline to generate the report, an example:
$ allure generate allure-results -o allure-report
Allure results directory is the directory which contains *-testsuite.xml files. Make sure your C:\TestResults\file.xml/ directory contains at least one such file.
I am using Robot Framework, to run 50 Testcases. Everytime its creating following three files as expected:
c:\users\<user>\appdata\local\output.xml
c:\users\<user>\appdata\local\log.html
c:\users\<user>\appdata\local\report.html
But when I run same robot file, these files will be removed and New log files will be created.
I want to keep all previous run logs to refer in future. Log files should be saved in a folder with a time-stamp value in that.
NOTE: I am running robot file from command prompt (pybot test.robot). NOT from RIDE.
Could any one guide me on this?
Using the built-in features of robot
The robot framework user guide has a section titled Timestamping output files which describes how to do this.
From the documentation:
All output files listed in this section can be automatically timestamped with the option --timestampoutputs (-T). When this option is used, a timestamp in the format YYYYMMDD-hhmmss is placed between the extension and the base name of each file. The example below would, for example, create such output files as output-20080604-163225.xml and mylog-20080604-163225.html:
robot --timestampoutputs --log mylog.html --report NONE tests.robot
To specify a folder, this too is documented in the user guide, in the section Output Directory, under Different Output Files:
...The default output directory is the directory where the execution is started from, but it can be altered with the --outputdir (-d) option. The path set with this option is, again, relative to the execution directory, but can naturally be given also as an absolute path...
Using a helper script
You can write a script (in python, bash, powershell, etc) that performs two duties:
launches pybot with all the options you wan
renames the output files
You then just use this helper script instead of calling pybot directly.
I'm having trouble working out how to create a timestamped directory at the end of the execution. This is my script it timestamps the files, but I don't really want that, just the default file names inside a timestamped directory after each execution?
CALL "C:\Python27\Scripts\robot.bat" --variable BROWSER:IE --outputdir C:\robot\ --timestampoutputs --name "Robot Execution" Tests\test1.robot
You may use the directory creation for output files using the timestamp, like I explain in RIDE FAQ
This would be in your case:
-d ./%date:~-4,4%%date:~-10,2%%date:~-7,2%
User can update the default output folder of the robot framework in the pycharm IDE by updating the value for the key "OutputDir" in the Settings.py file present in the folder mentioned below.
..ProjectDirectory\venv\Lib\site-packages\robot\conf\settings.py
Update the 'outputdir' key value in the cli_opts dictionary to "str(os.getcwd()) + "//Results//Report" + datetime.datetime.now().strftime("%d%b%Y_%H%M%S")" of class _BaseSettings(object):
_cli_opts = {
# Update the abspath('.') to the required folder path.
# 'OutputDir' : ('outputdir', abspath('.')),
'OutputDir' : ('outputdir', str(os.getcwd()) + "//Results//Report_" + datetime.datetime.now().strftime("%d%b%Y_%H%M%S") + "//"),
'Report' : ('report', 'report.html'),