Class Events
Events invoked during a code coverage session. A code coverage session is the period between starting and finishing capturing code coverage data.
Namespace: UnityEditor .TestTools .CodeCoverage
Assembly: Unity.TestTools.CodeCoverage.Editor.dll
Syntax
public static class Events
Examples
In the following example we create event handler methods which subscribe to the on
using UnityEngine;
using UnityEditor;
using UnityEditor.TestTools.CodeCoverage;
[InitializeOnLoad]
public class CoverageSessionListener
{
static CoverageSessionListener()
{
Events.onCoverageSessionStarted += OnSessionStarted;
Events.onCoverageSessionFinished += OnSessionFinished;
Events.onCoverageSessionPaused += OnSessionPaused;
Events.onCoverageSessionUnpaused += OnSessionUnpaused;
}
static void OnSessionStarted(SessionEventInfo args)
{
Debug.Log($"{args.SessionMode} Code Coverage Session Started");
}
static void OnSessionFinished(SessionEventInfo args)
{
Debug.Log($"{args.SessionMode} Code Coverage Session Finished");
string paths = string.Empty;
foreach (string path in args.SessionResultPaths)
paths = string.Concat(paths, "\n", path);
Debug.Log($"Code Coverage Results were saved in: {paths}");
}
static void OnSessionPaused(SessionEventInfo args)
{
Debug.Log($"{args.SessionMode} Code Coverage Session Paused");
}
static void OnSessionUnpaused(SessionEventInfo args)
{
Debug.Log($"{args.SessionMode} Code Coverage Session Unpaused");
}
}
Events
onCoverageSessionFinished
This event is invoked when a code coverage session is finished.
Declaration
public static event Action<SessionEventInfo> onCoverageSessionFinished
Event Type
Type | Description |
---|---|
Action<Session |
onCoverageSessionPaused
This event is invoked when a code coverage session is paused.
Declaration
public static event Action<SessionEventInfo> onCoverageSessionPaused
Event Type
Type | Description |
---|---|
Action<Session |
onCoverageSessionStarted
This event is invoked when a code coverage session is started.
Declaration
public static event Action<SessionEventInfo> onCoverageSessionStarted
Event Type
Type | Description |
---|---|
Action<Session |
onCoverageSessionUnpaused
This event is invoked when a code coverage session is unpaused.
Declaration
public static event Action<SessionEventInfo> onCoverageSessionUnpaused
Event Type
Type | Description |
---|---|
Action<Session |