PL/SQL unit testing with Ruby

3,565 views

Published on

Presentation at EMEA Harmony Oracle user groups conference in Tallinn

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,565
On SlideShare
0
From Embeds
0
Number of Embeds
22
Actions
Shares
0
Downloads
35
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

PL/SQL unit testing with Ruby

  1. 1. PL/SQL Unit Testing with Ruby
  2. 2. Raimonds Simanovskis github.com/rsim
  3. 3. What is good code? Test Correct functionality! Test Fast enough performance! Test after Maintainable changes!
  4. 4. How is it done? try something... dbms_output.put_line(...) it is obvious that there are no bugs :) testers should test, that’s their job
  5. 5. What are typical problems? “trying” and not testing tests are not repeatable manual verification of results testing is done too late in development
  6. 6. Types of tests unit tests integration tests programmer’s performance & load tests responsibility exploratory & usability tests
  7. 7. Test Driven Development Write test Run test Write code Run test Refactoring
  8. 8. Good unit tests Automatic, run fast Wide code coverage including edge cases Repeatable Independent from execution order Using real and understandable test data
  9. 9. How to do it when programming in PL/SQL ?
  10. 10. utPLSQL created by Steven Feuerstein, 1999 based on “xUnit”-style frameworks not maintained anymore :(
  11. 11. Example Substring from start until end position
  12. 12. Tests
  13. 13. Results
  14. 14. Visual testing tools Quest Code Tester SQL Developer 2.1
  15. 15. Why used just by few? too large / too verbose test code? hard to read, too much noise? hard to test complex cases? no best practices how to write tests? nobody is using, why should I use?
  16. 16. ruby-plsql-spec ideal language for writing tests RSpec powerful testing tools with “readable” syntax library for calling ruby-plsql PL/SQL procedures from Ruby
  17. 17. ruby-plsql-spec Demo
  18. 18. Benefits compact, readable syntax powerful features also for complex tests best practices from Ruby community based on needs from real projects opensource – “free as in beer” :)
  19. 19. Links http://blog.rayapps.com/2009/11/27/oracle- plsql-unit-testing-with-ruby/ http://blog.rayapps.com/2010/01/06/ screencasts-of-oracle-plsql-unit-testing-with- ruby/ http://github.com/rsim/ruby-plsql-spec

×