Using mstest to execute DLL's using WCF service RRS feed

  • Question

  • I am trying to execute the coded UI Test Solutions DLL's using C# code. I have a Window service, which will be calling a WCF service on the servers on which the Test Solutions are to be run. Now when i call this below code on the server locally, it works fine.

    Code to execute DLL using mstest-->

    ProcessStartInfo startInfo = new ProcessStartInfo(str);
                    startInfo.Arguments = @"/testcontainer:" + "\"" + applicationPath + "\"" + testCasesNames + @" /resultsfile:" + "\"" + resultFilePath + "\"";
                    startInfo.UseShellExecute = true;
                    startInfo.CreateNoWindow = true;
                    startInfo.WindowStyle = ProcessWindowStyle.Normal;
                    startInfo.RedirectStandardOutput = false;
                    startInfo.LoadUserProfile = true; 
                    startInfo.RedirectStandardInput = false;
                    executeTestCases.StartInfo = startInfo;

     But when called from the WCF service, it is giving an error in the trx report generated.


              <Message>Error calling Initialization method for test class TTX.Automation.AppCheckout.BusinessDirectory.AppCheckout: Microsoft.VisualStudio.TestTools.UITest.Extension.UITestException: To run tests that interact with the desktop, you must set up the test agent to run as an interactive process. For more information, see "How to: Set Up Your Test Agent to Run Tests That Interact with the Desktop" (
    If you are running the tests as part of your team build, you must also set up the build agent to run as an interactive process. For more information, see "How to: Configure and Run Scheduled Tests After Building Your Application" (</Message>
              <StackTrace>    at Microsoft.VisualStudio.TestTools.UITesting.Playback.Initialize()
       at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestExtensionExecution.BeforeTestInitialize(Object sender, BeforeTestInitializeEventArgs e)
       at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecution.RaiseBeforeTestInitialize(BeforeTestInitializeEventArgs args)
       at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.RunInitializeMethod()


    This requires to make test controllers and test agents. Also the user needs to have Project Collection Administrator rights on TFS for assigning test controller role to it.

    As i have the Test solution Dll's on the server locally, so is this a remote execution actually. Do i need to make these test controllers and agents or is there something else i am missing. Please suggest

    • Edited by Paras TTX Tuesday, January 15, 2013 7:10 AM
    • Moved by Bob Shen Wednesday, January 16, 2013 5:14 AM
    Tuesday, January 15, 2013 7:08 AM

All replies