I am Daniel and fairly new to Robotframework. Currently I am scouting the possibilities of (output) file compare, whether it be a csv or xml.
There is an output file generated by the SUT and I have a reference file with the expected result.
I either used the Diff Files keyword to compare or convert both files to Strings and do a Should Be Equal as Strings to them. OK.
Dynamic contents like a timestamp I can easily resolve in the expected result with a variable, but there are also elements like e.g. an ever changing ID field, that actually needs to be ignored in the compare.
Have you already looked at the keywords in the builtin XML Library?
There’s a lot of useful keywords for getting a list of elements (so you can use a FOR loop) and for getting individual elements or the attributes/values of elements
Thanks Dave, the XMLLibrary might indeed be helpful especially when comparing xml files. I am particularly interested in the pattern matching stuff with e.g. the keyword Elements Should Match. I might indeed have to use a for loop to scan all the elements, hopefully it is possible to provide an * within those elements of the expected result xml file, where the values do not need to be validated.
I also looked into the RF CSVLibrary but this one does not have that many keywords provided. I hope to find some pattern matching examples for csv-files as well. So I can also use the * for skipping some columns. I might end up with some regex string comparison. Looking for some hooks to set that up. Wish me luck.
There are a lot of libraries for robot framework for doing so many things, for example a lot of people use the datadriver Library for csv and excel files, and I find Collections quite useful as well.
Also Evaluate can be very useful to just call a python function if you need to.
If you can’t find a library that does what you need but are comfortable with python, they are easy to create as well (something to remember later down the track)
The most powerful thing about robot framework though is the ability to combine keywords from several libraries in the same test case to acheive quite complex workflows that are still easy to read and understand without being a programmer.