views:

214

answers:

2

I've just started having a proper play with Powermock and noticed that it slows down test startup immensely. A quick look at top while it was running shows that mount.nfts-3g was taking up most of the CPU. I moved Eclipse and my source directory to ext3 partitions to see if that was a problem and the tests now startup quicker but there's still a noticeable delay. Is this normal with Powermock or am I missing something obvious?

A: 

Try to run Powermock without Eclipse. Does the same symptoms occur?

Mock veeery small units. Is the performance loss as high as before?

furtelwart
+1  A: 

PowerMock is a bit slower at startup since it uses it's own classloader but the time needed also depends on how you write the tests using PowerMock. For instance if you are using the PrepareForTest annotation at the class or method level of your test. If you're using it at the method-level a new classloader is created for each test-method. The time may also depend on the junit fork mode.

PrepareForTest is on the class. Not sure what the fork mode is as I'm running it from within Eclipse. Can I presume this startup time will increase the more PowerMock is being used then?
MrWiggles
Well it will be a bit slower but it shouldn't be significantly so. Whether it will increase the more you use PowerMock is dependent on the junit fork mode I think. But by default I don't think it should be any problem, at least not in Eclipse.