NightOwl888 commented on issue #406:
URL: https://github.com/apache/lucenenet/issues/406#issuecomment-771731062


   I specifically [brought this to the attention of the NUnit 
team](https://github.com/nunit/nunit3-vs-adapter/issues/301) when we started 
targeting NUnit 3 instead of NUnit 2. `Console.WriteLine()` used to work in 
NUnit 2 flawlessly, but we had to make the switch to NUnit 3 to support .NET 
Standard.
   
   There seems to be more options in NUnit 3, but I haven't worked out which 
one is the "right" one for our use cases
   
   - In Visual Studio, write output to debug or console output
   - On `dotnet test`, output to stdout
   - Xamarin.Android - not sure
   - Xamarin.iOS - not sure
   - UWP - not sure
   
   I believe all of the mobile platforms have a standard way to write output, 
but they would need further investigation.
   
   ## Verbose Setting
   
   Do note that we also had an issue with some of the tests with larger output 
filling up a buffer in Visual Studio and crashing the IDE. Those tests have 
since had their `Verbose` output either disabled or truncated. We either need 
to find an actual way to increase the buffer, or find the "proper" way to 
output the logging from the tests.
   
   Currently verbose is set to true when running tests in `Debug` mode. It can 
also be set to true by adding a file named `lucene.testsettings.json` in a test 
folder or parent folder of the tests with `verbose` set to `true`
   
   ```json
   {
       "tests": {
           "verbose": "true"
       }
   }
   ```
   
   ## Abstraction of Output Methods
   
   I suggest using an abstract set of `Write` and `WriteLine` methods into the 
test framework for writing the output into a `TextWriter` and then we can 
easily switch that to whatever output NUnit requires or even do more than one 
output simultaneously, if needed. The `Trace` functionality of .NET is designed 
in just such a way.
   
   Do note that in some cases, output is written to an `InfoStream`, which can 
be directed to any `TextWriter` as well.
   
   ## Future Porting
   
   One additional thing to keep in mind - when porting future tests, the 
logical thing to do is to change
   
   - `System.out.println()` > `Console.WriteLine()`
   - `System.out.print()` > `Console.Write()`
   
   Whatever syntax we actually end up with, we should strive to make these 
lines intuitive to convert to .NET.
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to