SFUnitTests.UnitTest service

The UnitTest service provides a framework for automating unit tests using the Basic language, including the ability to:

note

Both the unit tests and the code to be tested must be written in Basic. The code being tested may call functions written in other languages.


warning

The UnitTest service is not available for Python scripts.


Definitions

Test Case

A test case is the individual unit of testing. It checks for a specific response to a particular set of inputs.

In the UnitTest service, a test case is represented by a single Basic Sub whose name starts with a common prefix (the default is "Test_").

The test case fails if one of the AssertX methods returns False.

Test Suite

A test suite is a collection of test cases that should be executed together.

All test cases of a test suite are stored in a single Basic module.

A test suite may implement the SetUp and TearDown methods to prepare for test cases in its module.

Unit Test

A full unit test consists of a set of test suites in the same Basic library.

Service invocation

Before using the UnitTest service the ScriptForge library needs to be loaded or imported:

note

• Basic macros require to load ScriptForge library using the following statement:
Globa