• 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

Am I doing unit test right?

 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
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

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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic