Beispiel #1
0
        /// <summary>
        /// Start a run of the tests in the loaded TestPackage. The tests are run
        /// asynchronously and the listener interface is notified as it progresses.
        /// </summary>
        /// <param name="listener">An ITestEventHandler to receive events</param>
        /// <param name="filter">A TestFilter used to select tests</param>
        /// <returns>A <see cref="AsyncTestEngineResult"/> that will provide the result of the test execution</returns>
        public AsyncTestEngineResult RunAsync(ITestEventListener listener, TestFilter filter)
        {
            if (_runner == null)
            {
                throw new InvalidOperationException("RemoteTestAgent: RunAsync called before Load");
            }

            return(_runner.RunAsync(listener, filter));
        }
Beispiel #2
0
        private void CommandLoop()
        {
            bool keepRunning  = true;
            var  socketReader = new SocketReader(_clientSocket, new BinarySerializationProtocol());

            while (keepRunning)
            {
                var command = socketReader.GetNextMessage <CommandMessage>();

                switch (command.CommandName)
                {
                case "CreateRunner":
                    var package = (TestPackage)command.Arguments[0];
                    _runner = CreateRunner(package);
                    break;

                case "Load":
                    SendResult(_runner.Load());
                    break;

                case "Reload":
                    SendResult(_runner.Reload());
                    break;

                case "Unload":
                    _runner.Unload();
                    break;

                case "Explore":
                    var filter = (TestFilter)command.Arguments[0];
                    SendResult(_runner.Explore(filter));
                    break;

                case "CountTestCases":
                    filter = (TestFilter)command.Arguments[0];
                    SendResult(_runner.CountTestCases(filter));
                    break;

                case "Run":
                    filter = (TestFilter)command.Arguments[0];
                    SendResult(_runner.Run(this, filter));
                    break;

                case "RunAsync":
                    filter = (TestFilter)command.Arguments[0];
                    _runner.RunAsync(this, filter);
                    break;

                case "Stop":
                    keepRunning = false;
                    break;
                }
            }

            Stop();
        }
Beispiel #3
0
 /// <summary>
 /// Start a run of the tests in the loaded TestPackage, returning immediately.
 /// The tests are run asynchronously and the listener interface is notified
 /// as it progresses.
 /// </summary>
 /// <param name="listener">An ITestEventHandler to receive events</param>
 /// <param name="filter">A TestFilter used to select tests</param>
 /// <returns>An AsyncTestRun that will provide the result of the test execution</returns>
 protected override AsyncTestEngineResult RunTestsAsync(ITestEventListener listener, TestFilter filter)
 {
     try
     {
         return(_remoteRunner.RunAsync(listener, filter));
     }
     catch (Exception e)
     {
         log.Error("Failed to run remote tests {0}", e.Message);
         var result = new AsyncTestEngineResult();
         result.SetResult(CreateFailedResult(e));
         return(result);
     }
 }
Beispiel #4
0
        /// <summary>
        /// Start a run of the tests in the loaded TestPackage, returning immediately.
        /// The tests are run asynchronously and the listener interface is notified
        /// as it progresses.
        /// </summary>
        /// <param name="listener">An ITestEventHandler to receive events</param>
        /// <param name="filter">A TestFilter used to select tests</param>
        /// <returns>An AsyncTestRun that will provide the result of the test execution</returns>
        protected override AsyncTestEngineResult RunTestsAsync(ITestEventListener listener, TestFilter filter)
        {
            log.Info("Running " + TestPackage.Name + " (async)");

            try
            {
                EnsurePackageIsLoaded();
                return(_remoteRunner.RunAsync(listener, filter));
            }
            catch (Exception e)
            {
                log.Error("Failed to run remote tests {0}", e.Message);
                var result = new AsyncTestEngineResult();
                result.SetResult(CreateFailedResult(e));
                return(result);
            }
        }
        /// <summary>
        /// Start a run of the tests in the loaded TestPackage, returning immediately.
        /// The tests are run asynchronously and the listener interface is notified
        /// as it progresses.
        /// </summary>
        /// <param name="listener">An ITestEventHandler to receive events</param>
        /// <param name="filter">A TestFilter used to select tests</param>
        /// <returns>An AsyncTestRun that will provide the result of the test execution</returns>
        protected override AsyncTestEngineResult RunTestsAsync(ITestEventListener listener, TestFilter filter)
        {
            log.Info("Running " + TestPackage.Name + " (async)");

            try
            {
                CreateAgentAndRunner();

                return(_remoteRunner.RunAsync(listener, filter));
            }
            catch (Exception e)
            {
                log.Error("Failed to run remote tests {0}", ExceptionHelper.BuildMessageAndStackTrace(e));
                var result = new AsyncTestEngineResult();
                result.SetResult(CreateFailedResult(e));
                return(result);
            }
        }
 /// <summary>
 /// Start a run of the tests in the loaded TestPackage. The tests are run
 /// asynchronously and the listener interface is notified as it progresses.
 /// </summary>
 /// <param name="listener">The listener that is notified as the run progresses</param>
 /// <param name="filter">A TestFilter used to select tests</param>
 /// <returns></returns>
 public ITestRun RunAsync(ITestEventListener listener, TestFilter filter)
 {
     return(_engineRunner.RunAsync(listener, filter));
 }
Beispiel #7
0
 /// <summary>
 /// Start a run of the tests in the loaded TestPackage. The tests are run
 /// asynchronously and the listener interface is notified as it progresses.
 /// </summary>
 /// <param name="listener">An ITestEventHandler to receive events</param>
 /// <param name="filter">A TestFilter used to select tests</param>
 /// <returns>A <see cref="AsyncTestEngineResult"/> that will provide the result of the test execution</returns>
 public AsyncTestEngineResult RunAsync(ITestEventListener listener, TestFilter filter)
 {
     return(_runner.RunAsync(listener, filter));
 }
Beispiel #8
0
 /// <summary>
 /// Start a run of the tests in the loaded TestPackage, returning immediately.
 /// The tests are run asynchronously and the listener interface is notified
 /// as it progresses.
 /// </summary>
 /// <param name="listener">An ITestEventHandler to receive events</param>
 /// <param name="filter">A TestFilter used to select tests</param>
 /// <returns>An AsyncTestRun that will provide the result of the test execution</returns>
 protected override AsyncTestEngineResult RunTestsAsync(ITestEventListener listener, TestFilter filter)
 {
     return(_remoteRunner.RunAsync(listener, filter));
 }