0

I am trying to execute Selenium tests written in C#.NET with NUnit through Jenkins, but the following error message is displayed:

-> error: Unexpected error. System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:13748 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)

My build configuration in Jenkins is as follows: enter image description here

The solution appears to build successfully, but again, upon executing the tests I receive the above error message.

Note: I've checked my firewall settings and Jenkins is allowed through the firewall.

Any feedback would be greatly appreciated.

ZachOverflow
  • 387
  • 1
  • 3
  • 14
  • Can you access 127.0.0.1:13748 if you remote into the Jenkins build machine? Is the service/app running on that port on AND running on the same machine as Jenkins? – Matt Stannett May 27 '19 at 03:58
  • @MattStannett Hello & thanks for your response. So, I had Jenkins installed on my local machine as a service. When I installed it via the WAR file, it runs fine - what is the different between the two? – ZachOverflow May 28 '19 at 12:01
  • 1
    I'm not familiar with Jenkins but I did some googling and found a link that may help: [this link](https://stackoverflow.com/a/45069448/5209435) notes that when run as a service it doesn't run under your current user, but another account that my have different permissions, also see the comments on the original question. – Matt Stannett May 28 '19 at 20:09
  • @MattStannett thank you! I will take a look. It turns out I was instantiating Selenium before the test run, which meant any subsequent tests would not have have access to the WebDrivef instance as it was disposed of in the Teardow – ZachOverflow May 29 '19 at 21:08

1 Answers1

1

Selenium was instaniated before the test run (BeforeTestRun). This meant any subsequent test executed after the first one would have no reference to the instance of the WebDriver, as it was not re-instantiated at the start of a scenario.

ZachOverflow
  • 387
  • 1
  • 3
  • 14