I am using robotframework to automate the system tests for the embedded sw. After executing the tests, the log.html, output.xml and report.html are saved in Output folder inside the robotframework repo. The system tests in the output folder have some images generated while running the tests. If I open the report keeping Output folder inside the robotframework repo then all images are displayed like the following.
enter image description here
But if I relocate the Output folder to some other place, then the images are not displayed and the log.html file looks for the images in the Output folder placed in the robotframework repo instead of the new location of the Output folder.
enter image description here
The implementation of plotting the images is given below
def plot_data(
self,
data: Data,
*,
title: Optional[str] = None,
marker: str = “o”,
markersize: float = 2.0,
):
“””Plots the data given and adds it to the report file generated by
Robot Framework. A .png for the plotted data is also available in the
same location as the report file.”””
testcase, outputdir = self._get_test_variables()
plttitle = title if title is not None else testcase
filetitle = self._strip_string_for_path(plttitle)
fig_path = os.path.join(
outputdir,
f'{filetitle}-DataVerification-{datetime.now().strftime("%Y%m%d-%H%M%S")}.png',
)
plt.title(plttitle)
plt.xlabel(data.x_label)
plt.ylabel(data.y_label)
plt.plot(
data.x, data.y, label=data.y_label, marker=marker, markersize=markersize
)
plt.legend()
plt.savefig(fig_path)
self._log_plot(fig_path)
plt.close()
Here the outputdir and fig_path are absolute path to the Output folder in the Roboframework repo. The robotframework repo is the folder where out whole auto-test framework lies.
Do anyone have seen the same issue? Any solution?
After result folder “Output”has been generated by robot.rebot() function, I have tried to change output.xml file by changing the path to the png images and regenerate the log.html file, but it did not work for me. I also tried to make the output.xml to ignore the absolute path to the output folder in the robotframework and always tried to search for .png images in the current folder but I could not find the way in python.
Shahid is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.