RunAll() public method

public RunAll ( Func selectionFilter, Action callback ) : void
selectionFilter Func
callback Action
return void
コード例 #1
0
ファイル: ProjectRunner.cs プロジェクト: larsw/storyteller
        private void executeProject(IProject project)
        {
            var    runner = new ProjectTestRunner(project);
            string projectHistoryFolder = Path.Combine(_historyFolder, project.Name);

            Directory.CreateDirectory(projectHistoryFolder);


            try
            {
                runner.RunAll(test =>
                {
                    try
                    {
                        _counts[test.Lifecycle].Tally(test);

                        string filename = Path.GetFileNameWithoutExtension(test.FileName) +
                                          DateTime.Now.ToString("hhmmss") + "-results.htm";
                        string resultFile = Path.Combine(_resultsFolder,
                                                         filename);

                        test.WriteResultsToFile(resultFile);
                        _summary.AddTest(test, "results/" + filename);

                        ResultPersistor.SaveResult(test.LastResult, test, projectHistoryFolder);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex);
                    }
                });
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            finally
            {
                runner.Dispose();
            }
        }
コード例 #2
0
        private void executeProject(IProject project)
        {
            var runner = new ProjectTestRunner(project);

            var projectHistoryFolder = Path.Combine(_historyFolder, project.Name);
            Directory.CreateDirectory(projectHistoryFolder);

            try
            {
                Func<Hierarchy, IEnumerable<Test>> selector = h => h.GetAllTests();
                if (StringExtensions.IsNotEmpty(Workspace))
                {
                    selector = h => h.FindSuite(Workspace).GetAllTests();
                }

                if (DesiredLifecycle != Lifecycle.Any)
                {
                    var nestedSelector = selector;
                    selector = h => nestedSelector(h).Where(t => t.Lifecycle == DesiredLifecycle);
                }

                runner.MaxRetries = MaxRetries;

                runner.RunAll(selector, test =>
                {
                    try
                    {
                        _counts[test.Lifecycle].Tally(test);

                        var filename = Path.GetFileNameWithoutExtension(test.FileName) +
                                       DateTime.Now.ToString("hhmmss") + "-results.htm";
                        var resultFile = Path.Combine(_resultsFolder,
                                                      filename);

                        test.WriteResultsToFile(resultFile);
                        _summary.AddTest(test, "results/" + filename);

                        ResultPersistor.SaveResult(test.LastResult, test, projectHistoryFolder);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex);
                    }
                });
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            finally
            {
                runner.Dispose();
            }
        }
コード例 #3
0
ファイル: ProjectRunner.cs プロジェクト: abombss/storyteller
        private void executeProject(IProject project)
        {
            var runner = new ProjectTestRunner(project);
            string projectHistoryFolder = Path.Combine(_historyFolder, project.Name);
            Directory.CreateDirectory(projectHistoryFolder);

            try
            {
                runner.RunAll(test =>
                {
                    _counts[test.Lifecycle].Tally(test);

                    string filename = Path.GetFileNameWithoutExtension(test.FileName) +
                                      DateTime.Now.ToString("hhmmss") + "-results.htm";
                    string resultFile = Path.Combine(_resultsFolder,
                                                     filename);

                    test.WriteResultsToFile(resultFile);
                    _summary.AddTest(test, "results/" + filename);

                    ResultPersistor.SaveResult(test.LastResult, test, projectHistoryFolder);
                });
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                runner.Dispose();
            }
        }