Running Catch test cases over a dynamic set of files

128 Views Asked by At

I am looking for a way to run a test case in the Catch framework (https://github.com/philsquared/Catch) over a set of files.

I know I could do something like this:

TEST_CASE( "Test", "[Test]" ) {
   for each file {
       REQUIRE( ... );
   }
}

But the problem is that this will abort on the first error.

Therefore I would like to do something like this:

for each file {
    TEST_CASE( "Test", "[Test]" ) {
       REQUIRE( ... );
   }
}

Ideally it would also be possible to specify the folder where the test files are located when calling the unit tests on the command line.

Does anyone know if something like this is possible with Catch?

1

There are 1 best solutions below

0
On

You can use the CHECK macro to mark the test as failed but not stop processing.

It seems like you might be writing a test case driven by data files, but if you can tell us a little more about the nature of the files, we might be able to help more.