我有一个将值插入表中的过程。
showFile() {
var fs = require('fs');
var obj = fs.readFile('dic.txt', 'utf8');
console.log(obj);
}
getItems(ev) {
// Reset items back to all of the items
this.initializeItems();
// set val to the value of the ev target
var val = ev.target.value;
// if the value is an empty string don't filter the items
if (val && val.trim() != '') {
this.items = this.items.filter((item) => {
this.showFile();
return (item.toLowerCase().indexOf(val.toLowerCase()) > -1);
})
}
}
在ut_documentation_reporter上,我将after_calling_test代码的程序修改为:
CREATE OR REPLACE PROCEDURE proc_test_status_table(
p_test_description IN VARCHAR2,
p_test_status IN varchar2)
AS
l_sql VARCHAR2(4000);
BEGIN
l_sql := 'insert into test_status_table(test_description, test_status)
values
( '''||p_test_description||''',
'''||p_test_status||''')';
EXECUTE IMMEDIATE (l_sql);
END;
/
参数未传递。我也无法在过程中打印该值。我想将测试状态/描述消息添加到现有表中。
答案 0 :(得分:0)
您可能在过程中错过了COMMIT。 Insert语句需要提交才能将数据插入表中。
答案 1 :(得分:0)
commit
。my_reporter
)以进行此插入。这样一来,您就可以分隔职责,避免在每次重新安装/升级utPLSQL
时丢失更改。utplsql-cli
与多个报告者一起运行测试。 示例:
create or replace procedure proc_test_status_table(
p_test_description in varchar2,
p_test_status in varchar2
) as
pragma auotonomous_transaction;
l_sql varchar2(4000);
begin
execute immediate
'insert into test_status_table(test_description, test_status)
values( :desc, :stataus )'
using p_test_description, p_test_status;
commit;
end;
/
create or replace type my_reporter under ut_reporter_base(
constructor function my_reporter(self in out nocopy my_reporter) return self as result,
overriding member procedure before_calling_test(self in out nocopy my_reporter, a_test ut_test),
overriding member procedure after_calling_test(self in out nocopy my_reporter, a_test ut_test),
overriding member function get_description return varchar2
)
/
create or replace type body my_reporter as
constructor function my_reporter(self in out nocopy my_reporter) return self as result,
begin
self.init($$plsql_unit);
return;
end;
overriding member procedure before_calling_test(self in out nocopy my_reporter, a_test ut_test) is
begin
proc_test_status_table(
coalesce(a_test.description, a_test.name),
'Starting'
);
end;
overriding member procedure after_calling_test(self in out nocopy my_reporter, a_test ut_test) is
begin
proc_test_status_table(
coalesce(a_test.description, a_test.name)||' ['||round(a_test.execution_time,3)||' sec]',
ut_utils.test_result_to_char(a_test.result)
);
end;
overriding member function get_description return varchar2 is
begin
return 'My custom reporter to insert test status data into test_status_table';
end;
end;
/