none
Cannot run test remotely in Visual studio 2017

    Question

  • Installed: TestAgent 2017, TestController 2017
    Firewall: Disabled everywhere
    Wrote test: 
    public void TestMethod1()
    {
         Assert.IsFalse(false);
    }

    Try to run this test on remote agent from VS 2017 and get in the output:
    "No connection could be made because the target machine actively refused it"

    TestController log:
    I, 6516, 45, 2018/01/23, 14:49:37.723, WINTCNN\QTController.exe, ControllerObject: Creating ControllerExecution for TestRun a007769d-4e55-4dc9-8d5a-db42b5b3f10e
    I, 6516, 45, 2018/01/23, 14:49:37.723, WINTCNN\QTController.exe, ControllerSpooledJob: creating spooled job for test run 'akozlov@WKS04 2018-01-23 14:49:22'
    I, 6516, 45, 2018/01/23, 14:49:37.723, WINTCNN\QTController.exe, ControllerObject: Queuing TestRun a007769d-4e55-4dc9-8d5a-db42b5b3f10e

    And nothing more related to test execution

    When I try the same test from VS 2015 everything goes OK. And TestController log has many more records.

    What prevents my test from executing from VS 2017?


    Tuesday, January 23, 2018 3:02 PM

All replies

  • Hi Alexey,

    Welcome to the MSDN forum.

    Based on your description, I create a unit test in VS 2017 Enterprise v15.5.2, execute it remotely.

    I encountered Warning “A testsettings file or a runsettings with a ForcedLegacyMode set to true is not supported with the MSTest V2 Adapter.” in output window, it different as your error message.

    But when I use “Microsoft.VisualStudio.QualityTools.UnitTestFramework” instead of MSTest V2, it works well.

    What is the version of your Visual Studio 2017?

    Is your VS2015 and VS2017 on the same computer? And are they in the same domain?

    Based on the error message "No connection could be made because the target machine actively refused it", it often means that the host sent a reset instead of an ask when you tried to connect. Either there is a firewall blocking the connection or the process that is hosting the service is not listening on that port. This may be because it is not running at all or because it is listening on a different port.

    Please check the agent component connects to the controller and the Test Agent status is Online.

    If test agent and test controller connect OK, could you ping the successful test controller on VS2017 's computer?

    If not, please add the trust in C:\Windows\System32\drivers\etc\hosts. Then, test again.

    Regards,

    Judyzh


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Wednesday, January 24, 2018 9:13 AM
  • Hi Judyzh,

    I use VS 2017 Professional 15.5.4
    I use “Microsoft.VisualStudio.QualityTools.UnitTestFramework”

    VS 2017 and VS 2015 are on different computers.

    Firewall is disabled everywhere.

    Test agent is registered to the controller and it's status is Online.

    I can ping test controller machine from VS 2017 computer.
    I enabled tracing on test controller and I can see that the controller creates a job for test run but the job is not executed:
    TestController log:
    I, 6516, 45, 2018/01/23, 14:49:37.723, WINTCNN\QTController.exe, ControllerObject: Creating ControllerExecution for TestRun a007769d-4e55-4dc9-8d5a-db42b5b3f10e
    I, 6516, 45, 2018/01/23, 14:49:37.723, WINTCNN\QTController.exe, ControllerSpooledJob: creating spooled job for test run 'akozlov@WKS04 2018-01-23 14:49:22'
    I, 6516, 45, 2018/01/23, 14:49:37.723, WINTCNN\QTController.exe, ControllerObject: Queuing TestRun a007769d-4e55-4dc9-8d5a-db42b5b3f10e

    When I run the same test from VS 2015 everything goes OK and the test is executed.
    Thursday, January 25, 2018 9:33 AM
  • Hi Alexey Kozlov,

    So your test controller and test agent were installed in the same machine(remote machine), you could run test remotely using VS2015 with them, but just VS2017 machine couldn't run the test remotely using the same Test controller and agent, am I right?

    If so, could you run them locally using VS2017?

    >>Test agent is registered to the controller and it's status is Online.

    How about connecting your test controller and agent without using the "Interactive Process" option? I mean use the option "Service". And make sure that your test agent is ready status

    https://msdn.microsoft.com/en-us/library/dd695837.aspx

    Please also check that whether two machines(VS2017 and VS2015) are in the same domain or the same user name or password as your test agent/controller machine.

    >>No connection could be made because the target machine actively refused it

    I met this error before which was related to the IE settings:

    https://social.msdn.microsoft.com/Forums/en-US/1cf82dc8-fe5d-40a2-af19-b5bcab1254c9/request-failed-no-connection-could-be-made-because-the-target-machine-actively-refused-it?forum=vstswebtest

    Maybe we also need to check the network proxy or others.

    Anyway, if still no help, please try to collect the detailed log and share it here.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, January 30, 2018 1:59 AM
    Moderator
  • Hi Jack

    >> So your test controller and test agent were installed in the same machine(remote machine), you could run test remotely using VS2015 with them, but just VS2017 machine couldn't run the test remotely using the same Test controller and agent, am I right?

    Yes you are.

    >> If so, could you run them locally using VS2017?

    Yes I can

    >> How about connecting your test controller and agent without using the "Interactive Process" option? I mean use the option "Service". And make sure that your test agent is ready status

    When I reconfigured test agent as a service I got the same error in VS:
    Failed to queue test run ....: No connection could be made because the target machine actively refused it

    >> Please also check that whether two machines(VS2017 and VS2015) are in the same domain or the same user name or password as your test agent/controller machine.

    All in the same domain, agent and controller run the same domain user which is local computer admin. Test agent status is online.

    >> >>No connection could be made because the target machine actively refused it
    >> I met this error before which was related to the IE settings:
    >> https://social.msdn.microsoft.com/Forums/en-US/1cf82dc8-fe5d-40a2-af19-b5bcab1254c9/request-failed-no-connection-could-be-made-because-the-target-machine-actively-refused-it?forum=vstswebtest
    >> Maybe we also need to check the network proxy or others.

    Seems like not my case, no proxies are configured

    >> Anyway, if still no help, please try to collect the detailed log and share it here.

    I put my project, configs and logs here
    https://1drv.ms/u/s!AmjejA0NeGsLglCiuvYEYBpqIdrS

    Thank you

    Tuesday, January 30, 2018 4:50 PM
  • Hi Alexey Kozlov,

    Not a direct solution, but if you install the test controller in your VS2017 machine, and then connect the previous test agent in another remote machine, how about the result if you run your test with them? I mean that use another test controller in your VS2017 machine.

    I know that your test controller and agent are in the same domain, but they are all in the same machine, so the real issue is that whether your VS2017 is also in the same domain.

    Please also try to restart your Test controller and Agent services, connect them again.

    I got the error in your log files:

    >>A network-related or instance-specific error occurred while establishing a connection to SQL Server.

    >>The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.

    Please check your SQL  Server, whether you could visit the SQL Server (during you config the test controller and agent) in your VS2017 machine?

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, January 31, 2018 5:49 AM
    Moderator
  • Hi Jack

    I got some more traces from Visual Studio. There are failures there:

    devenv.exe, TestProject.UpgradeTestItemsInProjectAndSolution: failed to get IVsUpgradeLogger (ignorable): Microsoft.VisualStudio.TestTools.Exceptions.EqtException: Failed to get service Microsoft.VisualStudio.Shell.Interop.IVsUpgradeLogger.
       at Microsoft.VisualStudio.TestTools.Vsip.VSServiceHelper.GetService[S,T](IServiceProvider serviceProvider)
       at Microsoft.VisualStudio.TestTools.Tips.TuipPackage.TestProject.UpgradeProject(UInt32 upgradeFlags)

    devenv.exe, TestProjectExtensions.GetPropertyValue:: Warning !! Failed to find the property IsWindowsStoreCodedUITest. ErrorCode:-2147170504

    Error: Failed to queue test run '... 2018-02-08 16:18:04': No such host is known

    Please see detailed log here:
    https://1drv.ms/u/s!AmjejA0NeGsLgmzlQyP-dd9yB1px

    SQL server is not used in my test controller configuration because I do not run load tests.


    Friday, February 09, 2018 4:05 PM
  • Hi Alexey Kozlov,

    Please have a try with the following to troubleshoot this issue:

    Please use the same account (the account connect test agent and test controller) to launch Visual Studio 2017.

    If there have anti-virus software on your VS2017 computer, please turn off it and turn off firewall.

    Please try to specify a port number (not 80 port) and test again.

    Please reboot the VS2017 computer.

    In addition, do you have any other computer installed VS2017? I suggest you use it to test, see if it has same issue. If it works fine, this means that caused by that computer, please check the configure in that computer.

    Meanwhile, I found warning “Warning: Warning : A testsettings file or a runsettings with a ForcedLegacyMode set to true is not supported with the MSTest V2 Adapter.in your detail log. Please check  ForcedLegacyMode in your runsettings file.

    Regard,

    Judyzh


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Tuesday, February 13, 2018 8:53 AM