Tuesday 15 May 2012

java - How to run tests with JUnit and Ant? In the same JVM or different JVM? -



java - How to run tests with JUnit and Ant? In the same JVM or different JVM? -

i facing little problem junit , ant. not know how should run tests. should utilize forked="yes" alternative witch create new vm each test,or should utilize same vm?

which improve way, or how know when utilize same jvm or not?

thanks

to run junit tests in ant utilize junit task. there alternative run tests in separate jvm (the fork attribute).

in general, improve run tests in separate vm isolate them ant jvm , classpath. allows configure properties of jvm tests, maximum amount of memory (many attributes of task applied if fork enabled).

however, makes tests take longer because of overhead of creating new jvm. depends on forkmode attribute. if set pertest, each test run in own vm.

forkmode

controls how many java virtual machines created if want fork tests. possible values "pertest" (the default), "perbatch" , "once". "once" creates single java vm tests while "pertest" creates new vm each testcase class. "perbatch" creates vm each nested , 1 collecting nested s.

java ant junit jvm

No comments:

Post a Comment