コード例 #1
0
        public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
        {
            testLogger = new TestLogger(logger);

            testLogger.SendMainMessage("Discovery started");

            foreach (var source in sources)
            {
                testLogger.SendDebugMessage(String.Format("Processing: '{0}'", source));

                try
                {
                    using (var sandbox = new Sandbox<Discoverer>(source))
                    {
                        if (sandbox.Content != null)
                        {
                            sandbox.Content
                                .DiscoverTests()
                                .Select(name => name.ToTestCase(source))
                                .ForEach(discoverySink.SendTestCase);
                        }
                    }
                }
                catch (Exception ex)
                {
                    testLogger.SendErrorMessage(ex, String.Format("Exception found while discovering tests in source '{0}'", source));

                    // just go on with the next
                }
            }

            testLogger.SendMainMessage("Discovery finished");
        }
コード例 #2
0
        public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            this.frameworkHandle = frameworkHandle;

            var testLogger = new TestLogger(frameworkHandle);

            testLogger.SendMainMessage("Execution started");

            foreach (var source in sources)
            {
                try
                {
                    using (var sandbox = new Sandbox<Executor>(source))
                    {
                        testLogger.SendInformationalMessage(String.Format("Running: '{0}'", source));

                        var assemblyDirectory = new DirectoryInfo(Path.GetDirectoryName(source));
                        Directory.SetCurrentDirectory(assemblyDirectory.FullName);
                        sandbox.Content.Execute(this);
                    }
                }
                catch (Exception ex)
                {
                    testLogger.SendErrorMessage(ex, String.Format("Exception found while executing tests in source '{0}'", source));

                    // just go on with the next
                }
            }

            testLogger.SendMainMessage("Execution finished");
        }
コード例 #3
0
        public void DiscoverTests(IEnumerable <string> sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
        {
            testLogger = new TestLogger(logger);

            testLogger.SendMainMessage("Discovery started");

            foreach (var source in sources)
            {
                testLogger.SendDebugMessage(String.Format("Processing: '{0}'", source));

                try
                {
                    using (var sandbox = new Sandbox <Discoverer>(source))
                    {
                        if (sandbox.Content != null)
                        {
                            sandbox.Content
                            .DiscoverTests()
                            .Select(name => name.ToTestCase(source))
                            .ForEach(discoverySink.SendTestCase);
                        }
                    }
                }
                catch (Exception ex)
                {
                    testLogger.SendErrorMessage(ex, String.Format("Exception found while discovering tests in source '{0}'", source));

                    // just go on with the next
                }
            }

            testLogger.SendMainMessage("Discovery finished");
        }
コード例 #4
0
        public void RunTests(IEnumerable <TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            this.frameworkHandle = frameworkHandle;

            var testLogger = new TestLogger(frameworkHandle);

            testLogger.SendMainMessage("Execution started");

            foreach (var group in tests.GroupBy(t => t.Source))
            {
                testLogger.SendInformationalMessage(String.Format("Running selected: '{0}'", group.Key));

                try
                {
                    using (var sandbox = new Sandbox <Executor>(group.Key))
                    {
                        sandbox.Content.Execute(this, group.Select(t => t.FullyQualifiedName).ToArray());
                    }
                }
                catch (Exception ex)
                {
                    testLogger.SendErrorMessage(ex, String.Format("Exception found while executing tests in group '{0}'", group.Key));

                    // just go on with the next
                }
            }

            testLogger.SendMainMessage("Execution finished");
        }
コード例 #5
0
        public void RunTests(IEnumerable <string> sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            this.frameworkHandle = frameworkHandle;

            var testLogger = new TestLogger(frameworkHandle);

            testLogger.SendMainMessage("Execution started");

            foreach (var source in sources)
            {
                try
                {
                    using (var sandbox = new Sandbox <Executor>(source))
                    {
                        testLogger.SendInformationalMessage(String.Format("Running: '{0}'", source));

                        sandbox.Content.Execute(this);
                    }
                }
                catch (Exception ex)
                {
                    testLogger.SendErrorMessage(ex, String.Format("Exception found while executing tests in source '{0}'", source));

                    // just go on with the next
                }
            }

            testLogger.SendMainMessage("Execution finished");
        }
コード例 #6
0
        public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            this.frameworkHandle = frameworkHandle;

            var testLogger = new TestLogger(frameworkHandle);

            testLogger.SendMainMessage("Execution started");

            foreach (var group in tests.GroupBy(t => t.Source))
            {
                testLogger.SendInformationalMessage(String.Format("Running selected: '{0}'", group.Key));

                try
                {
                    using (var sandbox = new Sandbox<Executor>(group.Key))
                    {
                        var assemblyDirectory = new DirectoryInfo(Path.GetDirectoryName(group.Key));
                        Directory.SetCurrentDirectory(assemblyDirectory.FullName);
                        sandbox.Content.Execute(this, group.Select(t => t.FullyQualifiedName).ToArray());
                    }
                }
                catch (Exception ex)
                {
                    testLogger.SendErrorMessage(ex, String.Format("Exception found while executing tests in group '{0}'", group.Key));

                    // just go on with the next
                }
            }

            testLogger.SendMainMessage("Execution finished");
        }