2014-02-14 61 views
2

我在運行量角器測試後生成了這個xml。jasmine.JUnitXmlReporter報告可視化器

<?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更優雅可視化瀏覽器,這些報告將介紹他們嗎?

回答

2

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小牛隊。

看看how the results look like

更新:我使用這個anwser我設法Junit的一個文件上報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') 
); 
+0

謝謝,我howver AML無法安裝execSync爲你在Github中提到我得到這個錯誤:gyp.js「rebuild gyp ERR!配置錯誤 gyp ERR!stack錯誤:找不到Python可執行文件」python「,你可以設置P HON env變量 gyp ERR !在failNoPython上堆棧(C:\ Program Files \ nodejs \ no de_modules \ npm \ n e_modules \ node-gyp \ lib \ configure.js:101:14) gyp ERR!堆棧位於C:\ Program Files \ nodejs \ node_modules \ npm \ node_modules \ no -gyp \ lib \ configure.js:64:11 gyp ERR!堆棧在Object.oncomplete(fs.js:107:15) – Ziwdigforbugs

+0

我看到它在我的Ubuntu 13.04上編譯了一堆東西,對於Windows,您需要做一些額外的工作,請參閱:https://github.com/mgutz/ execSync#安裝 –

+0

順便說一句,你有沒有設法在Windows上安裝** xsltproc **?這是運行所有這些的其他依賴項。 –