【发布时间】:2015-05-20 12:08:28
【问题描述】:
我有一个 python 文件 testing.py 包含以下内容:
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()
这个 testing.py 文件实际上打开了两个 .exe,然后我做了两个测试用例。我的问题是如何将 testing.py 的输出写入要在 jenkins 上可视化的 xml 文件?有一些命令吗?至少建议我从哪里开始。
【问题讨论】:
-
尝试标签
--junit-xml unit_test_results.xml并检查此link
标签: python xml unit-testing jenkins