示例#1
0
        /// <inheritdoc/>
        public virtual TestRunnerResult RunAssembly(IEnumerable <IResultXmlTransform> transforms)
        {
            XmlNode assemblyNode = null;

            logger.AssemblyStart(wrapper.AssemblyFilename, wrapper.ConfigFilename, wrapper.XunitVersion);

            TestRunnerResult result = CatchExceptions(() =>
            {
                assemblyNode = wrapper.RunAssembly(node => XmlLoggerAdapter.LogNode(node, logger));
                return(TestRunnerResult.NoTests);
            });

            if (result == TestRunnerResult.Failed)
            {
                return(TestRunnerResult.Failed);
            }
            if (assemblyNode == null)
            {
                return(TestRunnerResult.NoTests);
            }

            string assemblyXml = assemblyNode.OuterXml;

            foreach (IResultXmlTransform transform in transforms)
            {
                transform.Transform(assemblyXml);
            }

            return(ParseNodeForTestRunnerResult(assemblyNode));
        }
示例#2
0
 /// <inheritdoc/>
 public virtual TestRunnerResult RunTests(string type, List <string> methods)
 {
     return(CatchExceptions(() =>
     {
         XmlNode classNode = wrapper.RunTests(type, methods, node => XmlLoggerAdapter.LogNode(node, logger));
         return ParseNodeForTestRunnerResult(classNode);
     }));
 }
示例#3
0
        /// <summary>
        /// Runs the specified tests in the given type, calling the callback as appropriate.
        /// This override point exists primarily for unit testing purposes.
        /// </summary>
        /// <param name="methods">The test methods to run</param>
        /// <param name="callback">The run status information callback.</param>
        protected virtual string RunTests(List <string> methods, ITestMethodRunnerCallback callback)
        {
            IRunnerLogger    logger  = new TestClassCallbackDispatcher(this, callback);
            IExecutorWrapper wrapper = TestAssembly.ExecutorWrapper;

            try
            {
                XmlNode classNode = wrapper.RunTests(TypeName, methods, node => XmlLoggerAdapter.LogNode(node, logger));
                return(classNode.OuterXml);
            }
            catch (Exception ex)
            {
                logger.ExceptionThrown(wrapper.AssemblyFilename, ex);
                return(String.Empty);
            }
        }