1、开发webservice项目,使用eclipse的TestNG自测,发现报错儿: Couldn't contact the Remote TestNG client. Uncheck the 'Use Project testng.jar' option from your Project properties and try again.如图。
2、控制台输出如下:Unknown option: 颍骈城茇-serportUsage:[-d output-directory] default output directory to : test-output[-testclass list of .class files or list of class names][-sourcedir a source directory][-annotations javadoc or JDK] Specifies the default annotation type to be used in suites when none is explicitly specified. This version of TestNG (15) supports both "javadoc" and "JDK" annotation types.[-groups comma-separated list of group names to be run] works only with -testclass[-excludegroups comma-separated list of group names to be excluded] works only with -testclass[-testrunfactory list of .class files or list of class names implementing org.testng.ITestRunnerFactory][-listener list of .class files or list of class names implementing org.testng.ITestListener and/or org.testng.ISuiteListener][-parallel methods|tests] run tests in parallel using the specified mode[-threadcount number of threads to use when running tests in parallel][-suitename name] Default name of test suite, if not specified in suite definition file or source code[-testname Name] Default name of test, if not specified in suite definition file or source code[-reporter Extended configuration for custom report listener][suite definition files*]For details please consult documentation.
3、开始以为是TestNG的插件没有装好,后来排查,因为eclipse安装插件的时候,带了testng.jar包了,然后自己本身的项目中也有testng.jar包
4、既然查明,那么我们把项目里面的配置修改一下,右键点击项目,选择Properties,记得不要选eclipse上方的window菜单下的Properties,不然就把工作空间中所有的设置都改了。
5、点击左方TestNG, 看到Use Project TestNG jar 前方那个对勾了吗? 恩,去掉就可以了,点击应用,OK。
6、再次testNG 测试用例,OK 可以正常跑通了。