KEMBAR78
Test Driven Development for PLSQL with utPLSQL v3 | PDF
utPLSQL v3
Ultimate Unit Testing framework for Oracle
Jacek Gębal
twitter: @GebalJacek
mail: jgebal@gmail.com
blog: oraclethoughts.com
Senior Data Engineer Developer
@Fidelity Investments - Ireland
co-author of: utPLSQL v3
The Unit Test
● Simple
● Repeatable
● Automated
● Isolated from other tests
● Tests one behavior
● Living documentation
● Developer’s responsibility
● Professional product delivery
● Meets requirement
● Delivered on time
● Easy to build
● Maintainable
● Safe to change
Why should I
care?
What to test in
database?
● Logic
● Structure
● State
Why utPLSQL v3?
● open-source
● free
● complete
● unit tested
● IDE independent
● transportable
● pure PL/SQL
● CI/CD oriented
● extendable
Getting started
unit testing as part of software delivery lifecycle
Test Driven Development
● write a test
● make it fail
● keep it simple
● tests are examples
● tests become
documentation
● get to green fast
● take baby steps
● stuck?
undo and start over
● write only enough
code to pass the test
● remove duplication
(in code and tests)
● rename and clean up
● run tests and stay green
● change implementation,
not behavior
● improve structure
in small steps
RED GREEN
REFACTOR
Run all tests
after every single change
demo
utPLSQL v3 recap
● pure PL/SQL
● test configuration - annotations
● run configuration - invocation parameters
● flexible run scope
● hierarchical test structure
● several reporters
● test expectations on complex data-types
● multiple matchers
● automatic test isolation
● CI/CD with command-line utPLSQL-cli
resources
Documentation: http://utplsql.org/utPLSQL/
Cheat-sheet: https://www.cheatography.com/jgebal/cheat-sheets/utplsql-v3/#downloads
Sources: https://github.com/utPLSQL/utPLSQL
Demo project: https://github.com/utPLSQL/utPLSQL-demo-project
Sonar: https://sonarcloud.io/dashboard?id=utPLSQL%3AutPLSQL-demo-project%3Adevelop
Twitter: #utplsql, @utplsql

Test Driven Development for PLSQL with utPLSQL v3

  • 1.
    utPLSQL v3 Ultimate UnitTesting framework for Oracle Jacek Gębal twitter: @GebalJacek mail: jgebal@gmail.com blog: oraclethoughts.com Senior Data Engineer Developer @Fidelity Investments - Ireland co-author of: utPLSQL v3
  • 2.
    The Unit Test ●Simple ● Repeatable ● Automated ● Isolated from other tests ● Tests one behavior ● Living documentation ● Developer’s responsibility
  • 3.
    ● Professional productdelivery ● Meets requirement ● Delivered on time ● Easy to build ● Maintainable ● Safe to change Why should I care?
  • 4.
    What to testin database? ● Logic ● Structure ● State
  • 5.
    Why utPLSQL v3? ●open-source ● free ● complete ● unit tested ● IDE independent ● transportable ● pure PL/SQL ● CI/CD oriented ● extendable
  • 6.
    Getting started unit testingas part of software delivery lifecycle
  • 7.
    Test Driven Development ●write a test ● make it fail ● keep it simple ● tests are examples ● tests become documentation ● get to green fast ● take baby steps ● stuck? undo and start over ● write only enough code to pass the test ● remove duplication (in code and tests) ● rename and clean up ● run tests and stay green ● change implementation, not behavior ● improve structure in small steps RED GREEN REFACTOR
  • 8.
    Run all tests afterevery single change
  • 9.
  • 10.
    utPLSQL v3 recap ●pure PL/SQL ● test configuration - annotations ● run configuration - invocation parameters ● flexible run scope ● hierarchical test structure ● several reporters ● test expectations on complex data-types ● multiple matchers ● automatic test isolation ● CI/CD with command-line utPLSQL-cli
  • 11.
    resources Documentation: http://utplsql.org/utPLSQL/ Cheat-sheet: https://www.cheatography.com/jgebal/cheat-sheets/utplsql-v3/#downloads Sources:https://github.com/utPLSQL/utPLSQL Demo project: https://github.com/utPLSQL/utPLSQL-demo-project Sonar: https://sonarcloud.io/dashboard?id=utPLSQL%3AutPLSQL-demo-project%3Adevelop Twitter: #utplsql, @utplsql