Skip to content

Unit Testing

frikilax edited this page Jun 16, 2020 · 1 revision

Description

Since Fyara, a set of unit tests have been added using Catch2 framework.

Those tests are not extensive yet, but we may progressively increase our code coverage with them.

Compile tests

To compile tests along filters, you should add BUILD_TESTS to your custom cmake options, and submodules should be initialised and updated (done by default by cmake, with the GIT_SUBMODULE option).

Run tests

For now, there are 2 test suites defined:

  • tests_toolkit, which is compiled as long as you ask for tests compilation
    • this suite tests general toolkits, not associated with any filter
  • tests_darwin_yara, which is compiled if you ask for tests compilation, AND fyara compilation
    • this suite test the yara toolkit, associated with the fyara filter

As a rule of thumb, future test suites should be named "tests_<name_of_the_filter>.

Those tests can simply be called to run, and should return 0 on success, a non-zero value on error, please refer to Catch2 reference for information on possible output and parameters.

Unit tests use in project

Unit tests are currently not required when proposing new features (however, functional testing is still mandatory), but priority will be given to PRs with efforts made on UTests.

Clone this wiki locally