admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 1 | #/usr/bin/env python |
| 2 | ''' |
| 3 | Created on 07-Jan-2013 |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 4 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 5 | @author: Raghav Kashyap(raghavkashyap@paxterrasolutions.com) |
| 6 | |
| 7 | TestON is free software: you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation, either version 2 of the License, or |
| 10 | (at your option) any later version. |
| 11 | |
| 12 | TestON is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 18 | along with TestON. If not, see <http://www.gnu.org/licenses/>. |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 19 | |
| 20 | |
| 21 | ''' |
| 22 | |
| 23 | import logging |
| 24 | import datetime |
| 25 | import re |
| 26 | import os |
| 27 | class Logger: |
| 28 | ''' |
| 29 | Add continuous logs and reports of the test. |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 30 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 31 | @author: Raghav Kashyap(raghavkashyap@paxterrasolutions.com) |
| 32 | ''' |
| 33 | def _printHeader(self,main) : |
| 34 | ''' |
| 35 | Log's header will be append to the Log file |
| 36 | ''' |
| 37 | logmsg = "\n"+" " * 32+"+----------------+\n" +"-" * 30+" { Script And Files } "+"-" * 30+"\n" +" " * 32+"+----------------+\n"; |
| 38 | logmsg = logmsg + "\n\tScript Log File : " + main.LogFileName + "" |
| 39 | logmsg = logmsg + "\n\tReport Log File : " + main.ReportFileName + "" |
| 40 | for component in main.componentDictionary.keys(): |
| 41 | logmsg = logmsg + "\n\t"+component+" Session Log : " + main.logdir+"/"+component+".session" + "" |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 42 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 43 | logmsg = logmsg + "\n\tTest Script :" + path + "Tests/" + main.TEST + ".py"+ "" |
| 44 | logmsg = logmsg + "\n\tTest Params : " + path + "Tests/" + main.TEST + ".params" + "" |
Jon Hall | 368769f | 2014-11-19 15:43:35 -0800 | [diff] [blame] | 45 | logmsg = logmsg + "\n\tTopology : " + path + "Tests/" +main.TEST + ".topo" + "" |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 46 | logmsg = logmsg + "\n"+" " * 30+"+" +"-" * 18+"+" +"\n" +"-" * 27+" { Script Exec Params } "+"-" * 27 +"\n" +" " * 30 +"+"+"-" * 18 +"+\n"; |
| 47 | values = "\n\t" + str(main.params) |
| 48 | values = re.sub(",", "\n\t", values) |
| 49 | values = re.sub("{", "\n\t", values) |
| 50 | values = re.sub("}", "\n\t", values) |
| 51 | logmsg = logmsg + values |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 52 | logmsg = logmsg + "\n\n"+" " * 31+"+---------------+\n" +"-" * 29+" { Components Used } " +"-" * 29+"\n"+" " * 31+"+---------------+\n" |
| 53 | component_list = [] |
| 54 | component_list.append(None) |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 55 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 56 | # Listing the components in the order of test_target component should be first. |
| 57 | if type(main.componentDictionary) == dict: |
| 58 | for key in main.componentDictionary.keys(): |
| 59 | if main.test_target == key : |
| 60 | component_list[0] = key+"-Test Target" |
| 61 | else : |
| 62 | component_list.append(key) |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 63 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 64 | for index in range(len(component_list)) : |
| 65 | if index==0: |
| 66 | if component_list[index]: |
| 67 | logmsg+="\t"+component_list[index]+"\n" |
| 68 | elif index > 0 : |
| 69 | logmsg+="\t"+str(component_list[index])+"\n" |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 70 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 71 | logmsg = logmsg + "\n\n"+" " * 30+"+--------+\n" +"-" * 28+" { Topology } "+"-" * 28 +"\n" +" " * 30+"+--------+\n" |
| 72 | values = "\n\t" + str(main.topology['COMPONENT']) |
| 73 | values = re.sub(",", "\n\t", values) |
| 74 | values = re.sub("{", "\n\t", values) |
| 75 | values = re.sub("}", "\n\t", values) |
| 76 | logmsg = logmsg + values |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 77 | logmsg = logmsg + "\n"+"-" * 60+"\n" |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 78 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 79 | # enter into log file all headers |
| 80 | logfile = open(main.LogFileName,"w+") |
| 81 | logfile.write (logmsg) |
| 82 | print logmsg |
| 83 | main.logHeader = logmsg |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 84 | logfile.close() |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 85 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 86 | #enter into report file all headers |
| 87 | main.reportFile = open(main.ReportFileName,"w+") |
| 88 | main.reportFile.write(logmsg) |
| 89 | main.reportFile.close() |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 90 | |
Jon Hall | 79bec22 | 2015-04-30 16:23:30 -0700 | [diff] [blame] | 91 | #Sumamry file header |
| 92 | currentTime = str( main.STARTTIME.strftime("%d %b %Y %H:%M:%S") ) |
| 93 | main.summaryFile = open( main.SummaryFileName, "w+" ) |
| 94 | main.summaryFile.write( main.TEST + " at " + currentTime + "\n" ) |
| 95 | main.summaryFile.close() |
| 96 | |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 97 | #wiki file header |
| 98 | currentTime = str( main.STARTTIME.strftime("%d %b %Y %H:%M:%S") ) |
| 99 | main.wikiFile = open( main.WikiFileName, "w+" ) |
Jon Hall | 79bec22 | 2015-04-30 16:23:30 -0700 | [diff] [blame] | 100 | main.wikiFile.write( main.TEST + " at " + currentTime + "<p></p>\n" ) |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 101 | main.wikiFile.close() |
| 102 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 103 | def initlog(self,main): |
| 104 | ''' |
| 105 | Initialise all the log handles. |
| 106 | ''' |
| 107 | main._getTest() |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 108 | main.STARTTIME = datetime.datetime.now() |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 109 | |
| 110 | currentTime = re.sub("-|\s|:|\.", "_", str(main.STARTTIME.strftime("%d %b %Y %H:%M:%S"))) |
| 111 | if main.logdir: |
| 112 | main.logdir = main.logdir+ "/"+main.TEST + "_" + currentTime |
| 113 | else: |
| 114 | main.logdir = main.logs_path + main.TEST + "_" + currentTime |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 115 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 116 | os.mkdir(main.logdir) |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 117 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 118 | main.LogFileName = main.logdir + "/" + main.TEST + "_" +str(currentTime) + ".log" |
| 119 | main.ReportFileName = main.logdir + "/" + main.TEST + "_" + str(currentTime) + ".rpt" |
Jon Hall | 79bec22 | 2015-04-30 16:23:30 -0700 | [diff] [blame] | 120 | main.WikiFileName = main.logdir + "/" + main.TEST + "Wiki.txt" |
| 121 | main.SummaryFileName = main.logdir + "/" + main.TEST + "Summary.txt" |
Jon Hall | 94fd047 | 2014-12-08 11:52:42 -0800 | [diff] [blame] | 122 | main.JenkinsCSV = main.logdir + "/" + main.TEST + ".csv" |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 123 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 124 | #### Add log-level - Report |
| 125 | logging.addLevelName(9, "REPORT") |
| 126 | logging.addLevelName(7, "EXACT") |
Jon Hall | 0bde9ba | 2015-03-19 11:32:57 -0700 | [diff] [blame] | 127 | logging.addLevelName(11, "CASE") |
| 128 | logging.addLevelName(12, "STEP") |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 129 | main.log = logging.getLogger(main.TEST) |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 130 | def report(msg): |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 131 | ''' |
| 132 | Will append the report message to the logs. |
| 133 | ''' |
| 134 | main.log._log(9,msg,"OpenFlowAutoMattion","OFAutoMation") |
| 135 | currentTime = datetime.datetime.now() |
| 136 | currentTime = currentTime.strftime("%d %b %Y %H:%M:%S") |
| 137 | newmsg = "\n[REPORT] " +"["+ str(currentTime)+"] "+msg |
| 138 | print newmsg |
| 139 | main.reportFile = open(main.ReportFileName,"a+") |
| 140 | main.reportFile.write(newmsg) |
| 141 | main.reportFile.close() |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 142 | |
| 143 | main.log.report = report |
| 144 | |
Jon Hall | 79bec22 | 2015-04-30 16:23:30 -0700 | [diff] [blame] | 145 | def summary( msg ): |
| 146 | ''' |
| 147 | Will append the message to the txt file for the summary. |
| 148 | ''' |
| 149 | main.log._log(6,msg,"OpenFlowAutoMattion","OFAutoMation") |
| 150 | main.summaryFile = open(main.SummaryFileName,"a+") |
| 151 | main.summaryFile.write(msg+"\n") |
| 152 | main.summaryFile.close() |
| 153 | |
| 154 | main.log.summary = summary |
| 155 | |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 156 | def wiki( msg ): |
| 157 | ''' |
| 158 | Will append the message to the txt file for the wiki. |
| 159 | ''' |
| 160 | main.log._log(6,msg,"OpenFlowAutoMattion","OFAutoMation") |
| 161 | main.wikiFile = open(main.WikiFileName,"a+") |
| 162 | main.wikiFile.write(msg+"\n") |
| 163 | main.wikiFile.close() |
| 164 | |
| 165 | main.log.wiki = wiki |
| 166 | |
| 167 | def exact(exmsg): |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 168 | ''' |
| 169 | Will append the raw formatted message to the logs |
| 170 | ''' |
| 171 | main.log._log(7,exmsg,"OpenFlowAutoMattion","OFAutoMation") |
| 172 | main.reportFile = open(main.ReportFileName,"a+") |
| 173 | main.reportFile.write(exmsg) |
| 174 | main.reportFile.close() |
| 175 | logfile = open(main.LogFileName,"a") |
| 176 | logfile.write("\n"+ str(exmsg) +"\n") |
| 177 | logfile.close() |
| 178 | print exmsg |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 179 | |
| 180 | main.log.exact = exact |
| 181 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 182 | def case(msg): |
| 183 | ''' |
| 184 | Format of the case type log defined here. |
| 185 | ''' |
| 186 | main.log._log(9,msg,"OpenFlowAutoMattion","OFAutoMation") |
| 187 | currentTime = datetime.datetime.now() |
| 188 | newmsg = "["+str(currentTime)+"] " + "["+main.TEST+"] " + "[CASE] " +msg |
| 189 | logfile = open(main.LogFileName,"a") |
| 190 | logfile.write("\n"+ str(newmsg) +"\n") |
| 191 | logfile.close() |
| 192 | print newmsg |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 193 | |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 194 | main.log.case = case |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 195 | |
| 196 | def step(msg): |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 197 | ''' |
| 198 | Format of the step type log defined here. |
| 199 | ''' |
| 200 | main.log._log(9,msg,"OpenFlowAutoMattion","OFAutoMation") |
| 201 | currentTime = datetime.datetime.now() |
| 202 | newmsg = "["+str(currentTime)+"] " + "["+main.TEST+"] " + "[STEP] " +msg |
| 203 | logfile = open(main.LogFileName,"a") |
| 204 | logfile.write("\n"+ str(newmsg) +"\n") |
| 205 | logfile.close() |
| 206 | print newmsg |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 207 | |
| 208 | main.log.step = step |
| 209 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 210 | main.LogFileHandler = logging.FileHandler(main.LogFileName) |
| 211 | self._printHeader(main) |
| 212 | |
| 213 | ### initializing logging module and settig log level |
| 214 | main.log.setLevel(logging.INFO) |
Jon Hall | 0bde9ba | 2015-03-19 11:32:57 -0700 | [diff] [blame] | 215 | main.log.setLevel(logging.DEBUG) # Temporary |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 216 | main.LogFileHandler.setLevel(logging.INFO) |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 217 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 218 | # create console handler with a higher log level |
| 219 | main.ConsoleHandler = logging.StreamHandler() |
| 220 | main.ConsoleHandler.setLevel(logging.INFO) |
Jon Hall | 0bde9ba | 2015-03-19 11:32:57 -0700 | [diff] [blame] | 221 | main.ConsoleHandler.setLevel(logging.DEBUG) #Temporary |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 222 | # create formatter and add it to the handlers |
Jon Hall | 0bde9ba | 2015-03-19 11:32:57 -0700 | [diff] [blame] | 223 | #formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') |
| 224 | class MyFormatter( logging.Formatter ): |
| 225 | colors = { 'cyan': '\033[96m', 'purple': '\033[95m', |
| 226 | 'blue': '\033[94m', 'green': '\033[92m', |
| 227 | 'yellow': '\033[93m', 'red': '\033[91m', |
| 228 | 'end': '\033[0m' } |
| 229 | |
| 230 | FORMATS = {'DEFAULT': '%(asctime)s - %(name)s - %(levelname)s - %(message)s'} |
| 231 | if COLORS: # NOTE:colors will only be loaded if command is run from one line |
| 232 | # IE: './cli.py run testname' |
| 233 | # This is to prevent issues with Jenkins parsing |
| 234 | # TODO: Make colors configurable |
| 235 | levels = { logging.ERROR : colors['red'] + |
| 236 | FORMATS['DEFAULT'] + |
| 237 | colors['end'], |
| 238 | logging.WARN : colors['yellow'] + |
| 239 | FORMATS['DEFAULT'] + |
| 240 | colors['end'], |
| 241 | logging.DEBUG : colors['purple'] + |
| 242 | FORMATS['DEFAULT'] + |
| 243 | colors['end'] } |
| 244 | FORMATS.update( levels ) |
| 245 | |
| 246 | def format( self, record ): |
| 247 | self._fmt = self.FORMATS.get( record.levelno, |
| 248 | self.FORMATS[ 'DEFAULT' ] ) |
| 249 | return logging.Formatter.format( self, record ) |
| 250 | formatter = MyFormatter() |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 251 | main.ConsoleHandler.setFormatter(formatter) |
| 252 | main.LogFileHandler.setFormatter(formatter) |
| 253 | |
| 254 | # add the handlers to logger |
| 255 | main.log.addHandler(main.ConsoleHandler) |
| 256 | main.log.addHandler(main.LogFileHandler) |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 257 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 258 | def testSummary(self,main): |
| 259 | ''' |
| 260 | testSummary will take care about the Summary of test. |
| 261 | ''' |
| 262 | |
| 263 | main.ENDTIME = datetime.datetime.now() |
| 264 | main.EXECTIME = main.ENDTIME - main.STARTTIME |
| 265 | if (main.TOTAL_TC_PASS == 0): |
| 266 | main.TOTAL_TC_SUCCESS = 0 |
| 267 | else: |
| 268 | main.TOTAL_TC_SUCCESS = str((main.TOTAL_TC_PASS*100)/main.TOTAL_TC_RUN) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 269 | if (main.TOTAL_TC_RUN == 0) : |
| 270 | main.TOTAL_TC_EXECPERCENT = 0 |
| 271 | else : |
| 272 | main.TOTAL_TC_EXECPERCENT = str((main.TOTAL_TC_RUN*100)/main.TOTAL_TC_PLANNED) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 273 | testResult = "\n\n"+"*" * 37+"\n" + "\tTest Execution Summary\n" + "\n"+"*" * 37+" \n" |
| 274 | testResult = testResult + "\n Test Start : " + str(main.STARTTIME.strftime("%d %b %Y %H:%M:%S")) |
| 275 | testResult = testResult + "\n Test End : " + str(main.ENDTIME.strftime("%d %b %Y %H:%M:%S")) |
| 276 | testResult = testResult + "\n Execution Time : " + str(main.EXECTIME) |
| 277 | testResult = testResult + "\n Total tests planned : " + str(main.TOTAL_TC_PLANNED) |
| 278 | testResult = testResult + "\n Total tests RUN : " + str(main.TOTAL_TC_RUN) |
| 279 | testResult = testResult + "\n Total Pass : " + str(main.TOTAL_TC_PASS) |
| 280 | testResult = testResult + "\n Total Fail : " + str(main.TOTAL_TC_FAIL) |
| 281 | testResult = testResult + "\n Total No Result : " + str(main.TOTAL_TC_NORESULT) |
| 282 | testResult = testResult + "\n Success Percentage : " + str(main.TOTAL_TC_SUCCESS) + "%" |
| 283 | testResult = testResult + "\n Execution Result : " + str(main.TOTAL_TC_EXECPERCENT) + "%" |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 284 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 285 | #main.log.report(testResult) |
| 286 | main.testResult = testResult |
| 287 | main.log.exact(testResult) |
Jon Hall | 94fd047 | 2014-12-08 11:52:42 -0800 | [diff] [blame] | 288 | |
Jon Hall | 368769f | 2014-11-19 15:43:35 -0800 | [diff] [blame] | 289 | ##CSV output needed for Jenkin's plot plugin |
| 290 | #NOTE: the elements were orded based on the colors assigned to the data |
| 291 | logfile = open(main.JenkinsCSV ,"w") |
| 292 | logfile.write(",".join( ['Tests Failed', 'Tests Passed', 'Tests Planned'] ) + "\n") |
Jon Hall | 94fd047 | 2014-12-08 11:52:42 -0800 | [diff] [blame] | 293 | logfile.write(",".join( [str(int(main.TOTAL_TC_FAIL)), str(int(main.TOTAL_TC_PASS)), str(int(main.TOTAL_TC_PLANNED))] )) |
| 294 | logfile.close() |
| 295 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 296 | def updateCaseResults(self,main): |
| 297 | ''' |
| 298 | Update the case result based on the steps execution and asserting each step in the test-case |
| 299 | ''' |
| 300 | case = str(main.CurrentTestCaseNumber) |
Jon Hall | 79bec22 | 2015-04-30 16:23:30 -0700 | [diff] [blame] | 301 | currentResult = main.testCaseResult.get(case, 2) |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 302 | |
Jon Hall | 79bec22 | 2015-04-30 16:23:30 -0700 | [diff] [blame] | 303 | if currentResult == 2: |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 304 | main.TOTAL_TC_RUN = main.TOTAL_TC_RUN + 1 |
| 305 | main.TOTAL_TC_NORESULT = main.TOTAL_TC_NORESULT + 1 |
| 306 | main.log.exact("\n "+"*" * 29+"\n" + "\n Result: No Assertion Called \n"+"*" * 29+"\n") |
Jon Hall | 79bec22 | 2015-04-30 16:23:30 -0700 | [diff] [blame] | 307 | line = "Case "+case+": "+main.CurrentTestCase+" - No Result" |
| 308 | elif currentResult == 1: |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 309 | main.TOTAL_TC_RUN = main.TOTAL_TC_RUN + 1 |
| 310 | main.TOTAL_TC_PASS = main.TOTAL_TC_PASS + 1 |
| 311 | main.log.exact("\n"+"*" * 29+"\n Result: Pass \n"+"*" * 29+"\n") |
Jon Hall | 79bec22 | 2015-04-30 16:23:30 -0700 | [diff] [blame] | 312 | line = "Case "+case+": "+main.CurrentTestCase+" - PASS" |
| 313 | elif currentResult == 0: |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 314 | main.TOTAL_TC_RUN = main.TOTAL_TC_RUN + 1 |
| 315 | main.TOTAL_TC_FAIL = main.TOTAL_TC_FAIL + 1 |
| 316 | main.log.exact("\n"+"*" * 29+"\n Result: Failed \n"+"*" * 29+"\n") |
Jon Hall | 79bec22 | 2015-04-30 16:23:30 -0700 | [diff] [blame] | 317 | line = "Case "+case+": "+main.CurrentTestCase+" - FAIL" |
| 318 | else: |
| 319 | main.log.error( " Unknown result of case " + case + |
| 320 | ". Result was: " + currentResult ) |
| 321 | line = "Case "+case+": "+main.CurrentTestCase+" - ERROR" |
| 322 | main.log.wiki( "<h3>" + line + "</h3>" ) |
| 323 | main.log.summary( line ) |
Jon Hall | 81d3d39 | 2015-04-24 14:40:35 -0700 | [diff] [blame] | 324 | |