new article

J

Jacob Fugal

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
 
J

Jacob Fugal

/me looks at pate's reply and winces, realizing he guessed wrong.

I retract my previous post... :(

Jacob Fugal
 
G

Ghislain Mary

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.
 
P

pat eyler

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
=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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top