private void ConfigureRunnerForCI()
    {
      this.runner.AutoStart = true;
      this.runner.TerminateAfterExecution = true;

      var reportStream = new NUnitLite.Runner.NUnit2XmlOutputWriter(DateTime.Now);

      //      string host = "localhost";
      //      string host = "10.38.11.5"; // @adk mac-mini
      string host = "10.38.10.205"; // @darthvader.local
      var targetStreamOnBuildServer = new TcpTextWriter(host, 16390);

      runner.Writer = new NUnitOutputTextWriter(runner, targetStreamOnBuildServer, reportStream);
    }
示例#2
0
        private void ConfigureRunnerForCI()
        {
            this.runner.AutoStart = true;
            this.runner.TerminateAfterExecution = true;

            var reportStream = new NUnitLite.Runner.NUnit2XmlOutputWriter(DateTime.Now);

            //      string host = "localhost";
            //      string host = "10.38.11.5"; // @adk mac-mini
            string host = "10.38.10.205"; // @darthvader.local
            var    targetStreamOnBuildServer = new TcpTextWriter(host, 16390);

            runner.Writer = new NUnitOutputTextWriter(runner, targetStreamOnBuildServer, reportStream);
        }
示例#3
0
        internal static void Run(string title, Stream outputStream)
        {
            var suite   = new TestSuite(title);
            var builder = new NUnitLiteTestAssemblyBuilder();

            suite.Add(builder.Build(System.Reflection.Assembly.GetExecutingAssembly(), new Dictionary <string, object>()));

            var testExecutionContext = TestExecutionContext.CurrentContext;

            testExecutionContext.WorkDirectory = Environment.CurrentDirectory;

            var workItem = suite.CreateWorkItem(TestFilter.Empty);

            workItem.Execute(testExecutionContext);

            var testWriter = new NUnitLite.Runner.NUnit2XmlOutputWriter(DateTime.Now);

            using (var writer = new StreamWriter(outputStream))
            {
                testWriter.WriteResultFile(workItem.Result, writer);
            }
        }
示例#4
0
        internal static void Run(string title, Stream outputStream)
        {
            var suite = new TestSuite(title);
            var builder = new NUnitLiteTestAssemblyBuilder();
            suite.Add(builder.Build(System.Reflection.Assembly.GetExecutingAssembly(), new Dictionary<string, object>()));

            var testExecutionContext = TestExecutionContext.CurrentContext;
            testExecutionContext.WorkDirectory = Environment.CurrentDirectory;

            #if __IOS__
            var workItem = suite.CreateWorkItem(TestFilter.Empty, new FinallyDelegate());
            #else
            var workItem = suite.CreateWorkItem(TestFilter.Empty);
            #endif
            workItem.Execute(testExecutionContext);

            var testWriter = new NUnitLite.Runner.NUnit2XmlOutputWriter(DateTime.Now);
            using (var writer = new StreamWriter(outputStream))
            {
                testWriter.WriteResultFile(workItem.Result, writer);
            }
        }
示例#5
0
        public bool OpenWriter(string message)
        {
            TouchOptions options = TouchOptions.Current;
            DateTime     now     = DateTime.Now;

            // let the application provide it's own TextWriter to ease automation with AutoStart property
            if (Writer == null)
            {
                if (options.ShowUseNetworkLogger)
                {
                    try {
                        string hostname = null;
                        WriterFinishedTask = null;
                        TextWriter defaultWriter = null;
                        switch (options.Transport)
                        {
                        case "FILE":
                            Console.WriteLine("[{0}] Sending '{1}' results to the file {2}", now, message, options.LogFile);
                            defaultWriter = new StreamWriter(options.LogFile, true, System.Text.Encoding.UTF8)
                            {
                                AutoFlush = true,
                            };
                            break;

                        case "HTTP":
                            var hostnames = options.HostName.Split(',');
                            hostname = hostnames [0];
                            if (hostnames.Length > 1)
                            {
                                Console.WriteLine("[{0}] Found multiple host names ({1}); will only try sending to the first ({2})", now, options.HostName, hostname);
                            }
                            Console.WriteLine("[{0}] Sending '{1}' results to {2}:{3}", now, message, hostname, options.HostPort);
                            var w = new HttpTextWriter()
                            {
                                HostName = hostname,
                                Port     = options.HostPort,
                            };
                            w.Open();
                            defaultWriter      = w;
                            WriterFinishedTask = w.FinishedTask;
                            break;

                        default:
                            Console.WriteLine("Unknown transport '{0}': switching to default (TCP)", options.Transport);
                            goto case "TCP";

                        case "TCP":
                            hostname = SelectHostName(options.HostName.Split(','), options.HostPort);
                            if (string.IsNullOrEmpty(hostname))
                            {
                                Console.WriteLine("Couldn't establish a TCP connection with any of the hostnames: {0}", options.HostName);
                                break;
                            }
                            Console.WriteLine("[{0}] Sending '{1}' results to {2}:{3}", now, message, hostname, options.HostPort);
                            defaultWriter = new TcpTextWriter(hostname, options.HostPort);
                            break;
                        }
                        if (options.EnableXml)
                        {
                            NUnitLite.Runner.OutputWriter formatter;
                            switch (options.XmlVersion)
                            {
                            case XmlVersion.NUnitV3:
                                formatter = new NUnitLite.Runner.NUnit3XmlOutputWriter(DateTime.UtcNow);
                                break;

                            default:
                                formatter = new NUnitLite.Runner.NUnit2XmlOutputWriter(DateTime.UtcNow);
                                break;
                            }
                            Writer = new NUnitOutputTextWriter(
                                this, defaultWriter, formatter, options.XmlMode);
                        }
                        else
                        {
                            Writer = defaultWriter;
                        }
                    } catch (Exception ex) {
                        connection_failure = true;
                        if (!ShowConnectionErrorAlert(options.HostName, options.HostPort, ex))
                        {
                            return(false);
                        }

                        Console.WriteLine("Network error: Cannot connect to {0}:{1}: {2}. Continuing on console.", options.HostName, options.HostPort, ex);
                        Writer = Console.Out;
                    }
                }
            }

            if (Writer == null)
            {
                Writer = Console.Out;
            }

            Writer.WriteLine("[Runner executing:\t{0}]", message);
            Writer.WriteLine("[MonoTouch Version:\t{0}]", Constants.Version);
            Writer.WriteLine("[Assembly:\t{0}.dll ({1} bits)]", typeof(NSObject).Assembly.GetName().Name, IntPtr.Size * 8);
            Writer.WriteLine("[GC:\t{0}]", GC.MaxGeneration == 0 ? "Boehm": "sgen");
            WriteDeviceInformation(Writer);
            Writer.WriteLine("[Device Locale:\t{0}]", NSLocale.CurrentLocale.Identifier);
            Writer.WriteLine("[Device Date/Time:\t{0}]", now);              // to match earlier C.WL output

            Writer.WriteLine("[Bundle:\t{0}]", NSBundle.MainBundle.BundleIdentifier);
            // FIXME: add data about how the app was compiled (e.g. ARMvX, LLVM, GC and Linker options)
            PassedCount       = 0;
            IgnoredCount      = 0;
            FailedCount       = 0;
            InconclusiveCount = 0;
            return(true);
        }