pl/sql unit testing with ruby

Post on 18-May-2015

2.831 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

Presentation at EMEA Harmony Oracle user groups conference in Tallinn

TRANSCRIPT

PL/SQL Unit Testingwith Ruby

Raimonds Simanovskis

github.com/rsim

What is good code?

Correct

Fast enough

Maintainable

Test functionality!

Testperformance!

Test afterchanges!

How is it done?try something...

dbms_output.put_line(...)

testers should test,that’s their job

it is obvious thatthere are no bugs :)

What are typicalproblems?

“trying” and not testing

tests are not repeatable

manual verification of results

testing is done too late in development

Types of testsunit tests

integration tests

performance & load tests

exploratory & usability tests

programmer’sresponsibility

Test Driven Development

Write test

Run test

Write code

Run test

Refactoring

Good unit testsAutomatic, run fast

Wide code coverage including edge cases

Repeatable

Independent from execution order

Using real and understandable test data

How to do itwhen programming in

PL/SQL ?

utPLSQLcreated by Steven Feuerstein, 1999

based on “xUnit”-style frameworks

not maintained anymore :(

ExampleSubstring from startuntil end position

Tests

Results

Visual testing tools

Quest Code Tester SQL Developer 2.1

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?

ruby-plsql-specideal language for writing tests

powerful testing toolswith “readable” syntaxRSpec

ruby-plsql library for callingPL/SQL procedures

from Ruby

ruby-plsql-specDemo

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” :)

top related