예제 #1
0
 static Exception Initiaize(ITestExecutor executor)
 {
     try {
         executor.Initialize();
         return null;
     } catch(Exception ex) {
         return ex;
     }
 }
 public virtual void SetUp ()
 {
   if (Mode == TestMode.SaveReferenceResults)
   {
     _db = new LinqToSqlNorthwindDataProvider ();
     var directory = Path.Combine (AppDomain.CurrentDomain.BaseDirectory, "SavedResults");
     _testExecutor = new SavingTestExecutor (directory, SavedResultFileNameGenerator);
   }
   else
   {
     _db = new RelinqNorthwindDataProvider ();
     _testExecutor = new CheckingTestExecutor (LoadedResultFileNameGenerator);
   }
 }
        public void LoadMockassembly()
        {
            // Sanity check to be sure we have the correct version of mock-assembly.dll
            Assert.That(MockAssembly.Tests, Is.EqualTo(31),
                "The reference to mock-assembly.dll appears to be the wrong version");
            new List<TestCase>();
            testResults = new List<TestResult>();
            testLog = new FakeFrameworkHandle();

            // Load the NUnit mock-assembly.dll once for this test, saving
            // the list of test cases sent to the discovery sink
            executor = ((ITestExecutor) new NUnitTestExecutor());
            executor.RunTests(new[] { MockAssemblyPath }, Context, testLog);
            this.Summary = new ResultSummary(testResults);
        }
예제 #4
0
파일: TestRunner.cs 프로젝트: RoryVL/roslyn
 internal TestRunner(Options options, ITestExecutor testExecutor)
 {
     _testExecutor = testExecutor;
     _options = options;
 }
 internal CachingTestExecutor(Options options, ITestExecutor testExecutor, IDataStorage dataStorage)
 {
     _testExecutor = testExecutor;
     _dataStorage = dataStorage;
     _contentUtil = new ContentUtil(options);
 }
 public Application(ITestExecutor testExecutor, ILoggerFacade logger)
 {
     _testExecutor = testExecutor;
     _logger = logger;
 }
        public void Execute()
        {
            SetupCommandLineArgsSynonyms();

            _cmdArgsParser.Parse(Environment.GetCommandLineArgs().Skip(1).ToArray());

            if (!_cmdArgsParser.Arguments.Any() || _cmdArgsParser.ParameterIsSet("?"))
            {
                ShowConsoleHelp();
                return;
            }

            SetupFileLogger();

            if (!_cmdArgsParser.ParameterIsSet("m") || (_cmdArgsParser.ParameterIsSet("m") && _cmdArgsParser.GetParameterValue("m").ToLower() == "xap"))
            {
                // xap mode
                if (!_cmdArgsParser.Arguments.Any())
                {
                    _logger.Log("Please supply Xap file to test.");
                    ShowConsoleHelp();
                    return;
                }

                var xapPath = _cmdArgsParser.Arguments.FirstOrDefault();

                var xapSourcedTestExecutor = SimpleServiceLocator.Instance.Get<IXapSourcedTestExecutor>();
                _currentTestExecutor = xapSourcedTestExecutor;
                xapSourcedTestExecutor.SourceXapFullPath = xapPath;
            }
            else if (_cmdArgsParser.ParameterIsSet("m") && _cmdArgsParser.GetParameterValue("m").ToLower() == "dll")
            {
                // assemblies mode

                if (!_cmdArgsParser.ParameterIsSet("tests"))
                {
                    _logger.Log("Please name the full paths of assemblies to test via -tests parameter.");
                    ShowConsoleHelp();
                    return;
                }

                IList<string> realTestDllPaths;

                var testsDllPaths = GetListOfAssembliesFromParameter(_cmdArgsParser.GetParameterValue("tests"));
                if (!testsDllPaths.Any())
                {
                    _logger.Log("Parameter -tests must name full paths to all assemblies with tests.");
                    ShowConsoleHelp();
                    return;
                }
                else
                {
                    try
                    {
                        realTestDllPaths = _wildcardPathsParser.ConvertPathsWithWildcardsToIndividualPaths(testsDllPaths);
                    }
                    catch (FileNotFoundException e)
                    {
                        _logger.Log(string.Format("Assembly {0} in list of assemblies with tests could not be found", e.FileName));
                        return;
                    }
                }

                IList<string> realReferencedFilesPaths = new List<string>();
                IList<string> referencedDlls = new List<string>();
                if (_cmdArgsParser.ParameterIsSet("references"))
                {
                    referencedDlls = GetListOfAssembliesFromParameter(_cmdArgsParser.GetParameterValue("references"));
                }

                if (referencedDlls.Any())
                {
                    try
                    {
                        realReferencedFilesPaths = _wildcardPathsParser.ConvertPathsWithWildcardsToIndividualPaths(referencedDlls);
                    }
                    catch (FileNotFoundException e)
                    {
                        _logger.Log(string.Format("File {0} in list of references could not be found", e.FileName));
                        return;
                    }
                }

                var individualDllsSourcesTestExecutor = SimpleServiceLocator.Instance.Get<IIndividualDllsSourcesTestExecutor>();
                _currentTestExecutor = individualDllsSourcesTestExecutor;

                individualDllsSourcesTestExecutor.AssembliesWithTests = realTestDllPaths;
                individualDllsSourcesTestExecutor.ReferencedFiles = realReferencedFilesPaths;
            }

            if (!SetupTimeoutFromParamsIfAvailable())
            {
                _logger.Log("Invalid Timeout parameter value supplied.");
                ShowConsoleHelp();
                return;
            }

            AssignCommonSettingsThatAreAvailableInCommandLineArgs();

            _currentTestExecutor.Started += OnStarted;

            _logger.Log("Sending signal to Lighthouse Test Executor to start executing tests.");

            try
            {
                var results = _currentTestExecutor.Execute();
                OnFinished(results);
            }
            catch (Exception e)
            {
                _logger.Log(string.Format("Error occured: {0}", e.Message));
            }

            _logger.Log("Testing process completed.");
        }