Yes, this is - just apply the regular TDD loop (see, for example, wikipedia ), as in any other programming language:
- Add test
- Run all the tests and see if the new one works.
- Enter code
- Run automated tests and make sure they are successful.
- Refactoring code
- Repeat
Of course, you want to have a unit testing system . Impervious, for example. Does StackOverflow have questions such as Unit Testing for PL / SQL or Unit Testing for Oracle PL / SQL? . You already checked them - right?
Running tests in isolation is very possible. You probably want to have either a dedicated instance of Oracle DB or a schema that is 100% under your control.
The only tricky part I have experienced is to test the code that uses the database very widely or when the database schema changes a lot. Filling or faking a database can be complex and time consuming if the database is complex or requires a lot of data to complete the test. In those cases, I usually fake the database by removing constraints and triggers, which makes running tests cumbersome. This is great, because the focus is on the PL / SQL code, not the database structure, and unit testing is not the final stage of verification.
source share