testng-eclipse icon indicating copy to clipboard operation
testng-eclipse copied to clipboard

testng-eclipse + testng + mockito + powermock does not work.

Open staabm opened this issue 13 years ago • 2 comments
trafficstars

when using mockito + powermock with testng, we need to set the "object-factory" attribute in the testng.xml, like this


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="ProjectCommon" parallel="classes" object-factory="org.powermock.modules.testng.PowerMockObjectFactory">
  <test name="common" preserve-order="false">
    <packages>
       <package name="xxx.yyy.*" />
    </packages>
  </test>
</suite>

when starting the testsuite using "mvn" from commandline everything works as expected. when the tests are started using the eclipse-plugin i get a nullpointer-exception and the testrun fails.

seems to be some classloading issues, since the error happens while initializing our JAX-WS Clients.

staabm avatar Mar 20 '12 09:03 staabm

Caused by: javax.xml.ws.WebServiceException: Unable to createEndpointReference Provider at javax.xml.ws.spi.Provider.provider(Unknown Source) at javax.xml.ws.Service.(Unknown Source) ... 44 more Caused by: java.lang.NullPointerException ... 49 more

staabm avatar Mar 20 '12 09:03 staabm

hmm seems to be some linkageerrors occur while bootstraping JAX-WS. This seems to be caused by the proxy'ing of mockito/powermock

I have to correct myself. happens also outside the eclipse plugin, when running mvn on the commandline.

staabm avatar Mar 20 '12 12:03 staabm