Package: robotframework-reportmodifier
IntroductionThe high complexity of tests and the amount of information that can be logged makes the final report very confusing and unreadable for colleagues who aren't testers with Robot Framework knowledge but need to know the rough test flow and result. To provide a better overview of the test content, the library can filter the content by message content, keyword names or even keyword paths.Configuration assignmentThe report is configured using YAML files. The YAML files must be saved within the /tests folder. The name of the file to be used must be stored as a "report:" tag on the test case - either as a test tag for all test cases in the file or as a tag for a specific test case. There is also the option of a base configuration for all test cases using tag "report:basic_config" with file "basic_config.yaml" withing the /test directory. Examples:***Settings***

Testtagsreport:basic_config==> All test cases receive the custom report with the configuration basic_config.yamlAlternatively/additionally you can define the report at every test, e.g.***TestCases***

MyRobotTestWithCustomLog[Tags]report:custom

MyRobotTestWithCustomLog2[Tags]report:custom_log2Configuration contentThe YAML-configuration supports the following options:keywordsmessagesignored_messageskeyword_name_as_infokeyword_as_structureOption "keywords"Filtering based on the keyword names or paths.The keyword configuration can be used to store the name of a keyword, part of the call path of a keyword or the complete call path of a keyword. Different keywords can be defined in additional lines, e.g.:keywords:-SecondLevelKeyword.ThirdLevelKeyword→Allloggedcontentsofthekeyword*SecondLevelKeyword.ThirdLevelKeyword*areincluded,regardlessofhowoftenthiscallwasmadeinthetestcase.Option "messages"Filtering based on message content.The message configuration collects logs that contain a specific text or correspond to a specific regular expression. It means, the message is valid as soos as defined text is found in the message or the regular expression has any foundings. For the definition of the RegEx pattern, we recommend an online test, e.g. on regex.com. Characters such as $ must be escaped with a backslash ().
Examples:message="Starting test case with a custom log."messages:-text:custom→Logisrelevantbecausemessagecontainstheword"custom"-pattern:Starting.*log→Logisrelevantbecauseregex.findall("Starting .* log","message",regex.IGNORECASE)returnsatleastonehitOption "ignored_messages"Removal of unwanted content that was taken along by previous configuration, e.g.:message 1 = "Starting test case with a custom log."
message 2 0 "Finished test case with a custom log."yaml configuration:messages:-text:custom
ignored_messages:-text:finished→The2ndmessage"Finished test case with a custom log."isignoredeventhoughitwasfoundusingthepattern"custom".-pattern:fin.*→The2ndmessage"Finished test case with a custom log."isignoredeventhoughitwasfoundusingthepattern"custom".Option "keyword_name_as_info"To make the test procedure easier to read, it can be helpful to list the names of certain keywords, including the documentation, as information. These are automatically highlighted in colour. The configuration is as follows:keyword_name_as_info:-ThirdLevelKeywordOption "keyword_as_structure"Another option for improving the readability of the report is to specify the keyword structure. This means that it is possible to include keywords as such in the modified report and place them at the top level of the report - directly below the test case. The structure specification requires that content is found via "messages" or "keywords" that are found in these keywords.keyword_as_structure:-SecondLevelKeywordIn the tests/robot directory you can find some examples.UsageYou can create a custom log calling the class ReportModifier with the parametersbasis_output_xml,result_dirandreport_name, e.g.:ReportModifier(basis_output_xml,result_dir,report_name).write_report()or using the listener "ReportModifierListener" which is a Listener V3. In this case, the source xml file is the current created xml file, result dir the current result dir and report name the configured tag name.