pl/sql unit testing with ruby

19
PL/SQL Unit Testing with Ruby

Upload: rsim

Post on 18-May-2015

2.831 views

Category:

Technology


1 download

DESCRIPTION

Presentation at EMEA Harmony Oracle user groups conference in Tallinn

TRANSCRIPT

Page 1: PL/SQL unit testing with Ruby

PL/SQL Unit Testingwith Ruby

Page 2: PL/SQL unit testing with Ruby

Raimonds Simanovskis

github.com/rsim

Page 3: PL/SQL unit testing with Ruby

What is good code?

Correct

Fast enough

Maintainable

Test functionality!

Testperformance!

Test afterchanges!

Page 4: PL/SQL unit testing with Ruby

How is it done?try something...

dbms_output.put_line(...)

testers should test,that’s their job

it is obvious thatthere are no bugs :)

Page 5: PL/SQL unit testing with Ruby

What are typicalproblems?

“trying” and not testing

tests are not repeatable

manual verification of results

testing is done too late in development

Page 6: PL/SQL unit testing with Ruby

Types of testsunit tests

integration tests

performance & load tests

exploratory & usability tests

programmer’sresponsibility

Page 7: PL/SQL unit testing with Ruby

Test Driven Development

Write test

Run test

Write code

Run test

Refactoring

Page 8: PL/SQL unit testing with Ruby

Good unit testsAutomatic, run fast

Wide code coverage including edge cases

Repeatable

Independent from execution order

Using real and understandable test data

Page 9: PL/SQL unit testing with Ruby

How to do itwhen programming in

PL/SQL ?

Page 10: PL/SQL unit testing with Ruby

utPLSQLcreated by Steven Feuerstein, 1999

based on “xUnit”-style frameworks

not maintained anymore :(

Page 11: PL/SQL unit testing with Ruby

ExampleSubstring from startuntil end position

Page 12: PL/SQL unit testing with Ruby

Tests

Page 13: PL/SQL unit testing with Ruby

Results

Page 14: PL/SQL unit testing with Ruby

Visual testing tools

Quest Code Tester SQL Developer 2.1

Page 15: PL/SQL unit testing with Ruby

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?

Page 16: PL/SQL unit testing with Ruby

ruby-plsql-specideal language for writing tests

powerful testing toolswith “readable” syntaxRSpec

ruby-plsql library for callingPL/SQL procedures

from Ruby

Page 17: PL/SQL unit testing with Ruby

ruby-plsql-specDemo

Page 18: PL/SQL unit testing with Ruby

Benefitscompact, readable syntax

powerful features also for complex tests

best practices from Ruby community

based on needs from real projects

opensource – “free as in beer” :)