private static bool RunTestFixture(ITestCommand testCommand, ConcordionTest concordionTest, ITestStep parentTestStep) { ITestContext testContext = testCommand.StartPrimaryChildStep(parentTestStep); // The magic happens here! var concordion = new ConcordionBuilder() .WithSource(concordionTest.Source) .WithTarget(concordionTest.Target) .WithSpecificationListener(new GallioResultRenderer()) .Build(); var summary = concordion.Process(concordionTest.Resource, concordionTest.Fixture); bool passed = !(summary.HasFailures || summary.HasExceptions); testContext.AddAssertCount((int)summary.SuccessCount + (int)summary.FailureCount); testContext.FinishStep(passed ? TestOutcome.Passed : TestOutcome.Failed, null); return(passed); }
private static TestResult RunTestFixture(ITestCommand testCommand, ConcordionTest concordionTest, TestStep parentTestStep) { ITestContext testContext = testCommand.StartPrimaryChildStep(parentTestStep); // The magic happens here! var concordion = new ConcordionBuilder() .WithSource(concordionTest.Source) .WithTarget(concordionTest.Target) .WithSpecificationProcessingListener(new GallioResultRenderer()) .Build(); ConstructorInfo constructor = concordionTest.FixtureType.GetConstructor(Type.EmptyTypes); var fixture=constructor.Invoke(new object[]{}); var summary = concordion.Process(concordionTest.Resource, fixture); bool passed = !(summary.HasFailures || summary.HasExceptions); testContext.AddAssertCount((int)summary.SuccessCount + (int)summary.FailureCount); return testContext.FinishStep(passed ? TestOutcome.Passed : TestOutcome.Failed, null); }
private static bool RunTest(ITestCommand testCommand, ITestStep parentTestStep, IProgressMonitor progressMonitor) { ITest test = testCommand.Test; progressMonitor.SetStatus(test.Name); bool passed; ConcordionTest concordionTest = test as ConcordionTest; if (concordionTest == null) { passed = RunChildTests(testCommand, parentTestStep, progressMonitor); } else { passed = RunTestFixture(testCommand, concordionTest, parentTestStep); } progressMonitor.Worked(1); return(passed); }
private static TestResult RunTest(ITestCommand testCommand, TestStep parentTestStep, IProgressMonitor progressMonitor) { Test test = testCommand.Test; progressMonitor.SetStatus(test.Name); TestResult result; ConcordionTest concordionTest = test as ConcordionTest; if (concordionTest == null) { result = RunChildTests(testCommand, parentTestStep, progressMonitor); } else { result = RunTestFixture(testCommand, concordionTest, parentTestStep); } progressMonitor.Worked(1); return(result); }
private ConcordionTest CreateTypeTest(ConcordionTypeInfoAdapter typeInfo) { var fixtureType = CreateFixtureType(typeInfo.Target); var resource = CreateResource(ExtrapolateResourcePath(fixtureType)); var typeTest = new ConcordionTest(typeInfo.Target.FullName, typeInfo.Target, typeInfo, resource, fixtureType); typeTest.Source = new EmbeddedResourceSource(fixtureType.Assembly); typeTest.Target = new FileTarget(_baseOutputDirectory.FullName); typeTest.Kind = TestKinds.Fixture; typeTest.IsTestCase = true; // Add XML documentation. var xmlDocumentation = typeInfo.Target.GetXmlDocumentation(); if (xmlDocumentation != null) { typeTest.Metadata.SetValue(MetadataKeys.XmlDocumentation, xmlDocumentation); } return(typeTest); }
private ConcordionTest CreateTypeTest(ConcordionTypeInfoAdapter typeInfo) { var fixtureType = CreateFixtureType(typeInfo.Target); var resource = CreateResource(ExtrapolateResourcePath(fixtureType)); var typeTest = new ConcordionTest(typeInfo.Target.FullName, typeInfo.Target, typeInfo, resource, fixtureType); typeTest.Source = new EmbeddedResourceSource(fixtureType.Assembly); typeTest.Target = new FileTarget(_baseOutputDirectory.FullName); typeTest.Kind = TestKinds.Fixture; typeTest.IsTestCase = true; // Add XML documentation. var xmlDocumentation = typeInfo.Target.GetXmlDocumentation(); if (xmlDocumentation != null) typeTest.Metadata.SetValue(MetadataKeys.XmlDocumentation, xmlDocumentation); return typeTest; }