DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(guile.info.gz) Testbed Example

Info Catalog (guile.info.gz) Scheme vs C (guile.info.gz) Programming Overview (guile.info.gz) Programming Options
 
 17.3 Example: Using Guile for an Application Testbed
 ====================================================
 
 As an example of what this means in practice, imagine writing a testbed
 for an application that is tested by submitting various requests (via a
 C interface) and validating the output received.  Suppose further that
 the application keeps an idea of its current state, and that the
 "correct" output for a given request may depend on the current
 application state.  A complete "white box"(1) test plan for this
 application would aim to submit all possible requests in each
 distinguishable state, and validate the output for all request/state
 combinations.
 
    To write all this test code in C would be very tedious.  Suppose
 instead that the testbed code adds a single new C function, to submit an
 arbitrary request and return the response, and then uses Guile to export
 this function as a Scheme procedure.  The rest of the testbed can then
 be written in Scheme, and so benefits from all the advantages of
 programming in Scheme that were described in the previous section.
 
    (In this particular example, there is an additional benefit of
 writing most of the testbed in Scheme.  A common problem for white box
 testing is that mistakes and mistaken assumptions in the application
 under test can easily be reproduced in the testbed code.  It is more
 difficult to copy mistakes like this when the testbed is written in a
 different language from the application.)
 
    ---------- Footnotes ----------
 
    (1) A "white box" test plan is one that incorporates knowledge of
 the internal design of the application under test.
 
Info Catalog (guile.info.gz) Scheme vs C (guile.info.gz) Programming Overview (guile.info.gz) Programming Options
automatically generated byinfo2html