Visual Assert – The Unit Testing Add-In for Visual C++
cfix – C/C++ Unit Testing for Win32 and NT
 
 

CFIX_FIXTURE_BEFORE

CFIX_FIXTURE_BEFORE

Synopsis

Used to specify a routine that is to be used as before-routine. The before-routine will be called once per test routine, before the test routine is invoked. As such, the before-routine should be used to initialize any state required by the test routines. Use CfixPeSetValue to store any custom state information and make it available to test- and after routines.

Specifying CFIX_FIXTURE_BEFORE is optional. Note, however, that CFIX_FIXTURE_BEFORE may be used at most once per fixture definition.

See here for an example of a complete fixture definition.

Declaration
CFIX_FIXTURE_BEFORE( Routine )
				

Setup routines must have the following signature. Specifying __stdcall is only required if /Gz is not used as compiler switch.

void __stdcall BeforeRoutine()
				
Remarks

When the before-routine fails, the current test routine will not be called. The after-routine (if present) will not be called either.

[Note]Note
For certain initialization work that should occur only once per fixture (rather than once per test routine), use a setup routine rather than a before-routine.
Requirements

Table 7.24. 

 User ModeKernel Mode
Available since1.21.2
HeaderDeclared in cfix.hDeclared in cfix.h
IRQLN/ACalled at PASSIVE_LEVEL