private void StartDiscovery(DiscoveryRequestPayload discoveryRequestPayload, ITestRequestManager testRequestManager) { Task.Run( delegate { try { testRequestManager.ResetOptions(); testRequestManager.DiscoverTests(discoveryRequestPayload, new DesignModeTestEventsRegistrar(this), this.protocolConfig); } catch (Exception ex) { EqtTrace.Error("DesignModeClient: Exception in StartDiscovery: " + ex); var testMessagePayload = new TestMessagePayload { MessageLevel = TestMessageLevel.Error, Message = ex.ToString() }; this.communicationManager.SendMessage(MessageType.TestMessage, testMessagePayload); var payload = new DiscoveryCompletePayload() { IsAborted = true, LastDiscoveredTests = null, TotalTests = -1 }; // Send run complete to translation layer this.communicationManager.SendMessage(MessageType.DiscoveryComplete, payload); } }); }
private void StartTestRun(TestRunRequestPayload testRunPayload, ITestRequestManager testRequestManager, bool skipTestHostLaunch) { Task.Run( delegate { try { testRequestManager.ResetOptions(); var customLauncher = skipTestHostLaunch ? DesignModeTestHostLauncherFactory.GetCustomHostLauncherForTestRun(this, testRunPayload) : null; testRequestManager.RunTests(testRunPayload, customLauncher, new DesignModeTestEventsRegistrar(this), this.protocolConfig); } catch (Exception ex) { EqtTrace.Error("DesignModeClient: Exception in StartTestRun: " + ex); var testMessagePayload = new TestMessagePayload { MessageLevel = TestMessageLevel.Error, Message = ex.ToString() }; this.communicationManager.SendMessage(MessageType.TestMessage, testMessagePayload); var runCompletePayload = new TestRunCompletePayload() { TestRunCompleteArgs = new TestRunCompleteEventArgs(null, false, true, ex, null, TimeSpan.MinValue), LastRunTests = null }; // Send run complete to translation layer this.communicationManager.SendMessage(MessageType.ExecutionComplete, runCompletePayload); } }); }
private void StartDiscovery(DiscoveryRequestPayload discoveryRequestPayload, ITestRequestManager testRequestManager) { Task.Run( delegate { try { testRequestManager.ResetOptions(); testRequestManager.DiscoverTests(discoveryRequestPayload, new DesignModeTestEventsRegistrar(this), this.protocolConfig); } catch (Exception ex) { EqtTrace.Error("DesignModeClient: Exception in StartDiscovery: " + ex); // If there is an exception during test discovery request creation or some time during the process // In such cases, TestPlatform will never send a DiscoveryComplete event and IDE need to be sent a discovery complete message // We need recoverability in translationlayer-designmode scenarios var testMessagePayload = new TestMessagePayload { MessageLevel = TestMessageLevel.Error, Message = ex.ToString() }; this.communicationManager.SendMessage(MessageType.TestMessage, testMessagePayload); var payload = new DiscoveryCompletePayload() { IsAborted = true, LastDiscoveredTests = null, TotalTests = -1 }; // Send run complete to translation layer this.communicationManager.SendMessage(MessageType.DiscoveryComplete, payload); } }); }
private void StartTestRun(TestRunRequestPayload testRunPayload, ITestRequestManager testRequestManager, bool skipTestHostLaunch) { Task.Run( delegate { try { testRequestManager.ResetOptions(); var customLauncher = skipTestHostLaunch ? DesignModeTestHostLauncherFactory.GetCustomHostLauncherForTestRun(this, testRunPayload) : null; testRequestManager.RunTests(testRunPayload, customLauncher, new DesignModeTestEventsRegistrar(this), this.protocolConfig); } catch (Exception ex) { EqtTrace.Error("DesignModeClient: Exception in StartTestRun: " + ex); // If there is an exception during test run request creation or some time during the process // In such cases, TestPlatform will never send a TestRunComplete event and IDE need to be sent a run complete message // We need recoverability in translationlayer-designmode scenarios var testMessagePayload = new TestMessagePayload { MessageLevel = TestMessageLevel.Error, Message = ex.ToString() }; this.communicationManager.SendMessage(MessageType.TestMessage, testMessagePayload); var runCompletePayload = new TestRunCompletePayload() { TestRunCompleteArgs = new TestRunCompleteEventArgs(null, false, true, ex, null, TimeSpan.MinValue), LastRunTests = null }; // Send run complete to translation layer this.communicationManager.SendMessage(MessageType.ExecutionComplete, runCompletePayload); } }); }
private void StartTestRun(TestRunRequestPayload testRunPayload, ITestRequestManager testRequestManager, bool shouldLaunchTesthost) { Task.Run( () => { try { testRequestManager.ResetOptions(); // We must avoid re-launching the test host if the test run payload already // contains test session info. Test session info being present is an indicative // of an already running test host spawned by a start test session call. var customLauncher = shouldLaunchTesthost && testRunPayload.TestSessionInfo == null ? DesignModeTestHostLauncherFactory.GetCustomHostLauncherForTestRun( this, testRunPayload.DebuggingEnabled) : null; testRequestManager.RunTests(testRunPayload, customLauncher, new DesignModeTestEventsRegistrar(this), this.protocolConfig); } catch (Exception ex) { EqtTrace.Error("DesignModeClient: Exception in StartTestRun: " + ex); var testMessagePayload = new TestMessagePayload { MessageLevel = TestMessageLevel.Error, Message = ex.ToString() }; this.communicationManager.SendMessage(MessageType.TestMessage, testMessagePayload); var runCompletePayload = new TestRunCompletePayload() { TestRunCompleteArgs = new TestRunCompleteEventArgs(null, false, true, ex, null, TimeSpan.MinValue), LastRunTests = null }; // Send run complete to translation layer this.communicationManager.SendMessage(MessageType.ExecutionComplete, runCompletePayload); } }); }
private void StartTestSession(StartTestSessionPayload payload, ITestRequestManager requestManager) { Task.Run(() => { var eventsHandler = new TestSessionEventsHandler(this.communicationManager); try { var customLauncher = payload.HasCustomHostLauncher ? DesignModeTestHostLauncherFactory.GetCustomHostLauncherForTestRun(this, payload.IsDebuggingEnabled) : null; requestManager.ResetOptions(); requestManager.StartTestSession(payload, customLauncher, eventsHandler, this.protocolConfig); } catch (Exception ex) { EqtTrace.Error("DesignModeClient: Exception in StartTestSession: " + ex); eventsHandler.HandleLogMessage(TestMessageLevel.Error, ex.ToString()); eventsHandler.HandleStartTestSessionComplete(null); } }); }