如何在 qcumber 测试中使用 2 个与外键链接的本地表?
How to use 2 local tables linked with a foreign key in a qcumber test?
我有以下测试代码
feature UsingQcumber
should be able to create 2 tables in a test
expect the code to run through to the end
tParent:([id: til 5]; parentData: 5 ? 100);
tChild:([] parentId: `tParent$ 20 ? 5; childData: 20 ? 1000);
1b
此测试失败,原因如下
file test1.quke
feature UsingQcumber
(should) be able to create 2 tables in a test
- fail | (expect) the code to run through to the end
error: tParent (line 3)
如果我删除外键,测试通过。所以我预计 qcumber 正在使用某种名称空间恶作剧。另外,如果我用 ::
全局分配表,那么它就会通过。但是,如果我希望我的测试被隔离怎么办?
据我所知,您不能将外键(或枚举符号)设置为本地 table(或本地符号列表)....它必须是全局的。所以你唯一的选择是全局创建 tParent 然后删除它。
请注意,您的 tChild table 可以 是本地的,只是不是外键(或枚举)的目标
我有以下测试代码
feature UsingQcumber
should be able to create 2 tables in a test
expect the code to run through to the end
tParent:([id: til 5]; parentData: 5 ? 100);
tChild:([] parentId: `tParent$ 20 ? 5; childData: 20 ? 1000);
1b
此测试失败,原因如下
file test1.quke
feature UsingQcumber
(should) be able to create 2 tables in a test
- fail | (expect) the code to run through to the end
error: tParent (line 3)
如果我删除外键,测试通过。所以我预计 qcumber 正在使用某种名称空间恶作剧。另外,如果我用 ::
全局分配表,那么它就会通过。但是,如果我希望我的测试被隔离怎么办?
据我所知,您不能将外键(或枚举符号)设置为本地 table(或本地符号列表)....它必须是全局的。所以你唯一的选择是全局创建 tParent 然后删除它。
请注意,您的 tChild table 可以 是本地的,只是不是外键(或枚举)的目标