I'm working on a fairly small project (in terms of dependencies), and whenever I run a unit test it takes 8 seconds for the JVM to load, before running the actual test in 0.2s.
My environment:
I fear there must be something in my environment that's causing this to take so long, and I'm hoping someone has seen this before and found the source of the problem and perhaps a solution?
E.g. if my PATH
environment variable is really long, would that matter at all?
What exactly happens when I run a JUnit test?
The actual test I'm trying to run is:
public class TemplateLocationCalculatorTest {
private TemplateLocationCalculator target = new TemplateLocationCalculator();
@Test
public void whenGivenRootReturnIndex(){
Assert.assertEquals("index", target.calculate("/"));
}
}
And the target class is this:
public class TemplateLocationCalculator {
public String calculate(String string) {
return "index";
}
}
I hope you'll agree with me when I say this shouldn't take long to load.
OP here.
Following a suggestion given in the chat I used the Microsoft Process Monitor and after a lot of filtering I discovered that the AV software Avecto DefendPoint was running on my machine, and that it seemed like this was the bottleneck. Whenever I start a test, it would run at about 25%, which to me seems to indicate that it's running at full speed on a single thread on one of my four cores. I'm not the administrator on this machine so I was unable to disable it to verify this hypothesis, but in general if other people should see this issue check if it could be your anti-virus software.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With