Jmockit with idea problem
Hi all.
I am having hard time running jmockit on idea.
i am using version 11.1.2 idea, jmockit-0.999.16.jar, testng6.0.1.jar.
http://jmockit.googlecode.com/svn/trunk/www/gettingStarted.html part 4 it is said that I need to give javaagent.
I am setting like that:

But i am still getting in my console:
WARNING: JMockit was initialized on demand, which may cause certain tests to fail;
please check the documentation for better ways to get it initialized.
And later I am getting NP exception during creation of Expectations class. it is because of jmockit is not intialized correctly i think.
How can i set up correctly?
Please sign in to leave a comment.
I am defining jars in this order:

Stille getting this warning: WARNING: JMockit was initialized on demand, which may cause certain tests to fail;
please check the documentation for better ways to get it initialized.
Guys are telling how to solve with eclipse: " Putting it into the Order and Export tab solved the
problem. That and adding an Expectation or two."
here: https://groups.google.com/forum/?fromgroups=#!topic/jmockit-users/r4JLInIhG30
What else i can do?
thanks.
Any help?
I changed some versions of jars and getting nowthing:

It is just telling that No Test Results, Not sure what does it mean? But there are many test cases which are running on eclipse perfect
Anyone can have a look?
thanks.
I upgraded to 11.1.5 version and getting the following error, the order of jars are correct:
WARNING: JMockit was initialized on demand, which may cause certain tests to fail;
please check the documentation for better ways to get it initialized.
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:108)
Caused by: java.lang.NullPointerException
at mockit.internal.startup.Startup.redefineMethods(Startup.java:184)
at mockit.internal.startup.Startup.redefineMethods(Startup.java:176)
at mockit.internal.annotations.MockClassSetup.applyClassModifications(MockClassSetup.java:190)
at mockit.internal.annotations.MockClassSetup.redefineMethodsInClassHierarchy(MockClassSetup.java:151)
at mockit.internal.annotations.MockClassSetup.redefineMethods(MockClassSetup.java:140)
at mockit.Mockit.setUpMocks(Mockit.java:249)
at mockit.integration.testng.internal.TestNGRunnerDecorator.<init>(TestNGRunnerDecorator.java:67)
at mockit.integration.testng.internal.TestNGRunnerDecorator.registerWithTestNG(TestNGRunnerDecorator.java:60)
at mockit.integration.testng.Initializer.<init>(Initializer.java:29)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.testng.internal.ClassHelper.newInstance(ClassHelper.java:48)
at org.testng.TestNG.setListenerClasses(TestNG.java:637)
at org.testng.TestNG.configure(TestNG.java:1372)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:187)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:111)
WARNING: JMockit was initialized on demand, which may cause certain tests to fail;
please check the documentation for better ways to get it initialized.
... 5 more
Disconnected from the target VM, address: '127.0.0.1:52782', transport: 'socket'
Anyone knows this issue?
Hi Elbek,
Not sure about exact jmockit configuration but your screenshot shows that agent setup (-javaagent:.../jmockit.jar) has not been applied during the run configuraiont execution.
Denis
Yes, Whatever I do(jars order) Still gettingwarning. My doubt is idea has it's own jars(junit, testng). So maybe idea is loading them before my conffig applies. is it possible?
But the thing is from version 6.2+ testng order of jars does not matter, so most probabyly idea is using it's own testNG in my opinion. Any idea where to go and manage this situation? Maybe update jar of the testng plugin?
IDEA doesn't use itsown testng jar in your tests VM. With new testng versions IDEA would use old "String" protocol so probably you should update version in IDEA's plugin. Please download the testng jar from testng.org site.
Thanks
I upgraded it. It does not solve the issue, but upgrade worked.