question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improvement: Extend TestContext with Write method

See original GitHub issue

I would like to suggest to add to TestContext the Write(string message) method. The suggested method behaves identically to the existing method WriteLine(string message), except that it does not terminate the message with the newline character. Compare for example the existence of both Write and WriteLine in System.Console.

In a project I am currently working on, there is a lot of existing logging code. I wrote a logging adapter forwarding the logging output to TestContext.WriteLine. The logging mechanism already takes care of formatting and inserts line terminators. This results in empty lines (double line termination) in the test log, making it harder to read and unnecessary long.

I would be glad to contribute the PR myself, but only if it fits in the product vision, of course.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nohwndcommented, Feb 26, 2020

Ah okay, next time please mention the issue in the PR like this, so it gets vlosed when the PR is merged:

Fixes #645

0reactions
HeroMaxPowercommented, Feb 26, 2020

@nohwnd this issue can be closed now

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to extend TestClass, TestMethod and TestCleanup in ...
Try having the abstract class calling a new OnTest method: [TestClass] public abstract class TestBase { bool disposed = false; ...
Read more >
Create Data-Driven Unit Tests - Visual Studio (Windows)
Learn how to use the Microsoft unit test framework for managed code to set up a unit test method to retrieve values from...
Read more >
TestContext
The TestContext class allows tests to access certain information about the execution context.
Read more >
Improve Build Times with Context Caching from Spring Test
Understand how the Context Caching mechanism from Spring Test can improve your build time while resuing an already started context.
Read more >
A Comprehensive Guide On JUnit 5 Extensions
In this blog, we will learn about different kinds of extension models in the JUnit 5 testing library and see how JUnit 5...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found