Ejemplo n.º 1
0
        public void SetUp()
        {
            var library = FixtureLibrary.For(x => x.AddFixture <RecordingFixture>());

            system = new RecordingSystem();


            var fixtureContainerSource = new FixtureContainerSource(new Container(x =>
            {
                x.For <IFixture>().Add <RecordingFixture>().Named("Recording");
            }));

            fixtureContainerSource.RegisterFixture("Recording", typeof(RecordingFixture));

            lifecycle = new SystemLifecycle(system);
            runner    = new TestRunner(lifecycle, library, fixtureContainerSource);
            lifecycle.StartApplication();

            lifecycle.RecycleEnvironment();

            var test = new Test("something");

            test.Add(new Section("Recording").WithStep("Execute"));

            runner.RunTest(new TestExecutionRequest()
            {
                Test             = test,
                TimeoutInSeconds = 1200
            });

            system.Messages.Each(x => Debug.WriteLine(x));
        }
Ejemplo n.º 2
0
        public void SetUp()
        {
            var library = FixtureLibrary.For(x => x.AddFixture <RecordingFixture>());

            system = new RecordingSystem();
            var fixtureContainerSource = new FixtureContainerSource(new Container(x =>
            {
                x.For <IFixture>().Add <RecordingFixture>().Named("Recording");
            }));

            fixtureContainerSource.RegisterFixture("Recording", typeof(RecordingFixture));

            runner = new TestRunner(system, library, fixtureContainerSource);

            var test = new Test("something");

            test.Add(new Section("Recording").WithStep("Execute"));

            runner.RunTest(new TestExecutionRequest()
            {
                Test             = test,
                TimeoutInSeconds = 1200
            });

            runner.RunTest(new TestExecutionRequest()
            {
                Test             = test,
                TimeoutInSeconds = 1200
            });
        }
Ejemplo n.º 3
0
        public void run_a_test_when_teardown_blows_up_do_not_rethrow_exception_and_log_the_exception_to_the_test()
        {
            var system = MockRepository.GenerateMock <ISystem>();
            var fixtureContainerSource = new FixtureContainerSource(new Container(x =>
            {
                x.For <IFixture>().Add <RecordingFixture>().Named("Recording");
            }));
            var runner = new TestRunner(system, new FixtureLibrary(), fixtureContainerSource);

            system.Expect(x => x.Teardown()).Throw(new NotImplementedException());

            var test = new Test("something");

            runner.RunTest(test);

            test.LastResult.ExceptionText.ShouldContain("NotImplementedException");
        }
Ejemplo n.º 4
0
        public void SetUp()
        {
            var library = FixtureLibrary.For(x => x.AddFixture <RecordingFixture>());

            system = new RecordingSystem();


            var fixtureContainerSource = new FixtureContainerSource(new Container(x =>
            {
                x.For <IFixture>().Add <RecordingFixture>().Named("Recording");
            }));

            fixtureContainerSource.RegisterFixture("Recording", typeof(RecordingFixture));

            runner = new TestRunner(system, library, fixtureContainerSource);

            runner.Dispose();
        }
Ejemplo n.º 5
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());
            }
        }