コード例 #1
0
ファイル: EDTestCase.py プロジェクト: yayahjb/edna-mx
    def processKernel(self):
        """
        Executes the test case.
        """
        EDVerbose.DEBUG("EDTestCase.processKernel")
        EDVerbose.screen()
        EDVerbose.unitTest(
            "==================================================================="
        )
        if self.getTestSuiteName() is not None:
            EDVerbose.unitTest("TEST SUITE : %s" % self.getTestSuiteName())
        EDVerbose.unitTest("TEST CASE  : %s" % self.getClassName())
        EDVerbose.unitTest(" ")
        if self.__strReasonForNotBeingExecuted == "":
            self.setTimeInit()
            iNumberMethods = self.getNumberOfTests()
            EDVerbose.unitTest("Total number of tests : %d" % iNumberMethods)
            EDVerbose.unitTest()
            iTestCaseNumber = 0
            if self.getListTest() == []:
                self.__strReasonForNotBeingExecuted = "No test methods!"
            else:
                for pyTestMethod in self.getListTest():
                    iTestCaseNumber = iTestCaseNumber + 1
                    strMethodName = EDUtilsTest.patchMethodName(pyTestMethod)
                    EDVerbose.unitTest(
                        "-------------------------------------------------------------------"
                    )
                    EDVerbose.unitTest("Test case method : %s" % strMethodName)
                    EDVerbose.unitTest()
                    try:
                        pyTestMethod()
                        self.__iNumberTestMethodSuccess += 1
                        EDVerbose.unitTest("%s executed with SUCCESS" %
                                           strMethodName)
                        EDVerbose.unitTest()

                    except AssertionError as pyException:
                        self.__dictMethodFailureMessages[strMethodName] = str(
                            pyException)
                        self.__iNumberTestMethodFailure += 1
                        EDVerbose.unitTest("Assertion Error Raised!")
                        EDVerbose.unitTest("%s executed with FAILURE" %
                                           strMethodName)
                        EDVerbose.unitTest()

                    except Exception as pyException:
                        self.__dictMethodFailureMessages[strMethodName] = str(
                            pyException)
                        self.__iNumberTestMethodFailure += 1
                        EDVerbose.unitTest("Unexpected Error!")
                        EDVerbose.unitTest("%s executed with FAILURE" %
                                           strMethodName)
                        EDVerbose.unitTest()
                        EDVerbose.writeErrorTrace()
                        EDVerbose.unitTest()
                self.__bIsExecuted = True
                self.setTimeEnd()
コード例 #2
0
ファイル: EDTestCase.py プロジェクト: gbourgh/edna
    def processKernel(self):
        """
        Executes the test case.
        """
        EDVerbose.DEBUG("EDTestCase.processKernel")
        EDVerbose.screen()
        EDVerbose.unitTest("===================================================================")
        if self.getTestSuiteName() is not None:
            EDVerbose.unitTest("TEST SUITE : %s" % self.getTestSuiteName())
        EDVerbose.unitTest("TEST CASE  : %s" % self.getClassName())
        EDVerbose.unitTest(" ")
        if self.__strReasonForNotBeingExecuted == "":
            self.setTimeInit()
            iNumberMethods = self.getNumberOfTests()
            EDVerbose.unitTest("Total number of tests : %d" % iNumberMethods)
            EDVerbose.unitTest()
            iTestCaseNumber = 0
            if self.getListTest() == []:
                self.__strReasonForNotBeingExecuted = "No test methods!"
            else:
                for pyTestMethod in self.getListTest():
                    iTestCaseNumber = iTestCaseNumber + 1
                    strMethodName = EDUtilsTest.patchMethodName(pyTestMethod)
                    EDVerbose.unitTest("-------------------------------------------------------------------")
                    EDVerbose.unitTest("Test case method : %s" % strMethodName)
                    EDVerbose.unitTest()
                    try:
                        pyTestMethod()
                        self.__iNumberTestMethodSuccess += 1
                        EDVerbose.unitTest("%s executed with SUCCESS" % strMethodName)
                        EDVerbose.unitTest()

                    except AssertionError, pyException:
                        self.__dictMethodFailureMessages[strMethodName] = str(pyException)
                        self.__iNumberTestMethodFailure += 1
                        EDVerbose.unitTest("Assertion Error Raised!")
                        EDVerbose.unitTest("%s executed with FAILURE" % strMethodName)
                        EDVerbose.unitTest()

                    except Exception, pyException:
                        self.__dictMethodFailureMessages[strMethodName] = str(pyException)
                        self.__iNumberTestMethodFailure += 1
                        EDVerbose.unitTest("Unexpected Error!")
                        EDVerbose.unitTest("%s executed with FAILURE" % strMethodName)
                        EDVerbose.unitTest()
                        EDVerbose.writeErrorTrace()
                        EDVerbose.unitTest()
                self.__bIsExecuted = True
                self.setTimeEnd()