Wednesday, October 17, 2007

Unit Testing with Junit

Unit Testing with Junit

This article introduces unit testing, distinguishes it from other types of testing, and shows how unit testing can help you deliver more robust code with a lower bug rate in less time. JUnit is used to help achieve this since it’s the defacto unittesting framework for Java

Types Of Testings
There are many types of testing strategies used in software development. But In a typical software project, there are two types of tests that are most important: programmer tests and customer tests. These are otherwise known as unit tests and acceptance tests, respectively.Unit tests and acceptance tests are equally important and, as such, should not be overlooked when developing any sort of serious enterprise or largescale application.
Example we can take of our tradebeam application.

Compares ion between unit tests and acceptance tests.

Unit Tests ---------------------------- Acceptance tests
Defined by developers . ------- ---------------- Defined by customer.
Develops confidence in developer .------ --- Develops confidence in customer.
Test small unit in isolation. ------------------- Test entire application
Low level testing High Level testing.------- -- Done progammatically Done by hand or by script
100% automated ------------------- --------- Mixture of automation and manual intervation.

These two testing techniques complement each other. Neither on its own is sufficient. Many projects tend to use one but not the other.
Without unit tests, acceptance tests become very tedious to write and run. Many more combinations need to be tested, since there is less confidence in the underlying code. This results in much more manual labor.
Without acceptances tests, there is no process for determining when the software meets the requirements of the customer. This results in vague development cycles that drag on and on.

More details and other information on this topic refer to following site.
http://www.junit.org/

No comments: