Closed
Description
Description
When running dotnet test
with --collect CustomCollector
Console.WriteLine is not emitted into the console. Is it intended by design or can it be considered as a bug?
Steps to reproduce
- Create a custom collector like the following:
[DataCollectorFriendlyName("SampleDataCollector")]
[DataCollectorTypeUri("my://sample/datacollector")]
public class SampleDataCollector: DataCollector
{
public override void Initialize(
System.Xml.XmlElement configurationElement,
DataCollectionEvents events,
DataCollectionSink dataSink,
DataCollectionLogger logger,
DataCollectionEnvironmentContext environmentContext)
{
events.TestCaseEnd += this.Events_TestCaseEnd;
}
private void Events_TestCaseEnd(object sender, TestCaseEndEventArgs e)
{
Console.WriteLine("Hello world!");
}
}
- Place it in a new project (the assembly name must end with "collector")
- Reference this collector project in some test project
- in console run
dotnet test TestProjectFolder --collect SampleDataCollector
- check there is no sign of "Hello world!" in the console
Expected behavior
Console.WriteLine is emitted to the console.
Actual behavior
Console.WriteLine is NOT emitted to the console.
Environment
Windows 10, netstandard2.0, netcore3.1