testlinkのカスタムフィールド(実行)の集計をmysqlでしてみる。

testlinkでカスタムフィールドに、実行時間を入れるカスタマイズをしてあるので、集計をSQLでやってみる。

バージョンは1.8.1です。(今更?感もありますが)
とりあえず、どんなテーブルがあるか見る。
mysql> show tables;

                                                                • +
Tables_in_testlink
                                                                • +
assignment_status
assignment_types
attachments
builds
cfield_design_values
cfield_execution_values
cfield_node_types
cfield_testplan_design_values
cfield_testprojects
custom_fields
db_version
events
execution_bugs
executions
keywords
milestones
node_types
nodes_hierarchy
object_keywords
req_coverage
req_specs
requirements
rights
risk_assignments
role_rights
roles
tcversions
testcase_keywords
testplan_tcversions
testplans
testprojects
testsuites
text_templates
transactions
user_assignments
user_group
user_group_assign
user_testplan_roles
user_testproject_roles
users
                                                                • +

40 rows in set (0.13 sec)

とりあえず結果はexecutionsだろうということで

mysql> select * from executions;

                                                                                                                                                                                                                                                                        • +
id build_id tester_id execution_ts status testplan_id tcversion_id tcversion_number execution_type notes
                                                                                                                                                                                                                                                                        • +
1 1 1 2012-08-06 22:49:29 p 5 4 1 1
2 1 1 2012-08-06 23:01:36 p 5 4 1 1
3 1 1 2012-08-06 23:44:08 x 5 4 1 1
4 1 1 2012-08-08 00:29:19 t 5 4 1 1
5 1 1 2012-08-09 22:24:30 t 5 4 1 1 test
                                                                                                                                                                                                                                                                        • +

5 rows in set (0.01 sec)

結果のカスタムフィールドは、これっぽい、、、
mysql> select * from cfield_execution_values;

                                                                                                                              • +
field_id execution_id testplan_id tcversion_id value
                                                                                                                              • +
1 1 5 4 10
1 2 5 4 12
1 3 5 4
1 4 5 4 10
1 5 5 4 10
                                                                                                                              • +

5 rows in set (0.00 sec)

ビンゴ!!

ということで、あるテスト計画の、ユーザ毎の一覧を見るにはこれで良いのではなかろうかね、、、、
mysql> select tester_id, sum(value) from cfield_execution_values, executions where cfield_execution_values.execution_id = executions.id and executions.testplan_id = 5;

                                                  • +
tester_id sum(value)
                                                  • +
1 42
                                                  • +

1 row in set (0.00 sec)

まあ1人分のユーザIDでしか実行してないから合ってるかわからんが、、、、