将nosetests结果保存为自定义xml文件

0 投票
2 回答
774 浏览
提问于 2025-04-18 12:30

我该如何把nosetests的结果保存到一个特定文件夹里的自定义xml文件中呢?

我的文件夹结构是:

    /MyApp
      /TestSuites
      /Logs

我的测试用例在一个叫做tests.py的文件里,这个文件位于/TestSuites文件夹内。

当我尝试运行:

    nosetests tests.py --xunit-file=../Logs/testlog.xml

却没有生成任何xml文件。

2 个回答

0

为了将来方便查阅,如果你在命令行中输入以下内容:

$ nosetests --help

这会给你提供一系列的选项供nosetests使用,其中包括一个必需的参数,也就是:

--with-xunit
0

我搞明白了,实际上我只需要这样执行它就可以了:

    nosetests tests.py --with-xunit --xunit-file=../Logs/testlog.xml

撰写回答