473,320 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Testing in C++

nw
Hi,

I have been asked to teach a short course on testing in C++. Until now
I have used my own testing classes (which from what I've seen seem
similar to the boost unit testing classes). Considering I have a
limited amount of time what do readers of this group think would be
useful to cover in this course? Is boost the way to go?

Sorry if this is off-topic in this group.

Many Thanks.

Mar 8 '07
58 3477
Pete Becker wrote:
Ian Collins wrote:
>>>
I think we are arguing at cross purposes here, what are tests run
against if not the original code?

Yes, sorry: by "the original code" I was referring to the failing code
submitted by the customer.
Ah, I see now, you were working with a compiler test suite.

--
Ian Collins.
Mar 9 '07 #51
Ian Collins wrote:
Pete Becker wrote:
>Ian Collins wrote:
>>I think we are arguing at cross purposes here, what are tests run
against if not the original code?
Yes, sorry: by "the original code" I was referring to the failing code
submitted by the customer.
Ah, I see now, you were working with a compiler test suite.
Whoops, sorry: you're right, that's why I fell into that terminology.
So: the customer's test case isn't necessarily the same as the test case
you end up writing when you make the fix. The latter will often be
smaller and faster.

--

-- Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com)
Author of "The Standard C++ Library Extensions: a Tutorial and
Reference." (www.petebecker.com/tr1book)
Mar 9 '07 #52
Pete Becker wrote:
Noah Roberts wrote:
>>
In general, yes you can find the meaning of a phrase through analysis
of its composite words. If you couldn't communication would be
difficult if not impossible.

The meaning of modifiers is often determined by context, which a
dictionary doesn't understand. For example, if you look up "unit" in the
dictionary, its definition could lead you to believe that a "unit test"
is any test that you apply to your application, which is, after all, a
"unit".
How so? Since unit is quite explicitly singular and meaning a single
part and applications are composed of several distinct modules and
components. I imagine someone on the outside of development might fall
into a definition like that but those that understand what composes an
application shouldn't. The first time I heard the term there was little
doubt to its meaning; it was almost completely self explainitory.
Mar 9 '07 #53
Noah Roberts wrote:
Pete Becker wrote:
>Noah Roberts wrote:
>>>
In general, yes you can find the meaning of a phrase through analysis
of its composite words. If you couldn't communication would be
difficult if not impossible.

The meaning of modifiers is often determined by context, which a
dictionary doesn't understand. For example, if you look up "unit" in
the dictionary, its definition could lead you to believe that a "unit
test" is any test that you apply to your application, which is, after
all, a "unit".

How so? Since unit is quite explicitly singular and meaning a single
part and applications are composed of several distinct modules and
components. I imagine someone on the outside of development might fall
into a definition like that but those that understand what composes an
application shouldn't. The first time I heard the term there was little
doubt to its meaning; it was almost completely self explainitory.
Okay, I gave you too much leeway, and you dodged the issue. So let me
say it again:

The definition of "unit" could lead you to believe that a "unit test" is
any test that you apply to any of the executables that constitute your
application.

--

-- Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com)
Author of "The Standard C++ Library Extensions: a Tutorial and
Reference." (www.petebecker.com/tr1book)
Mar 9 '07 #54
Pete Becker wrote:
Noah Roberts wrote:
>Pete Becker wrote:
>>Noah Roberts wrote:

In general, yes you can find the meaning of a phrase through
analysis of its composite words. If you couldn't communication
would be difficult if not impossible.

The meaning of modifiers is often determined by context, which a
dictionary doesn't understand. For example, if you look up "unit" in
the dictionary, its definition could lead you to believe that a "unit
test" is any test that you apply to your application, which is, after
all, a "unit".

How so? Since unit is quite explicitly singular and meaning a single
part and applications are composed of several distinct modules and
components. I imagine someone on the outside of development might fall
into a definition like that but those that understand what composes an
application shouldn't. The first time I heard the term there was
little doubt to its meaning; it was almost completely self explainitory.

Okay, I gave you too much leeway, and you dodged the issue. So let me
say it again:

The definition of "unit" could lead you to believe that a "unit test" is
any test that you apply to any of the executables that constitute your
application.
No, I didn't dodge the issue. I didn't say applications where composed
of several executables.

Yes, it could lead you to believe that unit test means test the whole
program but you would have to use an incomplete definition of unit and
have an incomplete knowledge of program development to fairly make that
assumption since unit quite explicitly means a single part and
applications are made up of several distinct pieces. I'm fairly certain
the first time you heard the phrase it didn't require a lot of
explanation either.
Mar 9 '07 #55
Noah Roberts wrote:
Yes, it could lead you to believe that unit test means test the whole
program but you would have to use an incomplete definition of unit
To avoid arguments over definitions, select definitions that are distinct,
useful, and concise. "Distinct" means that any two engineers could apply the
definition (whether or not they agree it is useful), and get the same
results.

For example, a good definition of a "unit test" is this: "A test whose
failure implicates a well-defined unit of the code, requiring very little
search to find the bug".

The definition applies to a process - a test failing - and not to a static
analysis of the test's code. The definition could include multiple
executables, if the test's failure is still easy to search out.

The point of the definition is not to achieve semiotic perfection, it is to
avoid excessive searching when a unit test fails.

--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
Mar 10 '07 #56
Pete Becker wrote:
nw wrote:
>Hi,

I have been asked to teach a short course on testing in C++. Until now
I have used my own testing classes (which from what I've seen seem
similar to the boost unit testing classes). Considering I have a
limited amount of time what do readers of this group think would be
useful to cover in this course? Is boost the way to go?

Talk about testing, not about tools. For example, have each member of
the class write a complete set of test cases for a program that reads
three numbers from stdin and tells you whether a triangle with sides of
those lengths is equilateral, isosceles, scalene, or impossible. Then
compare the solutions, and talk about testing principles that help
refine the set of test cases.
Unit testing is merely one aspect of software testing, but it
probably merits a complete course on its own.

Because unit testing should be light in time to encourage its
use at build time, I mostly recommend not using a framework at
all. The unit test program merely needs to report success or
failure to the build environment, and should be silent on
successes and verbose on failures.

Legacy code needs careful treatment. Most beginning programmers
will need to deal with existing code in the real world. They
will need to know about breaking dependencies, creating mock
objects, and test coverage.

The limitations of unit testing should also be covered. Unit
tests at build time just don't do the same job as Monte Carlo
testing with randomized loads (useful for multi-threaded
testing), but you don't want to want every build for a million
trial MC run.

I like Michael Feather's book Working Effectively with Legacy
Code. It contains good material on unit testing for both new
code and legacy code.
Mar 11 '07 #57
Glen Dayton wrote:
Pete Becker wrote:
>nw wrote:
>>Hi,

I have been asked to teach a short course on testing in C++. Until now
I have used my own testing classes (which from what I've seen seem
similar to the boost unit testing classes). Considering I have a
limited amount of time what do readers of this group think would be
useful to cover in this course? Is boost the way to go?

Talk about testing, not about tools. For example, have each member of
the class write a complete set of test cases for a program that reads
three numbers from stdin and tells you whether a triangle with sides
of those lengths is equilateral, isosceles, scalene, or impossible.
Then compare the solutions, and talk about testing principles that
help refine the set of test cases.

Unit testing is merely one aspect of software testing, but it probably
merits a complete course on its own.

Because unit testing should be light in time to encourage its use at
build time, I mostly recommend not using a framework at all. The unit
test program merely needs to report success or failure to the build
environment, and should be silent on successes and verbose on failures.
Using a framework takes a lot of the donkey work out of writing unit
test suites. Most frameworks are silent on successes and verbose on
failures.

--
Ian Collins.
Mar 11 '07 #58
Glen Dayton wrote:
I like Michael Feather's book Working Effectively with Legacy Code. It
contains good material on unit testing for both new code and legacy code.
Yes, it's a very good book.
Mar 12 '07 #59

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Hugh Cowan | last post by:
Hello, I don't program full-time (anymore), but I do try and stay on-top of the latest technologies and like most are always trying to upgrade my skills and remain current (as much as is...
0
by: Jonathan Allen | last post by:
We have found that our method of testing does not match traditional text-book methodologies. I decided to write a short white paper on it so that I could get your opinions. Does anyone else use...
0
by: Brian Russell | last post by:
We have three servers (beyond my development box) in our organization. The first is a testing server that has IIS and SQL Server on it. The second is another testing server that also has IIS and...
4
by: Peter Rilling | last post by:
Does VS.NET 2005 Professional support integrated unit testing, or is that only with the team system?
72
by: Jacob | last post by:
I have compiled a set og unit testing recommendations based on my own experience on the concept. Feedback and suggestions for improvements are appreciated: ...
18
by: Andrew Wan | last post by:
I have been developing web applications with ASP & Javascript for a long time. I have been using Visual Studio 2003.NET. While VS2003 is okay for intellisense of ASP & Javascript, it's still not...
0
by: Matthew Fitzgibbons | last post by:
I'm by no means a testing expert, but I'll take a crack at it. Casey McGinty wrote: I've never run into this. Rule of thumb: always separate software from hardware. Write mock classes or...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.