Navigation
API > API/Plugins > API/Plugins/NetcodeUnitTest
Inheritance Hierarchy
- UObjectBase
- UObjectBaseUtility
- UObject
- UUnitTask
References
| Module | NetcodeUnitTest |
| Header | /Engine/Plugins/NetcodeUnitTest/NetcodeUnitTest/Source/NetcodeUnitTest/Classes/UnitTask.h |
| Include | #include "UnitTask.h" |
Syntax
UCLASS&40;Abstract&41;
class UUnitTask :
public UObject,
public FUnitLogRedirect
Remarks
UnitTask's are used to implement supporting code for UnitTest's, for handling complex behind-the-scenes setup prior to test execution (e.g. primarily for implementing game-specific server/client environment setup), which is shared between many unit tests, and which is better to abstract-away from visibility in unit tests themselves, for code clarity.
For example, some games require authentication negotiation before the game client can connect to a server, and this is the type of task that UnitTask's are designed for.
Unit tasks that are added to a unit test, must complete execution before the unit test itself can execute.
Variables
| Type | Name | Description | |
|---|---|---|---|
| bool | bStarted | Whether or not the UnitTask has started | |
| TObjectPtr< UUnitTest > | Owner | The UnitTest that owns this task | |
| EUnitTaskFlags | UnitTaskFlags | Flags for configuring the UnitTask |
Constructors
| Type | Name | Description | |
|---|---|---|---|
UUnitTask
(
const FObjectInitializer& ObjectInitializer |
UUnitTask |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | Attach the task to a unit test | ||
| void | Cleanup () |
Cleanup the task state, after the task completes | |
| EUnitTaskFlags | Retrieves UnitTaskFlags | ||
| bool | HasStarted () |
Whether or not the task has started | |
| bool | Whether or not the task has completed | ||
| 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 | NotifyAlterMinClient
(
FMinClientParms& Parms |
Gives UnitTask's an opportunity to alter the MinimalClient setup parameters | |
| void | ResetTimeout
(
FString ResetReason, |
See UUnitTest::ResetTimeout | |
| void | StartTask () |
Start executing the task | |
| void | TriggerFailure
(
FString Reason |
Triggers a failure for the UnitTask and owning UnitTest | |
| void | UnitTick
(
float DeltaTime |
Events passed from the unit test Main tick function for the unit test | |
| void | After attaching to a unit test, validate the unit task settings are compatible |