Search code examples
unit-testingthrift

Is that necessary to unit test code generated by Apache Thrift?


We are presenting unit tests for a C++ project. Our goal is to cover up to 60% the whole project. The project uses a lot of code generated by Apache Thrift for communication between Client and Server.

Should we make unit tests for the generated code? If we don't introduce unit tests for the code, some coverage tools will be complaining that we are neglecting a big part of the project.

Does Apache Thrift provide those unit tests already?


Solution

  • There are a bunch of tests that run on the CI servers to ensure

    • the Thrift compiler can be built and works
    • the language bindings can be built and work
    • the language bindings operate as expected (including cross-lang tests)

    In addition to the Apache Thrift Test Suite each language binding may or may not define additional tests to test specific things as needed, e.g. as shown here.

    Regarding "is it necessary": First, we all make errors (except Linus of course). I would probably not go as far and test the entire thing again, but I would test those pieces in my own code that implement a certain behaviour using that 3rd party library.