Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > new article

Reply
Thread Tools

new article

 
 
Jacob Fugal
Guest
Posts: n/a
 
      06-07-2005
Disclaimer: I've never actually used ZenTest, so I may be wrong, but
having read a little about it this is my understanding...

> But I have a question. The article is entitled 'Test-first programming
> with Ruby' but when talking about ZenTest you tell that it "can also
> work in reverse, loading a test suite and writing code stubs for every
> test" which corresponds to what this is all about. However the examples
> you are showing after that are examples to go from code to tests. Why
> didn't you show how to go from tests to code using ZenTest?


I believe that you are misinterpreting the (admittedly ambiguous)
statement "loading a test suite and writing code stubs for every
test". From my understanding of ZenTest, the noun "test suite" would
refer to the code base to be tested plus any existing tests, and the
"code stubs" are stubs for new tests, not stubs for the code being
tested. E.g. my code has a method 'eatTaquitos' which isn't yet tested
in my existing test suite. ZenTest will detect that and create a stub
'test_eatTaquitos' (or some other, probably better, name) method. It's
a stub because ZenTest isn't smart enought to know *how* to test
'eatTaquitos', just that it still *needs* to be tested.

Does that clear up the confusion? (Or, if I'm totally off base, will
someone familiar with ZenTest clean up the mess I just made?)

Jacob Fugal


 
Reply With Quote
 
 
 
 
Jacob Fugal
Guest
Posts: n/a
 
      06-07-2005
/me looks at pate's reply and winces, realizing he guessed wrong.

I retract my previous post...

Jacob Fugal


 
Reply With Quote
 
 
 
 
Ghislain Mary
Guest
Posts: n/a
 
      06-07-2005
pat eyler a écrit :

> I did, perhaps it didn't show up very well:
>
>
>
> Letting ZenTest write code stubs for you works the same way. If you
> were to run the tool against your existing ts_r43.rb like
> 'ZenTest.rb ts_r43.rb', it would generate the output shown here:
>
> 1 class R43
>
> 2 def key
> 3 raise NotImplementedError, 'Need to write key'
> 4 end
>
> 5 def echo
> 6 raise NotImplementedError, 'Need to write echo'
> 7 end
>
> 8 end
>
> Since all that ZenTest is writing for you are code stubs (which look
> a *lot* like test stubs) I probably need to be more explicit about what's
> going on.
>


Oh... sorry. That's my mistake. It is indeed very clear.

Thanks.


 
Reply With Quote
 
pat eyler
Guest
Posts: n/a
 
      06-07-2005
On 6/7/05, Jacob Fugal <(E-Mail Removed)> wrote:
> Disclaimer: I've never actually used ZenTest, so I may be wrong, but
> having read a little about it this is my understanding...


Anti-disclaimer: the description below is pretty accurate for Ruby=20
code -> tests via ZenTest

>=20
> > But I have a question. The article is entitled 'Test-first programming
> > with Ruby' but when talking about ZenTest you tell that it "can also
> > work in reverse, loading a test suite and writing code stubs for every
> > test" which corresponds to what this is all about. However the examples
> > you are showing after that are examples to go from code to tests. Why
> > didn't you show how to go from tests to code using ZenTest?

>=20
> I believe that you are misinterpreting the (admittedly ambiguous)
> statement "loading a test suite and writing code stubs for every
> test". From my understanding of ZenTest, the noun "test suite" would
> refer to the code base to be tested plus any existing tests, and the
> "code stubs" are stubs for new tests, not stubs for the code being
> tested. E.g. my code has a method 'eatTaquitos' which isn't yet tested
> in my existing test suite. ZenTest will detect that and create a stub
> 'test_eatTaquitos' (or some other, probably better, name) method. It's
> a stub because ZenTest isn't smart enought to know *how* to test
> 'eatTaquitos', just that it still *needs* to be tested.
>=20
> Does that clear up the confusion? (Or, if I'm totally off base, will
> someone familiar with ZenTest clean up the mess I just made?)


ZenTest is capable of 'working in reverse' too though. If you've written a
nice test suite but haven't gotten around to writing code yet, ZenTest will
gleefully write stubs for the code. In fact, you could hand ZenTest a file=
=20
full of tests and a file full of code, and it will pump out test method stu=
bs=20
for any untested methods and methods stubs to match any tests for which=20
no methods currently exist. (Have I successfully undisambiguated things?)

>=20
> Jacob Fugal
>=20
>=20



--=20
thanks,
-pate
-------------------------
We are often unable to tell people what they need to know, because=20
they want to know something else, and would therefore only=20
misunderstand what we said
- the Raven (George MacDonald, Lilith)


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Article: New digital camera? Know how, where you can use it drocillo Digital Photography 1 02-04-2006 02:11 PM
new AJAX.Net MSDN article Karl Seguin ASP .Net 1 09-21-2005 08:16 PM
ANN: Project VeriPage Announces New SystemVerilog Article Swapnajit Mittra VHDL 0 08-01-2005 08:18 PM
SETI - New Scientist Article - "Mysterious signals" frederick NZ Computing 2 09-03-2004 12:27 AM
Article: The New Python - Part 1 - Types and Objects Shalabh Chaturvedi Python 0 01-12-2004 10:31 AM



Advertisments