首页 > 解决方案 > 如何在 qcumber 测试中使用与外键链接的 2 个本地表?

问题描述

我有以下测试代码

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正在使用某种命名空间恶作剧。另外,如果我全局分配表,::那么它就会通过。但是,如果我希望我的测试被隔离怎么办?

标签: kdb

解决方案


据我所知,您不能将外键(或枚举符号)设置为本地表(或本地符号列表)......它必须是全局的。因此,您唯一的选择是全局创建 tParent 并在之后将其删除。

请注意,您的 tChild 表可以是本地的,而不是外键(或枚举)的目标


推荐阅读