0

On running the testng.xml, I am getting the following error:

Exception in thread "main" com.beust.jcommander.ParameterException: Unknown option: -protocol
    at com.beust.jcommander.JCommander.parseValues(JCommander.java:742)
    at com.beust.jcommander.JCommander.parse(JCommander.java:282)
    at com.beust.jcommander.JCommander.parse(JCommander.java:265)
    at com.beust.jcommander.JCommander.<init>(JCommander.java:210)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:161)

No errors are there in the actual selenium classes.

juherr
  • 5,640
  • 1
  • 21
  • 63
Anirudh
  • 1
  • 1
  • 4
  • How do you run the suite ? With Eclipse ? – juherr Oct 27 '16 at 10:42
  • Which version of Eclipse, TestNG and testng plugin are you using ? – juherr Oct 27 '16 at 10:43
  • Yes, with Eclipse.Eclipse Neon.1a – Anirudh Oct 27 '16 at 10:59
  • testng-6.9.13.6.jar and TestNG plug-in for Eclipse. – Anirudh Oct 27 '16 at 11:02
  • I created the issue: https://github.com/cbeust/testng-eclipse/issues/297 – juherr Oct 27 '16 at 11:07
  • @Arnrudh, could navigate to "Window -> Show View -> Others -> Error Log", locate to the entry of '[TestNGLaunchConfigurationDelegate] Launching:', copy and paste the content here? since i'd like to know the classpath – XuQing Tan Oct 27 '16 at 12:14
  • eclipse.buildId=4.6.1.M20160907-1200 java.version=1.8.0_40 java.vendor=Oracle Corporation BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_IN Framework arguments: -product org.eclipse.epp.package.jee.product Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.productorg.testng.eclipse Info Fri Oct 28 09:09:02 IST 2016 [TestNGLaunchConfigurationDelegate] Launching: – Anirudh Oct 28 '16 at 03:43
  • Classpath: C:\Program Files\eclipse-jee-neon-1a-win32-x86_64\eclipse\plugins\org.testng.eclipse_6.9.13.201609291640\lib\testng-remote.jar C:\Users\anirudhsn\workspace\Arrhythmia\target\classes C:\Program Files\eclipse-jee-neon-1a-win32-x86_64\eclipse\plugins\org.junit_4.12.0.v201504281640\junit.jar C:\Program Files\eclipse-jee-neon-1a-win32-x86_64\eclipse\plugins\org.hamcrest.core_1.3.0.v201303031735.jar C:\Users\anirudhsn\Downloads\selenium-java-3.0.0-beta3 (1)\lib\cglib-nodep-3.2.4.jar C:\Users\anirudhsn\Downloads\selenium-java-3.0.0-beta3 (1)\lib\commons-codec-1.10.jar – Anirudh Oct 28 '16 at 03:45
  • @ XuQing Tan, I am unable to paste all content of classpath here due to space limitation. – Anirudh Oct 28 '16 at 03:48
  • @Anirudh, somehow the older version of RemoteTestNG inside your fat selenium jar was loaded first, though I saw the new testng-remote.jar is at the front of classpath; Could you share a sample project to reproduce the issue. let's track it on github ticket: https://github.com/cbeust/testng-eclipse/issues/297, thanks – XuQing Tan Oct 29 '16 at 14:52
  • @Anirudh, I just downloaded the latest selenium-java 3.0.1, I don't see testng was embedded in any fat jar, so, could you try with this version? and also please confirm there is only one TestNG (to be more specific RemoteTestNG) on your classpath. – XuQing Tan Oct 29 '16 at 15:22
  • @XuQing, I tried with selenium-java 3.0.1 also. But,still I am getting the same error. – Anirudh Oct 31 '16 at 04:24
  • could you add '-verbose:class' to JVM arguments when launch the testng process in Eclipse. on the stdout, it would print something like this: [Loaded org.testng.remote.RemoteTestNG from file:/Users/nick/workspace/myproject/testng-eclipse/testng-eclipse-plugin/lib/testng-remote.jar] [Loaded org.testng.TestNGException from file:/Users/nick/.m2/repository/org/testng/testng/6.9.10/testng-6.9.10.jar] [Loaded com.beust.jcommander.ParameterException from file:/Users/nick/.m2/repository/com/beust/jcommander/1.48/jcommander-1.48.jar] – XuQing Tan Oct 31 '16 at 23:32
  • [Loaded java.lang.Shutdown from C:\Program Files\Java\jdk1.8.0_40\jre\lib\rt.jar] [Loaded java.lang.Shutdown$Lock from C:\Program Files\Java\jdk1.8.0_40\jre\lib\rt.jar] Exception in thread "main" com.beust.jcommander.ParameterException: Unknown option: -protocol – Anirudh Nov 01 '16 at 03:59
  • could you locate to line "Loaded org.testng.remote.RemoteTestNG", need to know where loaded RemoteTestNG class. and please paste the output onto ticket: https://github.com/cbeust/testng-eclipse/issues/297, stack overflow comment is not a good place for tracking this. – XuQing Tan Nov 01 '16 at 04:38
  • @ XuQing Tan, Issue is resolved. I just removed the RemoteTestNG loaded under file:/C:/Program%20Files/Java/jdk1.8.0_40/jre/lib/ext/testng-6.9.6.jar. Thanks for your support. – Anirudh Nov 01 '16 at 04:52
  • I have the same issue on eclipse Version: 2019-12 (4.14.0), testng-7.0.0, testNG plugin 7.0.0. In my case, I don't have any testng under my jdk installation. – Kevin Nguyen Feb 05 '20 at 22:37

1 Answers1

0

Issue is resolved now. The problem was occurred by the RemoteTestNG loading. So I just removed the C:/Program%20Files/Java/jdk1.8.0_40/jre/lib/ext/testng-6.9.6.jar. I am able to run the testng.xml without any error message. Thanks @XuQing Tan for your valuable comments.

Anirudh
  • 1
  • 1
  • 4