java - Powermock JUnit tests are taking more time to execute compared to normal JUnit -


We are using PowerMock by junking the static methods using annotations using @PrepareForTest . The test runs fine but the problem is that it is taking too much time to execute the test.

The code snippet is as follows:

  @PrepareForTest ({StaticClass1.class, StaticClass2.class})  

Normally However, it takes about 2 seconds to execute JUnit while joking the static method, but when we add annotation to the @PrepareForTest joke, static calls to complete the test execution It takes about a minute to take time. For a test, this is not a big effect, but we have more than 1K tests and the overall building time is taking more than 2 hours, which took 20 to 30 minutes before.

For the time being what could be the reason for the powermoke.

Any help would be greatly appreciated.

PowerMock is a tool that performs bytecode instrumentation on your generated sections. Once your classes are compiled into Java bytecode, then the powermock comes with it and modifies this generated square. It is not possible to duplicate a private or static method (using Java proxy).

You should only use the @PrepareForTest annotation in those sections that you want to use special features for PowerMock, such as joking about personal or static methods


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -