Ranorex: mark a bug as "known-bug"

71 Views Asked by At

Sometimes it takes long time for the software developers in your team to fix a well-known and reported bug. If there is a corresponding automatic test case that is covering this bug, then it will continue to fail for a long time.

So it would be helpful to mark this bug as a "known-bug" to keep the overview in the testreport.

Where can I catch any exception in Ranorex?

1

There are 1 best solutions below

0
else42.de On
/// <summary>
/// This method is used to have only new bugs appear as errors in the test report - known bugs that have already been described in a ticket will only appear as warnings in the test report.
/// 1.) You need to set the action that causes the bug to "Continue on fail".
/// 2.) You need to insert this UserCodeMethod behind the error-prone action as a UserCode action.
/// </summary>
/// <param name="errormessage">
/// The specific part of the error message triggered by the known bug is entered here.
/// </param>
/// <param name="linkToTicketOfKnownBug">
/// self-explanatory.
/// </param>
/// <param name="furtherInfos">
/// Interesting information about this known bug, e.g. the environment in which the bug occurs.
/// </param>
[UserCodeMethod]
public static void ReportLinkToKnownBug(string errorMessage, string linkToTicketOfKnownBug, string furtherInfos)
{
    if (String.IsNullOrEmpty(furtherInfos)) furtherInfos = "---";
    
    string resultSummary = Ranorex.Core.Reporting.TestReport.CurrentTestContainerActivity.ResultSummary;
    
    string description = String.Empty;
    if (!String.IsNullOrEmpty(errorMessage) && resultSummary.Contains(errorMessage)) {
        description = "An already known bug happened here.";
        } else {
        description = "The expected known bug DID NOT HAPPEN here.";
    }
    
    Report.LogHtml(Ranorex.ReportLevel.Warn, "<p>" + description + "</p><p>The expected error message is: " + errorMessage + "</p><p>Link to the corresponding bug-ticket: <a href='" + linkToTicketOfKnownBug + "'>Bug-Ticket</a>.</p><p>Further infos: " + furtherInfos + "</p>");
}