public
Description: Behavior driven development in C
Homepage:
Clone URL: git://github.com/arnaudbrejeon/cspec.git
cspec /
name age message
file .gitignore Sat Aug 23 01:56:46 -0700 2008 First full feature commit with initial source c... [arnaudbrejeon]
file COPYING Mon Aug 25 06:11:08 -0700 2008 Added LGPL license [arnaudbrejeon]
file COPYING.LESSER Mon Aug 25 06:11:08 -0700 2008 Added LGPL license [arnaudbrejeon]
file README Thu Jan 01 11:19:33 -0800 2009 Added XML output in the output list [arnaudbrejeon]
directory VC/ Wed Dec 24 06:38:05 -0800 2008 Added xml outputs and its samle. [toshi-kawanishi]
file VERSIONS Mon Dec 29 03:15:20 -0800 2008 Prepare for 0.2.1 [arnaudbrejeon]
directory etc/ Wed Dec 24 06:38:05 -0800 2008 Added xml outputs and its samle. [toshi-kawanishi]
directory inc/ Wed Dec 24 06:38:05 -0800 2008 Added xml outputs and its samle. [toshi-kawanishi]
directory sample/ Thu Dec 11 06:29:09 -0800 2008 Arranged coding style. [toshi-kawanishi]
directory sample_skip/ Thu Dec 11 06:29:09 -0800 2008 Arranged coding style. [toshi-kawanishi]
directory sample_xml/ Wed Dec 24 06:38:05 -0800 2008 Added xml outputs and its samle. [toshi-kawanishi]
directory src/ Mon Dec 29 06:02:13 -0800 2008 Minor changes [arnaudbrejeon]
README
CSpec:  Behaviour-driven development in C
=========================================

Overview
--------

CSpec is a Behaviour-driven Development (http://behaviour-driven.org/) framework for C.
It provides a spec framework for describing the behavior of the functions of your system.
The syntax is inspired from RSpec (http://rspec.info/) to be as legible as possible.
The source code is as portable and as light as possible to make it easy to run the library 
on embedded devices.


Documentation
-------------

CSpec is mostly based on the macros defined in cspec.h . The macros can be differentiated in two 
groups: structural macros that define the structure of the specification and expectation macros 
that describe the tests to be evaluated.

Writing the spec of a function is quite straightforward:
    - Enclose your spec in between the macros DESCRIBE and END_DESCRIBE with function name and caption
    - Enclose each part of the spec between the macros IT and END_IT with the caption
    - For each part of the specification, the tests should be evaluated with one of the expectation macros
  
That's it. Your specification is ready to be run.

Running a spec is done by calling CSpec_Run with the spec name (using macro DESCRIPTION) and selecting
an output type.

There are currently 4 basic outputs provided in CSpec:
    - OutputVerbose  : provides much information as possible: captions, evaluated tests and results
    - OutputUnit      : provides less information, concentrated more one the number of failed tests
                (similar to unit tests)
    - OutputHeader    : provides information that does not depend on the tests result and can be used 
                as function header
    - OutputXML     : provides verbose information in XML format
  
It is easy to define other outputs depending on your needs and platform constraints.
TODO: explain how to make new output.


Spec framework sample
---------------------

There are 2 samples provided with the library. They are located in directories sample and sample_skip.
sample contains the specifications of 2 functions from the C library and is the place to check first because
of its simplicity.
sample_skip specifies a skip list library and therefore is a small proof of concept for CSpec.

Future & ideas
--------------

- Put in place a story framework
- Check how to mock
- Automake autoconf


Compile and link
----------------

- Windows       : directory VC contains VC++ 6.0 dsw and dsp files to compile and link the library and 
                    the sample
- OS X /Linux   : src and sample directories contain a Makefile to compile and link  the library and 
                    the sample

Links
-----

http://behaviour-driven.org/
http://en.wikipedia.org/wiki/Behavior_Driven_Development
http://dannorth.net/introducing-bdd
http://dannorth.net/whats-in-a-story
http://www.ibm.com/developerworks/java/library/j-cq09187/index.html


Arnaud Brejeon
arnaud.brejeon@laposte.net

Toshiyuki Kawanishi
toshi.kawanishi@gmail.com