Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Cppunit: Test functions and/or whole applications?
People talk a lot about unit tests, meaning single functions of the
code are tested and their outputs are compared to expected outputs.

But noone talks about testing a whole compiled application. For
example, I also want to check if my compiled command line tool app.exe
really prints out what it has to print out. (my app.exe is not
interactive)

Is there a framework that can do both? Testing single functions and
testing whole compiled applications? For my projectg, I want to do
both.

It should be possible to write a wrapper function that calls my
compiled program with system(). This wrapper function could then be
tested with Cppunit. Does that make sense? Or are Makefiles using diff
just the right thing to test a compiled app?

Thanks!

Report this thread to moderator Post Follow-up to this message
Old Post
Markus Dehmann
08-26-04 08:56 AM


Re: Cppunit: Test functions and/or whole applications?
In article <c1e48b51.0408251739.478b6e39@posting.google.com>,
Markus Dehmann wrote:

> It should be possible to write a wrapper function that calls my
> compiled program with system(). This wrapper function could then be
> tested with Cppunit. Does that make sense? Or are Makefiles using diff
> just the right thing to test a compiled app?

I've been using such approach (diffs), but while application grows tests
becomes very hard to maintain. Single change in functionality causes a
lot of modifcations in several tests.

I've choosed another strategy: set up is done at low-level (several
inserts into database) and output from high-level is checked selectively
(example: if customer name is visible on the customer lists). Those
tests check connection between UI and application model.

More checks are done at lower (application model, unit tests) level -
they are easier to set-up and to check.

--
Regards, Darek Cieslak; +48 505-670-010;          cieslakd at gazeta.pl
http://xprogramming.prv.pl - ExtremeProgramming / TestDrivenDevelopment
Cartalia.com: +48 (022) 334-54-09 int. 121;         http://cartalia.com

Report this thread to moderator Post Follow-up to this message
Old Post
Darek Cieslak
08-26-04 01:56 PM


Re: Cppunit: Test functions and/or whole applications?
markus.cl@gmx.de (Markus Dehmann) writes:

> It should be possible to write a wrapper function that calls my
> compiled program with system(). This wrapper function could then be
> tested with Cppunit. Does that make sense? Or are Makefiles using diff
> just the right thing to test a compiled app?

This looks like an acceptance test to me. Not that it matters, but just as a
point of reference.

Anyway, I would do this the simplest way that would get me meaninful
results. If capturing the output and doing a diff gives you enough
information, do that. If you need to process the output in some way to extra
ct
useful info, then write a wrapper to launch your app, capture the output,
process it and check the results.

OTOH, you can test your code directly if your main function just forwards
everything to a function called "doStuff", for example. You can then call
doStuff directly from your tests, rather than having to launch the app. This
is the way I would go for development tests.

HTH,

Anthony
--
Anthony Williams
Senior Software Engineer, Beran Instruments Ltd.

Report this thread to moderator Post Follow-up to this message
Old Post
Anthony Williams
08-26-04 01:56 PM


Re: Cppunit: Test functions and/or whole applications?
On 25 Aug 2004 18:39:27 -0700, markus.cl@gmx.de (Markus Dehmann)
wrote:

>People talk a lot about unit tests, meaning single functions of the
>code are tested and their outputs are compared to expected outputs.
>
>But noone talks about testing a whole compiled application. For
>example, I also want to check if my compiled command line tool app.exe
>really prints out what it has to print out. (my app.exe is not
>interactive)
>
>Is there a framework that can do both? Testing single functions and
>testing whole compiled applications? For my projectg, I want to do
>both.

Have you looked at FitNesse?  (www.fitnesse.org)  I wrote a fixture
for FitNesse some time ago named CommandLineFixture.  It was able to
monitor standard out and standard error and verify that the right
things got printed, etc.


-----
Robert C. Martin (Uncle Bob)  | email: unclebob@objectmentor.com
Object Mentor Inc.            | blog:  www.butunclebob.com
The Agile Transition Experts  | web:   www.objectmentor.com
800-338-6716


"The aim of science is not to open the door to infinite wisdom,
but to set a limit to infinite error."
-- Bertolt Brecht, Life of Galileo

Report this thread to moderator Post Follow-up to this message
Old Post
Robert C. Martin
09-02-04 08:56 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Extreme Programming archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:53 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.