-
Notifications
You must be signed in to change notification settings - Fork 758
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add TestEventSource and use it in TestInvoker (#2884)
- Loading branch information
1 parent
4100ea2
commit 0b635ca
Showing
2 changed files
with
51 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System.Diagnostics.Tracing; | ||
|
||
namespace Xunit.v3; | ||
|
||
[EventSource(Name = sourceName, Guid = "ae399e80-45fc-4219-aacc-b73a458ad7e1")] | ||
internal sealed class TestEventSource : EventSource | ||
{ | ||
const string sourceName = "xUnit.TestEventSource"; | ||
|
||
internal static readonly TestEventSource Log = new(); | ||
|
||
TestEventSource() { } | ||
|
||
[Event(Events.TestStart, Level = EventLevel.Informational, Task = Tasks.Test, Opcode = EventOpcode.Start)] | ||
internal void TestStart(string testName) => WriteEvent(Events.TestStart, testName); | ||
|
||
[Event(Events.TestStop, Level = EventLevel.Informational, Task = Tasks.Test, Opcode = EventOpcode.Stop)] | ||
internal void TestStop(string testName) => WriteEvent(Events.TestStop, testName); | ||
|
||
class Events | ||
{ | ||
internal const int TestStart = 1; | ||
internal const int TestStop = 2; | ||
} | ||
|
||
class Tasks | ||
{ | ||
internal const EventTask Test = (EventTask)1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters