Suppose we have an oracle package, which was initialized with some value grabbed from a table holding global parameters. Despite the fact that it is an ugly practice, it could work in production since the parameters are to be set during installation and not likely to change frequently. But when one is testing the package, it's needed to reinitialize its state before each case.
I tried two approaches:
- execute immediate 'ALTER PACKAGE my_package COMPILE';
- dbms_session.reset_package;
The first doesn't work in some rare cases (i don't know why).
The second resets all the packages touched by current session, including a package, which contains test cases, so any call of reset_package leads to abort execution of tests.
What do I need to correctly test a package with inner state, when there's a need to change the state during tests execution?
Aucun commentaire:
Enregistrer un commentaire