Hi,
I want to know if it is possible to "catch" an error of the underlying database.
I have a database schema where I defined multiple types, constraints and other safeguards for data-integrity which I want to test through venom.
If I create a testcase to raise one of those exceptions the test failes and never returns a result as the code of the executor failes hard with the error message the underlying database driver gives.
Testcase "Query database", step #0-0: failed to exec command number 1: pq: cannot insert a non-DEFAULT value into column "dog_id" (test.yml:7)
I want to know how do I test such cases. I know the SQL will fail and I know the error message. Can I catch those errors and assert against them or do I have to be creative and write a simple database function which catches the error itself and returns plain sql-rows?
Regards
Markus
Hi,
I want to know if it is possible to "catch" an error of the underlying database.
I have a database schema where I defined multiple types, constraints and other safeguards for data-integrity which I want to test through venom.
If I create a testcase to raise one of those exceptions the test failes and never returns a result as the code of the executor failes hard with the error message the underlying database driver gives.
Testcase "Query database", step #0-0: failed to exec command number 1: pq: cannot insert a non-DEFAULT value into column "dog_id" (test.yml:7)I want to know how do I test such cases. I know the SQL will fail and I know the error message. Can I catch those errors and assert against them or do I have to be creative and write a simple database function which catches the error itself and returns plain sql-rows?
Regards
Markus