Test execution flow

Overview

Macros to be used in tests. More…

// global functions

void te_test_tester_message(te_test_msg_type type, const char* fmt, ...);
void te_test_fail_state_update(const char* fmt, ...);
void te_test_fail_substate_update(const char* fmt, ...);
const char* te_test_fail_state_get(void);
const char* te_test_fail_substate_get(void);

// macros

#define ERROR_ARTIFACT(_fmt...)
#define ERROR_VERDICT(fmt...)
#define MI_ARTIFACT(_fmt...)
#define REGISTER_ARTIFACT(_level, _fmt...)
#define RING_ARTIFACT(_fmt...)
#define RING_VERDICT(fmt...)
#define TEST_ARTIFACT(_fmt...)
#define TEST_OBJECTIVE(fmt...)
#define TEST_STEP(_fs...)
#define TEST_STEP_NEXT(_fs...)
#define TEST_STEP_POP(_fs...)
#define TEST_STEP_POP_INFO(_fs...)
#define TEST_STEP_PUSH(_fs...)
#define TEST_STEP_PUSH_INFO(_fs...)
#define TEST_STEP_RESET()
#define TEST_SUBSTEP(_fs...)
#define TEST_VERDICT(fmt...)
#define TE_TEST_OBJECTIVE_ID
#define WARN_ARTIFACT(_fmt...)
#define WARN_VERDICT(fmt...)

Detailed Documentation

Macros to be used in tests. The header must be included from test sources only. It is allowed to use the macros only from main() function of the test.

Copyright (C) 2004-2022 OKTET Labs Ltd. All rights reserved.

Global Functions

void te_test_tester_message(te_test_msg_type type, const char* fmt, ...)

Compose test message and send it to Tester.

The function uses te_test_id global variable.

Parameters:

type

Message type

fmt

printf()-like format string with TE extensions

void te_test_fail_state_update(const char* fmt, ...)

Update state of the test to be dumped in case of failure.

Parameters:

fmt

printf()-like format string w/o! TE extensions

void te_test_fail_substate_update(const char* fmt, ...)

Update substate of the test to be dumped in case of failure.

Parameters:

fmt

printf()-like format string w/o! TE extensions

const char* te_test_fail_state_get(void)

Get the current test state string or NULL if it’s not filled in.

const char* te_test_fail_substate_get(void)

Get the current test substate string or NULL if it’s not filled in.

Macros

#define ERROR_ARTIFACT(_fmt...)

Macro should be used to output artifact with ERROR log level from tests.

Parameters:

_fmt

the content of the artifact as format string with arguments

#define ERROR_VERDICT(fmt...)

Macro should be used to output verdict with ERROR log level from tests.

Parameters:

fmt

the content of the verdict as format string with arguments

#define MI_ARTIFACT(_fmt...)

Macro should be used to output artifact with MI log level from tests.

Parameters:

_fmt

the content of the artifact as format string with arguments

#define REGISTER_ARTIFACT(_level, _fmt...)

Print test artifact to log. Artifact is a string describing test results like a verdict. But it is not taken into account when matching obtained results to TRC database.

Parameters:

_level

Level of the message/artifact that will go into the log

_fmt

Message describing the artifact (format string with parameters)

#define RING_ARTIFACT(_fmt...)

Macro should be used to output artifact from tests.

Parameters:

_fmt

the content of the artifact as format string with arguments

#define RING_VERDICT(fmt...)

Macro should be used to output verdict from tests.

Parameters:

fmt

the content of the verdict as format string with arguments

#define TEST_ARTIFACT(_fmt...)

Print test artifact to log. Artifact is a string describing test results like a verdict. But it is not taken into account when matching obtained results to TRC database.

Parameters:

_fmt

Message describing the artifact (format string with parameters)

#define TEST_OBJECTIVE(fmt...)

The macro should be used to output per-iteration test objectives

Parameters:

fmt

Format string for the following arguments

#define TEST_STEP(_fs...)

Logging of nesting level step.

Reset nesting level to 0, log message with zero nesting level and increment it for subsequent messages (level equal to 1). The macro should be used in the test main function only. The macro is used to extract the test description (generated using Doxygen).

Parameters:

_fs

  • format string and arguments

#define TEST_STEP_NEXT(_fs...)

Logging of nesting level step next.

Keep current nesting level, but log the message with previous nesting level. So, the message will have the same nesting level as previous step-push and subsequent step-next messages.

Parameters:

_fs

  • format string and arguments

#define TEST_STEP_POP(_fs...)

Logging of nesting level step pop.

Decrement log nesting level and log the message (if not empty). It wraps the block and message could be used to summarize results.

Parameters:

_fs

  • format string and arguments

#define TEST_STEP_POP_INFO(_fs...)

Same as TEST_STEP_POP() but uses INFO log level instead of RING. Should be used together with TEST_STEP_PUSH_INFO().

#define TEST_STEP_PUSH(_fs...)

Logging of nesting level step push.

Log message at current nesting level and increment nesting level for subsequent log messages. Subsequent messages will have greater nesting level and will be considered as details of the step implementation.

Parameters:

_fs

  • format string and arguments

#define TEST_STEP_PUSH_INFO(_fs...)

Same as TEST_STEP_PUSH() but uses INFO log level instead of RING. This results in hiding messages between TEST_STEP_PUSH_INFO() and corresponding TEST_STEP_POP_INFO() in HTML log by default. Such hidden messages can be viewed by clicking on “+”.

Parameters:

_fs

  • format string and arguments

#define TEST_STEP_RESET()

Logging of nesting level step reset

Reset nesting level to 0

#define TEST_SUBSTEP(_fs...)

Logging of nesting level sub-step.

Reset nesting level to 1, log message with the nesting level and increment it for subsequent messages (level equal to 2). The macro should be used in the test main function only. The macro is used to extract the test description (generated using Doxygen).

Parameters:

_fs

  • format string and arguments

#define TEST_VERDICT(fmt...)

Terminate a test with failure status, report an error as verdict.

Parameters:

fmt

error message format string with parameters

#define TE_TEST_OBJECTIVE_ID

A string used to identify per-iteration objectives, generated by test control messages

#define WARN_ARTIFACT(_fmt...)

Macro should be used to output artifact with WARN log level from tests.

Parameters:

_fmt

the content of the artifact as format string with arguments

#define WARN_VERDICT(fmt...)

Macro should be used to output verdict with WARN log level from tests.

Parameters:

fmt

the content of the verdict as format string with arguments