Пример #1
0
        public override View GetView(Context context, View convertView, ViewGroup parent)
        {
            View view = base.GetView(context, convertView, parent);

            view.Click += delegate {
                if (TestCase.RunState != RunState.Runnable)
                {
                    return;
                }

                AndroidRunner runner = AndroidRunner.Runner;
                if (!runner.OpenWriter("Run " + TestCase.FullName, context))
                {
                    return;
                }

                try
                {
                    runner.Run(TestCase);
                }
                finally {
                    runner.CloseWriter();
                    Update();
                }

                if (!Result.IsSuccess())
                {
                    Intent intent = new Intent(context, typeof(TestResultActivity));
                    intent.PutExtra("TestCase", Name);
                    intent.AddFlags(ActivityFlags.NewTask);
                    context.StartActivity(intent);
                }
            };
            return(view);
        }
Пример #2
0
        public void Run()
        {
            Dictionary <string, string> testCases = new Dictionary <string, string>();
            int successCount = 0;
            int failureCount = 0;
            int errorCount   = 0;
            int noRunCount   = 0;

            AndroidRunner runner = AndroidRunner.Runner;

            if (!runner.OpenWriter("Run " + test_suite, this))
            {
                return;
            }

            try {
                foreach (ITest test in suite.Tests)
                {
                    TestResult result = test.Run(runner);
                    testCases.Add(test.FullName, result.ResultState.ToString());
                    switch (result.ResultState)
                    {
                    case ResultState.Success:
                        successCount++;
                        break;

                    case ResultState.Failure:
                        failureCount++;
                        break;

                    case ResultState.Error:
                        errorCount++;
                        break;

                    case ResultState.NotRun:
                        noRunCount++;
                        break;
                    }
                }
            }
            finally {
                runner.CloseWriter();
            }

            foreach (TestElement te in main)
            {
                te.Update();
            }

            foreach (string key in testCases.Keys)
            {
                Console.WriteLine("{0} : {1}", key, testCases [key]);
            }
            Console.WriteLine("TestCaseCount = {0}", suite.TestCaseCount);
            Console.WriteLine("Success Count = {0}", successCount);
            Console.WriteLine("Fail Count = {0}", failureCount);
            Console.WriteLine("Error Count = {0}", errorCount);
            Console.WriteLine("Not Run count = {0}", noRunCount);
        }
Пример #3
0
        public void Run()
        {
            AndroidRunner runner = AndroidRunner.Runner;

            if (!runner.OpenWriter("Run " + test_suite, this))
            {
                return;
            }

            try {
                foreach (NUnit.Framework.Internal.Test test in suite.Tests)
                {
                    runner.Run(test);
                }
            }
            finally {
                runner.CloseWriter();
            }

            foreach (TestElement te in main)
            {
                te.Update();
            }
        }