Example #1
0
        public void get_file_name_for_test_with_spaces()
        {
            //var test = DataMother.MathProject().LoadTests().GetAllTests().First();
            var test = new Test("something with spaces");

            ResultPersistor.FileNameFor(test).ShouldEqual("something_with_spaces.stresult");
        }
Example #2
0
        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();
            }
        }
Example #3
0
        public void persist_and_load_and_clear_by_project_smoke_test()
        {
            var persistor = new ResultPersistor();
            var runner    = DataMother.MathProjectRunner();

            runner.RunAll(t => Debug.WriteLine("executed " + t.GetPath().Locator));

            runner.Hierarchy.GetAllTests().Each(t =>
            {
                persistor.SaveResult(runner.Project, t, t.LastResult);
            });

            var results = persistor.LoadResults(runner.Project);

            runner.Hierarchy.GetAllTests().Each(t =>
            {
                results[t].ShouldNotBeNull();
            });

            persistor.ClearResults(runner.Project);
        }
Example #4
0
        public void save_and_load_the_history_for_a_hierarchy()
        {
            if (Directory.Exists("results-dir"))
            {
                Directory.Delete("results-dir", true);
            }

            Hierarchy hierarchy =
                DataMother.BuildHierarchy(
                    @"
s1/t4,Success
s1/t5,Success
s1/t6,Failure
s1/s2/t7,Success
s1/s2/t8,Failure
s1/s2/s3/t9,Success
s1/s2/s3/t10,Success
s1/s2/s3/s4/t11,Success
s5/t12,Success
s5/s6/t13,Success
s5/s6/s7/t14,Success
s5/s6/s7/s8/t15,Success
s9/t16,Success
s9/t17,Success
s9/t18,Success
");

            var persistor = new ResultPersistor();

            persistor.SaveResultsToDirectory(hierarchy.GetFullResults(), "results-dir");

            var results = persistor.LoadResults("results-dir");

            hierarchy.GetAllTests().Each(x =>
            {
                results[x].ShouldNotBeNull();
            });
        }
Example #5
0
        public void get_file_name_for_test_gets_the_full_path_with_underscores_for_paths()
        {
            var test = DataMother.MathProject().LoadTests().GetAllTests().First();

            ResultPersistor.FileNameFor(test).ShouldEqual(test.GetPath().Locator.Replace("/", ".").Replace(" ", "_") + ".stresult");
        }