/// <summary>
        /// Executes the task.
        /// </summary>
        protected override void ExecuteTask()
        {
            DisplayTaskConfiguration();

            if (FileSetHelper.Count(Assemblies) == 0)
            {
                Log(Level.Warning, "No specification assemblies, aborting task");
                return;
            }

            List <ISpecificationRunListener> listeners = SetUpListeners();
            NAntRunListener nantRunListener            = new NAntRunListener(this);

            listeners.Add(nantRunListener);

            AggregateRunListener rootListener = new AggregateRunListener(listeners);
            ISpecificationRunner runner       = new AppDomainRunner(rootListener, RunOptions.Default);

            RunSpecifications(Assemblies, runner);

            Log(Level.Info, "Finished running specs");

            if (nantRunListener.FailureOccurred)
            {
                throw new BuildException("There were failing specifications. Please see the build log.");
            }
        }
Ejemplo n.º 2
0
        protected static string[] Globbing(string pattern, string baseDir)
        {
            var includes = FileSetHelper.Include(pattern);

            includes = FileSetHelper.SetBaseDir(Path.Combine(TempDir, baseDir), includes);
            return(FileSetHelper.ScanImmediately(includes).ToArray());
        }
        void RunSpecifications(FileSet[] assemblies, ISpecificationRunner runner)
        {
            Ensure.ArgumentIsNotNull(assemblies, "assemblies");
            Ensure.ArgumentIsNotNull(runner, "runner");

            foreach (string fileName in FileSetHelper.Flatten(assemblies))
            {
                RunSpecificationAssembly(fileName, runner);
            }
        }
        void DisplayTaskConfiguration()
        {
            Log(Level.Info, "Machine.Specifications {0} test runner", typeof(Subject).Assembly.GetName().Version);

            Log(Level.Verbose, "Assemblies:");
            foreach (string fileName in FileSetHelper.Flatten(Assemblies))
            {
                Log(Level.Verbose, "\t{0}", fileName);
            }

            Log(Level.Verbose, "Working directory: {0}", WorkingDirectory);
            Log(Level.Verbose, "Report directory: {0}", ReportDirectory);
            Log(Level.Verbose, "Report file name: {0}", ReportFilename);
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     Scans the specified pattern.
        /// </summary>
        /// <param name="pattern">The pattern.</param>
        /// <param name="baseDir">The base dir.</param>
        /// <returns></returns>
        public static List <string> Scan(string pattern, string baseDir)
        {
            TraceHelper.trace(string.Format("Scan for {0} in {1}:", pattern, baseDir));

            var list =
                FileSetHelper.Scan(
                    FileSetHelper.SetBaseDir(baseDir,
                                             FileSetHelper.Include(pattern))).ToList();

            foreach (var file in list)
            {
                TraceHelper.trace(string.Format("  - {0}", file));
            }
            return(list);
        }
Ejemplo n.º 6
0
        ReportResult RunTests(FileSet[] assemblies)
        {
            Ensure.ArgumentIsNotNull(assemblies, "assemblies");

            ReportResult result = new ReportResult();

            foreach (string fileName in FileSetHelper.Flatten(assemblies))
            {
                bool testsFailed = RunTestAssembly(fileName, result);
                if (testsFailed)
                {
                    break;
                }
            }

            return(result);
        }
Ejemplo n.º 7
0
        void DisplayTaskConfiguration()
        {
            Log(Level.Info, "MbUnit {0} test runner", typeof(Fixture).Assembly.GetName().Version);

            Log(Level.Verbose, "Assemblies:");
            foreach (string fileName in FileSetHelper.Flatten(Assemblies))
            {
                Log(Level.Verbose, "\t{0}", fileName);
            }

            Log(Level.Verbose, "Working directory: {0}", WorkingDirectory);
            Log(Level.Verbose, "Report types: {0}", ReportTypes);
            Log(Level.Verbose, "Report directory: {0}", ReportDirectory);
            Log(Level.Verbose, "Report file name format: {0}", ReportFileNameFormat);
            Log(Level.Verbose, "Transform: {0}", Transform == null ? String.Empty : Transform.FullName);
            Log(Level.Verbose, "Transform report file name format: {0}", TransformReportFileNameFormat);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Executes the task.
        /// </summary>
        protected override void ExecuteTask()
        {
            DisplayTaskConfiguration();

            if (FileSetHelper.Count(Assemblies) == 0)
            {
                Log(Level.Warning, "No test assemblies, aborting task");
                return;
            }

            ReportResult result = RunTests(Assemblies);

            GenerateReports(result, ReportTypes);

            if (result.Counter.FailureCount > 0)
            {
                throw new BuildException("There were failing tests. Please see the build log.");
            }
        }