This tutorial assumes that the jmockit.jar is already in the projects build path. If you want to know how to do it.You can find it here
Adding the java agent argument
Since JMockit uses instrumentation apis, we need to add the java agent in the VM argument.Assume the jmockit.jar is present in the directory C:\jmockit\jmockit.jar and you will be running ViewTest class as a JUnit test.
Then in the Run Configurations window add to VM arguments "-javaagent:C:\jmockit\jmockit.jar" as shown in the screen shot below.
Then click on Apply and then Run.
Hope this tutorial makes things easier for you .If you have any questions please post, I'll be happy to answer.
This comment has been removed by the author.
ReplyDeleteIf we are using maven, and added the jMockit dependency artifact, do we still need to use jar in VM args? or we can run as junit directly?
ReplyDelete