• 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

creating a testing framework using JUnit

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any pros or cons in the book on creating a testing framework using JUnit? Also, in estimating a project what additional percentage of time would you say writing test first approach would be vs not using this approach?
 
Author
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jean Miles:
Any pros or cons in the book on creating a testing framework using JUnit? Also, in estimating a project what additional percentage of time would you say writing test first approach would be vs not using this approach?


WRT framework, no there is nothing related to this in the book. However, I would highly recommend you verify that such a framework does not already exist!
WRT TDD, I don't have any idea. Some hints. First, if you're not doing TDD, it's unlikely you'll get close to 100% test coverage. If you're not doing TDD you'll also spend a considerable amount of time refactoring your code when the code's first users try to use it. You can try asking the question on the TDD mailing list (on yahoogroups).
Thanks
-Vincent
 
Jean Miles
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you have any suggestion on creating test cases in packages that are similar package the test cases are written for. Example.
package: ebusiness.servlet
test cases package: ebusiness.servlet.test
I am not sure if test cases in frameworks test cases should be written for application across the enterprise? How do you handle project specific testing needs?
 
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What I've most often seen recommended is to put the test cases/classes in the same packages as the classes that they're testing. To keep test code segemented from "real" code, put them in a different source directory. So, you'd have a src/ebusiness/servlet directory structure and a test/ebusiness/servlet directory structure. Then you can easily package up the test classes separately, but the test classes still have package-layer access to the classes they're testing.
 
Vincent Massol
Author
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jean Miles:
Do you have any suggestion on creating test cases in packages that are similar package the test cases are written for. Example.
package: ebusiness.servlet
test cases package: ebusiness.servlet.test
I am not sure if test cases in frameworks test cases should be written for application across the enterprise? How do you handle project specific testing needs?


I strongly recommend:

Where myproject/src/test contains your test classes.
 
Jean Miles
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are reasons I would use a testing framework like cactus vs not use a testing framework.
 
Vincent Massol
Author
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jean Miles:
What are reasons I would use a testing framework like cactus vs not use a testing framework.


First, you need to find the answer to: "why would I use a testing framework like cactus vs not use a testing framework.". Look at http://junit.org for answers (you can also search on the junit yahoogroups archives). Once you get that answer, you can solve the "why do I need cactus instead of using pure JUnit". Then you can check http://jakarta.apache.org/cactus!
Thanks.
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jean Miles:
Any pros or cons in the book on creating a testing framework using JUnit?


What exactly do you mean by "creating a testing framework"? JUnit *is* a testing framework, isn't it?

Also, in estimating a project what additional percentage of time would you say writing test first approach would be vs not using this approach?


Well, there is an initial learning curve, of course. But after that I would say that using TDD will actually *save* time. The time spent writing the tests will be paid back manyfold by reduced debugging time and a better decoupled (easier to maintain/extend) design.
 
Jean Miles
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My question wasn't specific on what I wanted to ask. I wanted to know how to organize the test classes. Do I create a framework of test classes to mirror my existing classes or put the test classes in same package as the existing class or put test classes in one large package?
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Take a look at this thread.
reply
    Bookmark Topic Watch Topic
  • New Topic