Navigation
API > API/Plugins > API/Plugins/NetcodeUnitTest
Inheritance Hierarchy
- UObjectBase
- UObjectBaseUtility
- UObject
- UUnitTestBase
- UUnitTest
- UNetBitsTest
- UPackedVectorTest
- UProcessUnitTest
- UClientUnitTest
- UFTextCrash
- UIPClient
- USteamClient
- UWebSocketClient
- UUTT61_DebugReplicateData
- UVMReflection
References
| Module | NetcodeUnitTest |
| Header | /Engine/Plugins/NetcodeUnitTest/NetcodeUnitTest/Source/NetcodeUnitTest/Classes/UnitTest.h |
| Include | #include "UnitTest.h" |
Syntax
UCLASS&40;Abstract, Config&61;UnitTestStats&41;
class UUnitTest : public UUnitTestBase
Remarks
Base class for all unit tests
Variables
| Type | Name | Description | |
|---|---|---|---|
| bool | bAborted | Whether or not the unit test has aborted execution | |
| bool | bCompleted | Whether or not the unit test has completed | |
| bool | bDeveloperMode | Whether or not developer-mode has been enabled for this unit test (prevents it from ending execution) | |
| bool | bFirstTimeStats | Whether it's the first time this unit test has run, i.e. whether prior memory stats exist (NOTE: Not set until first tick) | |
| bool | bObsolete | Whether or not this unit test is obsolete - i.e. based on code no longer present in the game/engine | |
| bool | bUnreliable | Whether or not this unit test is unreliable, i.e. prone to giving incorrect/unexpected results, requiring multiple runs | |
| bool | bWorkInProgress | Whether or not this unit test is a 'work in progress', and should not be included in automated tests | |
| uint64 | CurrentMemoryUsage | The current realtime memory usage of the unit test | |
| TMap< FString, EUnitTestVerification > | ExpectedResult | The unit test result we expect for each games codebase, i.e. whether we expect that the problem is fixed yet or not NOTE: Games which don't have an expected result specified here, are considered 'unsupported' and the unit test isn't run for them | |
| float | LastExecutionTime | The amount of time it took to execute the unit test the last time it was run | |
| double | LastNetTick | The time of the last NetTick event | |
| double | LastTimeoutReset | The last time that the unit test timeout was reset | |
| FString | LastTimeoutResetEvent | Every timeout reset specifies a string to identify/describe the event that triggered it, for tracking | |
| TSharedPtr< SLogWindow > | LogWindow | The log window associated with this unit test | |
| uint64 | PeakMemoryUsage | Config variables Stores stats on the highest-ever reported memory usage, for this unit test - for estimating memory usage | |
| double | StartTime | The time at which execution of the unit test started | |
| TArray< TSharedPtr< FUnitStatusLog > > | StatusLogSummary | Collects unit test status logs, that have been printed to the summary window | |
| double | TimeoutExpire | The time at which the unit test timeout will expire | |
| float | TimeToPeakMem | The amount of time it takes to reach 'PeakMemoryUsage' (or within 90% of its value) | |
| TUniquePtr< FOutputDeviceFile > | UnitLog | The log file for outputting all log information for the current unit test | |
| FString | UnitLogDir | The log directory for this unit test | |
| TArray< TObjectPtr< UUnitTask > > | UnitTasks | UnitTask's which must be run before different stages of the unit test can execute | |
| EUnitTaskFlags | UnitTaskState | Marks the state of met unit task requirement flags and active unit task blocking flags | |
| TArray< FString > | UnitTestBugTrackIDs | The bug tracking identifiers related to this unit test (e.g. TTP numbers) | |
| TArray< FString > | UnitTestCLs | Source control changelists relevant to this unit test | |
| FDateTime | UnitTestDate | The date this unit test was added to the project (for ordering in help command) | |
| FString | UnitTestName | Variables which should be specified by every subclass The name/command for this unit test (N.B. Must be set in class constructor) | |
| uint32 | UnitTestTimeout | The amount of time (in seconds), before the unit test should timeout and be marked as broken | |
| FString | UnitTestType | The type of unit test this is (e.g. bug/exploit) (N.B. Must be set in class constructor) | |
| EUnitTestVerification | VerificationState | Whether or not the success or failure of the current unit test has been verified |
Constructors
| Type | Name | Description | |
|---|---|---|---|
UUnitTest
(
const FObjectInitializer& ObjectInitializer |
UUnitTest |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | Aborts execution of the unit test, part-way through | ||
| void | Adds a UnitTask to the unit test, during its configuration stage - to be completed before executing the unit test | ||
| bool | Whether or not this unit test supports resetting | ||
| void | CleanupUnitTest
(
EUnitTestResetStage ResetStage |
Cleans up all items needing destruction, and removes the unit test from tracking, before deleting the unit test itself | |
| void | EndUnitTest () |
Called upon completion of the unit test (may not happen during same tick), for tearing down created worlds/connections/etc. | |
| bool | Executes the main unit test | ||
| void | GetCommandContextList
(
TArray< TSharedPtr< FString >>& OutList, |
Outputs the list of console command contexts, that this unit test supports (which can include custom contexts in subclasses) | |
| ELogType | Returns the type of log entries that this unit expects to output, for setting up log window filters (only needs to return values which affect what tabs are shown) | ||
| EUnitTestVerification | Returns the expected result for the current game | ||
| TArray< FString > | Returns the list of supported games, for this unit test | ||
| FDateTime | Returns the date this unit test was first added to the code | ||
| FString | Returns the name/command, for the current unit test | ||
| uint32 | Returns the value of UnitTestTimeout | ||
| FString | Returns the type of unit test (e.g. bug/exploit) | ||
| bool | HasStarted () |
Whether or not the unit test has started | |
| void | Finishes initializing unit test settings, that rely upon the current unit test environment being loaded | ||
| void | Sets up the log directory and log output device instances. | ||
| bool | Returns whether or not this is the first time the unit test has been run/collecting-stats | ||
| bool | IsTaskBlocking
(
EUnitTaskFlags InFlag |
Determines whether or not a UnitTask is blocking the specified event | |
| void | LogComplete () |
Triggered upon unit test completion, for outputting that the unit test has completed - plus other unit test state information | |
| bool | NotifyConsoleCommandRequest
(
FString CommandContext, |
Notifies that there was a request to execute a console command for the unit test, which can occur in a specific context, e.g. for a unit test server, for a local minimal-client (within the unit test), or for a separate unit test client process | |
| void | NotifyDeveloperModeRequest
(
bool bInDeveloperMode |
Notifies that there was a request to enable/disable developer mode | |
| void | NotifyUnitTaskFailure
(
UUnitTask* InTask, |
Triggered when a UnitTask fails unrecoverably during execution | |
| void | ResetTimeout
(
FString ResetReason, |
Resets the unit test timeout code - should be used liberally, within every unit test, when progress is made during execution | |
| void | ResetUnitTest
(
EUnitTestResetStage ResetStage |
Resets the unit test to its initial state, allowing it to restart from scratch NOTE: Must be implemented for every unit test that intends to support it, through CleanupUnitTest | |
| void | UnblockEvents
(
EUnitTaskFlags ReadyEvents |
When events that were pending but blocked by a UnitTask, are unblocked, this function triggers them. | |
| bool | ValidateUnitTestSettings
(
bool bCDOCheck |
Validate that the unit test settings/flags specified for this unit test, are compatible with one another, and that the engine settings/environment, support running the unit test. |
Overridden from UUnitTestBase
| Type | Name | Description | |
|---|---|---|---|
| bool | IsTickable () |
Must override in subclasses, that need ticking. | |
| void | NetTick () |
Tick function that runs at a tickrate of ~60 fps, for interacting with netcode (high UnitTick tickrate, can lead to net buffer overflows) | |
| void | PostUnitTick
(
float DeltaTime |
For cleanup actions that should occur after the primary tick function is called | |
| void | TickIsComplete
(
float DeltaTime |
Tick function for checking if the unit test is completed (happens after all above tick events) | |
| void | UnitTick
(
float DeltaTime |
Main tick function for the unit test | |
| bool |
Overridden from FUnitLogInterface
| Type | Name | Description | |
|---|---|---|---|
| bool | IsConnectionLogSource
(
UNetConnection* InConnection |
Whether or not this log interface is the source of a UNetConnection - used for deciding where to direct, UNetConnection log hooks | |
| bool | IsTimerLogSource
(
UObject* InTimerDelegateObject |
Whether or not this log interface is the source of an FTimerManager delegate object, used for hooking logs triggered during global timer manager delegates. | |
| void | NotifyLocalLog
(
ELogType InLogType, |
For implementation in subclasses, for helping to track local log entries related to a unit test. | |
| void | NotifyStatusLog
(
ELogType InLogType, |
As above, except for log entries directed towards the Unit Test Status window. |
Constants
| Name | Description |
|---|---|
| NullUnitEnv | The null unit test environment - for unit tests which support all games, due to requiring no game-specific features |
| UnitEnv | Runtime variables The unit test environment (not set until the current games unit test module is loaded - not set at all, if no such module) |