Navigation
API > API/Plugins > API/Plugins/NetcodeUnitTest
Manages centralized execution and tracking of unit tests, as well as handling console commands, and some misc tasks like local log hooking
| Name | UUnitTestManager |
| Type | class |
| Header File | /Engine/Plugins/NetcodeUnitTest/NetcodeUnitTest/Source/NetcodeUnitTest/Classes/UnitTestManager.h |
| Include Path | #include "UnitTestManager.h" |
Syntax
UCLASS (Config=UnitTest)
class UUnitTestManager :
public UObject ,
public FTickableGameObject ,
public FOutputDevice
Inheritance Hierarchy
- FOutputDevice → UUnitTestManager
- FTickableObjectBase → FTickableGameObject → UUnitTestManager
- UObjectBase → UObjectBaseUtility → UObject → UUnitTestManager
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UUnitTestManager
(
const FObjectInitializer& ObjectInitializer |
UUnitTestManager | UnitTestManager.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~UUnitTestManager() |
Destructor for handling removal of log registration | UnitTestManager.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| AbortAllDialog | TSharedPtr< SWindow > | The 'abort all' dialog | UnitTestManager.h | |
| ActiveUnitTests | TArray< TObjectPtr< UUnitTest > > | Holds a list of currently active unit tests | UnitTestManager.h | |
| AutoCloseMemoryPercent | uint8 | As above, but when reaching this limit, recently started unit test(s) will be terminated/re-queued, to get back within limits | UnitTestManager.h |
|
| bAbortedFirstRunUnitTest | bool | If a unit test was aborted on its first run, strictly cap all first-run unit tests to one at a time | UnitTestManager.h | |
| bAllowRequeuingUnitTests | bool | Whether or not to allow re-queuing of unit tests | UnitTestManager.h | |
| bCapUnitTestCount | bool | Whether or not to cap the maximum number of unit tests that can be active at any given time | UnitTestManager.h |
|
| bCapUnitTestMemory | bool | Whether or not to cap active unit tests, based on memory usage | UnitTestManager.h |
|
| FinishedUnitTests | TArray< TObjectPtr< UUnitTest > > | Unit tests which are finished, and are kept around until printing the final summary | UnitTestManager.h | |
| MaxAutoCloseCount | uint8 | Limits the number of auto-aborts a particular unit test will allow, before it is no longer accepted for re-queueing | UnitTestManager.h |
|
| MaxMemoryPercent | uint8 | When total physical memory usage, as a percentage, reaches this limit, no new unit tests can be started | UnitTestManager.h |
|
| MaxUnitTestCount | uint8 | Specifies the maximum number of unit tests that can be run at any given time | UnitTestManager.h |
|
| PendingUnitTests | TArray< TObjectPtr< UClass > > | Holds a list of unit tests pending execution | UnitTestManager.h | |
| StatusLog | TUniquePtr< FOutputDeviceFile > | The log file for outputting overall unit test status | UnitTestManager.h | |
| StatusWindow | TSharedPtr< SLogWindow > | The log window which displays the overall status of unit testing | UnitTestManager.h | |
| UnitTestSessionCount | uint32 | The number of recorded sessions where UE has run unit tests (max one per each run of the UE process) | UnitTestManager.h |
|
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| BaseUnitLogDir | FString | The base log directory used by unit tests, for this session | UnitTestManager.h | |
| bStatusLog | bool | Whether the current log line being written, is a status log or not (used to toggle Serialize function between modes) | UnitTestManager.h | |
| DialogWindows | TMap< TSharedRef< SWindow >, UUnitTest * > | Maps open dialog boxes, to unit tests | UnitTestManager.h | |
| LastMemoryLimitHit | double | The time at which the memory limit was last hit | UnitTestManager.h | |
| LogWindowManager | FLogWindowManager * | The log window manager - used for creating and managing the positioning of unit test log windows | UnitTestManager.h | |
| MemoryTickCountdown | int32 | When a unit test is force-closed, wait a number of ticks for global memory values to update, before closing any more | UnitTestManager.h | |
| MemoryUsageUponCountdown | SIZE_T | When waiting for restart of unit test auto-closing, note the system memory usage, and end the countdown early if it increases | UnitTestManager.h | |
| StatusColor | FSlateColor | The colour to use for the current status log | UnitTestManager.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void DumpStatus
(
bool bForce |
Dumps status information for running/pending unit tests, to the status window and log | UnitTestManager.h | |
bool Exec
(
UWorld* InWorld, |
Handles exec commands starting with 'UnitTest' | UnitTestManager.h | |
const FString GetBaseUnitLogDir() |
Returns the base log directory used by unit tests | UnitTestManager.h | |
void Initialize() |
Initialize the unit test manager | UnitTestManager.h | |
void InitializeLogs() |
Initialize unit test log output | UnitTestManager.h | |
bool IsRunningUnitTests() |
Returns whether or not there are unit tests running (or about to be run) | UnitTestManager.h | |
void NotifyCloseAllDialogResult
(
const TSharedRef< SWindow >& DialogWindow, |
When the main status window is closed, a dialog pops up asking if you want to abort all running unit tests; this returns the result | UnitTestManager.h | |
void NotifyCloseDialogResult
(
const TSharedRef< SWindow >& DialogWindow, |
When a log window is closed, a dialog pops up asking if the unit test should be aborted - this returns the result NOTE: This dialog is non-modal, i.e. doesn't block the game thread - so the unit test is not guaranteed to still exist | UnitTestManager.h | |
void NotifyLogWindowClosed
(
const TSharedRef< SWindow >& ClosedWindow |
Notifies when a log window has closed | UnitTestManager.h | |
void NotifyUnitTestCleanup
(
UUnitTest* InUnitTest |
Notification that is triggered when a unit test is cleaning up | UnitTestManager.h | |
void NotifyUnitTestComplete
(
UUnitTest* InUnitTest, |
Notification that is triggered when a unit test completes | UnitTestManager.h | |
void OpenStatusWindow() |
Opens the status log window | UnitTestManager.h | |
void OpenUnitTestLogWindow
(
UUnitTest* InUnitTest |
Opens the log window, for a unit test | UnitTestManager.h | |
void PollUnitTestQueue() |
Checks to see if we're ready to execute any unit tests in the queue, and if so, begins execution | UnitTestManager.h | |
void PrintFinalSummary() |
Prints the final unit test summary, when all active/pending unit tests have completed | UnitTestManager.h | |
void PrintUnitTestResult
(
UUnitTest* InUnitTest, |
Prints the results information for a single unit test | UnitTestManager.h | |
bool QueueUnitTest
(
UClass* UnitTestClass, |
Queues a unit test for execution | UnitTestManager.h | |
virtual void Serialize
(
const TCHAR* Data, |
We're hiding UObject::Serialize() by declaring this. That's OK, but Clang will warn about it. | UnitTestManager.h | |
void SetStatusColor
(
FSlateColor InStatusColor |
UnitTestManager.h | ||
void SetStatusLog
(
bool bInStatusLog |
Getters/Setters | UnitTestManager.h | |
bool WithinUnitTestLimits
(
UClass* PendingUnitTest |
Tests whether currently active unit tests, and optionally/additionally, a unit test about to be executed, fall within limits/restrictions on unit test counts and memory usage | UnitTestManager.h |
Overridden from FTickableGameObject
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual bool IsTickableWhenPaused() |
UnitTestManager.h |
Overridden from FTickableObjectBase
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual TStatId GetStatId() |
UnitTestManager.h | ||
virtual bool IsTickable() |
Must override in subclasses, that need ticking. | UnitTestManager.h | |
virtual void Tick
(
float DeltaTime |
FTickableGameObject methods | UnitTestManager.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static UUnitTestManager * Get() |
Static getter for the unit test manager | UnitTestManager.h | |
static FSlateColor GetDefaultStatusColor() |
UnitTestManager.h |