星期五, 1月 18, 2008

CruiseControl Dashboard顯示UnitTest++測試結果

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

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
    <xsl:apply-templates select="//unittest-results"/>
</xsl:template>

<xsl:template match="unittest-results">
    <html>
    <body>
      <h3>
        UnitTest++測試了<xsl:value-of select="@tests"/>筆資料,<xsl:value-of select="@failedtests"/>筆失敗,費時<xsl:value-of select="@time"/>秒
      </h3>
      <table>
        <tr>
          <th>Suite</th>
          <th>測試</th>
          <th>費時</th>
          <th>訊息</th>
        </tr>
      <xsl:for-each select="test">
        <xsl:if test="count(failure)>0">
          <tr bgcolor="#ffaaaa">
            <td>
              <xsl:value-of select="@suite"/>
            </td>
            <td>
              <font color="green">
                <xsl:value-of select="@name"/>
              </font>
            </td>
            <td>
              <xsl:value-of select="@time"/>
            </td>
            <td>
              <xsl:value-of select="failure/@message"/>
            </td>
          </tr>
        </xsl:if>
        <xsl:if test="count(failure)=0">
          <tr>
            <td>
              <xsl:value-of select="@suite"/>
            </td>
            <td>
              <font color="green">
                <xsl:value-of select="@name"/>
              </font>
            </td>
            <td>
              <xsl:value-of select="@time"/>
            </td>
            <td></td>
          </tr>
        </xsl:if>

      </xsl:for-each>
      </table>
    </body>
    </html>
</xsl:template>

</xsl:stylesheet>

星期二, 1月 15, 2008

追蹤subversion comment訊息錯誤

使用subversion相關的client工具時,如果發現comment內容有問題,想要追蹤時,可以直接到svn server上察看「repository目錄/db/revprops」,內含所有revision的comment。

星期五, 1月 11, 2008

TRAC顯示某里程碑中ticket進度

SELECT
owner AS __group__,
(CASE status WHEN 'closed' THEN 'color: #aaaaaa'
ELSE ''
END) AS __style__,
(CASE status WHEN 'assigned' THEN 4
ELSE 3
END) AS __color__,
id AS ticket,

(CASE status = 'closed'
WHEN 0 THEN
(CASE (round(julianday(substr(tc.value,7,4) ||
'-' || substr(tc.value,1,2) || '-' ||
substr(tc.value,4,2))) - round(julianday('now'))) < 0
WHEN 0 THEN (round(julianday(substr(tc.value,7,4) || '-' ||
substr(tc.value,1,2) || '-' || substr(tc.value,4,2)))
- round(julianday('now')))
ELSE '超時' || abs((round(julianday(substr(tc.value,7,4) || '-' ||
substr(tc.value,1,2) || '-' || substr(tc.value,4,2)))
- round(julianday('now')))) || '天'
END)
ELSE ''
END) AS '距截止天數',

tc.value AS '預估截止日',

status,
priority,
summary,
t.type AS type,
time AS created,
changetime AS _changetime,
description AS _description,
reporter AS _reporter,
tc2.value AS '_due assign',

date('now') as _nowdate,
julianday('now') AS _nowdate2

FROM ticket t,enum p, ticket_custom tc, ticket_custom tc2
where
t.id = tc.ticket AND
tc.name = "due_close" AND
t.id = tc2.ticket AND
tc2.name = "due_assign" AND
p.name=t.priority AND
p.type='priority' AND
t.milestone='**指定里程碑**'
ORDER BY owner, (status = 'closed') ,p.value, t.type, time

星期三, 1月 09, 2008

TRAC依使用者顯示所指定里程碑的工作狀況

以下指令可用在TRAC上建立一個「依使用者顯示所指定里程碑的工作狀況」的報告。
  • 依使用者分群
  • 依priority排序
  • 已經closed的ticket會排到最後面,同時以灰色字顯示
  • 已經assigned的以藍色底顯示

SELECT
owner AS __group__,
(CASE status WHEN 'closed' THEN 'color: #aaaaaa'
ELSE ''
END) AS __style__,
(CASE status WHEN 'assigned' THEN 4
ELSE 3
END) AS __color__,
id AS ticket,
status,
priority,
summary,
component,
t.type AS type,
time AS created,
changetime AS _changetime,
description AS _description,
reporter AS _reporter
FROM ticket t,enum p
where
p.name=t.priority AND
p.type='priority' AND
t.milestone='***里程碑***'
ORDER BY owner, (status = 'closed') ,p.value, t.type, time

sqlite使用筆記

  • database檔案: *.db
  • 連接db: sqlite3 foo.db
  • 區分sqlite指令與SQL指令
    • sqlite指令以「.」開頭,比如說「.tables」用來列出所有table。「.help」用來列出可用的sqlite指令。
    • SQL指令按照一般方式直接下,以「;」結尾。