CppSpec

CppSpec is a behavior driven development (BDD) framework for C++.
Download

CppSpec Ranking & Summary

Advertisement

  • Rating:
  • License:
  • The Apache License 2.0
  • Price:
  • FREE
  • Publisher Name:
  • Timo Puronen
  • Publisher web site:
  • http://www.laughingpanda.org/projects/cppspec/

CppSpec Tags


CppSpec Description

CppSpec is a behavior driven development (BDD) framework for C++. CppSpec is a behavior driven development (BDD) framework for C++. Behavior Driven Development is a refinement of TDD which turns the focus from writing the tests to the process of defining the behavior of the software using tests.Using CppSpecTo define behavior of your class you need to create a specifications for different states of your class. Specification is created by deriving from CppSpec::Specification class. Expectations for the behavior are written using specify method.Basic validationspecify(should.be.empty());specify(not should.be.empty());specify(context().count(), should.equal(1));Exception handlingExceptions are tested by defining a executable block which is expected to throw an exceptions. A block is defined by deriving from Block and implementing run() method. The most convenient way to do this is to use local, anonymous classes. For example:struct : Block { void run() { context().methodWhichThrowsException(); }} block;specify(block, should.raise.exception());specify(block, should.raise.exception("Division by zero")); // throws std::string with content "Division by zero"ContainersIf the context implements iterator interface, you can specify that context should contain either unique items or sequences using contain keyword.specify(should.have.element("key"));specify(should.have.elements(sequence.begin(), sequence.end()));Regular expressionsspecify(context().asString(), should.contain(pattern));specify(context().asString(), should.match(pattern));Compiling CppSpecCppSpec is compiled using cmake (www.cmake.org) and native C++ toolchain. Pre-requisites for CppSpec are Boost headers and CppUTest. CppUTest is used for tests of CppSpec itself. If you don't have it and you're not interested in executing the tests you can remove test directory from main level CMakeLists.txt.If CMake can't find the required libraries, you can either edit manually CMakeCache.txt and add the locations or use environment variables which are used by CMake to search for the dependencies. Please refer to CMake documentation for more information (http://www.cmake.org/).What's New in This Release:· Greatly improved messages for failures.· A CUTE logger for usage with the CUTE Eclipse plugin.· Specification execution time measurements have been improved.· Build fixes for Visual C++. install and CPack targets to enable the make install target and creation of binary distribution packages.· Bugfixes.


CppSpec Related Software