Exemple #1
0
        //calls a method.
        //if no exceptions were thrown then the test was a success.
        //if they were, then test failed
        //SelectTest stores the success values in the testInfo object
        public static string SelectTest(MethodInfo method, MethodTestInfo testInfo)
        {
            bool testPassed = true;

            try
            {
                JesterUtilities.RunTestMethod(method);
            }
            catch (TargetInvocationException ex)
            {
                testPassed = false;
                string errorInfo = JesterUtilities.GetErrorInfo(ex.InnerException);
                testInfo.ErrorInfo = errorInfo;
                testInfo.SetTestStatus(JestResultsEnum.FAILED);
                return(errorInfo);
            }

            if (testPassed)
            {
                string errorInfo = "Test Passed!";
                testInfo.ErrorInfo = errorInfo;
                testInfo.SetTestStatus(JestResultsEnum.PASSED);
                return(errorInfo);
            }
            else
            {
                return(null);
            }
        }
Exemple #2
0
        private void AddTest(MethodInfo m)
        {
            ListViewItem.ListViewSubItem[] subItems =
                new ListViewItem.ListViewSubItem[2];

            subItems[0] = new ListViewItem.ListViewSubItem(null, m.Name);
            subItems[1] = new ListViewItem.ListViewSubItem(null, JestResultsEnum.NOT_RUN.display);

            ListViewItem item = new ListViewItem(subItems, 0);

            item.UseItemStyleForSubItems = false;
            listView1.Items.Add(item);
            MethodTestInfo methodTest = new MethodTestInfo()
            {
                MethodName      = m.Name,
                Method          = m,
                ErrorInfo       = String.Empty,
                ListViewSubItem = subItems[TEST_STATUS_INDEX]
            };

            methodDictionary.Add(m.Name, methodTest);
        }
Exemple #3
0
        private string SelectTest(MethodInfo method)
        {
            MethodTestInfo testInfo = methodDictionary[method.Name];

            return(JesterUtilities.SelectTest(method, testInfo));
        }