Troubleshooting

The instrumenter has a -o commandline switch to help troubleshoot. When invoked in this mode, the instrumenter will show command lines for each pass and keep the temporary files. Some typical problems are shown below.

  • Creating mock for EXECUTE(and other TestApe macros)

    Check that testape.h is included in the tests.

  • Creating mock for getreentrnet

    Check that you are linking with all required standard libraries. Try and remove testape from the commandline and verify that you can compile the tests without the instrumenter and that you do not see unexpected unresolved external symbols.

  • Creating mock for _Z20testape_validate_intPcS_ii

    Check that you have named the files with the extension .c if these are c files. Verify that you are compiling using gcc, not g++. If you want to to use g++ in order to write the tests in c++, the #include <testape.h> statement must be put inside a extern "C" declaration.

  • undefined reference to `testape_validate_int'

    Check that you are linking with library (testape.a/testape.lib). The order of libraries and tests given on commandline is important. Verify that the library is given later on commandline than the tests using it.

  • Failures when functions returning doubles are implicitly declared The following code will fail to return correct value to the calling function

      int degree_to_miliradians(int degrees) {
        return 1000*deg2rad(degrees)
      }
    
    The code relies on the function deg2rad. This function accepts an integer and returns a double. However, in this example, deg2rad are implicitely declared to be of type int deg2rad(int) and not double deg2rad(int) as intented, so degree_to_miliradians will not work correctly.

    However, it is possible to write a test, to discover this e.g.

      void test_degree_to_miliradians(void) {
        SIMULATE(deg2rad, 2*PI);
        VALIDATE(degree_to_miliradians(360), 1000*2*PI);
      }
    

    When TestApe detects a call to deg2rad, it correctly detects that deg2rad should return an integer, and will return (int)2*PI, e.g. 6, that will make degree_to_miliradians return 6000, and the test will fail.

    However, if the bug is corrected, e.g.

      double deg2rad(int degrees);
    
      int degree_to_miliradians(int degrees) {
        return 1000*deg2rad(degrees)
      }
    

The TestApe will detect the deg2rad should return a floating point e.g. 2*PI, 6.28..., and that will make degree_to_miliradians return the correct value 6282, and the test will pass

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