亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Hudson支持的JUnit XML格式規范是什么?

Hudson支持的JUnit XML格式規范是什么?

手掌心 2019-11-05 14:37:33
我將Hudson作為持續集成服務器,并且我想使用選項“發布JUnit測試結果報告”。但是我不使用xUnit工具進行測試,相反,我擁有運行測試并以簡單格式返回結果的shell腳本。我正在考慮制作一個腳本,將這些結果轉換為JUnit格式。所以我很有趣JUnit文件的外觀如何?
查看完整描述

3 回答

?
江戶川亂折騰

TA貢獻1851條經驗 獲得超5個贊

幾個月前,我做了類似的事情,結果證明這種簡單的格式足以讓哈德森接受它作為測試協議:


<testsuite tests="3">

    <testcase classname="foo1" name="ASuccessfulTest"/>

    <testcase classname="foo2" name="AnotherSuccessfulTest"/>

    <testcase classname="foo3" name="AFailingTest">

        <failure type="NotEnoughFoo"> details about failure </failure>

    </testcase>

</testsuite>

這個問題的答案有更多詳細信息:規格。用于JUnit XML輸出


查看完整回答
反對 回復 2019-11-05
?
慕森卡

TA貢獻1806條經驗 獲得超8個贊

我只是抓住了其他人鏈接到的junit-4.xsd,并使用了一個名為XMLSpear的工具,通過以下所示的選項將架構轉換為空白XML文件。這是(稍作清理)的結果:


<?xml version="1.0" encoding="UTF-8"?>

<testsuites disabled="" errors="" failures="" name="" tests="" time="">

    <testsuite disabled="" errors="" failures="" hostname="" id=""

               name="" package="" skipped="" tests="" time="" timestamp="">

        <properties>

            <property name="" value=""/>

        </properties>

        <testcase assertions="" classname="" name="" status="" time="">

            <skipped/>

            <error message="" type=""/>

            <failure message="" type=""/>

            <system-out/>

            <system-err/>

        </testcase>

        <system-out/>

        <system-err/>

    </testsuite>

</testsuites>

其中一些項目可能會多次出現:


testsuites因為XML是這樣工作的,所以只能有一個元素,但是testsuite元素內可以有多個元素testsuites。

每個properties元素可以有多個property子代。

每個testsuite元素可以有多個testcase子代。

每一個testcase元素可以有多個error,failure,system-out,或system-err孩子。


查看完整回答
反對 回復 2019-11-05
  • 3 回答
  • 0 關注
  • 645 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號