示例#1
0
        public MainPage()
        {
            _tunitrunner = new TRunner();
            _tunitrunner.LoadTestsuite();
            _listNotPass = new List <string>();
            _tcIDList    = new List <string>();
            _listItem    = new List <ItemData>();
            _listNotPass = TSettings.GetInstance().GetNotPassListManual();

            int count = 0;

            if (_listNotPass.Count == 0)
            {
                foreach (KeyValuePair <string, ITest> pair in _tunitrunner.GetTestList())
                {
                    count++;
                    _listItem.Add(new ItemData {
                        No = count, TCName = pair.Key, Result = StrResult.NOTRUN
                    });
                    _tcIDList.Add(pair.Key);
                }
            }
            else
            {
                foreach (var tc in _listNotPass)
                {
                    count++;
                    _listItem.Add(new ItemData {
                        No = count, TCName = tc, Result = StrResult.NOTRUN
                    });
                    _tcIDList.Add(tc);
                }
            }

            ResultNumber.Total = ResultNumber.NotRun = _tcIDList.Count;

            if (_listItem.Count != 0)
            {
                _testPage = TestPage.GetInstance();
                _testPage.Initialize(_tunitrunner, _tcIDList, _listItem);
                _testPage.TestcaseDone += OnTestcaseDone;
            }
            MakeWindowPage();

            _navigationPage = new NavigationPage(_mainContentPage);
            NavigationPage.SetHasNavigationBar(_mainContentPage, false);
            MainPage = _navigationPage;
        }
示例#2
0
        private void MakeTCInfoList()
        {
            foreach (var testcaseItem in _listItem)
            {
                foreach (KeyValuePair <string, ITest> pair in _tunitRunner.GetTestList())
                {
                    if (testcaseItem.TCName.Equals(pair.Key))
                    {
                        IEnumerator <CustomAttributeData> customAttributes = pair.Value.Method.MethodInfo.CustomAttributes.GetEnumerator();
                        List <string> _preconditonsStr   = new List <string>(); _preconditonsStr.Add("Preconditions:");
                        List <string> _stepsStr          = new List <string>(); _stepsStr.Add("Steps:");
                        List <string> _postconditionsStr = new List <string>(); _postconditionsStr.Add("Postconditions:\n");

                        while (customAttributes.MoveNext())
                        {
                            if (customAttributes.Current.AttributeType.FullName.Equals(STEP_ATTRIBUTE_NAME))
                            {
                                _stepsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);
                            }
                            else if (customAttributes.Current.AttributeType.FullName.Equals(PRECONDITION_ATTRIBUTE_NAME))
                            {
                                _preconditonsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);
                            }
                            else if (customAttributes.Current.AttributeType.FullName.Equals(POSTCONDITION_ATTRIBUTE_NAME))
                            {
                                _postconditionsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);
                            }
                        }

                        _tcInfoList.Add(new TestcaseInfo
                        {
                            TestcaseName   = pair.Key,
                            Preconditions  = _preconditonsStr,
                            Steps          = _stepsStr,
                            Postconditions = _postconditionsStr,
                        });
                        break;
                    }
                }
            }
        }