I have a python file testing.py consisting of following:
import subprocess
import unittest
DETACHED_PROCESS = 0x00000008
def open_exe(file,mode):
if mode == 1:
if type(file) is str:
object = subprocess.Popen([file],creationflags=DETACHED_PROCESS,shell=True)
if object.pid is None:
return 0
else:
print "Process id ", object.pid
return 1
if mode == 2:
if type(file) is str:
object = subprocess.Popen([file,"-configuration=" + "Other_base_0x1010.def"], creationflags=DETACHED_PROCESS,shell=True)
if object.pid is None:
return 0
else:
print "Process id ", object.pid
return 1
class testmyfunctions(unittest.TestCase):
def test_contains_simple_true(self):
self.assertEqual(open_exe("D:\\learning\\development\\MY_base.exe",1),1)
def test_first_process(self):
self.assertEqual(open_exe("D:\\learning\\Projects\\Other_base.exe", 2), 1)
if __name__ == '__main__':
unittest.main()
This testing.py file is actualy opening two .exe's and then i have made two test cases.My question is how do i write the output of testing.py to xml file which are to be visualized on jenkins? Are there some commands ? Atleast suggest me from where to start.
--junit-xml unit_test_results.xmland check this link