In Junit, I know there is a @beforeclass , @before annotation, do we have a annotation or design,
allow us to write a method to run ONLY once before the whole testing process?
we have a script, which setup some database data (config, static, lookup table etc…..) for the test, but its too expensive to run before each individual test, we would like it to set it, only once before start running any test.
thanks!
Since you tagged your question with
maven, I’ll go this way: you could use thepre-integration-testphase to run this one-time expensive script (symmetrically, you clean up inpost-integration-test).You could use exec-maven-plugin for this:
JUnit does not have this kind of annotation, because it does not make any assumption about the environment: its goal is to test one class at a time in an isolated manner.