Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
Python and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Lua, etc
 
Regression testing - via a very short C testing framework

Code testing is important. Separation of code into separate, managable sections is important. Retesting of code running all the old tests is important when the code sections are enhanced / debugged.

At the end of this week's C course, we wrote a whole series of pieces of logic relating to web server log files - loading data into dynamic (realloc'd arrays of structs, and then extracting data from those structures. And we wrote an initial main routine to run and test from the command line. For initial development, that's great but ...
... the main couldn't remain as we started to build with the logic
... lots of sections / routine groups need testing.

Solution?
• Rename main to a different name such as test_access and leave it in the original file
• build a tiny test harness that runs each set of tests and correlates the results
• have the test harness send standard output (stdout) within the tests to a file

Result?
A rudemintary regression testing system, where each time you add a new set of routines or change something, you can rerun all the tests and get an automated set of replies.

The results of running the test suite look a bit boring:

  WomanWithCat:cj16 grahamellis$ ./framework
  
  .F..
  Failed 1 test(s) out of 4, passed 3
  
  WomanWithCat:cj16 grahamellis$


Commented framework source is [here] and tests and routines to be tested [here] and [here].
(written 2016-01-29, updated 2016-01-30)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
C212 - C and C based languages - Memory Management
  [4635] Encapsulating logic in functions and structs - the C approach to Object Oriented techniques - (2016-01-30)
  [4340] Simple C structs - building up to full, dynamic example - (2014-12-03)
  [4128] Allocating memory dynamically in a static language like C - (2013-06-30)
  [3416] Storing Tcl source code encoded, and running via your own C program - (2011-09-02)
  [3386] Adding the pieces together to make a complete language - C - (2011-08-11)
  [3144] Setting up arrays in C - fixed size at compile time, or dynamic - (2011-01-24)
  [3118] Arrays of arrays - or 2D arrays. How to program tables. - (2011-01-02)
  [2848] C course - final course example puts it all together - (2010-07-02)
  [2669] Efficient use of dynamic memory - C and realloc - (2010-03-10)
  [1845] Passing a table from Lua into C - (2008-10-18)
  [1670] Dynamic Memory Allocation in C - (2008-06-09)
  [1589] Dynamic Memory Allocation in C - calloc, realloc - (2008-03-22)
  [1581] What is an lvalue? (Perl, C) - (2008-03-18)
  [1497] Training Season Starts again! - (2008-01-07)

Q456 - Object Orientation and General technical topics - Test Driven Development and Behaviour Driven Development
  [4652] Testing new algorithms in PHP - (2016-02-20)
  [4542] The principle of mocking - and the Python Mock package - (2015-10-17)
  [4457] Test framework for TCL - Tcltest - some examples - (2015-03-11)
  [4387] Regression Testing my website - Cucumber and Watir - (2015-01-07)
  [4380] Behaviour Driven Development / Ruby and Cucumber - (2015-01-02)
  [4374] Test driven development, and class design, from first principles (using C++) - (2014-12-30)
  [4346] A behaviour driven example of writing a Java program - (2014-12-09)
  [4336] Test Driven Development - a first example of principle in C - (2014-12-01)
  [4326] Learning to program - comments, documentation and test code - (2014-11-22)


Back to
String handling in C - new examples of extracting integers from a string
Previous and next
or
Horse's mouth home
Forward to
Encapsulating logic in functions and structs - the C approach to Object Oriented techniques
Some other Articles
TransWilts Community Interest Company AGM - 13 Feb 2016, Swindon
People matter - but there is a tradeoff between different people in there
Rail user groups worried about what is happening on the buses
Regression testing - via a very short C testing framework
String handling in C - new examples of extracting integers from a string
Remember to ask the question before you listen for the answer
What would the Wiltshire Council bus cuts mean for Melksham?
The story behind the bus cuts, and what they could mean
Making travel time useful time on public transport
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2019: 404 The Spa • Melksham, Wiltshire • United Kingdom • SN12 6QL
PH: 01225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/4634_Reg ... ework.html • PAGE BUILT: Sat May 27 16:49:10 2017 • BUILD SYSTEM: WomanWithCat