Exemplo n.º 1
0
        protected override void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);

            test_suite = Intent.GetStringExtra ("TestSuite");
            suite = AndroidRunner.Suites [test_suite];

            var menu = new RootElement (String.Empty);
            
            main = new Section (test_suite);
            foreach (ITest test in suite.Tests) {
                TestSuite ts = test as TestSuite;
                if (ts != null)
                    main.Add (new TestSuiteElement (ts));
                else
                    main.Add (new TestCaseElement (test as TestCase));
            }
            menu.Add (main);

            Section options = new Section () {
                new ActionElement ("Run all", Run),
            };
            menu.Add (options);

            var da = new DialogAdapter (this, menu);
            var lv = new ListView (this) {
                Adapter = da
            };
            SetContentView (lv);
        }
Exemplo n.º 2
0
		public TestSuiteElement (TestSuite test, TouchRunner runner)
			: base (test, runner)
		{
			Caption = Suite.Name;
			int count = Suite.TestCaseCount;
			if (count > 0) {
				Accessory = UITableViewCellAccessory.DisclosureIndicator;
				DetailColor = DarkGreen;
				Value = String.Format ("{0} test case{1}, {2}", count, count == 1 ? String.Empty : "s", Suite.RunState);
				Tapped += delegate {
					runner.Show (Suite);
				};
			} else {
				DetailColor = UIColor.Orange;
				Value = "No test found inside the assembly";
			}
		}
Exemplo n.º 3
0
		void Add (TestSuite suite)
		{
			AndroidRunner.Suites.Add (suite.FullName ?? suite.Name, suite);
			foreach (ITest test in suite.Tests) {
				TestSuite ts = (test as TestSuite);
				if (ts != null)
					Add (ts);
			}
		}
Exemplo n.º 4
0
		public TestSuiteElement (TestSuite suite) : base (suite)
		{
			if (Suite.TestCaseCount > 0)
				Indicator = ">"; // hint there's more
		}
Exemplo n.º 5
0
		TestSuiteElement Setup (TestSuite suite)
		{
			TestSuiteElement tse = new TestSuiteElement (suite, this);
			suite_elements.Add (suite, tse);
			
			var root = new RootElement ("Tests");
		
			Section section = new Section (suite.Name);
			foreach (ITest test in suite.Tests) {
				TestSuite ts = (test as TestSuite);
				if (ts != null) {
					section.Add (Setup (ts));
				} else {
					TestCase tc = (test as TestCase);
					if (tc != null) {
						section.Add (Setup (tc));
					} else {
						throw new NotImplementedException (test.GetType ().ToString ());
					}
				}
			}
		
			root.Add (section);
			
			if (section.Count > 1) {
				Section options = new Section () {
					new StringElement ("Run all", delegate () {
						Run (suite);
					})
				};
				root.Add (options);
			}
				
			suites_dvc.Add (suite, new DialogViewController (root, true));
			return tse;
		}
Exemplo n.º 6
0
		public void Show (TestSuite suite)
		{
			NavigationController.PushViewController (suites_dvc [suite], true);
		}
Exemplo n.º 7
0
		void Run (TestSuite suite)
		{
			suite_elements [suite].Run ();
		}