Created Why do we need yet another C++/ Obj-C Automated Test framework? (markdown)

philsquared
2012-06-02 10:26:41 -07:00
parent 644a95d3aa
commit 6d5c7e93af

@@ -0,0 +1,37 @@
Good question. For C++ there are quite a few established frameworks, including (but not limited to), [[CppUnit|http://sourceforge.net/apps/mediawiki/cppunit/index.php?title=Main_Page]], [[Aeryn|https://launchpad.net/aeryn]], [[Cute|http://r2.ifs.hsr.ch/cute]], [[Fructose|http://fructose.sourceforge.net/]], [[Google Test|http://code.google.com/p/googletest/]], [[Boost.Test|http://www.boost.org/doc/libs/1_49_0/libs/test/doc/html/index.html]] and [[many more|http://en.wikipedia.org/wiki/List_of_unit_testing_frameworks#C.2B.2B]]. Even for Objective-C there are a few, including OCUnit - which now comes bundled with XCode.
So what does CATCH bring to the party that differentiates it from these? Apart from a Catchy name, of course.
## Key Features
* Really easy to get started. Just download catch.hpp, #include it and you're away.
* No external dependencies. As long as you have the C++ standard library available.
* Write test cases as, self-registering, functions or methods.
* Divide test cases into sections, each of which is run in isolation (eliminates the need for fixtures!)
* Only one core assertion macro for comparisons. Standard C operators are used for the comparison - yet the full expression is decomposed and lhs and rhs values are logged.
## Other core features
* Failures can (optionally) break into the debugger on Windows and Mac.
* Tests are named hierarchically and can be run by matching the entire name or partially to provide one way of grouping tests.
* Test case function names are generated within the macro - you only need to provide a free-form test name (and description)
* Test cases can be described from a TDD or BDD mindset, with support for nested SECTIONs in the latter.
* Output is through reporter objects. basic textual and XML reporters are included. Custom reporters can easily be added.
* JUnit xml output is supported for integration with third-party tools, such as CI servers.
* Output can be to any stream.
* A default main() function is provided (in a header), but you can supply your own for complete control (e.g. integration into your own test runner GUI).
* A command line parser is provided and can still be used if you choose to provided your own main() function.
* Catch can test itself.
* Alternative assertion macro(s) report failures but don't abort the test case
* Floating point tolerance comparisons are built in using an expressive Approx() syntax.
* Internal and friendly macros are isolated so name clashes can be managed
* Support for Matchers (early stages)
## Objective-C-specific features
* Automatically detects if you are using it from an Objective-C project
* Works with and without ARC with no additional configuration
* Implement test fixtures using Obj-C classes too (like OCUnit)
* Additional built in matchers that work with Obj-C types (e.g. string matchers)
See the [[tutorial]] to get more of a test of using CATCH in practice