示例#1
0
        public void RunSpecsAndCheckNames()
        {
            var result   = SpecRunner.Run <SpecNamingSpec>();
            var allTests = result.AllTests();

            Assert.IsTrue(allTests.All(t => t.Name == SpecNamingSpec.ExpectedSpecName));
        }
示例#2
0
        public void ExceptionsShouldTrumpAssertionErrors()
        {
            var result = SpecRunner.Run <BrokenClassSpec>();

            Assert.Greater(result.FailedTests().Count(), 0, "Test cases should have failed");
            Assert.IsTrue(result.FailedTests().All(ft => ft.Message.StartsWith("System.ArgumentOutOfRangeException")), "At least one failed spec reported an assertion error when it should have reported an exception.");
        }
示例#3
0
        private static SpecRunner buildRunner(RunInput input, List <Specification> specs, RunningSystem running, out IExecutionObserver executionObserver)
        {
            IBatchObserver batchObserver = new NulloBatchObservor();

            executionObserver = new NulloObserver();
            switch (input.TracingFlag)
            {
            case TracingStyle.verbose:
                batchObserver = new ConsoleBatchObserver(specs.Count);
                // TODO -- awesome if you could get smarter w/ the console output here
                break;

            case TracingStyle.teamcity:
                batchObserver     = new TeamCityBatchObserver();
                executionObserver = new TeamCityExecutionObserver();
                break;

            case TracingStyle.appveyor:
                batchObserver = new AppVeyorBatchObserver();
                break;
            }

            var runner = new SpecRunner(new BatchExecutionMode(batchObserver), running.System, executionObserver);

            runner.UseStopConditions(Project.CurrentProject.StopConditions);
            return(runner);
        }
示例#4
0
        public void NullReturningInvalidCreateSUTTest()
        {
            var result = SpecRunner.Run <NullReturningInvalidCreateSUTSpec>();

            Assert.Greater(result.FailedTests().Count(), 0);
            Assert.IsTrue(result.FailedTests().All(ft => ft.Message.StartsWith("System.InvalidOperationException") && ft.Message.Contains("Failed to construct SUT: ConstructSUT returned null")), "At least one failed spec reported an assertion error when it should have reported an exception.");
        }
示例#5
0
        public void ExceptionThrowingInvalidCreateSUTTest()
        {
            var result = SpecRunner.Run <ExceptionThrowingInvalidCreateSUTSpec>();

            Assert.Greater(result.FailedTests().Count(), 0);
            Assert.IsTrue(result.FailedTests().All(ft => ft.Message.Equals(
                                                       $"{ExceptionThrowingInvalidCreateSUTSpec.ConstructSUTThrownException.GetType().FullName} : {ExceptionThrowingInvalidCreateSUTSpec.ConstructSUTThrownException.Message}")));
        }
        public void ThrowSpecificExceptionForDuplicateGivenDescriptions()
        {
            var result = SpecRunner.Run <DuplicateDescriptionsSpec>();

            Assert.Greater(result.FailedTests().Count(), 0, "Test cases should have failed");
            Assert.IsTrue(result.FailedTests().All(ft => ft.Message.StartsWith(typeof(DuplicateDescriptionException).FullName)), "Every failure should have reported an exception specific to a description having been repeated");
            Assert.IsTrue(result.FailedTests().All(ft => ft.StackTrace.Contains(typeof(DuplicateDescriptionsSpec).FullName)), "Every failure's stack trace should include a line number from the spec that failed");
        }
示例#7
0
        public void run_st_spec()
        {
            using (var runner = new SpecRunner<NulloSystem>())
            {
                var results = runner.Run("Linq Queries/DateTime querying");

                runner.OpenResultsInBrowser();
            }
        }
示例#8
0
        public void ExpectedExceptionExpectationFailureShouldFail()
        {
            var result = SpecRunner.Run <ExpectedExceptionExpectationFailureSpec>();

            Assert.Greater(result.FailedTests().Count(), 0, "Test cases should have failed");
            Assert.IsTrue(result.FailedTests().All(ft =>
                                                   ft.Message.StartsWith("System.Exception") &&
                                                   ft.Message.Contains("the specified constraint failed")));
        }
示例#9
0
        public void run_st_spec()
        {
            using (var runner = new SpecRunner <NulloSystem>())
            {
                var results = runner.Run("Event Store/Projections/Inline Aggregation by Stream");


                runner.OpenResultsInBrowser();
            }
        }
示例#10
0
        public void run_st_spec()
        {
            using (var runner = new SpecRunner <NulloSystem>())
            {
                var results = runner.Run("Event Store/Event Capture/Version a stream as part of event capture");


                runner.OpenResultsInBrowser();
            }
        }
示例#11
0
        public void ExpectedExceptionNothingThrownShouldFail()
        {
            var result = SpecRunner.Run <ExpectedExceptionNothingThrownSpec>();

            Assert.Greater(result.FailedTests().Count(), 0, "Test cases should have failed");
            Assert.IsTrue(result.FailedTests().All(ft =>
                                                   ft.Message.StartsWith("System.Exception") &&
                                                   ft.Message.Contains("of type System.InvalidOperationException was not thrown") &&
                                                   ft.Message.Contains("no exception was thrown")));
        }
示例#12
0
 public static void TryIt()
 {
     using (var runner = new SpecRunner <TestSystem>())
     {
         //runner.Run("ServiceBus/HealthMonitoring/A running task goes down and gets reassigned");
         runner.Run("ServiceBus/HealthMonitoring/Assign on order of preference when some nodes are down");
         //runner.Run("ServiceBus/HealthMonitoring/Assign on order or preference when some nodes timeout on activation");
         //runner.Run("ServiceBus/HealthMonitoring/A running task times out on health checks and gets reassigned");
         runner.OpenResultsInBrowser();
     }
 }
示例#13
0
        public void RunTransformations()
        {
            var runner = new SpecRunner<SpecificationSystem>();
            //runner.RunAll(1.Minutes());
            //var results = runner.Run("Docs/Parsing a Single Topic File");
            //var results = runner.Run("Docs/Navigation structure with nested folders and implicit ordering");
            runner.RunAll(1.Minutes());

            runner.OpenResultsInBrowser();

            //results.Counts.AssertSuccess();
        } 
示例#14
0
        public void RunTransformations()
        {
            var runner = new SpecRunner<SpecificationSystem>();

            var results = runner.Run("Docs/Navigation structure of a single directory using a splash page");
            //var results = runner.Run("Docs/Transformation Rules");
            //runner.RunAll(1.Minutes());

            runner.OpenResultsInBrowser();

            //results.Counts.AssertSuccess();
        }
示例#15
0
        public void RunTransformations()
        {
            var runner = new SpecRunner <SpecificationSystem>();

            //runner.RunAll(1.Minutes());
            //var results = runner.Run("Docs/Parsing a Single Topic File");
            //var results = runner.Run("Docs/Navigation structure with nested folders and implicit ordering");
            runner.RunAll(1.Minutes());

            runner.OpenResultsInBrowser();

            //results.Counts.AssertSuccess();
        }
示例#16
0
        public void run_a_single_test()
        {
            using (var runner = new SpecRunner <TestSystem>())
            {
                runner.Run("ServiceBus/Basics/Publishing a message that has multiple subscribers");

                //runner.Run("ServiceBus/HealthMonitoring/A running task goes down and gets reassigned");
                //runner.Run("ServiceBus/HealthMonitoring/Assign on order of preference when some nodes are down");
                //runner.Run("ServiceBus/HealthMonitoring/Assign on order or preference when some nodes timeout on activation");
                //runner.Run("ServiceBus/HealthMonitoring/A running task times out on health checks and gets reassigned");
                runner.OpenResultsInBrowser();
            }
        }
示例#17
0
        private void buildExecutionQueue(SpecRunner runner, IExecutionObserver executionObserver)
        {
            _queue = new ConsumingQueue(request =>
            {
                if (request.IsCancelled)
                {
                    return;
                }

                var results = runner.Execute(request, _queue);

                if (!request.IsCancelled && results != null)
                {
                    // TODO -- combine the two things here?
                    request.SpecExecutionFinished(results);
                    executionObserver.SpecFinished(request);
                }
            });

            _queue.Start();
        }
示例#18
0
        private SpecificationEngine buildUserInterfaceEngine()
        {
            var observer = new UserInterfaceObserver();

            var runner = new SpecRunner(new UserInterfaceExecutionMode(observer), _system, _specExpiration);

            var executionObserver = new UserInterfaceExecutionObserver();
            var engine            = new SpecificationEngine(_system, runner, executionObserver);

            _controller = new EngineController(engine, observer, runner);

            // Super hokey, but we need some way to feed the spec started
            // event up to EngineController
            // TODO -- maybe pull the IExecutionQueue concept from 1-2 back out
            executionObserver.Controller = (EngineController)_controller;


            _services.Add(observer);
            _services.Add(engine);

            EventAggregator.Messaging.AddListener(_controller);

            return(engine);
        }
 public void BeforeDefectScenario()
 {
     SpecRunner.TestIgnored("Test is marked with a defect, see the feature file to learn more.");
 }
 public void BeforePendingScenario()
 {
     SpecRunner.TestPending("Test marked as pending.");
 }
示例#21
0
 public static void PendingBeforeScenario()
 {
     SpecRunner.TestPending("Tagged as pending");
 }