def run(self):
     self.emit(SIGNAL('updateExecutionButtons'), False)
     # set default icon for all items
     for item in self.items:
         self.emit(SIGNAL('setItemIcon'), item, ItemIcon.DEFAULT)
     
     # parse and execute test caeses 
     handNumber = 1  
     failedTc = 0
     successfulTc = 0
     errorTc = 0 
     for item in self.items:     
         try:
             
             if self.executionStopped:
                 return
             
             self.emit(SIGNAL('logMessage'), " => Test case : " + item.text(),LogStyle.TITLE)
             file = item.data(Qt.UserRole) # get file name
             
             #parse test case 
             tc = TestCaseParser(file)
             tc.parse()
             
             #start test
             successful = self.autoPlayer.startTest(tc, handNumber)
             
             if self.executionStopped:
                 return
             
             if successful:
                 self.emit(SIGNAL('setItemIcon'), item, ItemIcon.SUCCESS)
                 successfulTc += 1
             else:
                 self.emit(SIGNAL('setItemIcon'), item, ItemIcon.FAILED)
                 failedTc += 1
             handNumber += 1
         except ParserException as e:
             self.emit(SIGNAL('setItemIcon'), item, ItemIcon.ERROR)
             self.emit(SIGNAL('logMessage'),"Parsing error: " + str(e),LogStyle.ERROR)
             errorTc += 1
         except socket.error:
             self.emit(SIGNAL('logMessage'),"Can't connect to Manual Mode",LogStyle.ERROR)
             self.stopExecution()
             self.emit(SIGNAL('updateExecutionButtons'), True) 
             return
         except Exception as e:
             self.emit(SIGNAL('logMessage'),"Unknown error: " + str(e),LogStyle.ERROR)
             errorTc += 1
             self.emit(SIGNAL('setItemIcon'), item, ItemIcon.ERROR)
     
     self.emit(SIGNAL('logMessage'), " => Execution finished",LogStyle.TITLE)
     
     #emit it all the time, simpler for parsing
     #if(len(self.items) > 1):                 
     self.emit(SIGNAL('logMessage'), "Result => Total: {0}, Successful: {1}, Failed: {2}, Error: {3}"
         .format(len(self.items),successfulTc,failedTc,errorTc),LogStyle.TITLE)
             
     self.emit(SIGNAL('updateExecutionButtons'), True) 
Example #2
0
 def parseListItem(self, item):
     """ Parses a list item and sets the status"""
     tc = item.data(Qt.UserRole)
     try:
         tcParser = TestCaseParser(tc.file)
         tcParser.parse()
         tc.info = tcParser.info
         tc.hand = tcParser.heroHand
         if(tc.status == TestCaseStatus.UNTESTED or tc.status == TestCaseStatus.ERROR):
             tc.status = TestCaseStatus.UNTESTED
       
     except ParserException as e:
         self.emit(SIGNAL('logMessage'), "Parsing error in file {0}. {1}".format(tc.fileName,str(e)), LogStyle.WARNING) 
         tc.info = str(e)
         tc.status = TestCaseStatus.ERROR
Example #3
0
    def run(self):
        self.emit(SIGNAL('updateExecutionButtons'), False)
        # set default icon for all items
        for item in self.items:
            self.emit(SIGNAL('setItemIcon'), item, ItemIcon.DEFAULT)

        # parse and execute test caeses
        handNumber = 1
        failedTc = 0
        successfulTc = 0
        errorTc = 0
        for item in self.items:
            try:

                if self.executionStopped:
                    return

                self.emit(SIGNAL('logMessage'),
                          " => Test case : " + item.text(), LogStyle.TITLE)
                file = item.data(Qt.UserRole)  # get file name

                #parse test case
                tc = TestCaseParser(file)
                tc.parse()

                #start test
                successful = self.autoPlayer.startTest(tc, handNumber)

                if self.executionStopped:
                    return

                if successful:
                    self.emit(SIGNAL('setItemIcon'), item, ItemIcon.SUCCESS)
                    successfulTc += 1
                else:
                    self.emit(SIGNAL('setItemIcon'), item, ItemIcon.FAILED)
                    failedTc += 1
                handNumber += 1
            except ParserException as e:
                self.emit(SIGNAL('setItemIcon'), item, ItemIcon.ERROR)
                self.emit(SIGNAL('logMessage'), "Parsing error: " + str(e),
                          LogStyle.ERROR)
                errorTc += 1
            except socket.error:
                self.emit(SIGNAL('logMessage'), "Can't connect to Manual Mode",
                          LogStyle.ERROR)
                self.stopExecution()
                self.emit(SIGNAL('updateExecutionButtons'), True)
                return
            except Exception as e:
                self.emit(SIGNAL('logMessage'), "Unknown error: " + str(e),
                          LogStyle.ERROR)
                errorTc += 1
                self.emit(SIGNAL('setItemIcon'), item, ItemIcon.ERROR)

        self.emit(SIGNAL('logMessage'), " => Execution finished",
                  LogStyle.TITLE)

        #emit it all the time, simpler for parsing
        #if(len(self.items) > 1):
        self.emit(
            SIGNAL('logMessage'),
            "Result => Total: {0}, Successful: {1}, Failed: {2}, Error: {3}".
            format(len(self.items), successfulTc, failedTc,
                   errorTc), LogStyle.TITLE)

        self.emit(SIGNAL('updateExecutionButtons'), True)
Example #4
0
 def run(self):
     self.emit(SIGNAL('updateExecutionButtons'), False)
     # set default icon for all items
     for item in self.items:
         self.emit(SIGNAL('updateItemStatus'), item, TestCaseStatus.UNTESTED, False)
     
     # parse and execute test caeses 
     handNumber = 1  
     failedTc = 0
     successfulTc = 0
     errorTc = 0 
     for item in self.items:     
         try:
             
             self.checkForPause()    
             if self.executionStopped:
                 return
             
             self.emit(SIGNAL('logMessage'), " => Test case : " + item.text(),LogStyle.TITLE)
             self.emit(SIGNAL('updateItemStatus'), item, TestCaseStatus.UNTESTED, True)
             tc = item.data(Qt.UserRole) # get file name
             
             #parse test case 
             tcp = TestCaseParser(tc.file)
             tcp.parse()
             
             #start test
             successful = self.autoPlayer.startTest(tcp, handNumber)
             
             self.checkForPause()
             if self.executionStopped:
                 return
             
             if successful:
                 self.emit(SIGNAL('updateItemStatus'), item, TestCaseStatus.SUCCESS, True)
                 successfulTc += 1
             else:
                 self.emit(SIGNAL('updateItemStatus'), item, TestCaseStatus.FAILED, True)
                 failedTc += 1
                 if(self.stopOnFail):
                     break
             handNumber += 1
         except ParserException as e:
             self.emit(SIGNAL('updateItemStatus'), item, TestCaseStatus.ERROR, True)
             self.emit(SIGNAL('logMessage'),"Parsing error: " + str(e),LogStyle.WARNING)
             errorTc += 1
             if(self.stopOnError):
                 break
         except socket.error:
             self.emit(SIGNAL('logMessage'),"Can't connect to player",LogStyle.ERROR)
             self.stopExecution()
             self.emit(SIGNAL('updateExecutionButtons'), True) 
             return
         except Exception as e:
             self.emit(SIGNAL('logMessage'),"Unknown error: " + str(e),LogStyle.ERROR)
             raise         
     
     self.emit(SIGNAL('logMessage'), " => Execution finished",LogStyle.TITLE)
     if(len(self.items) > 1):                 
         self.emit(SIGNAL('logMessage'), "Result => Total: {0}, Successful: {1}, Failed: {2}, Error: {3}"
                   .format(len(self.items),successfulTc,failedTc,errorTc),LogStyle.TITLE)
             
     self.emit(SIGNAL('updateExecutionButtons'), True)