当前位置: 首页>>代码示例>>C#>>正文


C# ITestCommand.StartPrimaryChildStep方法代码示例

本文整理汇总了C#中ITestCommand.StartPrimaryChildStep方法的典型用法代码示例。如果您正苦于以下问题:C# ITestCommand.StartPrimaryChildStep方法的具体用法?C# ITestCommand.StartPrimaryChildStep怎么用?C# ITestCommand.StartPrimaryChildStep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITestCommand的用法示例。


在下文中一共展示了ITestCommand.StartPrimaryChildStep方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RunContext

        private TestResult RunContext( NSpecContextTest contextTest, ITestCommand command, TestStep testStep )
        {
            ITestContext testContext = command.StartPrimaryChildStep( testStep );
            TestOutcome outcome = TestOutcome.Passed;

            foreach( ITestCommand testCommand in command.Children )
            {
                NSpecExampleTest exampleTest = testCommand.Test as NSpecExampleTest;
                if( exampleTest == null )
                {
                    continue;
                }
                outcome = outcome.CombineWith( this.RunTest( contextTest, exampleTest, testCommand, testContext.TestStep ).Outcome );
            }
            foreach( ITestCommand testCommand in command.Children )
            {
                NSpecContextTest contextTestChild = testCommand.Test as NSpecContextTest;
                if( contextTestChild == null )
                {
                    continue;
                }
                outcome = outcome.CombineWith( this.RunContext( contextTestChild, testCommand, testContext.TestStep ).Outcome );
            }

            return testContext.FinishStep( outcome, null );
        }
开发者ID:JosephJung,项目名称:NSpec,代码行数:26,代码来源:NSpecController.cs

示例2: RunImpl

        protected override TestResult RunImpl( ITestCommand rootTestCommand, TestStep parentTestStep, TestExecutionOptions options, IProgressMonitor progressMonitor )
        {
            using(progressMonitor.BeginTask( "Verifying Specifications", rootTestCommand.TestCount ) )
            {
                if( options.SkipTestExecution )
                {
                    return SkipAll( rootTestCommand, parentTestStep );
                }
                else
                {
                    ITestContext rootContext = rootTestCommand.StartPrimaryChildStep( parentTestStep );
                    TestStep rootStep = rootContext.TestStep;
                    TestOutcome outcome = TestOutcome.Passed;

                    foreach( ITestCommand command in rootTestCommand.Children )
                    {
                        NSpecAssemblyTest assemblyTest = command.Test as NSpecAssemblyTest;
                        if( assemblyTest == null )
                            continue;

                        var assemblyResult = this.RunAssembly( command, rootStep );
                        outcome = outcome.CombineWith( assemblyResult.Outcome );
                    }

                    return rootContext.FinishStep( outcome, null );
                }
            }
        }
开发者ID:JosephJung,项目名称:NSpec,代码行数:28,代码来源:NSpecController.cs

示例3: RunTest

        private TestResult RunTest(ITestCommand testCommand, TestStep parentTestStep, IProgressMonitor progressMonitor)
        {
            Test test = testCommand.Test;
            progressMonitor.SetStatus(test.Name);

            // The first test should be an assembly test
            MSTestAssembly assemblyTest = testCommand.Test as MSTestAssembly;
            TestOutcome outcome;
            TestResult result;
            if (assemblyTest != null)
            {
                ITestContext assemblyContext = testCommand.StartPrimaryChildStep(parentTestStep);
                try
                {
                    MSTestRunner runner = MSTestRunner.GetRunnerForFrameworkVersion(frameworkVersion);

                    outcome = runner.RunSession(assemblyContext, assemblyTest,
                        testCommand, parentTestStep, progressMonitor);
                }
                catch (Exception ex)
                {
                    assemblyContext.LogWriter.Failures.WriteException(ex, "Internal Error");
                    outcome = TestOutcome.Error;
                }

                result = assemblyContext.FinishStep(outcome, null);
            }
            else
            {
                result = new TestResult(TestOutcome.Skipped);
            }

            progressMonitor.Worked(1);
            return result;
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:35,代码来源:MSTestController.cs

示例4: RunChildTests

        private static TestResult RunChildTests(ITestCommand testCommand, TestStep parentTestStep, IProgressMonitor progressMonitor)
        {
            ITestContext testContext = testCommand.StartPrimaryChildStep(parentTestStep);

            bool passed = true;
            foreach (ITestCommand child in testCommand.Children)
                passed &= RunTest(child, testContext.TestStep, progressMonitor).Outcome.Status == TestStatus.Passed;

            return testContext.FinishStep(passed ? TestOutcome.Passed : TestOutcome.Failed, null);
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:10,代码来源:XunitTestController.cs

示例5: RunTestFixture

        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);
        }
开发者ID:john-ross,项目名称:concordion-net,代码行数:18,代码来源:ConcordionTestController.cs

示例6: RunAssembly

        private TestResult RunAssembly( ITestCommand command, TestStep rootStep )
        {
            ITestContext assemblyContext = command.StartPrimaryChildStep( rootStep );

            TestOutcome outcome = TestOutcome.Passed;

            foreach( ITestCommand contextCommand in command.Children )
            {
                NSpecContextTest contextTest = contextCommand.Test as NSpecContextTest;
                if( contextTest == null )
                    continue;

                var contextResult = this.RunContext( contextTest, contextCommand, assemblyContext.TestStep );
                outcome = outcome.CombineWith( contextResult.Outcome );
                assemblyContext.SetInterimOutcome( outcome );
            }

            return assemblyContext.FinishStep( outcome, null );
        }
开发者ID:JosephJung,项目名称:NSpec,代码行数:19,代码来源:NSpecController.cs

示例7: RunImpl

    protected override TestResult RunImpl(ITestCommand rootTestCommand, TestStep parentTestStep,
                    TestExecutionOptions options, IProgressMonitor progressMonitor)
    {
      using (progressMonitor)
      {
        progressMonitor.BeginTask("Verifying Specifications", rootTestCommand.TestCount);

        if (options.SkipTestExecution)
        {
          return SkipAll(rootTestCommand, parentTestStep);
        }
        else
        {
          ITestContext rootContext = rootTestCommand.StartPrimaryChildStep(parentTestStep);
          TestStep rootStep = rootContext.TestStep;
          TestOutcome outcome = TestOutcome.Passed;

          _progressMonitor = progressMonitor;
          SetupRunOptions(options);
          SetupListeners(options);

          _listener.OnRunStart();

          foreach (ITestCommand command in rootTestCommand.Children)
          {
            MachineAssemblyTest assemblyTest = command.Test as MachineAssemblyTest;
            if( assemblyTest == null )
              continue;

            var assemblyResult = RunAssembly(assemblyTest, command, rootStep);
            outcome = outcome.CombineWith( assemblyResult.Outcome);
          }

          _listener.OnRunEnd();

          return rootContext.FinishStep( outcome, null);
        }
      }
    }
开发者ID:agross,项目名称:machine.specifications,代码行数:39,代码来源:MachineSpecificationController.cs

示例8: RunContextTest

    private void RunContextTest(MachineContextTest description, ITestCommand testCommand, ITestStep parentTestStep)
    {
      ITestContext testContext = testCommand.StartPrimaryChildStep(parentTestStep);

      testContext.LifecyclePhase = LifecyclePhases.SetUp;
      description.SetupContext();
      bool passed = true;

      foreach (ITestCommand child in testCommand.Children)
      {
        MachineSpecificationTest specification = child.Test as MachineSpecificationTest;

        if (specification != null)
        {
          passed &= RunSpecificationTest(specification, child, testContext.TestStep);
        }
      }

      testContext.LifecyclePhase = LifecyclePhases.TearDown;
      description.TeardownContext();

      testContext.FinishStep(passed ? TestOutcome.Passed : TestOutcome.Failed, null);
    }
开发者ID:benlovell,项目名称:machine.specifications,代码行数:23,代码来源:MachineSpecificationController.cs

示例9: SkipAll

        /// <summary>
        /// Recursively generates single test steps for each <see cref="ITestCommand" /> and
        /// sets the final outcome to <see cref="TestOutcome.Skipped" />.
        /// </summary>
        /// <remarks>
        /// <para>
        /// This is useful for implementing fallback behavior when 
        /// <see cref="TestExecutionOptions.SkipTestExecution" /> is true.
        /// </para>
        /// </remarks>
        /// <param name="rootTestCommand">The root test command.</param>
        /// <param name="parentTestStep">The parent test step.</param>
        /// <returns>The combined result of the test commands.</returns>
        protected static TestResult SkipAll(ITestCommand rootTestCommand, TestStep parentTestStep)
        {
            ITestContext context = rootTestCommand.StartPrimaryChildStep(parentTestStep);

            foreach (ITestCommand child in rootTestCommand.Children)
                SkipAll(child, context.TestStep);

            return context.FinishStep(TestOutcome.Skipped, null);
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:22,代码来源:TestController.cs

示例10: RunContextTest

    TestResult RunContextTest(MachineAssemblyTest assemblyTest, MachineContextTest contextTest, ITestCommand command, TestStep parentTestStep)
    {
      ITestContext testContext = command.StartPrimaryChildStep(parentTestStep);

      GallioRunListener listener = new GallioRunListener(_listener, _progressMonitor, testContext, command.Children);

      IContextRunner runner = ContextRunnerFactory.GetContextRunnerFor(contextTest.Context);
      runner.Run(contextTest.Context, listener, _options, assemblyTest.GlobalCleanup, assemblyTest.SpecificationSupplements);

      return testContext.FinishStep(listener.Outcome, null);
    }
开发者ID:agross,项目名称:machine.specifications,代码行数:11,代码来源:MachineSpecificationController.cs

示例11: RunAssembly

    TestResult RunAssembly(MachineAssemblyTest assemblyTest, ITestCommand command, TestStep parentTestStep)
    {
      ITestContext assemblyContext = command.StartPrimaryChildStep(parentTestStep);

      AssemblyInfo assemblyInfo = new AssemblyInfo(assemblyTest.Name, assemblyTest.AssemblyFilePath);
      TestOutcome outcome = TestOutcome.Passed;

      _listener.OnAssemblyStart(assemblyInfo);
      assemblyTest.AssemblyContexts.Each(context => context.OnAssemblyStart());
      
      foreach (ITestCommand contextCommand in command.Children)
      {
        MachineContextTest contextTest = contextCommand.Test as MachineContextTest;
        if (contextTest == null) 
          continue;

        var contextResult = RunContextTest( assemblyTest, contextTest, contextCommand, assemblyContext.TestStep);
        outcome = outcome.CombineWith(contextResult.Outcome);
        assemblyContext.SetInterimOutcome(outcome);
      }

      assemblyTest.AssemblyContexts.Reverse().Each(context => context.OnAssemblyComplete());
      _listener.OnAssemblyEnd(assemblyInfo);

      return assemblyContext.FinishStep( outcome, null);
    }
开发者ID:agross,项目名称:machine.specifications,代码行数:26,代码来源:MachineSpecificationController.cs

示例12: RunTest

        private TestResult RunTest(ITestCommand testCommand, TestStep parentTestStep,
            TestExecutionOptions options, IProgressMonitor progressMonitor)
        {
            // NOTE: This method has been optimized to minimize the total stack depth of the action
            //       by inlining blocks on the critical path that had previously been factored out.

            using (TestController testController = testControllerProvider(testCommand.Test))
            {
                if (testController != null)
                {
                    try
                    {
                        using (IProgressMonitor subProgressMonitor = progressMonitor.CreateSubProgressMonitor(testCommand.TestCount))
                        {
                            // Calling RunImpl directly instead of Run to minimize stack depth
                            // because we already know the arguments are valid.
                            return testController.RunImpl(testCommand, parentTestStep, options, subProgressMonitor);
                        }
                    }
                    catch (Exception ex)
                    {
                        ITestContext context = testCommand.StartPrimaryChildStep(parentTestStep);
                        context.LogWriter.Failures.WriteException(ex, "Fatal Exception in test controller");
                        return context.FinishStep(TestOutcome.Error, null);
                    }
                }
            }

            // Enter the scope of the test and recurse until we find a controller.
            progressMonitor.SetStatus(testCommand.Test.FullName);

            ITestContext testContext = testCommand.StartPrimaryChildStep(parentTestStep);
            TestOutcome outcome = TestOutcome.Passed;

            foreach (ITestCommand monitor in testCommand.Children)
            {
                if (progressMonitor.IsCanceled)
                    break;

                TestResult childResult = RunTest(monitor, testContext.TestStep, options, progressMonitor);
                outcome = outcome.CombineWith(childResult.Outcome).Generalize();
            }

            if (progressMonitor.IsCanceled)
                outcome = TestOutcome.Canceled;

            TestResult result = testContext.FinishStep(outcome, null);

            progressMonitor.Worked(1);
            return result;
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:51,代码来源:DelegatingTestController.cs

示例13: ReportTestError

 private static TestResult ReportTestError(ITestCommand testCommand, Model.Tree.TestStep parentTestStep, Exception ex, string message)
 {
     ITestContext context = testCommand.StartPrimaryChildStep(parentTestStep);
     TestLog.Failures.WriteException(ex, message);
     return context.FinishStep(TestOutcome.Error, null);
 }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:6,代码来源:PatternTestExecutor.cs

示例14: RunTestFixture

        private static TestResult RunTestFixture(ITestCommand testCommand, XunitTypeInfoAdapter typeInfo,
            TestStep parentTestStep)
        {
            ITestContext testContext = testCommand.StartPrimaryChildStep(parentTestStep);

            XunitTestClassCommand testClassCommand;
            try
            {
                testClassCommand = XunitTestClassCommandFactory.Make(typeInfo);
            }
            catch (Exception ex)
            {
                // Xunit can throw exceptions when making commands if the test is malformed.
                testContext.LogWriter.Failures.WriteException(ex, "Internal Error");
                return testContext.FinishStep(TestOutcome.Failed, null);
            }

            return RunTestClassCommandAndFinishStep(testCommand, testContext, testClassCommand);
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:19,代码来源:XunitTestController.cs

示例15: RunTestStep

 private TestResult RunTestStep(ITestCommand testCommand, TestInfoData testStepInfo, TestStep parentTestStep, IProgressMonitor progressMonitor)
 {
     ITestContext testContext = testCommand.StartPrimaryChildStep(parentTestStep);
     TestStepResult testStepResult = repository.RunTest(testStepInfo);
     reporter.Run(testContext, testStepInfo, testStepResult);
     WriteToTestLog(testContext, testStepResult);
     testContext.AddAssertCount(testStepResult.AssertCount);
     progressMonitor.Worked(1);
     return testContext.FinishStep(testStepResult.TestOutcome, testStepResult.Duration);
 }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:10,代码来源:RunTask.cs


注:本文中的ITestCommand.StartPrimaryChildStep方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。