Exception : During run my first Test using TestNG | Selenium Forum
M
Posted on 23/09/2016
hi Team,

I create a simple testclass using TestNG:
===================================
package Test;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeTest;

public class NewTest {
@Test
public void f() {
System.out.println("TEST");
}
@BeforeMethod
public void beforeMethod() {
}

@BeforeTest
public void beforeTest() {
}

}
======================================

When I right click on NewTest and Run As TestNg Test
I am getting following exception:

java.lang.IllegalArgumentException: port out of range:-1
at java.net.InetSocketAddress.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at org.testng.remote.strprotocol.BaseMessageSender.connect(BaseMessageSender.java:58)
at org.testng.remote.strprotocol.MessageHub.connect(MessageHub.java:32)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:84)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)


Attached the Screen shot of Eclipse if that could help in understand the project structure

M
Replied on 23/09/2016

the issue is resolved. for some reason the Eclipse version I was using was corrupt and after re-installing and change JDK to 1.7 from earlier 1.6 and also installing the correct version of TestNG it worked fine. thanks all