Fetch the repository succeeded.
import xml.dom.minidom
import xlwt
if __name__=='__main__':
xml_path = "C:/Users/NewUser/Desktop/auto_ELV_Test_Cases.xml"
dom = xml.dom.minidom.parse(xml_path)
db = dom.documentElement
row_element = db.getElementsByTagName('row')
row_num = row_element.length
row = 0
for i in range(0, row_num):
xls = xlwt.Workbook()
sheet = xls.add_sheet('sheet1', cell_overwrite_ok=True)
row = 0
module = row_element[i].getElementsByTagName('module')[0].firstChild.data
if "342" in str(module):
id = row_element[i].getElementsByTagName('id')[0].firstChild.data
stepDesc = row_element[i].getElementsByTagName('stepDesc')[0].firstChild.data
expectDesc = row_element[i].getElementsByTagName('stepExpect')[0].firstChild.data
stepList = stepDesc.replace('\n', '').replace('。', '').replace(' ', '').split('<br/>')
expectList = expectDesc.replace('\n', '').replace('。', '').replace(' ', '').split('<br/>')
leng = len(stepList)
for j in range(0, leng - 1):
step = stepList[j].split('.')[1]
stepArray = step.split(',')
for stepUnit in stepArray:
sheet.write(row, 0, str(stepUnit))
row = row + 1
row = row - 1
sheet.write(row, 1, str(expectList[j]))
row = row + 1
xls.save('caseDirectory/testCase_' + id + '.xls')
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。