Tuesday, January 4, 2011

JUnit Annotations

JUnit Annotations:

An annotation, in the Java computer programming language, is a special form of syntactic metadata that can be added to Java source code. Classes, methods, variables, parameters and packages may be annotated.

Annotations provide data about a program that is not part of the program itself. They have no direct effect on the operation of the code they annotate.

Annotations have a number of uses, among them:
  • Information for the compiler - Annotations can be used by the compiler to detect errors or suppress warnings.
  • Compiler-time and deployment-time processing - Software tools can process annotation information to generate code, XML files and so forth.
  • Runtime processing - Some annotations are available to be examined at runtime.
Followings are the some of JUnit annotations which are quite useful:

1. Test
2. Ignore
3. Before
4. After
5. BeforeClass
6. AfterClass
7. RunWith

<<Previous  Next>>