Skip to content
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

Add timestamp to the log #610

Closed
fanyang-mono opened this issue May 25, 2021 · 3 comments
Closed

Add timestamp to the log #610

fanyang-mono opened this issue May 25, 2021 · 3 comments

Comments

@fanyang-mono
Copy link
Member

I am trying to investigate a test timeout issue. It would be helpful to have timestamps in the log. Right now xharness print logs like this:

  Discovering: reflection.SetValue.XUnitWrapper
  Discovered:  reflection.SetValue.XUnitWrapper
  Discovering: reflection.DefaultInterfaceMethods.XUnitWrapper
  Discovered:  reflection.DefaultInterfaceMethods.XUnitWrapper
  Discovering: reflection.Modifiers.XUnitWrapper
  Discovered:  reflection.Modifiers.XUnitWrapper
  Discovering: reflection.StaticInterfaceMembers.XUnitWrapper
  Discovered:  reflection.StaticInterfaceMembers.XUnitWrapper
  Starting:    reflection.StaticInterfaceMembers.XUnitWrapper

It would be nice to have logs like this

 [yyyy/MM/dd HH:mm:ss.ff] Discovering: reflection.SetValue.XUnitWrapper
 [yyyy/MM/dd HH:mm:ss.ff] Discovered:  reflection.SetValue.XUnitWrapper
 [yyyy/MM/dd HH:mm:ss.ff] Discovering: reflection.DefaultInterfaceMethods.XUnitWrapper
 [yyyy/MM/dd HH:mm:ss.ff] Discovered:  reflection.DefaultInterfaceMethods.XUnitWrapper
 [yyyy/MM/dd HH:mm:ss.ff] Discovering: reflection.Modifiers.XUnitWrapper
 [yyyy/MM/dd HH:mm:ss.ff] Discovered:  reflection.Modifiers.XUnitWrapper
 [yyyy/MM/dd HH:mm:ss.ff] Discovering: reflection.StaticInterfaceMembers.XUnitWrapper
 [yyyy/MM/dd HH:mm:ss.ff] Discovered:  reflection.StaticInterfaceMembers.XUnitWrapper
 [yyyy/MM/dd HH:mm:ss.ff] Starting:    reflection.StaticInterfaceMembers.XUnitWrapper

To achieve this, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.ff") should be added to the following places

Console.WriteLine($"Discovering: {assemblyFileName} (method display = {discoveryOptions.GetMethodDisplayOrDefault()}, method display options = {discoveryOptions.GetMethodDisplayOptionsOrDefault()})");

Console.WriteLine($"Discovered: {assemblyFileName} (found {testCasesToRun.Count} of {discoverySink.TestCases.Count} test cases)");

testSink.Execution.TestAssemblyStartingEvent += args => { Console.WriteLine($"Starting: {assemblyFileName}"); };
testSink.Execution.TestAssemblyFinishedEvent += args => { Console.WriteLine($"Finished: {assemblyFileName}"); };

@premun
Copy link
Member

premun commented May 25, 2021

@fanyang-mono I am not sure you are using this ThreadlessXunitTestRunner in your tests. This one is only used in WASM flows and is a copy of the regular Xunit test runner and the code for that is not in this repo.

I think you should try configuring the test runner you are using (if it has options like that) on your side. If I am correct, you invoke the Helix job via running:

dotnet C:\h\w\A7A008E0\p\xunit\xunit.console.dll

Where the test runner comes from a NuGet?

@premun
Copy link
Member

premun commented May 28, 2021

We discussed this offline. Nothing we can do as this is not the test runner in question

@premun premun closed this as completed May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants