3

Hi I am using SpringJUnit4ClassRunner for my unit tests. It does a bunch of initialization like scanning jpa packages, creating a dataSource and binding it to my jndi environment. All of this takes time. I realize my first unit test function always takes a longer time than the others. I guess Jvm puts the initialization step when running the first step. I am doing some basic load tests and this situation affects me.

Is there a way to exclude this init step time from my first running test.

enter image description here

cgon
  • 1,955
  • 2
  • 23
  • 37
  • 2
    it needs to be initialized, so.. I would advise looking into some benchmark lib that can perform test with more realistic timings (junit-benchmarks for example) –  Feb 28 '14 at 15:58
  • @cgon: Just for clarification of the question: "Is there a way to exclude this init step time from my first running test." a) do you just want to exclude the time from been measured, or b) do you want to make spring faster start? – Ralph Feb 28 '14 at 16:29
  • It is a) . exclude the time from been measured. – cgon Feb 28 '14 at 16:40
  • 1
    It is Eclipse that is adding this time in. You can't really change it. Please see my answer to JUnit @AfterClass run time is added to a poor testcase: http://stackoverflow.com/a/7423368/1836 – Matthew Farwell Feb 28 '14 at 17:14

0 Answers0