An important attribute of CxxTester is, that the syntax of the input script reflects in a natural way the C++ interface of  the target software.The example below should explain the concept behind this idea. We discuss only the key parts of the concept. The details can be seen in Testscript

 

We assume an interface of a simple target software which divides two integers:

double result = divide(int p1, int p2);

Here is a minimal input script with a single testcase:

resultfile "out.txt"

 

divide

{

    p1 = 5

    p2 = 4

    verify:

    result == 1.25

}

And here is the code which introduces CxxTester to the target software:

#include "CxxTester.h"

 

 // startup code for Unix/Linux

int main(int argc,char** argv)

{

   return cxxloop(argc,argv);

}

 

cxxcall(divide)

{

    int p1 = DIN["p1"];

    int p2 = DIN["p2"];

    double result = divide(p1,p2);

    DOUT["result" ] = result;

}

#include "CxxTester.h"

 

 // startup code for MS Windows

BOOL CxxMain::InitInstance()

{

   return cxxloop();

}

 

cxxcall(divide)

{

    int p1 = DIN["p1"];

    int p2 = DIN["p2"];

    double result = divide(p1,p2);

    DOUT["result" ] = result;

}

This is an example for the generated resultfile, assuming that the divide function works wrong:

divide

{

    verified:

    result == 1.25 [result = 1.4 ERROR]

    logged:

}

This is an example for a more complex testsession controlled by CxxViewer:

An example for interactive testing with graphic output, which can be used in addition to text oriented testing:

The CxxViewer allows to toggle between textual and graphic output at any time.