← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #251396]: How to create xml report using xmltestrunner for test suite

 

Question #251396 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/251396

Harry gave more information on the question:

I have written the following script But blank xml file is getting generated in the specified path.
Please tell me if anything is wrong in the code.

import unittest
from xmlrunner import *
import comres
from launchemulator import * 
from phonevalidation import *
from invalidcode import *
from callme import *

class xmlreport(unittest.TestCase):
    def open_the_emulator_and_launch_the_securechatapp(self):
        try:
            emuobj = launchemulator()        
            res=emuobj.emulator()
            if(res=="Fail"):
                self.fail()            
        except:
            raise

    def phone_number_validations(self):
        try:
            phnobj = phonevalidation()
            res=phnobj.blank_number()
            if(res=="Fail"):
                self.fail()
            
            res1=phnobj.invalid_number(comres.inv_no)
            if(res1=="Fail"):
                self.fail()
            
            res2=phnobj.valid_number()
            if(res2=="Fail"):
                self.fail()
            
            res3=phnobj.popup_edit()
            if(res3=="Fail"):
                self.fail()

            res4=phnobj.pencil_edit()
            if(res4=="Fail"):
                self.fail()    
        except:
            raise

    def putting_invalid_otp_code(self):
        try: 
            invobj = invalidcode()
            res=invobj.inval_otpcode(comres.inv_otp)            
            if(res=="Fail"):
                self.fail()
        except:
                raise              
             
    def getting_otp_code_through_phone_call(self):
        try:
            callobj = callme()
            res=callobj.val_otpcode()
            if(res=="Fail"):
                self.fail()
        except:
            raise

def createSuite():
    suite = unittest.TestSuite()
    suite.addTest(xmlreport('open_the_emulator_and_launch_the_securechatapp'))
    suite.addTest(xmlreport('phone_number_validations'))
    suite.addTest(xmlreport('putting_invalid_otp_code'))
    suite.addTest(xmlreport('getting_otp_code_through_phone_call'))
    return suite

if __name__=='__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(xmlreport) 

timestamp = time.strftime('%Y_%m_%d_%H_%M')
rname = 'Test_Report_'+timestamp+'.xml'
my_dir="D:\\Hariprasad\\xmlreport\\"

  
suite = createSuite()
result = XMLTestRunner(file(my_dir+rname,"w"))
result.run(suite)

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.