-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to color text output when running the tests using testcentric #516
Comments
The GUI is able to color output for lines it generates itself. For your own text output, we would have to add some way to tell us what color to use. I'm don't think it can be done in the GUI alone, however, since the output is generated by the NUnit framework. I'll hang on to this as a possible future idea. |
Thanks for your answer! |
@mariaaNT That should help you for a temp solution at least. I'd like to explain why it's not so good as a permanent solution or for expansion within NUnit. NUnit currently supports three output streams for text output from tests: Out, Error and Progress. (There are also Console.Out and Console.Error, but they translate, respectively, to the first two.) The Out stream is incorporated in the test result itself. The other two are considered "immediate" output and are sent directly to the whatever runner you are using. The intention behind the different streams is that the runner may do different things with them. For example, the console runner displays both Error and Progress immediately in the text screen, using red for the Error output and the default output color for Progress. OTOH, a hypothetical GUI runner might decide to display Error and Progress in two different windows, so you could not use those two effectively just for the coloring. I could see expanding this to have a Warning output, which the console might choose to display in yellow. That's becasue "Error" and "Warning" indicate the purpose of the output, leaving the runner free to make a decision about how to display them. But beyond that, I don't see the use of different streams as a good way to display color. If we wanted color to be selectable for each fragment you write, we could add a parameter to the message that is sent to the runner and overloads to all the Write messages. That's simple but tedious, since there are quite a lot of calls to overload. OTOH, we could decide to support some sort of standard for color escapes in the text and just pass them to the runner. Some runners would use them while others might have to strip the information in order to do the display. The GUI could interpret some sort of color coding if you included it (we would have to add the fetaure) but I don't think that's really useful if it's going to mess up your output when you run under the NUnit console runner. |
Is there a possibility for coloring the output text in testcentric (not in the console but in the GUI Runner -> testcentric.exe)?
e.g. red for 'ERROR' level, green for 'DEBUG' level and so on ...
We are using a custom log4net appender in our project, which is using the TestContext.Progress.Write() method for writing test logging to the 'Text Output' window in real time.
As there are some green colored lines that come from NUnit3 during the test execution (see the screenshot attached), we would like to know where this is done and how. Is there a possibility for us to achieve this?
Thanks,
Maria
The text was updated successfully, but these errors were encountered: