Forum Stats

  • 3,741,452 Users
  • 2,248,430 Discussions
  • 7,861,817 Comments

Discussions

Literature on PL/SQL testing

user2081233
user2081233 Member Posts: 21
edited Jun 4, 2014 9:29AM in SQL & PL/SQL

Can someone give some links to good literature how to do PL/SQL unit testing?

And general PL/SQL testing?

I am new to the field and would like to create unit tests for my procedures. As it is not common practice in my current workplace I need to learn from a literature.

Tagged:

Answers

  • BluShadow
    BluShadow Member, Moderator Posts: 41,102 Red Diamond

    I guess you haven't done a course or training in computer/software engineering then?

    So, what do you think would be involved in unit testing some code?  What does it mean to you?

  • carajandb
    carajandb Member Posts: 260 Bronze Badge

    Steven Feuerstein has written a Tool called Code Tester for Toad. Guess he has documented it and there are some videos about it on Youtube.

  • Martin Preiss
    Martin Preiss Member Posts: 2,381 Gold Trophy

    there is also a nice unit testing framework included into sql developer: Unit Testing with SQL Developer

  • user2081233
    user2081233 Member Posts: 21

    I have done also formal course on testing in university.

    The problem with SQL is that it differs as there is a lot of stored data.

    You can write different insert into, but it is not fun task if your procedure uses select over 5 tables.

    It would be nice if someone could provide with some links. I googled, but didn't find very good examples.

    Unit Testing Stored Procedures is good basics, but don't explain much in detail.

  • BluShadow
    BluShadow Member, Moderator Posts: 41,102 Red Diamond

    Well, unit testing isn't about being "fun" (I know, I do lots of it, and it's my least favourite part of development)

    Unit testing is about testing all possible inputs to a single unit of code to ensure that all outputs or resultant actions are as expected, including input you expect to get (positive test) and input that you don't expect (negative test)

  • user2081233
    user2081233 Member Posts: 21

    Is there adequate unit test tools that helps to handle database test cases?

    Creating 5 insert into statements for one test and then multiply by test cases is no fun. Is there some adequate test tools that support this?

  • John Stegeman
    John Stegeman Member Posts: 24,269 Blue Diamond

    What do you expect - there is some tool that magically knows what your test data should be to support the test case and automatically generate it for you? If you're talking about a tool that can help you manage the test cases and their execution once you have written them - pl/unit is one of which I'm aware. I cannot say I've used it though.

    As Blu said - unit testing isn't generally "fun" so you should probably be using more descriptive words that describe exactly what you're looking for such a testing tool to do for you, as "make unit testing fun" isn't something that you're going to find.

  • Sven W.
    Sven W. Member Posts: 10,511 Gold Crown
    user2081233 wrote:
    
    Is there adequate unit test tools that helps to handle database test cases?
    Creating 5 insert into statements for one test and then multiply by test cases is no fun. Is there some adequate test tools that support this?
    

    Oracle SQL Developer. The link was already mentioned by Martin.

    You can create test suites and test cases. The test suite can include some preparation insert statements and some cleanup delete statements, for example. Those will be run only once for all the test cases inside one test suite.

    I use this to for package api tests. I even have a test that checks if there is a test case for all public modules in the package.

This discussion has been closed.