TESTLINK 测试用例数据结构解析

一、node_types 测试组件信息表
我们查询表 select * from testlink.node_types;
得到如下结果

二、nodes_hierarchy 测试用例目录层次表
我们以下图的项目为例,来讲解


1、测试项目
首先,我们有个Train的项目,存在表testprojects中,可以用如下sql查找到
select * from testlink.testprojects where notes like '%Train%' order by id desc;

对应在表nodes_hierarchy中有一条同id的数据,其中node_type_id为1,
这里node_type_id=1,表示的意思对应表node_types查出来的结果testproject
select * from testlink.nodes_hierarchy where id=21994;

2、测试项目下的测试集合testsuite
我们可以通过查父id为该项目id数据
select * from testlink.nodes_hierarchy where parent_id=21994;
得到如下图数据,
即Train项目下有2个testsuite,


根据node_types对应关系可知,type 2 为 testsuite,type 5 为 testplan
由目录层级结构可知,在Folder集下有个名为F1的用例子集,我们用如下sql查询,

select * from testlink.nodes_hierarchy where node_type_id=2 and parent_id in
(select id from testlink.nodes_hierarchy where parent_id=21994 and node_type_id=2);

得到结果

可知testsuite级别的目录node_type_id为2,通过parent_id来关联上下级

3、测试用例
接着我们再来看看测试用例的数据结构,通过node_types表可知testcase的node_type_id为3

select * from testlink.nodes_hierarchy where node_type_id=3 and parent_id in
(select id from testlink.nodes_hierarchy where parent_id=21994 and node_type_id=2);

就得到图中的三条case名称信息


我们继续往下查,执行如下sql

select * from testlink.nodes_hierarchy where parent_id in
(select id from testlink.nodes_hierarchy where node_type_id=3 and parent_id in
(select id from testlink.nodes_hierarchy where parent_id=21994 and node_type_id=2));

得到如下数据,可知node_type_id为4表示用例的版本


继续往下查,执行如下sql

select * from testlink.nodes_hierarchy where parent_id in
(select id from testlink.nodes_hierarchy where node_type_id=4 and parent_id in
(select id from testlink.nodes_hierarchy where node_type_id=3 and parent_id in
(select id from testlink.nodes_hierarchy where parent_id=21994 and node_type_id=2)));

得到结过如下,可知node_type_id为9表示用例的步骤


步骤的具体内容在表tcsteps中,

关于用例的id,Summary和Preconditions是与测试版本关联,用如下sql查询

select * from testlink.tcversions where id in
(select id from testlink.nodes_hierarchy where node_type_id=4 and parent_id in
(select id from testlink.nodes_hierarchy where node_type_id=3 and parent_id in
(select id from testlink.nodes_hierarchy where parent_id=21994 and node_type_id=2)));

你可能感兴趣的:(TESTLINK 测试用例数据结构解析)