TESTLINK 测试用例数据结构解析

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

4225600-a55e26110580084b.png

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

4225600-a544b6010c7165aa.png

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

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

4225600-354808f179bda0ea.png

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

4225600-caddd9d9a249697c.png

根据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);

得到结果
4225600-85450f19ed2f0be4.png

可知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名称信息


4225600-2cf4df5167d20516.png

我们继续往下查,执行如下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表示用例的版本


4225600-e94b764fbbf6094e.png

继续往下查,执行如下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表示用例的步骤

4225600-3ba11f2cb08cb58e.png

步骤的具体内容在表 tcsteps中,
4225600-6a61e310f13c6041.png

关于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)));

猜你喜欢

转载自blog.csdn.net/weixin_33941350/article/details/86795451