• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

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: 41988
911
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.
 
Forget this weirdo. You guys wanna see something really neat? I just have to take off my shoe .... (hint: it's a tiny ad)
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic