Exemple #1
0
        public void GetDataCollectorLauncherShouldBeInsensitiveToCaseOfCurrentProcess()
        {
            mockProcessHelper.Setup(x => x.GetCurrentProcessFileName()).Returns("DOTNET");
            var dataCollectorLauncher = DataCollectionLauncherFactory.GetDataCollectorLauncher(mockProcessHelper.Object, this.dummyRunSettings);

            Assert.IsInstanceOfType(dataCollectorLauncher, typeof(DotnetDataCollectionLauncher));
        }
Exemple #2
0
        public void GetDataCollectorLauncherShouldReturnDotnetDataCollectionLauncherWithDotnetCore()
        {
            mockProcessHelper.Setup(x => x.GetCurrentProcessFileName()).Returns("dotnet");
            var dataCollectorLauncher = DataCollectionLauncherFactory.GetDataCollectorLauncher(mockProcessHelper.Object, this.dummyRunSettings);

            Assert.IsInstanceOfType(dataCollectorLauncher, typeof(DotnetDataCollectionLauncher));
        }
Exemple #3
0
        public void GetDataCollectorLauncherShouldReturnDefaultDataCollectionLauncherWithFullCLRRunner()
        {
            mockProcessHelper.Setup(x => x.GetCurrentProcessFileName()).Returns("vstest.console.exe");
            var dataCollectorLauncher = DataCollectionLauncherFactory.GetDataCollectorLauncher(mockProcessHelper.Object, this.dummyRunSettings);

            Assert.IsInstanceOfType(dataCollectorLauncher, typeof(DefaultDataCollectionLauncher));
        }
Exemple #4
0
 public CommunicationLayerIntegrationTests()
 {
     this.mockTestMessageEventHandler = new Mock <ObjectModel.Client.ITestMessageEventHandler>();
     this.dataCollectorSettings       = string.Format("<DataCollector friendlyName=\"CustomDataCollector\" uri=\"my://custom/datacollector\" assemblyQualifiedName=\"{0}\" codebase=\"{1}\" />", typeof(CustomDataCollector).AssemblyQualifiedName, typeof(CustomDataCollector).GetTypeInfo().Assembly.Location);
     this.runSettings            = string.Format(this.defaultRunSettings, this.dataCollectorSettings);
     this.processHelper          = new ProcessHelper();
     this.dataCollectionLauncher = DataCollectionLauncherFactory.GetDataCollectorLauncher(this.processHelper, this.runSettings);
 }
Exemple #5
0
 public CommunicationLayerIntegrationTests()
 {
     this.mockTestMessageEventHandler = new Mock <ObjectModel.Client.ITestMessageEventHandler>();
     this.mockRequestData             = new Mock <IRequestData>();
     this.mockMetricsCollection       = new Mock <IMetricsCollection>();
     this.mockRequestData.Setup(rd => rd.MetricsCollection).Returns(this.mockMetricsCollection.Object);
     this.dataCollectorSettings = string.Format("<DataCollector friendlyName=\"CustomDataCollector\" uri=\"my://custom/datacollector\" assemblyQualifiedName=\"{0}\" codebase=\"{1}\" />", typeof(CustomDataCollector).AssemblyQualifiedName, typeof(CustomDataCollector).GetTypeInfo().Assembly.Location);
     this.runSettings           = string.Format(this.defaultRunSettings, this.dataCollectorSettings);
     this.testSources           = new List <string>()
     {
         "testsource1.dll"
     };
     this.processHelper          = new ProcessHelper();
     this.dataCollectionLauncher = DataCollectionLauncherFactory.GetDataCollectorLauncher(this.processHelper, this.runSettings);
 }
Exemple #6
0
        public void AfterTestRunShouldHandleSocketFailureGracefully()
        {
            var socketCommManager           = new SocketCommunicationManager();
            var dataCollectionRequestSender = new DataCollectionRequestSender(socketCommManager, JsonDataSerializer.Instance);
            var dataCollectionLauncher      = DataCollectionLauncherFactory.GetDataCollectorLauncher(this.processHelper);

            using (var proxyDataCollectionManager = new ProxyDataCollectionManager(this.runSettings, dataCollectionRequestSender, this.processHelper, dataCollectionLauncher))
            {
                proxyDataCollectionManager.BeforeTestRunStart(true, true, this.mockTestMessageEventHandler.Object);

                var result = Process.GetProcessById(dataCollectionLauncher.DataCollectorProcess.Id);
                Assert.IsNotNull(result);

                socketCommManager.StopClient();

                var attachments = proxyDataCollectionManager.AfterTestRunEnd(false, this.mockTestMessageEventHandler.Object);

                Assert.IsNull(attachments);

                // Give time to datacollector process to exit.
                Assert.IsTrue(result.WaitForExit(500));
            }
        }