예제 #1
0
 public void ResultTableClassesAutomaticallyInitializeResultColumnFields()
 {
     TestResult r = new TestResult();
     Assert.IsNotNull(r.IntResult);
     Assert.IsNotNull(r.StringResult);
     Assert.IsNotNull(r.DateResult);
 }
        private TestResult FindFailureTestResult(TestResult result)
        {
            while (result.FailureSite == FailureSite.Child && result.Results != null && result.Results.Count > 0)
                result = (TestResult)result.Results[0];

            return result;
        }
예제 #3
0
        private TestResult CreateResults(string recipe)
        {
            TestResult result = new TestResult(new TestSuite("From Recipe"));

            foreach (char c in recipe)
            {
                TestResult r = new TestResult(new TestCase("test"));
                switch (c)
                {
                    case 'S':
                        r.Success();
                        break;
                    case 'F':
                        r.Failure("failed!");
                        break;
                    case 'E':
                        r.Error(new Exception("error!"));
                        break;
                    default:
                        break;
                }

                result.AddResult(r);
            }

            if (recipe.IndexOfAny(new char[] { 'E', 'F' }) >= 0)
                result.Failure("Errors");
            else
                result.Success();

            return result;
        }
        public void Merge_EmptySequence_ResultsInWasExecutedFalseAndWasSuccessfulFalse()
        {
            var testResults = new TestResult[0];

            TestResult actual = testResults.Merge();

            Check.That(actual).Equals(TestResult.Inconclusive);
        }
예제 #5
0
 void TestListener.TestFinished(TestResult result)
 {
     if ( result.Results.Count == 0 )
     {
         ++tests;
         if (result.IsError) ++errors;
         if (result.IsFailure) ++failures;
         if (!result.Executed) ++notrun;
     }
 }
        public void Setup()
        {
            ActionAttributeFixture.Results = new List<string>();

            TestSuiteBuilder builder = new TestSuiteBuilder();
            TestPackage package = new TestPackage(AssemblyHelper.GetAssemblyPath(typeof(ActionAttributeFixture)));
            package.TestName = typeof(ActionAttributeFixture).Namespace;

            Test suite = builder.Build(package);
            _result = suite.Run(new NullListener(), new ActionAttributeFixtureFilter());
        }
        public void TestResultsAreRecorded()
        {
            var events = new MyTestLoggerEvents();
            var logger = new JUnitTestLogger();
            logger.Initialize(events, new Dictionary<string, string>());

            var testCase = new Microsoft.VisualStudio.TestPlatform.ObjectModel.TestCase("TestCaseFullName",
                new Uri("executor://dummy"), "c:\\abc.dll");
            var testResult = new TestResult(testCase);
            events.FireTestResult(new TestResultEventArgs(testResult));

            Assert.AreEqual(1, logger.testCases.Count, "There should be only 1 test case now.");
        }
        public void Can_Union_Test_Results()
        {
            var resultSetOne = new TestResults();
            var testA = new TestResult("My Special Test A", TestResultKind.Passed);            
            resultSetOne.AddTest(testA);

            var testB = new TestResult("My Special Test B", TestResultKind.Failure);
            testB.StackTrace = "Special stack trace";
            resultSetOne.AddTest(testB);

            var testC = new TestResult("My Special Test C", TestResultKind.Skipped);         
            resultSetOne.AddTest(testC);
            
            var resultSetTwo = new TestResults();
            var dummyTestA = new TestResult("", TestResultKind.Passed);           
            resultSetTwo.AddTest(dummyTestA);

            var dummyTestB = new TestResult("My Special Test B", TestResultKind.Failure);            
            resultSetTwo.AddTest(dummyTestB);

            var dummyTestC = new TestResult("", TestResultKind.Inconclusive);          
            resultSetTwo.AddTest(dummyTestC);

            resultSetOne.Merge(resultSetTwo);

            Assert.That(resultSetOne != null);
            var tests = resultSetOne.GetTests().ToList();


            Assert.That(tests.Count == 4);

            var firstTest = tests[0];
            Assert.That(firstTest.Name == testA.Name);
            Assert.That(firstTest.Kind == testA.Kind);

            var secondTest = tests[1];
            Assert.That(secondTest.Name == testB.Name);
            Assert.That(secondTest.Kind == testB.Kind);
            Assert.That(secondTest.StackTrace == testB.StackTrace);

            var thirdTest = tests[2];
            Assert.That(thirdTest.Name == testC.Name);
            Assert.That(thirdTest.Kind == testC.Kind);

            var fourthTest = tests[3];
            Assert.That(fourthTest.Name == dummyTestC.Name);
            Assert.That(fourthTest.Kind == dummyTestC.Kind);

        }      
예제 #9
0
파일: Tests.cs 프로젝트: inorton/testvault
        public void Insert()
        {
            foreach (var c in groups)
            {
                var result = new TestResult();
                var tn = "Foo.Whatever.Test_" + Guid.NewGuid().ToString().Substring(0, 6);
                result.Name = tn;
                result.Group = new TestGroup() { Project = project, Name = c };
                result.Outcome = TestOutcome.Passed;
                result.Time = DateTime.Now;
                result.BuildID = buildid;

                db.Save( result );
            }
        }
예제 #10
0
 /// <summary>
 /// Forwards the TestFinished event to all listeners.
 /// </summary>
 /// <param name="result">The result of the test that just finished.</param>
 public void TestFinished(TestResult result)
 {
     System.Diagnostics.Debug.WriteLine(result.Test.Name + " TEST FINISHED");
     System.Threading.Thread.Sleep(5000);
     foreach (TestListener listener in listeners)
         listener.TestFinished(result);
 }
예제 #11
0
 public void SetUp()
 {
     result = new TestResult(null);
 }
예제 #12
0
 /// <summary>
 /// Forwards the TestFinished event to all listeners.
 /// </summary>
 /// <param name="result">The result of the test that just finished.</param>
 public void TestFinished(TestResult result)
 {
     foreach (ITestListener listener in listeners)
         listener.TestFinished(result);
 }
예제 #13
0
 public void SummarizeSingleTestCase()
 {
     TestResult result = new TestResult(new TestCase( "TheTest", new DummyTestCase() ));
     result.Success();
     CreateSummaryAndVerify(result, 1, 0, 0, 0);
 }
예제 #14
0
			public void SuiteFinished(TestResult result)
			{
				suiteFinished++;
			}
예제 #15
0
 protected override void SetUp()
 {
     result = new TestResult(null);
 }
 public void TestFinished(TestResult result)
 {
     Events += string.Format(":{0}>", result.ResultState);
 }
예제 #17
0
 private void PrintNotRunReport(TestResult result)
 {
     reportCount = 0;
     writer.WriteLine();
     writer.WriteLine("Errors and Failures:");
     PrintNotRunResults(result);
 }
 public void SuiteFinished(TestResult result)
 {
     WriteTrace("SuiteFinished({0})", result);
 }
 public void TestFinished(TestResult result)
 {
     WriteTrace("TestFinished({0})", result);
 }
예제 #20
0
 private void CreateSummaryAndVerify(TestResult result, int tests, int errors, int failures, int notrun)
 {
     ResultSummary summary = new ResultSummary(result);
     Assert.That(summary.TestCount, Is.EqualTo(tests));
     Assert.That(summary.ErrorCount, Is.EqualTo(errors));
     Assert.That(summary.FailureCount, Is.EqualTo(failures));
     Assert.That(summary.NotRunCount, Is.EqualTo(notrun));
 }
예제 #21
0
 private void PrintNotRunResults(TestResult result)
 {
     if (result.Results != null)
         foreach (TestResult r in result.Results)
             PrintNotRunResults(r);
     else if (result.ResultState == ResultState.NotRun)
     {
         writer.WriteLine();
         writer.WriteLine("{0}) {1} ({2}) : {3}", ++reportCount, result.Test.Name, result.Test.FullName, result.Message);
         if (options.ListProperties)
             PrintTestProperties(result.Test);
     }
 }
예제 #22
0
 private void RunTestAndVerifyResult(ResultState expected)
 {
     result = test.Run();
     VerifyResult(expected);
 }
예제 #23
0
        private void PrintErrorResults(TestResult result)
        {
            if (result.Results.Count > 0)
                foreach (TestResult r in result.Results)
                    PrintErrorResults(r);
            else if (result.IsError || result.IsFailure)
            {
                writer.WriteLine();
                writer.WriteLine("{0}) {1} ({2})", ++reportCount, result.Test.Name, result.Test.FullName);
                if (options.ListProperties)
                    PrintTestProperties(result.Test);
                writer.WriteLine(result.Message);
#if !NETCF_1_0
                writer.WriteLine(result.StackTrace);
#endif
            }
        }
 private static Mock<SingleTestRunBase> SetupStubForGetScenarioResult(TestResult resultOfGetFeatureResult)
 {
     var testResults1 = new Mock<SingleTestRunBase>();
     testResults1.Setup(ti => ti.GetScenarioResult(It.IsAny<Scenario>())).Returns(resultOfGetFeatureResult);
     return testResults1;
 }
예제 #25
0
        private void ReportResults( TestResult result )
        {
            ResultSummary summary = new ResultSummary(result);

            writer.WriteLine("{0} Tests : {1} Errors, {2} Failures, {3} Not Run",
                summary.TestCount, summary.ErrorCount, summary.FailureCount, summary.NotRunCount);

            if (summary.ErrorCount + summary.FailureCount > 0)
                PrintErrorReport(result);

            if (summary.NotRunCount > 0)
                PrintNotRunReport(result);
        }
 private static Mock<SingleTestRunBase> SetupStubForGetFeatureResult(Feature feature, TestResult resultOfGetFeatureResult)
 {
     var testResults1 = new Mock<SingleTestRunBase>();
     testResults1.Setup(ti => ti.GetFeatureResult(feature)).Returns(resultOfGetFeatureResult);
     return testResults1;
 }
예제 #27
0
			public void TestFinished(TestResult result)
			{
				testCaseFinished++;
			}
예제 #28
0
 public void SuiteFinished(TestResult result)
 {
     suiteFinished.Add(result.Name);
 }
예제 #29
0
 public void TestFinished(TestCaseResult result)
 {
     testFinished.Add(result.Name);
     lastResult = result;
 }
예제 #30
0
 public void SummarizeEmptySuite()
 {
     TestResult result = new TestResult( new TestSuite("Empty Suite") );
     CreateSummaryAndVerify(result, 0, 0, 0, 0);
 }