Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion docstring-driven testing
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Les Schaffer  
View profile  
 More options Mar 6 1999, 3:00 am
Newsgroups: comp.lang.python
From: Les Schaffer <godzi...@netmeg.net>
Date: 1999/03/06
Subject: Re: [LONG] docstring-driven testing
Tim 'tested-by-fire' Peters spoke:

> About a month ago, I tried something new: take those priceless
> interactive testing sessions, paste them into docstrings, and write
> a module to do all the rest by magic

when i was writing an optics code last year i tried a similar but
simpler version of this: when i first constructed the basics of a
module, i ran it and collected the results and pasted it in at the
bottom of the module file as comments. subsequent usage of the module
could use a checker() function which compared subsequent test output
with what was in the saved string of results, showing only changes
between one and the other.

i like your idea better for the reason that each example is located
near its code, so a failure could be detected and the user sent to
where the problem __may__ lie.

as for interactive testing being the best mode, i agree for short
pieces of code i go to the interpreter, hack around, and then paste a
goodie into my module.

but for long winded code with many dependent pieces (a ray tracer
firing and bouncing rays around reflecting and refracting surfaces) i
tend to test only some larger subset -- for example, the initial ray
and the final ray through a refracting prism -- by running a script
and examining output.

but i guess there is a whole art to figuring out at what granularity
one should be testing (and re-testing) pieces of code (functions, a
few lines, classes, etc). i am still learning about this after coding
for 26 years, and still feel i have too much to learn.

<rant> finally, what i like best about your idea and design is that it
further encourages documentation, visible examples, and testing right
within the code base. i feel so stringly taht in the age of
internetwide development of code, all these things must be integrated
INTO THE SOURCE FILE to be really useable.

sometimes i tire so of clicking over to the browser to read the
doc.html, clicking to the README to look at the example, clicking to
xemacs to look at the source, clicking to the xterm to look at a
python interpreter. etc. etc. just as structs (classes) were created
by divine inspiration (intervention?)  to collect different but
related values (and functions), so too should open source code gather
all its parts together.  </rant>

nice work tim.....

--
____        Les Schaffer              ___| --->> Engineering R&D <<---
Theoretical & Applied Mechanics          |  Designspring, Inc.
Center for Radiophysics & Space Research |  http://www.designspring.com/
Cornell Univ.  schaf...@tam.cornell.edu  |  l...@designspring.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.