Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Am I doing unit test right?

 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
I'm trying to adopt unit testing in my application.
Here my Ant task:

This target uses <batchtest> , so it will runs all the tests in this folder even I don't want to do so.
Suppose I have many tests, tests that connects to the database, tests for parsing XML and so on.
How to run a specific test file? or it is a best practice to run them all?
Thanks.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by John Todd:
This target uses <batchtest> , so it will runs all the tests in this folder even I don't want to do so. Suppose I have many tests, tests that connects to the database, tests for parsing XML and so on. How to run a specific test file? or it is a best practice to run them all?

In a build script, one good practice is to always run all tests. Another good practice is to always run most tests (the fast ones) and run the rest (the slow ones) with a special target only when you feel that you're ready to check in your changes.

Typically, when I want to run just one test or all tests in one specific package, I do that from the IDE.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by John Todd:
tests that connects to the database,

Noting that these aren't unit tests. Another practice is to run all the unit tests from the build machine (if a database isn't available) and run the integration tests on another machine.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic