update my forked branch
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index 8934e50..a15bb8c 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 '''
 Created on 22-Oct-2012
-    
+
 @author: Anil Kumar (anilkumar.s@paxterrasolutions.com)
 
 
@@ -16,7 +16,7 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with TestON.  If not, see <http://www.gnu.org/licenses/>.		
+    along with TestON.  If not, see <http://www.gnu.org/licenses/>.
 
 
 
@@ -31,6 +31,7 @@
 import __builtin__
 import new
 import xmldict
+import importlib
 module = new.module("test")
 import openspeak
 global path, drivers_path, core_path, tests_path,logs_path
@@ -46,52 +47,50 @@
 sys.path.append(tests_path)
 
 from core.utilities import Utilities
+from core.Thread import Thread
 
-import logging 
-import datetime
-from optparse import OptionParser
 
 class TestON:
     '''
-    
-    TestON will initiate the specified test. 
-    The main tasks are : 
-    * Initiate the required Component handles for the test. 
+    TestON will initiate the specified test.
+    The main tasks are :
+    * Initiate the required Component handles for the test.
     * Create Log file  Handles.
-    
     '''
     def __init__(self,options):
         '''
            Initialise the component handles specified in the topology file of the specified test.
-          
         '''
         # Initialization of the variables.
         __builtin__.main = self
-        
         __builtin__.path = path
         __builtin__.utilities = Utilities()
         self.TRUE = 1
         self.FALSE = 0
         self.ERROR = -1
+        self.NORESULT = 2
         self.FAIL = False
         self.PASS = True
-        self.CASERESULT = self.TRUE
+        self.CASERESULT = self.ERROR
+        self.STEPRESULT = self.NORESULT
+        self.stepResults = []
         self.init_result = self.TRUE
         self.testResult = "Summary"
-        self.stepName =""
-        self.EXPERIMENTAL_MODE = False   
+        self.stepName = ""
+        self.stepCache = ""
+        self.EXPERIMENTAL_MODE = False
         self.test_target = None
         self.lastcommand = None
-        self.testDir = tests_path 
-        self.configFile = config_path + "teston.cfg" 
+        self.testDir = tests_path
+        self.configFile = config_path + "teston.cfg"
         self.parsingClass = "xmlparser"
         self.parserPath = core_path + "/xmlparser"
         self.loggerPath = core_path + "/logger"
         self.loggerClass = "Logger"
         self.logs_path = logs_path
         self.driver = ''
-	
-        
+        self.Thread = Thread
+
         self.configparser()
         verifyOptions(options)
         load_logger()
@@ -100,18 +99,18 @@
         self.driversList=[]
         if type(self.componentDictionary) == str :
             self.componentDictionary = dict(self.componentDictionary)
-            
+
         for component in self.componentDictionary :
             self.driversList.append(self.componentDictionary[component]['type'])
-            
+
         self.driversList = list(set(self.driversList)) # Removing duplicates.
         # Checking the test_target option set for the component or not
         if type(self.componentDictionary) == dict:
             for component in self.componentDictionary.keys():
                 if 'test_target' in self.componentDictionary[component].keys():
                     self.test_target = component
-             
-        # Checking for the openspeak file and test script 
+
+        # Checking for the openspeak file and test script
         self.logger.initlog(self)
 
         # Creating Drivers Handles
@@ -128,7 +127,6 @@
             #Ordering components based on the connect order.
             ordered_component_list =sorted(components_connect_order, key=lambda key: components_connect_order[key])
             print ordered_component_list
-            
             for component in ordered_component_list:
                 self.componentInit(component)
 
@@ -142,28 +140,28 @@
             try :
                 self.configDict = xmldict.xml_to_dict(xml)
                 return self.configDict
-            except :
+            except Exception:
                 print "There is no such file to parse " + self.configFile
-                        
+
     def componentInit(self,component):
         '''
         This method will initialize specified component
         '''
         global driver_options
         self.log.info("Creating component Handle: "+component)
-        driver_options = {}         
+        driver_options = {}
         if 'COMPONENTS' in self.componentDictionary[component].keys():
             driver_options =dict(self.componentDictionary[component]['COMPONENTS'])
 
         driver_options['name']=component
         driverName = self.componentDictionary[component]['type']
         driver_options ['type'] = driverName
-        
+
         classPath = self.getDriverPath(driverName.lower())
-        driverModule = __import__(classPath, globals(), locals(), [driverName.lower()], -1)
+        driverModule = importlib.import_module(classPath)
         driverClass = getattr(driverModule, driverName)
         driverObject = driverClass()
-         
+
         connect_result = driverObject.connect(user_name = self.componentDictionary[component]['user'] if ('user' in self.componentDictionary[component].keys()) else getpass.getuser(),
                                               ip_address= self.componentDictionary[component]['host'] if ('host' in self.componentDictionary[component].keys()) else 'localhost',
                                               pwd = self.componentDictionary[component]['password'] if ('password' in self.componentDictionary[component].keys()) else 'changeme',
@@ -171,46 +169,49 @@
                                               options = driver_options)
         if not connect_result:
             self.log.error("Exiting form the test execution because the connecting to the "+component+" component failed.")
-            self.exit() 
-            
+            self.exit()
+
         vars(self)[component] = driverObject
-                        
+
     def run(self):
         '''
-           The Execution of the test script's cases listed in the Test params file will be done here. 
-           And Update each test case result. 
-           This method will return TRUE if it executed all the test cases successfully, 
+           The Execution of the test script's cases listed in the Test params file will be done here.
+           And Update each test case result.
+           This method will return TRUE if it executed all the test cases successfully,
            else will retun FALSE
         '''
-        
         self.testCaseResult = {}
         self.TOTAL_TC = 0
         self.TOTAL_TC_RUN = 0
-        self.TOTAL_TC_PLANNED = 0 
+        self.TOTAL_TC_PLANNED = 0
         self.TOTAL_TC_NORESULT = 0
         self.TOTAL_TC_FAIL = 0
         self.TOTAL_TC_PASS = 0
         self.TEST_ITERATION = 0
         self.stepCount = 0
-        self.CASERESULT = self.TRUE
-        
-        import testparser 
+        self.CASERESULT = self.NORESULT
+
+        import testparser
         testFile = self.tests_path + "/"+self.TEST + "/"+self.TEST + ".py"
         test = testparser.TestParser(testFile)
         self.testscript = test.testscript
         self.code = test.getStepCode()
-	repeat= int(self.params['repeat']) if ('repeat' in self.params) else 1
-	main.TOTAL_TC_PLANNED = len(self.testcases_list)*repeat
-        
+        repeat= int(self.params['repeat']) if ('repeat' in self.params) else 1
+        self.TOTAL_TC_PLANNED = len(self.testcases_list)*repeat
+
         result = self.TRUE
-	while(repeat):
+        while(repeat):
             for self.CurrentTestCaseNumber in self.testcases_list:
-                result = self.runCase(self.CurrentTestCaseNumber) 
-	    repeat-=1                   
+                result = self.runCase(self.CurrentTestCaseNumber)
+            repeat-=1
         return result
-    
+
     def runCase(self,testCaseNumber):
         self.CurrentTestCaseNumber = testCaseNumber
+        self.CurrentTestCase = ""
+        self.stepResults = []
+        self.stepName = ""
+        self.caseExplaination = ""
         result = self.TRUE
         self.stepCount = 0
         self.EXPERIMENTAL_MODE = self.FALSE
@@ -219,34 +220,89 @@
         stopped = False
         try :
             self.stepList = self.code[self.testCaseNumber].keys()
-        except KeyError,e:
-            main.log.error("There is no Test-Case "+ self.testCaseNumber)
-            return main.FALSE
-        
+        except KeyError:
+            self.log.error("There is no Test-Case "+ self.testCaseNumber)
+            return self.FALSE
+
         self.stepCount = 0
         while self.stepCount < len(self.code[self.testCaseNumber].keys()):
             result = self.runStep(self.stepList,self.code,self.testCaseNumber)
-            if result == main.FALSE:
+            if result == self.FALSE:
                 break
-            elif result == main.TRUE :
+            elif result == self.TRUE:
                 continue
-            
         if not stopped :
+            if all( self.TRUE == i for i in self.stepResults ):
+                # ALL PASSED
+                self.CASERESULT = self.TRUE
+            elif self.FALSE in self.stepResults:
+                # AT LEAST ONE FAILED
+                self.CASERESULT = self.FALSE
+            elif self.TRUE in self.stepResults:
+                # AT LEAST ONE PASSED
+                self.CASERESULT = self.TRUE
+            else:
+                self.CASERESULT = self.NORESULT
             self.testCaseResult[str(self.CurrentTestCaseNumber)] = self.CASERESULT
             self.logger.updateCaseResults(self)
+            self.log.wiki( "<p>" + self.caseExplaination + "</p>" )
+            self.log.summary( self.caseExplaination )
+            self.log.wiki( "<ul>" )
+            for line in self.stepCache.splitlines():
+                if re.search( " - PASS$", line ):
+                    self.log.wiki( "<li>" + line + "  <ac:emoticon ac:name=\"tick\" /></li>\n" )
+                elif re.search( " - FAIL$", line ):
+                    self.log.wiki( "<li>" + line + "  <ac:emoticon ac:name=\"cross\" /></li>\n" )
+                elif re.search( " - No Result$", line ):
+                    self.log.wiki( "<li>" + line + "  <ac:emoticon ac:name=\"warning\" /></li>\n" )
+            self.log.wiki( "</ul>" )
+            self.log.summary( self.stepCache )
+            self.stepCache = ""
         return result
-    
+
     def runStep(self,stepList,code,testCaseNumber):
         if not cli.pause:
             try :
                 step = stepList[self.stepCount]
+                self.STEPRESULT = self.NORESULT
                 exec code[testCaseNumber][step] in module.__dict__
                 self.stepCount = self.stepCount + 1
+                if step > 0:
+                    self.stepCache += "\t"+str(testCaseNumber)+"."+str(step)+" "+self.stepName+" - "
+                    if self.STEPRESULT == self.TRUE:
+                        self.stepCache += "PASS\n"
+                        #self.stepCache += "PASS  <ac:emoticon ac:name=\"tick\" /></li>\n"
+                    elif self.STEPRESULT == self.FALSE:
+                        self.stepCache += "FAIL\n"
+                        #self.stepCache += "FAIL  <ac:emoticon ac:name=\"cross\" /></li>\n"
+                    else:
+                        self.stepCache += "No Result\n"
+                        #self.stepCache += "No Result  <ac:emoticon ac:name=\"warning\" /></li>\n"
+                    self.stepResults.append(self.STEPRESULT)
             except TypeError,e:
+                print "\nException in the following section of code: " +\
+                      str(testCaseNumber) + "." + str(step) + ": " +\
+                      self.stepName
+                #print code[testCaseNumber][step]
                 self.stepCount = self.stepCount + 1
-                self.log.error(e)
+                self.log.exception(e)
+                self.logger.updateCaseResults(self)
+                #WIKI results
+                self.log.wiki( "<ul>" )
+                for line in self.stepCache.splitlines():
+                    if re.search( " - PASS$", line ):
+                        self.log.wiki( "<li>" + line + "  <ac:emoticon ac:name=\"tick\" /></li>\n" )
+                    elif re.search( " - FAIL$", line ):
+                        self.log.wiki( "<li>" + line + "  <ac:emoticon ac:name=\"cross\" /></li>\n" )
+                    elif re.search( " - No Result$", line ):
+                        self.log.wiki( "<li>" + line + "  <ac:emoticon ac:name=\"warning\" /></li>\n" )
+                self.log.wiki( "</ul>" )
+                #summary results
+                self.log.summary( self.stepCache )
+                self.stepCache = ""
+                self.cleanup()
+                self.exit()
             return main.TRUE
-        
         if cli.stop:
             cli.stop = False
             stopped = True
@@ -255,21 +311,21 @@
             self.logger.updateCaseResults(self)
             result = self.cleanup()
             return main.FALSE
-        
+
     def addCaseHeader(self):
         caseHeader = "\n"+"*" * 30+"\n Result summary for Testcase"+str(self.CurrentTestCaseNumber)+"\n"+"*" * 30+"\n"
-        self.log.exact(caseHeader) 
-        caseHeader = "\n"+"*" * 40 +"\nStart of Test Case"+str(self.CurrentTestCaseNumber)+" : " 
+        self.log.exact(caseHeader)
+        caseHeader = "\n"+"*" * 40 +"\nStart of Test Case"+str(self.CurrentTestCaseNumber)+" : "
         for driver in self.componentDictionary.keys():
             vars(self)[driver+'log'].info(caseHeader)
-    
+
     def addCaseFooter(self):
         if self.stepCount-1 > 0 :
             previousStep = " "+str(self.CurrentTestCaseNumber)+"."+str(self.stepCount-1)+": "+ str(self.stepName) + ""
             stepHeader = "\n"+"*" * 40+"\nEnd of Step "+previousStep+"\n"+"*" * 40+"\n"
-            
+
         caseFooter = "\n"+"*" * 40+"\nEnd of Test case "+str(self.CurrentTestCaseNumber)+"\n"+"*" * 40+"\n"
-            
+
         for driver in self.driversList:
             vars(self)[driver].write(stepHeader+"\n"+caseFooter)
 
@@ -282,39 +338,38 @@
         '''
         result = self.TRUE
         self.logger.testSummary(self)
-        
+
         #self.reportFile.close()
-        
 
         #utilities.send_mail()
-        try :
-            for component in self.componentDictionary.keys():
-                tempObject  = vars(self)[component]    
-                print "Disconnecting "+str(tempObject)
-         
+        for component in self.componentDictionary.keys():
+            try :
+                tempObject  = vars(self)[component]
+                print "Disconnecting from " + str(tempObject.name) + ": " + \
+                      str(tempObject)
                 tempObject.disconnect()
-            #tempObject.execute(cmd="exit",prompt="(.*)",timeout=120) 
+            #tempObject.execute(cmd="exit",prompt="(.*)",timeout=120)
 
-        except(Exception):
-            #print " There is an error with closing hanldes"
-            result = self.FALSE
+            except (Exception):
+                self.log.exception( "Exception while disconnecting from " +
+                                     str( component ) )
+                result = self.FALSE
         # Closing all the driver's session files
         for driver in self.componentDictionary.keys():
            vars(self)[driver].close_log_handles()
-           
+
         return result
-        
+
     def pause(self):
         '''
         This function will pause the test's execution, and will continue after user provide 'resume' command.
         '''
         __builtin__.testthread.pause()
-    
+
     def onfail(self,*components):
         '''
-        When test step failed, calling all the components onfail. 
+        When test step failed, calling all the components onfail.
         '''
-         
         if not components:
             try :
                 for component in self.componentDictionary.keys():
@@ -323,7 +378,6 @@
             except(Exception),e:
                 print str(e)
                 result = self.FALSE
-                
         else:
             try :
                 for component in components:
@@ -332,8 +386,7 @@
             except(Exception),e:
                 print str(e)
                 result = self.FALSE
-    
-    
+
     def getDriverPath(self,driverName):
         '''
            Based on the component 'type' specified in the params , this method will find the absolute path ,
@@ -343,23 +396,22 @@
 
         cmd = "find "+drivers_path+" -name "+driverName+".py"
         result = commands.getoutput(cmd)
-        
+
         result_array = str(result).split('\n')
         result_count = 0
-        
+
         for drivers_list in result_array:
             result_count = result_count+1
         if result_count > 1 :
             print "found "+driverName+" "+ str(result_count) + "  times"+str(result_array)
             self.exit()
-            
+
         result = re.sub("(.*)drivers","",result)
         result = re.sub("\.py","",result)
         result = re.sub("\.pyc","",result)
         result = re.sub("\/",".",result)
         result = "drivers"+result
         return result
-    
 
     def step(self,stepDesc):
         '''
@@ -374,34 +426,34 @@
                 stepName = " INIT : Initializing the test case :"+self.CurrentTestCase
         except AttributeError:
                 stepName = " INIT : Initializing the test case :"+str(self.CurrentTestCaseNumber)
-            
+
         self.log.step(stepName)
         stepHeader = ""
         if self.stepCount > 1 :
             stepHeader = "\n"+"-"*45+"\nEnd of Step "+previousStep+"\n"+"-"*45+"\n"
-        
-        stepHeader += "\n"+"-"*45+"\nStart of Step"+stepName+"\n"+"-"*45+"\n" 
+
+        stepHeader += "\n"+"-"*45+"\nStart of Step"+stepName+"\n"+"-"*45+"\n"
         for driver in self.componentDictionary.keys():
             vars(self)[driver+'log'].info(stepHeader)
-            
+
     def case(self,testCaseName):
         '''
            Test's each test-case information will append to the logs.
         '''
-        self.CurrentTestCase = testCaseName 
+        self.CurrentTestCase = testCaseName
         testCaseName = " " + str(testCaseName) + ""
         self.log.case(testCaseName)
-        caseHeader = testCaseName+"\n"+"*" * 40+"\n" 
+        caseHeader = testCaseName+"\n"+"*" * 40+"\n"
         for driver in self.componentDictionary.keys():
             vars(self)[driver+'log'].info(caseHeader)
-        
+
     def testDesc(self,description):
         '''
            Test description will append to the logs.
         '''
         description = "Test Description : " + str (description) + ""
         self.log.info(description)
-        
+
     def _getTest(self):
         '''
            This method will parse the test script to find required test information.
@@ -417,65 +469,57 @@
             if lineMatch:
                 counter  = counter + 1
                 self.TC_PLANNED = len(self.testcases_list)
-        
-                
+
     def response_parser(self,response, return_format):
         ''' It will load the default response parser '''
         response_dict = {}
         response_dict = self.response_to_dict(response, return_format)
-        return_format_string = self.dict_to_return_format(response,return_format,response_dict)   
+        return_format_string = self.dict_to_return_format(response,return_format,response_dict)
         return return_format_string
-    
+
     def response_to_dict(self,response,return_format):
-        
         response_dict = {}
         json_match = re.search('^\s*{', response)
         xml_match = re.search('^\s*\<', response)
         ini_match = re.search('^\s*\[', response)
         if json_match :
-            main.log.info(" Response is in 'JSON' format and Converting to '"+return_format+"' format")
-            # Formatting the json string 
-            
+            self.log.info(" Response is in 'JSON' format and Converting to '"+return_format+"' format")
+            # Formatting the json string
             response = re.sub(r"{\s*'?(\w)", r'{"\1', response)
             response = re.sub(r",\s*'?(\w)", r',"\1', response)
             response = re.sub(r"(\w)'?\s*:", r'\1":', response)
             response = re.sub(r":\s*'(\w)'\s*([,}])", r':"\1"\2', response)
-            
             try :
                 import json
                 response_dict = json.loads(response)
-            except Exception , e :
-                print e
-                main.log.error("Json Parser is unable to parse the string")
+            except Exception, e:
+                self.log.exception( e )
+                self.log.error("Json Parser is unable to parse the string")
             return response_dict
-        
         elif ini_match :
-            main.log.info(" Response is in 'INI' format and Converting to '"+return_format+"' format")
+            self.log.info(" Response is in 'INI' format and Converting to '"+return_format+"' format")
             from configobj import ConfigObj
             response_file = open("respnse_file.temp",'w')
             response_file.write(response)
-            response_file.close() 
+            response_file.close()
             response_dict = ConfigObj("respnse_file.temp")
             return response_dict
-            
         elif xml_match :
-            main.log.info(" Response is in 'XML' format and Converting to '"+return_format+"' format")
+            self.log.info(" Response is in 'XML' format and Converting to '"+return_format+"' format")
             try :
-                from core import dicttoobject
                 response_dict = xmldict.xml_to_dict("<response> "+str(response)+" </response>")
             except Exception, e:
-                main.log.error(e)
+                self.log.exception( e )
             return response_dict
-        
+
     def dict_to_return_format(self,response,return_format,response_dict):
-        
         if return_format =='table' :
             ''' Will return in table format'''
             to_do = "Call the table output formatter"
             global response_table
             response_table = '\n'
             response_table = response_table +'\t'.join(response_dict)+"\n"
-            
+
             def get_table(value_to_convert):
                 ''' This will parse the dictionary recusrsively and print as table format'''
                 table_data = ""
@@ -485,17 +529,13 @@
                         table_data = table_data + get_table(temp_val)
                 else :
                     table_data = table_data + str(value_to_convert) +"\t"
-                return table_data 
-            
+                return table_data
+
             for value in response_dict.values() :
                 response_table =  response_table + get_table(value)
-                
-
-                
-            #response_table = response_table + '\t'.join(response_dict.values())
-                
+            # response_table = response_table + '\t'.join(response_dict.values())
             return response_table
-        
+
         elif return_format =='config':
             ''' Will return in config format'''
             to_do = 'Call dict to config coverter'
@@ -507,25 +547,22 @@
             response_config = re.sub("}", "\n", response_config)
             response_config = re.sub(":", " =", response_config)
             return "[response]\n\t "+response_config
-            
         elif return_format == 'xml':
             ''' Will return in xml format'''
-            from core import dicttoobject
             response_xml = xmldict.dict_to_xml(response_dict)
             response_xml = re.sub(">\s*<", ">\n<", response_xml)
             return "\n"+response_xml
-        
         elif return_format == 'json':
             ''' Will return in json format'''
             to_do = 'Call dict to xml coverter'
             import json
             response_json = json.dumps(response_dict)
             return response_json
-    
+
     def get_random(self):
         self.random_order = self.random_order + 1
         return self.random_order
-        
+
     def exit(self):
         __builtin__.testthread = None
         sys.exit()
@@ -537,7 +574,7 @@
     import pprint
     pp = pprint.PrettyPrinter(indent=4)
 
-    #pp.pprint(options)
+    # pp.pprint(options)
     verifyTest(options)
     verifyExample(options)
     verifyTestScript(options)
@@ -564,16 +601,16 @@
         main.testDir = path+'/examples/'
         main.tests_path = path+"/examples/"
         main.classPath = "examples."+main.TEST+"."+main.TEST
-               
+
 def verifyLogdir(options):
-    #Verifying Log directory option      
+    # Verifying Log directory option
     if options.logdir:
         main.logdir = options.logdir
     else :
-        main.logdir = main.FALSE  
-        
+        main.logdir = main.FALSE
+
 def verifyMail(options):
-    # Checking the mailing list 
+    # Checking the mailing list
     if options.mail:
         main.mail = options.mail
     elif main.params.has_key('mail'):
@@ -582,10 +619,10 @@
         main.mail = 'paxweb@paxterrasolutions.com'
 
 def verifyTestCases(options):
-    #Getting Test cases list 
+    # Getting Test cases list
     if options.testcases:
-	testcases_list = options.testcases 
-        #sys.exit() 
+        testcases_list = options.testcases
+        # sys.exit()
         testcases_list = re.sub("(\[|\])", "", options.testcases)
         main.testcases_list = eval(testcases_list+",")
     else :
@@ -593,27 +630,27 @@
             temp = eval(main.params['testcases']+",")
             list1=[]
             if type(temp[0])==list:
-	        for test in temp:
-      	            for testcase in test:
-	                if type(testcase)==int:
-		            testcase=[testcase]
-	                list1.extend(testcase)
-	    else :
-	    	temp=list(temp)
-      	        for testcase in temp:
-	            if type(testcase)==int:
-		        testcase=[testcase]
-	            list1.extend(testcase)
-	    main.testcases_list=list1	                                     
+                for test in temp:
+                    for testcase in test:
+                        if type(testcase)==int:
+                            testcase=[testcase]
+                        list1.extend(testcase)
+            else :
+                temp=list(temp)
+                for testcase in temp:
+                    if type(testcase)==int:
+                        testcase=[testcase]
+                    list1.extend(testcase)
+            main.testcases_list=list1
         else :
             print "testcases not specifed in params, please provide in params file or 'testcases' commandline argument"
-            sys.exit() 
-                  
+            sys.exit()
+
 def verifyTestScript(options):
     '''
     Verifyies test script.
     '''
-    main.openspeak = openspeak.OpenSpeak()        
+    main.openspeak = openspeak.OpenSpeak()
     openspeakfile = main.testDir+"/" + main.TEST + "/" + main.TEST + ".ospk"
     testfile = main.testDir+"/" + main.TEST + "/" + main.TEST + ".py"
     if os.path.exists(openspeakfile) :
@@ -624,32 +661,30 @@
         print "\nThere is no :\""+main.TEST+"\" test, Please Provide OpenSpeak Script/ test script"
         __builtin__.testthread = None
         main.exit()
-              
     try :
         testModule = __import__(main.classPath, globals(), locals(), [main.TEST], -1)
     except(ImportError):
         print "There was an import error, it might mean that there is no test like "+main.TEST
-        main.exit()       
+        main.exit()
 
     testClass = getattr(testModule, main.TEST)
     main.testObject = testClass()
     load_parser()
-    main.params = main.parser.parseParams(main.classPath)    
-    main.topology = main.parser.parseTopology(main.classPath) 
-    
+    main.params = main.parser.parseParams(main.classPath)
+    main.topology = main.parser.parseTopology(main.classPath)
+
 def verifyParams():
     try :
         main.params = main.params['PARAMS']
     except(KeyError):
         print "Error with the params file: Either the file not specified or the format is not correct"
-        main.exit()            
-    
+        main.exit()
     try :
         main.topology = main.topology['TOPOLOGY']
     except(KeyError):
         print "Error with the Topology file: Either the file not specified or the format is not correct"
         main.exit()
-        
+
 def load_parser() :
     '''
     It facilitates the loading customised parser for topology and params file.
@@ -671,19 +706,17 @@
                     main.parser = parsingClass()
                     #hashobj = main.parser.parseParams(main.classPath)
                     if hasattr(main.parser,"parseParams") and hasattr(main.parser,"parseTopology") and hasattr(main.parser,"parse") :
-                        
                         pass
                     else:
                         main.exit()
-
                 except ImportError:
                     print sys.exc_info()[1]
                     main.exit()
             else :
                 print "No Such File Exists !!"+ confighash['config']['parser']['file'] +"using default parser"
-                load_defaultParser() 
-        elif confighash['config']['parser']['file'] == None or confighash['config']['parser']['class'] == None :  
-            load_defaultParser() 
+                load_defaultParser()
+        elif confighash['config']['parser']['file'] == None or confighash['config']['parser']['class'] == None :
+            load_defaultParser()
     else:
         load_defaultParser()
 
@@ -694,7 +727,7 @@
     moduleList = main.parserPath.split("/")
     newModule = ".".join([moduleList[len(moduleList) - 2],moduleList[len(moduleList) - 1]])
     try :
-        parsingClass = main.parsingClass 
+        parsingClass = main.parsingClass
         parsingModule = __import__(newModule, globals(), locals(), [parsingClass], -1)
         parsingClass = getattr(parsingModule, parsingClass)
         main.parser = parsingClass()
@@ -706,7 +739,6 @@
     except ImportError:
         print sys.exc_info()[1]
 
-
 def load_logger() :
     '''
     It facilitates the loading customised parser for topology and params file.
@@ -733,8 +765,8 @@
             else :
                 print "No Such File Exists !!"+confighash['config']['logger']['file']+ "Using default logger"
                 load_defaultlogger()
-        elif confighash['config']['parser']['file'] == None or confighash['config']['parser']['class'] == None :  
-            load_defaultlogger() 
+        elif confighash['config']['parser']['file'] == None or confighash['config']['parser']['class'] == None :
+            load_defaultlogger()
     else:
         load_defaultlogger()
 
@@ -745,23 +777,7 @@
     moduleList = main.loggerPath.split("/")
     newModule = ".".join([moduleList[len(moduleList) - 2],moduleList[len(moduleList) - 1]])
     try :
-        loggerClass = main.loggerClass 
-        loggerModule = __import__(newModule, globals(), locals(), [loggerClass], -1)
-        loggerClass = getattr(loggerModule, loggerClass)
-        main.logger = loggerClass()
-
-    except ImportError:
-        print sys.exc_info()[1]
-        main.exit()    
-
-def load_defaultlogger():
-    '''
-    It will load the default parser which is xml parser to parse the params and topology file.
-    '''
-    moduleList = main.loggerPath.split("/")
-    newModule = ".".join([moduleList[len(moduleList) - 2],moduleList[len(moduleList) - 1]])
-    try :
-        loggerClass = main.loggerClass 
+        loggerClass = main.loggerClass
         loggerModule = __import__(newModule, globals(), locals(), [loggerClass], -1)
         loggerClass = getattr(loggerModule, loggerClass)
         main.logger = loggerClass()
@@ -770,8 +786,21 @@
         print sys.exc_info()[1]
         main.exit()
 
+def load_defaultlogger():
+    '''
+    It will load the default parser which is xml parser to parse the params and topology file.
+    '''
+    moduleList = main.loggerPath.split("/")
+    newModule = ".".join([moduleList[len(moduleList) - 2],moduleList[len(moduleList) - 1]])
+    try :
+        loggerClass = main.loggerClass
+        loggerModule = __import__(newModule, globals(), locals(), [loggerClass], -1)
+        loggerClass = getattr(loggerModule, loggerClass)
+        main.logger = loggerClass()
 
-
+    except ImportError:
+        print sys.exc_info()[1]
+        main.exit()
 
 def _echo(self):
     print "THIS IS ECHO"