I have a question about '--removekeywords'. According to RF User Guide about log outputs: "Removing keywords is done after parsing the output file and generating an internal model based on it."
Do we have any way to make the same parsing on output.xml as well?
I need that the same functionality will be also in xml file.
I really need this and will be appreciated for any help)
Related
In my RF tests in few places I have added logging by
log to console Scanning first UID ${pack_uids}[0]
But when I open HTML log file, I expected to see a value, which was used in this test. Instead I have exactly the text.
While Robot Framework can work with ${pack_uids}[0] stored as a variable, how can I get variable value, instead of plain text? I tried also to use Log only, same issue.
Similar case, when I try to log to file from Python file by running
logger.console("Some foo")
But as a result, this is not presented in log.html file at all.
And a side question, is it possible to get logs produced by each pabot thread in some file, like it's created in the console when running a single robot command?
Another option is to set the loglevel to INFO
In the command line use --loglevel option or the Set Log Level keyword
Of course I found it out just after placing the question... It's really important to have Log only, and the details are presented in a new line
In Python file use
logger.write("Log you want to include" + str(variable))
And it's working all fine. Just mind you need to expand the logging row
my management would like to have a simple switch to trigger the generated ROBOT test reports, to get from one test execution two reports: one comprehensive detailed report (xml, html) and one management-level report with general info and without many technical details.
Is there a standard ROBOT mechanism to generate two different reports at once?
How would you do?
Thank you for your suggestions!
Robot has the built-in ability to generate four types of outputs:
log.html is a detailed low level log of test execution, showing the details of every suite, test case, and keyword (parameters, results, duration)
report.html is a more high level overview of test execution
output.xml is a detailed log of all of the data used to generate the other reports
xUnit is an XUnit-compatible file that can be processed by many xUnit-compatibile tools
The log.html, report.html, and output.xml files are all generated by default. Generating the xUnit output requires the use of a command line option.
If none of those meet your need, there is an API for reading and processing the output.xml file which you can use to generate a custom report. The format of the output.xml file is very simple and easy to parse, so you can also use just about any xml parsing tool you want to parse the results and generate your own report.
All of this information is available in the robot frame user guide, in a section titled Created outputs.
I have recently started working on a program that should not be changed much and there are problems that it closes properly with Robot Framework. The method that came to my mind now was that I could get the reports before the test end.
So I have this Question:
Is there a possibility or keyword in Robotframework that I can use to get reports before the test is done?
Is there a possibility or keyword in Robotframework that I can use to get reports before the test is done?
No, there is not. Robot creates the reports as an in-memory xml document. It doesn't write the data to disk until the tests are finished. It then runs a post-processing step to convert them to html.
As #Bryan wrote, there is no way to get report.html during robot runtime as it is generated in postrun step.
However, you may use listener to get feedback from robot about execution status. For instance, in RED Robot Editor IDE, it is used to populate Execution View (see screenshot at the bottom):
http://nokia.github.io/RED/help/user_guide/launching/ui_elements.html
More about listener API: https://github.com/robotframework/robotframework/blob/master/doc/userguide/src/ExtendingRobotFramework/ListenerInterface.rst
When I am trying to copy the file 'Output.xml' from parent folder to target folder, it is not being copied properly i.e: the file size, in the target folder, is different. I am executing the keyword to copy files in my 'Suite Teardown'. Any solution for the issue.
Code written to copy files:
OperatingSystem.Copy Files ${sProjectPath}//output.xml ${sFinalFolder}
The problem is that while the test is running, the output file doesn't exist. It can't exist during suite teardown, because the result of the suite teardown must be part of the log.
If you need the log in another folder, the simplest solution is to tell robot to write it there initially, with the command line option --output or --outputdir.
If you cannot use --output, perhaps the simple solution is to create a script that runs your tests, and then copies the file after it runs. This is mentioned in the user guide in the section titled Creating start-up scripts.
A slightly more complex solution is to use a listener which copies the file in the done method.
Robot run reports are created at the end by robot-framework tool. Hence complete result/report files doesn't exist even in suite teardown.
Best practice would be providing --ouput argument with desired output dir.
More detail you can find from user guide
Robot framework user Guide under section 3.5.1
Note:
The command line option --output (-o) determines the path where the output file is created relative to the output directory. The default name for the output file, when tests are run, is output.xml.
Alternative way is use to rebot command and act on the output file generated by robot run.
When post-processing outputs with Rebot, new output files are not created unless the --output option is explicitly used.
Whether or not it can be done from Robot Framework script, the question is it should be done from Robot Script. These files could be locked and or changed by the current Robot Framework process. If not today, this could well be a part of any future change in this area.
With this perspective I can only recommend to copy these files prior to the start of Robot Framework, and not after. This ensures that the contents of these files are not changed and are fit for the purpose you have in mind.
As these types of actions are typically not part of a Test Case scenario I consider them to be part of the overarching Orchestration. This includes fetching the right version of the test script from version control software, starting Robot Framework, communicating results (ex. email) and safeguarding the test evidence (Log files and other files).
In general these are standard step functionality in a CI tool like Jenkins, Travis CI or Bamboo (to name a few). Even if you have only started on this path, separating this kind of logic from your test script will save you a lot of effort later on.
looks like that Copy Files Kw does not copy the content of output.xml during Teardown ,although it creates file with samename. As A.Kootstra suggested it could be a limitation currently.
Alternative:
in a separate robot script you can rename the file 'output.xml' generated from first script and then can run below command
Copy Files
${sProjectPath}//output.xml ${sFinalFolder}
This copies the whole content
My Robot reports contains sensitive information. I want to archive them for a security reason.
Anyone suggest me the way or process to archive/encrypt the robot reports??
Thanks,
Prasad Pasupuleti
use the --outputdir option to have the output files written to an empty directory. You can then zip/tar that whole directory into a single file that you can copy anywhere you want.
If you need the data encrypted you can use GnuPG or bcrypt, or any of the other standard encryption tools.