Description
I'm writing unit tests with --%throws()
and they are passing in the schema, but when running through utPLSQL CLI [Jenkins plugin], I'm getting multiple no_data_found [-01403] errors and tests fail as "Actual: -1403 was expected to equal: -1400". Any ideas on how to tackle this?
I'm testing that the trigger will raise "can't insert null" [-1400] when trying to insert null into one of the columns [through null as param to one of the procedures].
Code:
Spec:
--%test
--%throws(UNIT_TEST_PKG.E_CANT_INSERT_NULL)
PROCEDURE try_send_null_exp_error_E_CANT_INSERT_NULL;
The body is irrelevant, as I only insert null into one of the columns. There is no code after that.
Spec of UNIT_TEST_PKG [utility to help with common unit test features] is
E_CANT_INSERT_NULL EXCEPTION; PRAGMA EXCEPTION_INIT( E_CANT_INSERT_NULL, -1400);
I also tried with
E_CANT_INSERT_NULL CONSTANT NUMBER := -1400;
but got same result.
Test passes when running the UT.run() in the schema.
When running on Jenkins job on utPLSQL CLI, getting this error:
Actual: -1403 was expected to equal: -1400
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01403: no data found
ORA-01400: cannot insert NULL into ("XXX"."YYY"."EMAIL_OPT_OUT")
ORA-06512: at "XXX.YYY", line 243
ORA-04088: error during execution of trigger 'XXX.YYY_AUD_TRG'
ORA-06512: at "XXX.YYY_AUD_TRG", line 243
ORA-06512: at line 6
So, the right error is raised during the execution of the trigger "ORA-01400: cannot insert NULL into ...", but then multiple no_data_found are triggered and final errorstack error is "ORA-01403: no data found", which causes the test to fail. I think all the no_data_found are coming from utPLSQL CLI, but I don't know how to deal with this.