Exemplo n.º 1
0
        string ExecuteAssembly(string assemblyFilename, string configFilename, IRunnerLogger logger)
        {
            try
            {
                using (ExecutorWrapper wrapper = new ExecutorWrapper(assemblyFilename, configFilename, ShadowCopy))
                {
                    Log.LogMessage(MessageImportance.High, "xunit.dll:     Version {0}", wrapper.XunitVersion);
                    Log.LogMessage(MessageImportance.High, "Test assembly: {0}", assemblyFilename);

                    XmlTestRunner runner = new XmlTestRunner(wrapper, logger);
                    if (runner.RunAssembly() == TestRunnerResult.Failed)
                    {
                        ExitCode = -1;
                    }

                    return(runner.Xml);
                }
            }
            catch (Exception ex)
            {
                Exception e = ex;

                while (e != null)
                {
                    Log.LogError(e.GetType().FullName + ": " + e.Message);

                    foreach (string stackLine in e.StackTrace.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        Log.LogError(stackLine);
                    }

                    e = e.InnerException;
                }

                ExitCode = -1;
                return("");
            }
        }
Exemplo n.º 2
0
        string ExecuteAssembly(string assemblyFilename, string configFilename, IRunnerLogger logger)
        {
            try
            {
                using (ExecutorWrapper wrapper = new ExecutorWrapper(assemblyFilename, configFilename, ShadowCopy))
                {
                    Log.LogMessage(MessageImportance.High, "xunit.dll:     Version {0}", wrapper.XunitVersion);
                    Log.LogMessage(MessageImportance.High, "Test assembly: {0}", assemblyFilename);

                    XmlTestRunner runner = new XmlTestRunner(wrapper, logger);
                    if (runner.RunAssembly() == TestRunnerResult.Failed)
                        ExitCode = -1;

                    return runner.Xml;
                }
            }
            catch (Exception ex)
            {
                Exception e = ex;

                while (e != null)
                {
                    Log.LogError(e.GetType().FullName + ": " + e.Message);

                    foreach (string stackLine in e.StackTrace.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries))
                        Log.LogError(stackLine);

                    e = e.InnerException;
                }

                ExitCode = -1;
                return "";
            }
        }