需要安装
pytest
和
pytest-html(
生成
html
测试报告)
pip install pytest
和
pip install pytest-html
![](https://i-blog.csdnimg.cn/blog_migrate/bb4dcb84f1e644dd31366db983591023.png)
setup和teardown的区别
生成测试报告
pip install pytest-html
pytest.main(["--html=./report.html","模块.py"])
生成的测试报告
读取xml文件
from
xml
.
dom
import
minidom
class
Readxml
():
def
read_xml
(
self
,
filename
,
onename
,
twoname
):
root
=
minidom
.
parse
(
filename
)
firstnode
=
root
.
getElementsByTagName
(
onename
)[
0
]
secondnode
=
firstnode
.
getElementsByTagName
(
twoname
)[
0
].
firstChild
.
data
return
secondnode