sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #26912
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
Status: Answered => Open
Harry is still having a problem:
this is my code.Let me know if i m doing something wrong
>From this case blank xml page is getting generated
Please help
**********code******************
import unittest
import xmlrunner
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 suite():
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
suite = suite()
if __name__=='__main__':
try:
unittest.main()
except SystemExit,inst:
if inst.args[0] is True:
raise
timestamp = time.strftime('%Y_%m_%d_%H_%M')
rname = 'Test_Report_'+timestamp+'.xml'
my_dir="path"
suite = unittest.TestLoader().loadTestsFromTestCase(xmlreport)
result = xmlrunner.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.