Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #780 > unrolled thread

Unit testing, what is it?

Started bynroberts <roberts.noah@gmail.com>
First post2011-08-25 09:15 -0700
Last post2011-08-26 08:07 +1200
Articles 3 — 3 participants

Back to article view | Back to comp.programming


Contents

  Unit testing, what is it? nroberts <roberts.noah@gmail.com> - 2011-08-25 09:15 -0700
    Re : Unit testing, what is it? vincent_belliard <vincent@famillebelliard.fr> - 2011-08-25 12:57 -0700
    Re: Unit testing, what is it? Ian Collins <ian-news@hotmail.com> - 2011-08-26 08:07 +1200

#780 — Unit testing, what is it?

Fromnroberts <roberts.noah@gmail.com>
Date2011-08-25 09:15 -0700
SubjectUnit testing, what is it?
Message-ID<17e0fe2b-954c-4a5c-85d2-b4eac052fa13@b20g2000vbz.googlegroups.com>
I've recently started at a new job after 5 years working somewhere
else, which wasn't able to teach me much so I taught myself.  I
implemented what I read about unit testing using the Boost.Test
framework (was working in C++).

My idea of a unit test is to take some chunk of a program, often a
single class or small set of classes meant to work as a cohesive
entity, and link that part and only that part of the program to a
driver that asserts the behavior I expect from the unit and outputs a
report for me.  Generally I make sure there's a way to turn off
verbosity so the build system can use the return code to tell me
simply whether the test passes or fails.  Then I have a growing set of
these programs that are compiled and run as part of my build process.

I was rather surprised to find that something quite different goes by
the name "unit test" at the new employer, but maybe I'm the one that's
wrong.  Here they compile the program, which is a small part of a
large, multitiered framework, and run another program that requests
data from it; this client is somewhat configurable in what data it
requests.  Then they manually check things like the log and database
to see what's there and make sure it's correct.

At some level I suppose this way does test certain aspects of the
code, and probably stresses particular "units" within it, but are
these actually "unit tests"?  Does it matter?

[toc] | [next] | [standalone]


#781 — Re : Unit testing, what is it?

Fromvincent_belliard <vincent@famillebelliard.fr>
Date2011-08-25 12:57 -0700
SubjectRe : Unit testing, what is it?
Message-ID<b9588621-be60-4174-8cf4-4d9f97597246@glegroupsg2000goo.googlegroups.com>
In reply to#780
Your primary idea of unit testing is right. Testing a whole program outside it's context is more "unitary testing". Both are useful. Unit testing is more tedious (it needs strict specifications for small parts of a program) but it discovers more regressions.

[toc] | [prev] | [next] | [standalone]


#782

FromIan Collins <ian-news@hotmail.com>
Date2011-08-26 08:07 +1200
Message-ID<9bnob9Fau3U1@mid.individual.net>
In reply to#780
On 08/26/11 04:15 AM, nroberts wrote:
> I've recently started at a new job after 5 years working somewhere
> else, which wasn't able to teach me much so I taught myself.  I
> implemented what I read about unit testing using the Boost.Test
> framework (was working in C++).
>
> My idea of a unit test is to take some chunk of a program, often a
> single class or small set of classes meant to work as a cohesive
> entity, and link that part and only that part of the program to a
> driver that asserts the behavior I expect from the unit and outputs a
> report for me.  Generally I make sure there's a way to turn off
> verbosity so the build system can use the return code to tell me
> simply whether the test passes or fails.  Then I have a growing set of
> these programs that are compiled and run as part of my build process.
>
> I was rather surprised to find that something quite different goes by
> the name "unit test" at the new employer, but maybe I'm the one that's
> wrong.  Here they compile the program, which is a small part of a
> large, multitiered framework, and run another program that requests
> data from it; this client is somewhat configurable in what data it
> requests.  Then they manually check things like the log and database
> to see what's there and make sure it's correct.

You are much closer to the mark.  A good definition and description of 
unit tests can be found here:

http://c2.com/cgi/wiki?UnitTest

> At some level I suppose this way does test certain aspects of the
> code, and probably stresses particular "units" within it, but are
> these actually "unit tests"?  Does it matter?

That depends on their definition of "unit".  These look more like system 
tests to me.  The real teat is does a failure identify the function that 
cased the tests to fail, or do they have to do more work to track it down?

-- 
Ian Collins

[toc] | [prev] | [standalone]


Back to top | Article view | comp.programming


csiph-web