Is there any way to apply TDD methods for dev in PL / SQL

Since I have a lot of program logic on the DB server side in PL / SQL, I would like to know that TDD is applicable to PL / SQL. It would be even more a god if you would point me to some information resources with samples and a detailed description. Thanks in advance!

UPD: I need tests that need to be stored and run only on my machine, without affecting other team members. Is it possible?

+6
source share
1 answer

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.

+8
source

Source: https://habr.com/ru/post/897442/


All Articles