我已连接到' user1'并执行以下命令,utplsql安装在' utp'中。我从http://utplsql.sourceforge.net/安装了utplsql框架。
BEGIN
utp.utAssert.eq('test',1,1);
END;
/
错误输出
ORA-02291: integrity constraint (UTP.UTR_ERROR_OUTCOME_FK) violated - parent key not found
ORA-06512: at "UTP.UTRERROR", line 149
ORA-06512: at "UTP.UTRERROR", line 324
ORA-06512: at "UTP.UTROUTCOME", line 146
ORA-01400: cannot insert NULL into ("UTP"."UTR_OUTCOME"."RUN_ID")
ORA-06512: at "UTP.UTRESULT2", line 72
ORA-06512: at "UTP.UTASSERT2", line 137
ORA-06512: at "UTP.UTASSERT2", line 541
ORA-06512: at "UTP.UTASSERT", line 118
ORA-06512: at line 2
但是
答案 0 :(得分:3)
不是直接运行utAssert.eq
,而是将其放入测试包中,然后使用utPLSQL.test
或utPLSQL.run
运行 。 (我建议您完成Getting Started的utPLSQL documentation部分。
CREATE OR REPLACE PACKAGE ut_simple IS
PROCEDURE ut_setup;
PROCEDURE ut_teardown;
PROCEDURE ut_simple_test;
END;
CREATE OR REPLACE PACKAGE BODY ut_simple IS
PROCEDURE ut_setup IS
BEGIN
NULL;
END;
PROCEDURE ut_teardown IS
BEGIN
NULL;
END;
PROCEDURE ut_simple_test IS
BEGIN
utp.utAssert.eq('test',1,1);
END;
END;
exec utp.utplsql.run ('ut_simple');