Enfusion Script API
Loading...
Searching...
No Matches
Classes | Enumerations
Script Testing Framework

Classes

interface  Test
 Attribute used for tests annotation and assignment to Suites. More...
 
interface  Step
 Attribute which marks a method as part of the testing process. More...
 
interface  TestHarness
 Collection and main interface of the Testing framework. More...
 
interface  TestSuite
 Collection of tests. More...
 
interface  TestBase
 Test base class. More...
 
interface  TestResultBase
 Base class for test results. More...
 

Enumerations

enum  EStage { EStage.Setup , EStage.Main , EStage.TearDown }
 Stage definition used in conjunction with Step attribute. More...
 

Detailed Description

Script Testing Framework

Introduction

Simple tests

Can be perfomed in form of annotated free functions.

Note: Notice the Suite name in the attribute.

[Test("MyFirstTestSuite")]
TestResultBase MyFooBarTest() { return TestBoolResult(5 > 3); }
Base class for test results.
Definition: TestingFramework.c:198
Attribute used for tests annotation and assignment to Suites.
Definition: TestingFramework.c:97

Stateful tests

More elaborate tests that need some state and will run for several ticks have to be defined as TestBase derived classes. Your logic has to be ran through step methods.

Step methods

Stages

Return values

Result

Failure unwind

Timeout

[Test("MyFirstTestSuite", timeoutS: 2, timeoutMs: 250)]
class MyAsyncTest : TestBase
{
// Simple blocking initialization.
[Step(EStage.Setup)]
void Initialize() { ... }
// Async test which is waiting for result for several frames.
[Step(EStage.Main)]
bool Pool() { ... }
// Finalization process waiting for result for several frames.
[Step(EStage.TearDown)]
bool FinalizeA() { ... }
// Simple blocking finalization call.
[Step(EStage.TearDown)]
void FinalizeB() { ... }
}
EStage
Stage definition used in conjunction with Step attribute.
Definition: TestingFramework.c:115
Attribute which marks a method as part of the testing process.
Definition: TestingFramework.c:124
Test base class.
Definition: TestingFramework.c:178

Enumeration Type Documentation

◆ EStage

enum EStage

Stage definition used in conjunction with Step attribute.

Enumerator
Setup 
Main 
TearDown