static void Main(string [] args) { var exitCode = CommandLineInterface.RunMain(args); // We've seen a hang at times if we exit // normally, so force the process termination. Environment.Exit(exitCode); }
static void Main(string [] args) { using (var pool = new NSAutoreleasePool()) { NSApplication.Init(); // The Mac test runner is the best-behaved of // all the runners because we are able to take // advantage of the default activation policy // for command line utilities. This means that // all the tests can run and execute without // stealing focus or bringing the test window to // the foreground. // // Best of all, to get this functionality, we // simply don't call anything at all. (Acting // like a normal application is a bit trickier.) // SetInteractive (); CommandLineInterface.RunMain(args); } }
static void Main(string [] args) { CommandLineInterface.RunMain(args); }
public static void RunMain(string [] args) { bool launchResults = true; bool performXslTransform = true; bool showHelp = false; var directory = Directory.GetCurrentDirectory (); string xmlResultsFile = Path.Combine (directory, "test_results.xml"); string transformedResultsFile = Path.Combine (directory, "test_results.html"); string xslTransformPath = Path.Combine ("Resources", "tests.xsl"); string stdoutFile = Path.Combine (directory, "stdout.txt"); var filters = new List<RegexFilter> (); var optionSet = new OptionSet () { { "i|include=", x => filters.Add(RegexFilter.Parse(x, FilterAction.Include)) }, { "x|exclude=", x => filters.Add(RegexFilter.Parse(x, FilterAction.Exclude)) }, { "no-launch-results", x => launchResults = false }, { "no-xsl-transform", x => performXslTransform = false }, { "xml-results=", x => xmlResultsFile = x }, { "xsl-transform=", x => xslTransformPath = x }, { "transformed-results=", x => transformedResultsFile = x }, { "stdout=", x => stdoutFile = x }, // { "v|verbose", x => ++verbose }, { "h|?|help", x => showHelp = true }, }; List<string> extra = optionSet.Parse (args); if (extra.Count > 0) Console.WriteLine ( "Ignoring {0} unrecognized argument(s): {1}", extra.Count, string.Join (", ", extra)); if (showHelp) { ShowHelp (optionSet); System.Threading.Thread.Sleep (3000); return; } CoreExtensions.Host.InitializeService (); var assembly = Assembly.GetExecutingAssembly (); var simpleTestRunner = new SimpleTestRunner (); TestPackage package = new TestPackage (assembly.GetName ().Name); package.Assemblies.Add (assembly.Location); if (!simpleTestRunner.Load (package)) { Console.WriteLine ("Could not find the tests."); return; } var cli = new CommandLineInterface (filters); var result = simpleTestRunner.Run (cli, cli); var resultWriter = new XmlResultWriter (xmlResultsFile); resultWriter.SaveTestResult (result); if (performXslTransform) { var transform = new XslTransform (); transform.Load (xslTransformPath); transform.Transform (xmlResultsFile, transformedResultsFile); } File.WriteAllText (stdoutFile, cli._stdoutStandin.ToString ()); if (performXslTransform && launchResults) System.Diagnostics.Process.Start (transformedResultsFile); }