Change color of report depending on condition or pass/fail

Ranorex Spy, Recorder, and Studio.
cruzez
Posts: 24
Joined: Thu Jan 27, 2011 3:03 am
Location: London, UK

Change color of report depending on condition or pass/fail

Post by cruzez » Wed May 21, 2014 3:42 pm

Hi I am trying to BDD with my tests, (not really a specflow or cubumber type tests but I have copied its techniques to look and feel like BDD) but statements are just Report.Log( ReportLevel.None "message) embedded within test steps, put background and font style to differentiate rest of report logs.

From the attachment you can see my BBD scenarios My Question here, if a test fails, is there anyway I can make my scenario log go red or some different color?
Attachments
attach.png
Report
attach.png (16 KiB) Viewed 1766 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Change color of report depending on condition or pass/fail

Post by Support Team » Fri May 23, 2014 12:54 pm

Hey cruzez,

You could use a “Custom Report Template” in order to modify the look of your report.

Just modify following part of the RanorexReportX.css file if you want to change the color of the log messages:
--> tr.Debug {
        color: gray;
    }
    tr.Warn {
        color: #333;
        background-color: #fffea7;
    }
    tr.Error {
        color: #fff;
        background-color: #d80000;
        font-weight: bold;
    }
    tr.Failure {
        color: #fff;
        background-color: #d80000;
        font-weight: bold;
    }
    tr.Success {
        color: green;
    }
Regards,
Robert
.
Image

cruzez
Posts: 24
Joined: Thu Jan 27, 2011 3:03 am
Location: London, UK

Re: Change color of report depending on condition or pass/fail

Post by cruzez » Fri May 23, 2014 2:58 pm

Hi Robert, thanks for the response, I have already modified to custom template,
I made report.none to blue color.

tr.None {
color: #E5E4E2;
background-color: #151B8D;
font-style: italic
}


I was thinking in anyway I can make that blue color to have different one if condition in my tests fails or gives different result from expected. Something like this below

If condition = 1
tr.none { Color1, style 1}

else tr.none { color2, style 2}

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Change color of report depending on condition or pass/fail

Post by Support Team » Mon May 26, 2014 1:18 pm

Hello cruzez,

I'm afraid that I do not correctly understand your issue. There are six different report levels (not including "None" and "Always") whose styles can be modified in the css file, why would you need to do something like this:
If condition = 1tr.none { Color1, style 1}

else tr.none { color2, style 2}
Regards,
Robert
.
Image