Example #1
0
        public void InitializeShouldLoadAndInitializeAllExtension()
        {
            var commonAssemblyLocation = typeof(TestPluginCacheTests).GetTypeInfo().Assembly.Location;

            TestPluginCacheTests.SetupMockExtensions(
                new string[] { commonAssemblyLocation },
                () => { });


            this.executionManager.Initialize(new List <string> {
                commonAssemblyLocation
            });

            Assert.IsNotNull(TestPluginCache.Instance.TestExtensions);

            // Executors
            Assert.IsTrue(TestPluginCache.Instance.TestExtensions.TestExecutors.Count > 0);
            var allExecutors = TestExecutorExtensionManager.Create().TestExtensions;

            foreach (var executor in allExecutors)
            {
                Assert.IsTrue(executor.IsExtensionCreated);
            }

            // Settings Providers
            Assert.IsTrue(TestPluginCache.Instance.TestExtensions.TestSettingsProviders.Count > 0);
            var settingsProviders = SettingsProviderExtensionManager.Create().SettingsProvidersMap.Values;

            foreach (var provider in settingsProviders)
            {
                Assert.IsTrue(provider.IsExtensionCreated);
            }
        }
Example #2
0
 public TestableTestPluginCache(List <string> extensionsPath)
 {
     TestDiscoveryExtensionManager.Destroy();
     TestExecutorExtensionManager.Destroy();
     SettingsProviderExtensionManager.Destroy();
     this.UpdateExtensions(extensionsPath, skipExtensionFilters: false);
 }
Example #3
0
        private void LoadExtensions()
        {
            try
            {
                // Load the extensions on creation so that we dont have to spend time during first execution.
                EqtTrace.Verbose("TestExecutorService: Loading the extensions");

                TestDiscoveryExtensionManager.LoadAndInitializeAllExtensions(false);

                EqtTrace.Verbose("TestExecutorService: Loaded the discoverers");

                TestExecutorExtensionManager.LoadAndInitializeAllExtensions(false);

                EqtTrace.Verbose("TestExecutorService: Loaded the executors");

                SettingsProviderExtensionManager.LoadAndInitializeAllExtensions(false);

                EqtTrace.Verbose("TestExecutorService: Loaded the settings providers");
                EqtTrace.Info("TestExecutorService: Loaded the extensions");
            }
            catch (Exception ex)
            {
                if (EqtTrace.IsWarningEnabled)
                {
                    EqtTrace.Warning("TestExecutorWebService: Exception occured while calling test connection. {0}", ex);
                }
            }
        }
 public TestableTestPluginCache(IFileHelper fileHelper, List <string> extensionsPath) : base(fileHelper)
 {
     TestDiscoveryExtensionManager.Destroy();
     TestExecutorExtensionManager.Destroy();
     SettingsProviderExtensionManager.Destroy();
     this.UpdateExtensions(extensionsPath, true);
 }
Example #5
0
        public void TestCleanup()
        {
            RunTestWithSourcesExecutor.RunTestsWithSourcesCallback = null;
            RunTestWithSourcesExecutor.RunTestsWithTestsCallback   = null;

            TestDiscoveryExtensionManager.Destroy();
            TestExecutorExtensionManager.Destroy();
            SettingsProviderExtensionManager.Destroy();
        }
Example #6
0
        public void GetExecutorExtensionManagerShouldReturnAnExecutionManagerWithExtensions()
        {
            var extensionManager =
                TestExecutorExtensionManager.GetExecutionExtensionManager(
                    typeof(TestExecutorExtensionManagerTests).GetTypeInfo().Assembly.Location);

            Assert.IsNotNull(extensionManager.TestExtensions);
            Assert.IsTrue(extensionManager.TestExtensions.Count() > 0);
        }
Example #7
0
        public void CreateShouldDiscoverExecutorExtensions()
        {
            TestPluginCacheHelper.SetupMockExtensions(typeof(TestExecutorExtensionManagerTests));

            var extensionManager = TestExecutorExtensionManager.Create();

            Assert.IsNotNull(extensionManager.TestExtensions);
            Assert.IsTrue(extensionManager.TestExtensions.Count() > 0);
        }
Example #8
0
        public void CreateShouldCacheDiscoveredExtensions()
        {
            TestPluginCacheTests.SetupMockExtensions(() => { });

            var extensionManager = TestExecutorExtensionManager.Create();

            TestExecutorExtensionManager.Create();

            Assert.IsNotNull(extensionManager.TestExtensions);
            Assert.IsTrue(extensionManager.TestExtensions.Count() > 0);
        }
Example #9
0
        public void CreateShouldCacheDiscoveredExtensions()
        {
            TestPluginCacheHelper.SetupMockExtensions(typeof(TestExecutorExtensionManagerTests), () => { });

            var extensionManager = TestExecutorExtensionManager.Create();

            TestExecutorExtensionManager.Create();

            Assert.IsNotNull(extensionManager.TestExtensions);
            Assert.IsTrue(extensionManager.TestExtensions.Any());
        }
Example #10
0
        public void LoadAndInitializeShouldInitializeAllExtensions()
        {
            TestPluginCacheHelper.SetupMockExtensions(typeof(TestExecutorExtensionManagerTests));

            TestExecutorExtensionManager.LoadAndInitializeAllExtensions(false);

            var allExecutors = TestExecutorExtensionManager.Create().TestExtensions;

            foreach (var executor in allExecutors)
            {
                Assert.IsTrue(executor.IsExtensionCreated);
            }
        }
Example #11
0
        public ArgumentProcessorResult Execute()
        {
            ConsoleOutput.Instance.WriteLine(CommandLineResources.AvailableExecutorsHeaderMessage, OutputLevel.Information);
            var testPlatform     = TestPlatformFactory.GetTestPlatform();
            var extensionManager = TestExecutorExtensionManager.Create();

            foreach (var extension in extensionManager.TestExtensions)
            {
                ConsoleOutput.Instance.WriteLine(extension.Value.GetType().FullName, OutputLevel.Information);
                ConsoleOutput.Instance.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.AvailableExtensionsMetadataFormat, "Uri", extension.Metadata.ExtensionUri), OutputLevel.Information);
            }

            return(ArgumentProcessorResult.Success);
        }
Example #12
0
        private TestExecutorExtensionManager GetExecutorExtensionManager(string extensionAssembly)
        {
            try
            {
                if (string.IsNullOrEmpty(extensionAssembly) ||
                    string.Equals(extensionAssembly, Constants.UnspecifiedAdapterPath))
                {
                    // full execution. Since the extension manager is cached this can be created multiple times without harming performance.
                    return(TestExecutorExtensionManager.Create());
                }
                else
                {
                    return(TestExecutorExtensionManager.GetExecutionExtensionManager(extensionAssembly));
                }
            }
            catch (Exception ex)
            {
                EqtTrace.Error(
                    "BaseRunTests: GetExecutorExtensionManager: Exception occurred while loading extensions {0}",
                    ex);

                return(null);
            }
        }
Example #13
0
 public void Cleanup()
 {
     TestExecutorExtensionManager.Destroy();
     TestPluginCacheTests.ResetExtensionsCache();
 }
Example #14
0
 public void TestCleanup()
 {
     TestExecutorExtensionManager.Destroy();
 }