Add color to Validate method in User Code

Ask general questions here.
Posts: 1
Joined: Mon Mar 22, 2021 10:44 pm

Add color to Validate method in User Code

Post by rahat3 » Thu Apr 08, 2021 5:45 pm

I have a user code module in a test case. In the user code module I am validating some database values. Using :

Report.Log(ReportLevel.Info, "Validation", "Compare values below:");
Validate.AreEqual(numbers[2], sqlnumbers[2]);

When running from user code module using the "Run Code" button the Ranorex log gives the green color for Validate line in the log but when running the entire test case I get the log line: "Objects are eqaul(actual="a number", expected="a number); which is correct but no green Validate color for the log message. How can I get the green color in Ranorex log when using Validate method in user code.
What I want to get.JPG
This is what I WANT to get when I run the entire test case but only getting this when running user code itself
What I want to get.JPG (53.1 KiB) Viewed 80 times
what I am getting.JPG
This is what I am GETTING when I run the entire test case
what I am getting.JPG (29.7 KiB) Viewed 80 times

User avatar
Ranorex Guru
Ranorex Guru
Posts: 6553
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Add color to Validate method in User Code

Post by odklizec » Thu Apr 08, 2021 9:01 pm


This is really weird. I'm not experiencing such problem? Validation.AreEqual returns green text in report (in case of success), no matter how the test is run or where the validation mehod is called from.
validation.png (6.26 KiB) Viewed 74 times
Could you please create a small sample project, simulating your issue and post it (zipped) here? Thanks.

BTW, have you modified report template? Because the report looks definitely different from standard Ranorex report. So it seems to me that the solution is using customized report template. And this is why it looks so different, including colors.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration