今日、誰が何を実施したのかをリアルタイムに知りたい。
大規模なプロジェクトでは Testlink を用いてもテスターの進捗を管理するのは大変です。
サボっている人を可視化する 進捗が芳しくないメンバーのフォローするために、今日、誰がどの項目を実施したのかの一覧を見たいとの要望があったので SQL を考えてみました。
このSQLで必要な情報が得られるはず。
SELECT u.first, u.last ,e.tester_id, e.status,e.testplan_id,
tp.name as plan,
h3.name as suite,
h2.name as title,
tcversion_id, execution_ts,execution_duration as duration
FROM (executions e, users u , tcversions tc , nodes_hierarchy tp )
left outer join nodes_hierarchy h1 on (e.tcversion_id = h1.id)
left outer join nodes_hierarchy h2 on (h1.parent_id = h2.id)
left outer join nodes_hierarchy h3 on (h2.parent_id = h3.id)
WHERE DATE(`execution_ts`) = CURRENT_DATE and
u.id = e.tester_id and
e.tcversion_id = tc.id and
e.testplan_id = tp.id
order by e.tester_id, h2.name;
ついでに php のコードサンプル
テスト計画 : テスター : 結果 : テストスイート : テストケース : 実施時 : 実行時間(分)をブラウザ画面に表示します。表にしたい場合は適当に作ってください。
日付を選択できるようにしました。(デフォルトは当日)
DB接続は環境にあわせてください。
私の環境では、ステータス Skip/Hold を追加しています。
.php
<html xml:lang="ja" lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>本日の実施</title>
</head>
<body bgcolor="#EEEEEE" >
<?php
$basedir = dirname(__FILE__) . '/..';
$webroot = $_SERVER['DOCUMENT_ROOT'];
include_once($basedir . '/config/config.php');
include_once($basedir . '/lib/DB.class.php');
if(isset($_GET['date'])) {
$selectDate = $_GET['date'];
// form Table Style 定義
// table1_style();
// TodaysDo_tableHeader();
$db = new DB_ACCESS('testlink');
$dbh = $db->connect();
$sql = "SELECT u.first, u.last ,e.tester_id, e.status,e.testplan_id,
tp.name as plan,
h3.name as suite,
h2.name as title,
tcversion_id, execution_ts,execution_duration as duration
FROM (executions e, users u , tcversions tc , nodes_hierarchy tp )
left outer join nodes_hierarchy h1 on (e.tcversion_id = h1.id)
left outer join nodes_hierarchy h2 on (h1.parent_id = h2.id)
left outer join nodes_hierarchy h3 on (h2.parent_id = h3.id)
WHERE DATE(`execution_ts`) = '$selectDate' and
u.id = e.tester_id and
e.tcversion_id = tc.id and
e.testplan_id = tp.id
order by e.tester_id, h2.name;";
$res = $db->executeSQL($dbh,$sql,null);
$rowCount = 1;
echo $selectDate . " の実績" . "<br>";
echo "テスト計画 : テスター : 結果 : テストスイート : テストケース : 実施時 : 実行時間(分)"."<br>";
echo "------------------------------------------------------------------------------------------"."<br>";
while($list = $res -> fetch(PDO::FETCH_ASSOC)){
$list['execution_ts'] = mb_substr($list['execution_ts'],-8);
$list['first'] = $list['first'] . $list['last'];
switch ($list['status']){
case "x":
$list['status'] = "Hold";
break;
case "p":
$list['status'] = "OK";
break;
case "b":
$list['status'] = "Block";
break;
case "f":
$list['status'] = "NG";
break;
case "u":
$list['status'] = "Skip";
break;
default:
break;
}
// showTodaysDO_table($list);
echo $list['plan'] . " : ";
echo $list['first'] . " : ";
echo $list['status'] . " : ";
echo $list['suite']. " : ";
echo $list['title']. " : ";
echo $list['execution_ts'] . " : ";
echo $list['duration'];
echo "<br>";
}
$dbh = null;
unset($_GET['date']);
exit();
}
$today = date("Y-m-d");
echo "日付を選択してください" . "<br>";
?>
<form method="get" action="">
<input type="date" name="date" value="<?php echo $today; ?>"/>
<input type="submit" value="入力" />
</form>
</body>
</html>