From da280ae094a175528d991b111b30b2344f27185a Mon Sep 17 00:00:00 2001 From: Mazyad Alabduljaleel Date: Sun, 12 Apr 2015 09:52:20 +0400 Subject: [PATCH] Add a section about multiple file tests. Personally, I chased my tail for a while because this was missing. There are a few raised issues about this, so I really think this will help others get started with the library quicker. --- docs/tutorial.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/tutorial.md b/docs/tutorial.md index c4d10e89..37328e5f 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -219,6 +219,14 @@ Scenario: vectors can be sized and resized Then: the capacity changes but not the size ``` +## Spliting Test Cases Across Multiple Files + +There is a very small chance you will want to write all your test cases in a single file, so here is how you can split the tests across multple files. + +As noted above, you only need one `cpp` file where you include the `catch.hpp` with `CATCH_CONFIG_MAIN`. You can leave that file with just those two lines. + +Then, simply create more `cpp` files, include the `catch.hpp` header, and start writing those tests! No more includes or configuration is required. + ## Next steps This has been a brief introduction to get you up and running with Catch, and to point out some of the key differences between Catch and other frameworks you may already be familiar with. This will get you going quite far already and you are now in a position to dive in and write some tests.