RedmineとTestLinkの連携(テストケースIDプレフィックス有りの場合)

250 views
Skip to first unread message

JunKawa

unread,
Jul 28, 2009, 10:45:38 PM7/28/09
to Redmine Users (japanese)
はじめまして。

Redmine から TestLink 1.8 へのリンクについて fmkt さんのパッチを参考にいくつか追加したので公開します。
(http://groups.google.com/group/redmine-users-ja/browse_frm/thread/
aa2bf808a682756f)

<問題だったこと>
TestLink 1.8 では、テストプロジェクト毎にテストケースIDにプレフィックスがつくようになった。
これにより、
1) テストケースから従来のIDを知る方法が、リンク先のURL(javascript:ET(従来のID))からの推測、と面倒になった。
2) 従来のIDで「テストケースの検索」が行えなくなった。(プレフィックスつきのテストケースIDでの検索となった)

<やりたいこと>
プレフィックスつきのテストケースIDを使って Redmine から TestLink へリンクをはる。
具体的には、Redmine から「testlink:prefix-ID」のような記法でリンクを張ることができる。

<環境>
Redmine 0.8.4
TestLink 1.8.1

<パッチについて>
- redmineでの記法
testlink:プレフィックスつきのID
testlink#従来のID
- TestLinkのURLについて
localhostの部分を書き換えてください(手パッチになります、すいません...)

<参考ソース>
redmine/app/helpers/application_helper.rb
testlink/lib/testcases/archiveData.php

以下、パッチ内容
#---- ここから ----
--- application_helper.rb.orig 2009-07-29 11:21:21.000000000 +0900
+++ application_helper.rb 2009-07-29 11:25:22.000000000 +0900
@@ -385,7 +385,7 @@
# export:some/file -> Force the download of the file
# Forum messages:
# message#1218 -> Link to message with id 1218
- text = text.gsub(%r{([\s\(,\-\>]|^)(!)?(attachment|document|
version|commit|source|export|message)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]
*?|"[^"]+?"))(?=(?=[[\
:punct:]]\W)|\s|<|$)}) do |m|
+ text = text.gsub(%r{([\s\(,\-\>]|^)(!)?(attachment|document|
version|commit|source|export|message|testlink)?((#|r)(\d+)|(:)([^"\s<>]
[^\s<>]*?|"[^"]+?")\
)(?=(?=[[:punct:]]\W)|\s|<|$)}) do |m|
leading, esc, prefix, sep, oid = $1, $2, $3, $5 || $7, $6 || $8
link = nil
if esc.nil?
@@ -425,6 +425,8 @@
:anchor
=> (message.parent ? "message-#{message.id}" : nil)},
:class => 'message'
end
+ when 'testlink'
+ link = link_to("testlink##{oid}", "http://localhost/
testlink/lib/testcases/archiveData.php?id=#{oid}&edit=testcase")
end
elsif sep == ':'
# removes the double quotes if any
@@ -462,6 +464,8 @@
link = link_to h(attachment.filename), {:only_path =>
only_path, :controller => 'attachments', :action => 'download', :id =>
attachment},
:class =>
'attachment'
end
+ when 'testlink'
+ link = link_to("testlink:#{name}", "http://localhost/
testlink/lib/testcases/archiveData.php?targetTestCase=#{name}
&edit=testcase")
end
end
end
#---- ここまで ----

見当違いのことを行っているかもしれませんが、ご容赦ください。


Reply all
Reply to author
Forward
0 new messages