TSCAPI - the TestSmith C++ API

See also TSCAPI Specification.

The TestSmith C++ API provides the TestSmith user with the power of a real programming language. Scripts can be recorded as C++ source files (see Language in Recording Options) which can then be compiled in the usual way, e.g. through a C++ IDE.

The TSCAPI files are arranged in the \QualityForge\TestSmith\TSCAPI directory as follows:
  • \csmith
    Contains the .cpp tests and the compiled .exe files.
    Newly recorded .cpp files will be placed here by default.
  • \include
    Contains the tscapi.h file for including in your projects.
    Newly created .h files can also be moved to this directory if required.
  • \lib
    Contains the tscapi.obj file for linking to your projects.
  • \src
    Contains the .h and .cpp source code files for building the TSCAPI wrapper. This source is required if you need to rebuild the object file for a different platform, e.g. cygwin/gcc. It can also be used as a reference if you wish to build your own language-specific API.
To use TSCAPI you must have a C++ compiler correctly installed on your system. You will also need to update your system environment as follows:
  1. Add the full path of the \include directory to your C++ environment's INCLUDE path.
    Assuming you installed to the top-level C:\ directory this will be C:\QualityForge\TestSmith\TSCAPI\include .

  2. Add the full path of the \lib directory to your C++ environment's LIB path.
    Assuming you installed to the top-level C:\ directory this will be C:\QualityForge\TestSmith\TSCAPI\lib .

  3. Add the full path of the directory containing TSAPI.dll to your system PATH.
    Assuming you installed to the top-level C:\ directory this will be C:\QualityForge\TestSmith .
See the TSCAPI specification for full details of the TSCAPI classes and methods.

See the two sample C++ source files YahooLogin.cpp and DataDriver.cpp for examples of usage.

To run these two files (both of which are already compiled as .exe files) open a command prompt and change the working directory to be the directory where these two files exist (by default this is <install_location>\QualityForge\TestSmith\TSCAPI\csmith). Then use the following syntax to run the scripts:
  • YahooLogin
  • DataDriver n
    where n is a positive integer value (suggested range, 1-20)
These two files are equivalent in functionality to the two sample .smith scripts included in the \Scripts directory.