Exemplo n.º 1
0
        /// <summary>
        /// Load a TestPackage for possible execution,
        /// saving the result in the LoadResult property.
        /// </summary>
        private void LoadPackage()
        {
            // Last chance to catch invalid settings in package,
            // in case the client runner missed them.
            ValidatePackageSettings();

            // Some files in the top level package may be projects.
            // Expand them so that they contain subprojects for
            // each contained assembly.
            EnsurePackagesAreExpanded(TestPackage);

            // Use SelectRuntimeFramework for its side effects.
            // Info will be left behind in the package about
            // each contained assembly, which will subsequently
            // be used to determine how to run the assembly.
            _runtimeService.SelectRuntimeFramework(TestPackage);

            if (IntPtr.Size == 8 &&
                TestPackage.GetSetting(EnginePackageSettings.ProcessModel, "") == "InProcess" &&
                TestPackage.GetSetting(EnginePackageSettings.RunAsX86, false))
            {
                throw new NUnitEngineException("Cannot run tests in process - a 32 bit process is required.");
            }

            LoadResult = _engineRunner.Load().Aggregate(TEST_RUN_ELEMENT, TestPackage.Name, TestPackage.FullName);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Check the package settings, expand projects and
        /// determine what runtimes may be needed.
        /// </summary>
        private void InitializePackage()
        {
            // Last chance to catch invalid settings in package,
            // in case the client runner missed them.
            ValidatePackageSettings();

            // Some files in the top level package may be projects.
            // Expand them so that they contain subprojects for
            // each contained assembly.
            EnsurePackagesAreExpanded(TestPackage);

            // Use SelectRuntimeFramework for its side effects.
            // Info will be left behind in the package about
            // each contained assembly, which will subsequently
            // be used to determine how to run the assembly.
            _runtimeService.SelectRuntimeFramework(TestPackage);

            var processModel = TestPackage.GetSetting(EnginePackageSettings.ProcessModel, "").ToLower();

            if (IntPtr.Size == 8 && (processModel == "inprocess" || processModel == "single") &&
                TestPackage.GetSetting(EnginePackageSettings.RunAsX86, false))
            {
                throw new NUnitEngineException("Cannot run tests in process - a 32 bit process is required.");
            }
        }
Exemplo n.º 3
0
        //Exposed for testing
        internal ITestEngineRunner GetEngineRunner()
        {
            if (_engineRunner == null)
            {
                // Expand any project subpackages
                _packageAnalyzer.ExpandProjectPackages(TestPackage);

                // Add package settings to reflect the target runtime
                // and test framework usage of each assembly.
                foreach (var package in TestPackage.Select(p => p.IsAssemblyPackage()))
                {
                    if (File.Exists(package.FullName))
                    {
                        _packageAnalyzer.ApplyImageSettings(package);
                    }
                }

                // Use SelectRuntimeFramework for its side effects.
                // Info will be left behind in the package about
                // each contained assembly, which will subsequently
                // be used to determine how to run the assembly.
                _runtimeService.SelectRuntimeFramework(TestPackage);

                _engineRunner = _testRunnerFactory.MakeTestRunner(TestPackage);
            }

            return(_engineRunner);
        }
Exemplo n.º 4
0
        //Exposed for testing
        internal ITestEngineRunner GetEngineRunner()
        {
            if (_engineRunner == null)
            {
                // Expand projects and update package settings to reflect the
                // target runtime and test framework usage of each assembly.
                _packageSettingsService.UpdatePackage(TestPackage);

                // Use SelectRuntimeFramework for its side effects.
                // Info will be left behind in the package about
                // each contained assembly, which will subsequently
                // be used to determine how to run the assembly.
#if !NETSTANDARD2_0
                _runtimeService.SelectRuntimeFramework(TestPackage);
#endif

                _engineRunner = _testRunnerFactory.MakeTestRunner(TestPackage);
            }

            return(_engineRunner);
        }
Exemplo n.º 5
0
        //Exposed for testing
        internal ITestEngineRunner GetEngineRunner()
        {
            if (_engineRunner == null)
            {
                // Some files in the top level package may be projects.
                // Expand them so that they contain subprojects for
                // each contained assembly.
                EnsurePackagesAreExpanded(TestPackage);

                // Use SelectRuntimeFramework for its side effects.
                // Info will be left behind in the package about
                // each contained assembly, which will subsequently
                // be used to determine how to run the assembly.
#if !NETSTANDARD1_6 && !NETSTANDARD2_0
                _runtimeService.SelectRuntimeFramework(TestPackage);
#endif

                _engineRunner = _testRunnerFactory.MakeTestRunner(TestPackage);
            }

            return(_engineRunner);
        }