我在运行 Protractor 测试后生成了此 xml。
<?xml version="1.0" encoding="UTF-8" ?>
<testsuites>
<testsuite name="Spring Webapp Homepage" errors="0" tests="3" failures="0" time="1.508" timestamp="2014-02-14T15:23:27">
<testcase classname="Spring Webapp Homepage" name="should get title" time="1.309"></testcase>
<testcase classname="Spring Webapp Homepage" name="Test Header" time="0.098"></testcase>
<testcase classname="Spring Webapp Homepage" name="Test Simple Button" time="0.101"></testcase>
</testsuite>
</testsuites>
有一个选项可以将测试输出到 XML 输出
onPrepare: function() {
// The require statement must be down here, since jasmine-reporters
// needs jasmine to be in the global and protractor does not guarantee
// this until inside the onPrepare function.
require('jasmine-reporters');
jasmine.getEnv().addReporter(
new jasmine.JUnitXmlReporter('jasmine-results/xmloutput', true, true));
}
有没有一种方法可以在浏览器中可视化这些报告,从而比原始 XML 更优雅地呈现它们?
最佳答案
Is there a way to visualize these reports in the browser that would present them more elegantly than raw XML?
其实有nosetest-xunit-xslt .
注意xsltproc来自installed by default在 Mac OSX Mavericks 上。
更新:我正在使用 custom reporter that automates the html conversion
require('./jasmine.single_file_junit_reporter.js');
var junitPath = path.join('junitXMLReport/', '0001');
jasmine.getEnv().addReporter(new jasmine.singleFileJUnitXmlReporter(
junitPath, true, true, './nosetests.xslt')
);
关于junit - jasmine.JUnitXmlReporter 报告可视化工具,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21790204/