private void RunTests(object sender, EventArgs e)
        {
            var originalButtonText = RunTestsButton.Text;

            RunTestsButton.Text     = "running tests...";
            RunTestsButton.Clicked -= RunTests;

            Task.Run(() =>
            {
                var testInputs = GetTestTitleData();
                try
                {
                    UUnitIncrementalTestRunner.Start(true, null, testInputs, OnComplete);
                }
                catch (Exception exception)
                {
                    DisplayException(exception);
                    return;
                }

                while (!UUnitIncrementalTestRunner.SuiteFinished)
                {
                    try
                    {
                        UUnitIncrementalTestRunner.Tick();
                    }
                    catch (Exception exception)
                    {
                        DisplayException(exception);
                        return;
                    }
                }

                Device.BeginInvokeOnMainThread(() =>
                {
                    WriteConsoleColor(UUnitIncrementalTestRunner.Summary);
                    TestResultStack.Children.Add(new BoxView {
                        HeightRequest = 10, Color = Color.White
                    });
                });

                // Wait for OnComplete
                var timeout = DateTime.UtcNow + TimeSpan.FromSeconds(30);
                while (!_onCompleted && DateTime.UtcNow < timeout)
                {
                    Thread.Sleep(100);
                }

                Device.BeginInvokeOnMainThread(() =>
                {
                    WriteConsoleColor("Done!", UUnitIncrementalTestRunner.AllTestsPassed ? Color.Green : Color.Red);
                    RunTestsButton.Text     = originalButtonText;
                    RunTestsButton.Clicked += RunTests;
                });
            });
        }
        public int Execute(Dictionary <string, string> argsLc, Dictionary <string, string> argsCased)
        {
            UUnitIncrementalTestRunner.Start(false, null, null, null);
            while (!UUnitIncrementalTestRunner.SuiteFinished)
            {
                UUnitIncrementalTestRunner.Tick();
            }

            Console.WriteLine(UUnitIncrementalTestRunner.Summary);
            Console.WriteLine();
            return(UUnitIncrementalTestRunner.AllTestsPassed ? 0 : 1);
        }
Exemple #3
0
        public static async Task <int> MainTask(string[] args)
        {
            var testInputs = GetTestTitleData(args);

            UUnitIncrementalTestRunner.Start(true, null, testInputs, OnComplete);
            while (!UUnitIncrementalTestRunner.SuiteFinished)
            {
                await UUnitIncrementalTestRunner.Tick();
            }

            WriteConsoleColor(UUnitIncrementalTestRunner.Summary);

            return(UUnitIncrementalTestRunner.AllTestsPassed ? 0 : 1);
        }
Exemple #4
0
        public async Task <int> MainTask(string[] args)
        {
            await new PlayFabUtil.SynchronizationContextRemover();

            var testInputs = GetTestTitleData(args);

            UUnitIncrementalTestRunner.Start(true, null, testInputs, OnComplete);
            while (!UUnitIncrementalTestRunner.SuiteFinished)
            {
                label1.Text = await UUnitIncrementalTestRunner.Tick();
            }

            WriteConsoleColor(UUnitIncrementalTestRunner.Summary);

            return(UUnitIncrementalTestRunner.AllTestsPassed ? 0 : 1);
        }
Exemple #5
0
        private static int Main(string[] args)
        {
            Dictionary <string, string> testInputs = null;

            for (var i = 0; i < args.Length; i++)
            {
                if (args[i] == "-testInputsFile" && (i + 1) < args.Length)
                {
                    var filename = args[i + 1];
                    if (File.Exists(filename))
                    {
                        var testInputsFile = File.ReadAllText(filename);
                        testInputs = JsonWrapper.DeserializeObject <Dictionary <string, string> >(testInputsFile);
                    }
                    else
                    {
                        Console.WriteLine("Loading testSettings file failed: " + filename);
                        Console.WriteLine("From: " + Directory.GetCurrentDirectory());
                    }
                }
            }

            UUnitIncrementalTestRunner.Start(true, null, testInputs, OnComplete);
            while (!UUnitIncrementalTestRunner.SuiteFinished)
            {
                UUnitIncrementalTestRunner.Tick();
            }

            Console.WriteLine(UUnitIncrementalTestRunner.Summary);
            Console.WriteLine();

            // Wait for OnComplete
            var timeout = DateTime.UtcNow + TimeSpan.FromSeconds(30);

            while (!_onCompleted && DateTime.UtcNow < timeout)
            {
                Thread.Sleep(100);
            }

            return(UUnitIncrementalTestRunner.AllTestsPassed ? 0 : 1);
        }
Exemple #6
0
        public int Execute(Dictionary <string, string> argsLc, Dictionary <string, string> argsCased)
        {
            var testTitleData = TestTitleDataLoader.Load(null);

            UUnitIncrementalTestRunner.Start(false, null, testTitleData, null);
            // TODO: UUnitIncrementalTestRunner.AddAssembly();

            while (!UUnitIncrementalTestRunner.SuiteFinished)
            {
                UUnitIncrementalTestRunner.Tick();
            }

            var summaryLines = UUnitIncrementalTestRunner.Summary.Split('\n');

            foreach (var eachLine in summaryLines)
            {
                ConsoleColor color = eachLine.Contains("FAILED") ? ConsoleColor.Red : eachLine.Contains("PASSED") ? ConsoleColor.White : ConsoleColor.Yellow;
                JcuUtil.FancyWriteToConsole(color, eachLine);
            }
            Console.WriteLine();
            return(UUnitIncrementalTestRunner.AllTestsPassed ? 0 : 1);
        }
        private static int Main(string[] args)
        {
            var testInputs = GetTestTitleData(args);

            UUnitIncrementalTestRunner.Start(true, null, testInputs, OnComplete);
            while (!UUnitIncrementalTestRunner.SuiteFinished)
            {
                UUnitIncrementalTestRunner.Tick();
            }

            Console.WriteLine(UUnitIncrementalTestRunner.Summary);
            Console.WriteLine();

            // Wait for OnComplete
            var timeout = DateTime.UtcNow + TimeSpan.FromSeconds(30);

            while (!_onCompleted && DateTime.UtcNow < timeout)
            {
                Thread.Sleep(100);
            }

            return(Pause(UUnitIncrementalTestRunner.AllTestsPassed ? 0 : 1));
        }