Validating output

To improve the test, one or more validations can be added, as shown in sample2 below.2.1 The VALIDATE macro that is used, will validate the data returned from calculate against the expected value 10.

  void test_addition(void) {
    int result;
    result = calculate(3,7,'+');
    VALIDATE(result, 10);
    }
If the validation succeeds the following output are generated
 Executing test testmain

   Executing test test_addition

   PASSED verify result
     expected .......... 10 (10)
     actual ............ 10

   PASSED test test_addition

 PASSED test testmain

If not, the failure is is reported in the log. In addition the test will be listed as failed in the summary at the end of the log.

   FAILED verify result
     expected .......... 10 (10)
     actual ............ -1

The framework includes additional macros for validating strings, arrays, structs and file contents. Detailed description can be found in chapter [*] Readability of the log file can be improved by choosing proper test names and by using macros for values as shown below in sample32.1 If possible, the framework will try to retain the symbolic values and use these in the log output.

  #define EXPECTED_SUM 10
  void test_addition(void) {
    VALIDATE(calculate(3,7,'+'), EXPECTED_SUM);
    }
will change the log output to
Executing test testmain

  Executing test test_addition

  PASSED verify calculate(3,7,'+')
    expected .......... EXPECTED_SUM (10)
    actual ............ 10

  PASSED test test_addition

PASSED test testmain



testape

News

The latest headlines from Testape.com

TestApe Release 880 available, Dec 3rd 2011

New is this release are support for floating point validations and function mocking. Also, MinGW has been added to the list of supported platforms.

more

Forum change, Mar 27th 2011

TestApe forum is now hosted on Proboards. Support questions can be posted here or send directly on email. Due to ...

more

TestApe beta release available, Sep 27th 2011

TestApe can now be used with MinGW GCC on windows. Also supported in this beta are floating point types in validations or when mocking functions

more

IPad update for WebTTY, May 15th 2011

A small fix for webtty scripts, to allow the usage from Apple IPads. Tab on textarea to bring up IPad keyboard - you may have to scroll webpage beneath keyboard, in order to actually see what you're typing.

TestApe Release 791 available, Apr 2nd 2010

This release contains a new flexible mocking system with default mocks automatically generated for unresolved functions. Installation packages are available for GCC/Linux, GCC/CygWin as well Visual Studio 2009/Windows XP or Vista.

more

TestApe beta version available, Jan 26th 2010

New beta version is now available for download. This is the last beta before official release. The release supports an extensive mocking system.

more

Forum change, Mar 10th 2009

There is a change for the forum hosted on this site. The previous phpBB forum is closed for now. All forum threads will be migrated to a new simple blog. ...

more