예제 #1
0
파일: ConsoleUi.cs 프로젝트: nobled/mono
		private static TestRunner MakeRunnerFromCommandLine( ConsoleOptions options )
		{
			TestPackage package;
			ConsoleOptions.DomainUsage domainUsage = ConsoleOptions.DomainUsage.Default;

			if (options.IsTestProject)
			{
				NUnitProject project = NUnitProject.LoadProject((string)options.Parameters[0]);
				string configName = options.config;
				if (configName != null)
					project.SetActiveConfig(configName);

				package = project.ActiveConfig.MakeTestPackage();
				package.TestName = options.fixture;

				domainUsage = ConsoleOptions.DomainUsage.Single;
			}
			else if (options.Parameters.Count == 1)
			{
				package = new TestPackage((string)options.Parameters[0]);
				domainUsage = ConsoleOptions.DomainUsage.Single;
			}
			else
			{
				package = new TestPackage("UNNAMED", options.Parameters);
				domainUsage = ConsoleOptions.DomainUsage.Multiple;
			}

			if (options.domain != ConsoleOptions.DomainUsage.Default)
				domainUsage = options.domain;
                    
			TestRunner testRunner = null;
				
			switch( domainUsage )
			{
				case ConsoleOptions.DomainUsage.None:
					testRunner = new NUnit.Core.RemoteTestRunner();
					// Make sure that addins are available
					CoreExtensions.Host.AddinRegistry = Services.AddinRegistry;
					break;

				case ConsoleOptions.DomainUsage.Single:
					testRunner = new TestDomain();
					break;

				case ConsoleOptions.DomainUsage.Multiple:
					testRunner = new MultipleTestDomainRunner();
					break;
			}

			package.TestName = options.fixture;
			package.Settings["ShadowCopyFiles"] = !options.noshadow;
			package.Settings["UseThreadedRunner"] = !options.nothread;
			testRunner.Load( package );

			return testRunner;
		}
예제 #2
0
        public TestRunner GetTestRunner()
        {
            lock (InitalizeLock)
            {
                if (!CoreExtensions.Host.Initialized)
                {
                    InitalizeNUnits();
                }
            }

            var pack = new TestPackage(_assemblyLocation);
            //TODO next two lines, really needed???
            pack.PrivateBinPath = Path.GetDirectoryName(_assemblyLocation);
            //pack.BasePath = Path.GetDirectoryName(_assemblyLocation);
            //pack.ConfigurationFile = _assemblyLocation + ".config";
            var nu = new MultipleTestDomainRunner();
            //var nu = new SimpleTestRunner(Thread.CurrentThread.ManagedThreadId);
            //var nu = new ThreadedTestRunner(new RemoteTestRunner());
            if (!nu.Load(pack))
            {
                throw new ApplicationException("what... very rude stuff happened");
            }
            return nu;
        }