public void SetUp()
        {
            var            runner  = TestRunnerBuilder.ForFixture <TableOnlyFixture>();
            FixtureLibrary library = runner.Library;

            table = library.FixtureFor("TableOnly").GrammarFor("Go").ShouldBeOfType <Table>();
        }
예제 #2
0
        public void SetUp()
        {
            var runner = TestRunnerBuilder.For(fixturesAre);

            library   = runner.Library;
            templates = new GrammarWriter(library).Build();
        }
예제 #3
0
        private HtmlDocument writePreview(string xml)
        {
            Test test   = TestUtility.ReadTest(xml);
            var  runner = TestRunnerBuilder.ForFixture <AddressCheckFixture>();

            return(runner.WritePreview(test));
        }
        public void SetUp()
        {
            var            runner  = TestRunnerBuilder.ForFixture <LinesOnlyFixture>();
            FixtureLibrary library = runner.Library;

            fixtureGraph = library.FixtureFor("LinesOnly");
        }
예제 #5
0
        public void SetUp()
        {
            test =
                TestUtility.ReadTest(
                    @"
<Test name='some test'>
    <EmbeddedSection>
        <Grammar1 />
        <DoSomeArithmetic>
            <Arithmetic>
                <StartWith starting='100' />
                <MultiplyBy multiplier='2' />
                <TheValueShouldBe expected='200' />
                <Subtract operand='50' />
                <TheValueShouldBe expected='150' />
                <Throw />
                <TheValueShouldBe expected='1' />
            </Arithmetic>
        </DoSomeArithmetic>
        <Grammar2 />
    </EmbeddedSection>

</Test>


");

            runner = TestRunnerBuilder.For(x => x.AddFixturesFromThisAssembly());
        }
예제 #6
0
        public void the_context_should_not_show_up_in_example()
        {
            ITestRunner    runner  = TestRunnerBuilder.ForFixture <AddressCheckFixture>();
            FixtureLibrary library = runner.Library;
            IStep          step    = library.FixtureFor("AddressCheck").GrammarFor("LoadList1").CreateExample();

            step.Has("context").ShouldBeFalse();
        }
        public void SetUp()
        {
            var runner = TestRunnerBuilder.ForFixture <LinesOnlyFixture>();

            FixtureLibrary library = runner.Library;

            sentence = library.FixtureFor("LinesOnly").GrammarFor("Go").ShouldBeOfType <Sentence>();
        }
예제 #8
0
        private string writeResults(string xml)
        {
            Test test   = TestUtility.ReadTest(xml);
            var  runner = TestRunnerBuilder.ForFixture <AddressCheckFixture>();

            runner.RunTest(test);

            return(test.LastResult.Html);
        }
        public void SetUp()
        {
            var runner = TestRunnerBuilder.ForFixture <VerificationFixture>();

            FixtureLibrary library = runner.Library;

            verification =
                library.FixtureFor("Verification").GrammarFor("theStates").ShouldBeOfType <SetVerification>();
        }
예제 #10
0
        public void run_a_test_when_setup_blows_up_do_not_rethrow_exception_and_log_the_exception_to_the_test()
        {
            var runner = TestRunnerBuilder.ForSystem <SystemThatBlowsUpInSetup>();

            var test = new Test("Some test");

            runner.RunTest(test);

            test.LastResult.ExceptionText.ShouldContain("NotImplementedException");
        }
예제 #11
0
        public void SetUp()
        {
            FixtureLibrary library = TestRunnerBuilder.ForFixture <MathFixture>().Library;
            FixtureGraph   fixture = library.FixtureFor("Math");

            embeddedSection =
                new EmbeddedSectionGrammar <MathFixture>().ToStructure(library).ShouldBeOfType <EmbeddedSection>();
            embeddedSection.Name = "MathGrammar";

            theExample = embeddedSection.CreateExample();
        }
예제 #12
0
        public void SetUp()
        {
            var runner = TestRunnerBuilder.For(x =>
            {
                x.AddFixture <MathFixture>();
                x.AddFixture <AnotherFixture>();
                x.AddFixture <DoSomeMathFixture>();
            });

            library = runner.Library;
        }
예제 #13
0
        public void SetUp()
        {
            runner = TestRunnerBuilder.ForFixture <TimeoutFixture>();

            test = new Test("fake").Section <TimeoutFixture>(x => { x.WithStep("Go"); });

            runner.RunTest(new TestExecutionRequest()
            {
                Test             = test,
                TimeoutInSeconds = 1
            });
        }
        public void SetUp()
        {
            test =
                TestUtility.ReadTest(
                    @"
<Test name='a test'>
    <Adding>
        <AddNumbersTogether>
            <Rows>
                <AddNumbersTogether x='1' y='2' sum='3'/>
                <AddNumbersTogether x='3' y='2' sum='5'/>
                <AddNumbersTogether x='2' y='2' sum='4'/>
                <AddNumbersTogether x='5' y='2' sum='7'/>
                <AddNumbersTogether x='10' y='2' sum='12'/>
                <AddNumbersTogether x='1' y='2' sum='4'/>
                <AddNumbersTogether x='3' y='2' sum='3'/>
                <AddNumbersTogether x='1' y='2' sum='3'/>
                <AddNumbersTogether x='1' y='2' sum='3'/>
            </Rows>
        </AddNumbersTogether>
    </Adding>

</Test>
");


            test2 =
                TestUtility.ReadTest(
                    @"
<Test name='a test'>
    <Adding>
        <AddNumbersTable>
            <Rows>
                <AddNumbersTogether2 x='1' y='2' sum='3'/>
                <AddNumbersTogether2 x='3' y='2' sum='5'/>
                <AddNumbersTogether2 x='2' y='2' sum='4'/>
                <AddNumbersTogether2 x='5' y='2' sum='7'/>
                <AddNumbersTogether2 x='10' y='2' sum='12'/>
                <AddNumbersTogether2 x='1' y='2' sum='4'/>
                <AddNumbersTogether2 x='3' y='2' sum='3'/>
                <AddNumbersTogether2 x='1' y='2' sum='3'/>
                <AddNumbersTogether2 x='1' y='2' sum='3'/>
            </Rows>
        </AddNumbersTable>
    </Adding>

</Test>
");


            runner = TestRunnerBuilder.For(x => x.AddFixturesFromThisAssembly());
        }
예제 #15
0
        private TestResult runStep(IStep step)
        {
            ActionsFixture.Reset();

            var test    = new Test("something");
            var section = new Section("Actions");

            section.Add(step);
            test.Add(section);

            var runner = TestRunnerBuilder.ForFixture <ActionsFixture>();

            return(runner.RunTest(new TestExecutionRequest(test, new TestStopConditions())));
        }
예제 #16
0
        public FixtureLibrary StartSystem(FixtureAssembly fixtureAssembly, MarshalByRefObject remotePublisher)
        {
            _publisher = (IEventPublisher)remotePublisher;
            var observer = new FixtureObserver(_publisher);

            // TODO -- if fails, do a Thread.Sleep and try again
            _system = fixtureAssembly.System;

            _lifecycle = new SystemLifecycle(_system);

            // TODO -- make this be async
            observer.RecordStatus("Setting up the environment");
            _lifecycle.StartApplication();

            try
            {
                var registry = new FixtureRegistry();
                _system.RegisterFixtures(registry);

                var container = registry.BuildContainer();


                var library         = TestRunnerBuilder.BuildLibrary(_lifecycle, observer, container, fixtureAssembly.Filter.CreateTypeFilter());
                var containerSource = new FixtureContainerSource(container);
                _runner = new TestRunner(_lifecycle, library, containerSource);
                if (_listener != null)
                {
                    _runner.Listener = _listener;
                }

                return(library);
            }
            catch (TestEngineFailureException)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new TestEngineFailureException(e.ToString());
            }
        }
예제 #17
0
        public void give_it_a_whirl()
        {
            var test = new Test("The First Test");


            test.Section <ArithmeticFixture>(x =>
            {
                x.WithStep("StartWith", "starting:100")
                .WithStep("MultiplyBy", "multiplier:2")
                .WithStep("TheValueShouldBe", "expected:200")
                .WithStep("TheValueShouldBe", "expected:300")
                .WithStep("Subtract", "operand:5")
                .WithStep("TheValueShouldBe", "expected:195")
                .WithStep("Adding", "x:10, y:23.5, returnValue:33.5")
                .WithStep("Throw");
            });


            var          runner = TestRunnerBuilder.ForFixture <ArithmeticFixture>();
            HtmlDocument html   = runner.WritePreview(test);
        }
예제 #18
0
        public void SetUp()
        {
            test = new Test("The First Test");

            test.Section <ArithmeticFixture>(x =>
            {
                x.WithStep("StartWith", "starting:100")
                .WithStep("MultiplyBy", "multiplier:2")
                .WithStep("TheValueShouldBe", "expected:200")
                .WithStep("TheValueShouldBe", "expected:300")
                .WithStep("Subtract", "operand:5")
                .WithStep("Subtract", "")
                .WithStep("TheValueShouldBe", "expected:195")
                .WithStep("Adding", "x:10, y:23.5, returnValue:33.5")
                .WithStep("Throw");
            });


            var runner = TestRunnerBuilder.For(x => x.AddFixturesFromThisAssembly());

            runner.RunTest(test);
        }
예제 #19
0
        public void SetUp()
        {
            runner = TestRunnerBuilder.ForFixture <SlowFixture>();
            test   = new Test("slow test").With(Section.For <SlowFixture>().WithStep("GoSlow"));

            var reset   = new ManualResetEvent(false);
            var running = new ManualResetEvent(false);

            var thread = new Thread(() =>
            {
                running.Set();
                Debug.WriteLine("Starting to run");
                test.LastResult = runner.RunTest(new TestExecutionRequest()
                {
                    Test             = test,
                    TimeoutInSeconds = 60
                });

                test.LastResult.ShouldNotBeNull();
                Debug.WriteLine("finished running");
                reset.Set();
            });

            thread.Start();
            running.WaitOne();
            Thread.Sleep(1000);

            Debug.WriteLine("Aborting now!");
            runner.Abort();
            Debug.WriteLine("Done aborting");


            reset.WaitOne(5000);
            test.LastResult.ShouldNotBeNull();

            test.LastResult.WasCancelled.ShouldBeTrue();

            Debug.WriteLine("completely done");
        }
예제 #20
0
        public void try_to_write_table()
        {
            Project project = DataMother.MathProject();
            string  xml     =
                @"
<Test name='Bad Add 1'>
  <Math>
    <AddTable>
      <operation>
        <operation x='1' y='2' sum='4' />
        <operation x='2' y='2' sum='5' />
        <operation x='3' y='2' sum='6' />
      </operation>
    </AddTable>

  </Math>
</Test>";

            Test        test   = TestUtility.ReadTest(xml);
            ITestRunner runner = TestRunnerBuilder.ForFixture <MathFixture>();

            runner.RunTest(test);
        }
예제 #21
0
 public void SetUp()
 {
     theRunner = TestRunnerBuilder.ForSystem <FakeSerenitySystem>();
 }
예제 #22
0
 public void SetUp()
 {
     runner    = TestRunnerBuilder.For(x => x.AddFixturesFromAssemblyContaining <GrammarMarker>());
     hierarchy = DataMother.GrammarProject().LoadTests();
 }
예제 #23
0
 public static ITestRunner GetRunner()
 {
     return(TestRunnerBuilder.For(x => x.AddFixturesFromThisAssembly()));
 }
예제 #24
0
        public void SetUp()
        {
            FixtureGraph fixtureGraph = TestRunnerBuilder.ForFixture <MathFixture>().Library.FixtureFor("Math");

            section = fixtureGraph.CreateExample();
        }
예제 #25
0
        public static FixtureLibrary For(Action <FixtureRegistry> configure)
        {
            var runner = TestRunnerBuilder.For(configure);

            return(runner.Library);
        }