• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How do you do test driven development?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I am doing research on what tools can make TDDier's lives easier.
If you are a developer who practices "test driven development" (TDD) please answer the following questions.

Thanks a lot!

Instructions:
Please specify which of the following statements hold when you are modifying existing unfamiliar code or extending it with new functionality:
Please use seldom/sometime/usually or true/false values:
Example: I read tests to understand the program : sometimes

Questions:
1- I read tests to understand the program:
2- I run tests and trace them to understand the program:
3- Before I make any changes to the code, I first discover tests that are relevant to the functionality of interest and then make the changes:
4- I do not try to find the relevant tests. Instead, I write a set of new tests from scratch and then make changes to the code to pass them. I fix any other failing tests later:
5- I change the program code and then change and augment all the broken tests:

Other:

Copy Right: Valeh H. Nasser, 2010
 
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know if this will fit your questions but, if I have to add a new method I would start from the assert. Like Kent Becks book says it will give us a better view of the test by doing that.

But, I can't answer the first question, why should I read code to understand the software? If the software is well designed the class and its methods will be able to explain itself.

About the second it's too vague. We can do a lot of those options or just one of it.
 
Valeh H Nasser
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply. I just simplified the question so that it gets easier to answer.
 
Valeh H Nasser
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the modified question:

Instructions:
Please specify which of the following statements are true when you are modifying existing unfamiliar code or extending it with new functionality in a TDD project:
Please use a number from 1 to 5 where 1 is never and 5 is always.

Example: I read tests to understand the program : 2

Questions:
1- I read tests to understand the program:
2- I run tests and trace them to understand the program:
3- I change the program code and then change and augment all the broken tests:
4- Before I make any changes to the code, I first discover and make changes to tests that are relevant to the functionality of interest and then make the changes to the code to pass them:
5- I do not try to find the relevant tests. Instead, I write a set of new tests from scratch and then make changes to the code to pass them. Then I fix any other broken tests later:
Other:

Copy Right: Valeh H. Nasser, 2010
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do TDD about half the time.

1- I read tests to understand the program: 3 (sometimes; often the code is readable and this isn't necessary - or I've seen it before)
2- I run tests and trace them to understand the program: 1 (never)
3- I change the program code and then change and augment all the broken tests: 2 (rarely)
4- Before I make any changes to the code, I first discover and make changes to tests that are relevant to the functionality of interest and then make the changes to the code to pass them: 3 (sometimes - I think; see comment below)
5- I do not try to find the relevant tests. Instead, I write a set of new tests from scratch and then make changes to the code to pass them. Then I fix any other broken tests later: 4 (often)

For #4, discovery sounds formal; like I track down all the relevant tests. Usually one is relevant and I change that and see if others are affected. And then analyze whether they should change or not.
 
Valeh H Nasser
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply. Do you think IDE's do a good job helping tracking with relevant tests or do you wish to get more intelligent support?
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Valeh H Nasser wrote:Thanks for your reply. Do you think IDE's do a good job helping tracking with relevant tests or do you wish to get more intelligent support?


For the one test that needs addition/changing before I touch the code, it is almost always immediately apparent. Also, I run all my unit tests when something changed so this isn't a big problem. Infinitest does track which tests are affected when I change code and they do a good job of that.
 
author
Posts: 799
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:Also, I run all my unit tests when something changed so this isn't a big problem. Infinitest does track which tests are affected when I change code and they do a good job of that.



Hi Jeanne--

Have you been using Infinitest against a larger code base with some slower tests? I'm curious to know how that's been panning out. I've used it on a smaller, well-design effort where a small number of tests (~1000) all ran in a couple seconds, and it's fantastic, particularly in terms of how it makes you think about how testing fits into the development cycle.

thanks
Jeff
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeff,
I'm only using Infinitest on my JavaRanch stuff. Which is small in the scheme of things. The largest project we have is the software for this forum. Much smaller than a work project.

I'm not using it at work. I think I'm less concerned at work because there we have an automated build to pick up on failing tests in the rare event I manage to miss one. Also, my work machine is more powerful so I can run all the (thousands) of unit tests that go with the workspace in a couple seconds. It takes longer than that to think what I want to do next, so I don't notice it.
 
Jeff Langr
author
Posts: 799
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:I'm not using it at work. I think I'm less concerned at work because there we have an automated build to pick up on failing tests in the rare event I manage to miss one. Also, my work machine is more powerful so I can run all the (thousands) of unit tests that go with the workspace in a couple seconds. It takes longer than that to think what I want to do next, so I don't notice it.



Wish I had that problem. :-) I'm now in C# land and it takes half a minute just to wait for builds, plus our test suite takes 10 minutes to run ~8000 tests. Lots of work ahead on speeding things up...

Jeff
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wow. That's slow. Our integration tests do take longer of course, but even those don't take 10 minutes except for the largest apps.
 
Liar, liar, pants on fire! refreshing plug:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic