SlideShare a Scribd company logo
Jacek Gębal
twitter: @GebalJacek
mail: jgebal@gmail.com
blog: oraclethoughts.com
Principal Software Engineer
@Fidelity Investments - Ireland
co-author & maintainer of: utPLSQL
About me
● Software engineer since ~2000 - mainly Oracle database
● Infected with testing and automation since ~2013
● Key contributor, author and maintainer of utPLSQL v3
● Active developer, learner, testing advocate
Why?
Plan
What?
When?
How?
Why test?
● Check that software “works”
Why do we test?
● Find bugs
● Prove that solution meets requirements and expectations
● Prove that change didn’t break existing functionality
● Document requirements and reveal intention
Automatic test generators
● Find bugs
● Check that software “works”
● Prove that solution meets requirements and
expectations
● Prove that change didn’t break existing
functionality
● Document requirements and reveal intention
● Created from the code
● Created for the code
● Confirm that code “does stuff”
● No confidence that code
“does the right thing”
● No reference to requirements
● Behavior
○ Logic
○ in / out structures
○ State (?)
● Avoid
○ under / over testing
○ unstable tests
○ slow tests
○ testing code you don’t own
What to
test?
● Test early (TDD)
● Test often
● Test automatically (CI/CD)
When to
test?
https://www.google.com/search?q=test+early...
Properties of Unit Tests
● Fast
● Isolated
● Repeatable
● Self-verifying (obvious)
● Thorough & Timely
https://github.com/ghsukumar/.../F.I.R.S.T-Principles-of...
https://pragprog.com/magazines/2012-01/unit-tests-are-first
How to
test?
Test Driven Development
● write a test
● see 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
With TDD you get:
● Fast feedback loop
● Visible & iterative progress
● Code is tested before it exists
● Feeling of accomplishment
with every new test
create room
demo
function - Create room
● Creates a room with given name and returns it’s id
● Throws exception when room name is null
● Throws exception when room exists
Remove room by name
● Removes room that has no content
● Throws exception when room is not empty,
keeps the room and it’s content
● Throws exception when room does not exist
● Throws exception when null room name given
Add room content
● Fails when room does not exist
● Fails when content name is null
● Adds content to existing room
● free & open source
● self tested & compatible with Oracle 11gR2+
● IDE independent
● pure PL/SQL
● tests described only by annotations & expectations
● implements best testing patterns
● easy to Version Control
● transportable
● automatic transaction - no rollback/cleanup needed
● data type - aware comparison (expectations)
Why utPLSQL v3 ?
utPLSQL core
Annotation syntax:
--%suite( description )
--%test( description )
Expectations:
ut.expect( actual_value ).to_( equal( 1 ) );
ut.expect( ‘Chuck’ ).to_equal( ‘Chuck’ );
Running tests:
exec ut.run( [options] );
Annotations
Package:
● --%suite(<description>)
● --%suitepath(<path>)
● --%rollback(auto/manual)
● --%disabled
● --%displayname(<description>)
● --%context(<name>)
● --%endcontext
Test procedure:
● --%test(<description>)
● --%throws(<error>[,...])
● --%beforetest(<proc_name>[,...])
● --%aftertest(<proc_name>[,...])
● --%rollback(auto/manual)
● --%disabled
Procedure:
● --%beforeall, --%afterall
● --%beforeeach, --%aftereach
http://utplsql.org/utPLSQL/latest/userguide/annotations.html
Supported data-types
● clob, blob
● timestamp (with (local) timezone)
● interval (day to second / year to month)
● cursor
● object, nested table, varray
● number (integer)
● varchar2 (char / varchar)
● date
● boolean
Expectations & matchers
● equal( expected )
● be_null / be_not_null
● be_true / be_false
● be_like( mask [, escape_char] )
● match( pattern [, modifiers] )
● contain( expected )
● be_within( offset, expected )
ut.expect( actual ).to_( matcher(param[, param...]) );
ut.expect( actual ).not_to( matcher(param[, param...]) );
● be_between( lower, upper )
● be_greater_than( expected )
● be_less_than( expected )
● be_greater_or_equal( expected )
● be_less_or_equal( expected )
● have_count( count ) / be_empty
Matchers:
Equality rules in tests
ut.expect( 100 ).to_equal( ‘100’ );
ut.expect( ‘abcdef’ ).to_equal( to_clob( ‘abcdef’ ) );
ut.expect( systimestamp ).to_equal( current_timestamp );
ut.expect( sysdate ).to_equal( ‘20-MAR-2018’ );
When it comes to unit testing ...
Data types matter!
Organizing tests with suitepath
● suites hierarchy with suitepath
● parent, siblings, ancestors
● shared beforeall / afterall
● suites isolation / setup scope
demo
Test run options
● default options
● single schema
● single package
● single test
● suite
● multiple schema
● specifying reporter
demo
utplsql-cli
● Windows/Linux/Mac
● real-time reporting
● multi-reporting & saving reports to files
● Oracle client independent
● CI/CD oriented
demo
Integration
● CI/CD servers
○ Jenkins
○ TeamCity
○ Travis
○ other...
● Sonar
○ generic test results
○ code coverage
● Coveralls
○ code coverage
demo
Resources
Downloads: https://github.com/utPLSQL/utPLSQL/releases
Documentation: http://utplsql.org/utPLSQL/
Cheat-sheet: https://www.cheatography.com/jgebal/cheat-sheets/utplsql-v3-1-2/
Source code: https://github.com/utPLSQL/utPLSQL
utPLSQL-cli: https://github.com/utPLSQL/utPLSQL-cli/releases
SQLDeveloper-extension: https://github.com/utPLSQL/utPLSQL-SQLDeveloper/releases
Maven plugin: https://github.com/utPLSQL/utPLSQL-maven-plugin/releases
Twitter: @utplsql
Demo project: https://github.com/utPLSQL/utPLSQL-demo-project
Sonar results: https://sonarcloud.io/dashboard?id=utPLSQL
Coveralls results: https://coveralls.io/github/utPLSQL/utPLSQL
Travis-CI builds: https://travis-ci.org/utPLSQL/utPLSQL

More Related Content

What's hot

utPLSQL: Unit Testing for Oracle PL/SQL
utPLSQL: Unit Testing for Oracle PL/SQLutPLSQL: Unit Testing for Oracle PL/SQL
utPLSQL: Unit Testing for Oracle PL/SQL
Steven Feuerstein
 
Integration Group - Robot Framework
Integration Group - Robot Framework Integration Group - Robot Framework
Integration Group - Robot Framework
OpenDaylight
 
Test driving QML
Test driving QMLTest driving QML
Test driving QML
Artem Marchenko
 
Automated php unit testing in drupal 8
Automated php unit testing in drupal 8Automated php unit testing in drupal 8
Automated php unit testing in drupal 8
Jay Friendly
 
TDD in Go with Ginkgo and Gomega
TDD in Go with Ginkgo and GomegaTDD in Go with Ginkgo and Gomega
TDD in Go with Ginkgo and Gomega
Eddy Reyes
 
Successful Joomla migrations that don't hurt Search Engine Rankings
Successful Joomla migrations that don't hurt Search Engine RankingsSuccessful Joomla migrations that don't hurt Search Engine Rankings
Successful Joomla migrations that don't hurt Search Engine Rankings
Joomla Day South Africa
 
Unit Testing your React / Redux app (@BucharestJS)
Unit Testing your React / Redux app (@BucharestJS)Unit Testing your React / Redux app (@BucharestJS)
Unit Testing your React / Redux app (@BucharestJS)
Alin Pandichi
 
Unit testing - A&BP CC
Unit testing - A&BP CCUnit testing - A&BP CC
Unit testing - A&BP CC
JWORKS powered by Ordina
 
Php Inspections (EA Extended): The Cookbook
Php Inspections (EA Extended): The CookbookPhp Inspections (EA Extended): The Cookbook
Php Inspections (EA Extended): The Cookbook
Vladimir Reznichenko
 
20150314 - Functional Testing for Configuration Management @ Cascadia IT Con...
20150314  - Functional Testing for Configuration Management @ Cascadia IT Con...20150314  - Functional Testing for Configuration Management @ Cascadia IT Con...
20150314 - Functional Testing for Configuration Management @ Cascadia IT Con...
garrett honeycutt
 
Smolder Introduction
Smolder IntroductionSmolder Introduction
Smolder Introduction
Michael Peters
 
Test driving-qml
Test driving-qmlTest driving-qml
Test driving-qml
Artem Marchenko
 
Into The Box 2018 | Assert control over your legacy applications
Into The Box 2018 | Assert control over your legacy applicationsInto The Box 2018 | Assert control over your legacy applications
Into The Box 2018 | Assert control over your legacy applications
Ortus Solutions, Corp
 
Test your code
Test your codeTest your code
Test your code
Geeks Anonymes
 
Ratpack JVM_MX Meetup February 2016
Ratpack JVM_MX Meetup February 2016Ratpack JVM_MX Meetup February 2016
Ratpack JVM_MX Meetup February 2016
Domingo Suarez Torres
 
Drupalhagen 2014 kiss omg ftw
Drupalhagen 2014   kiss omg ftwDrupalhagen 2014   kiss omg ftw
Drupalhagen 2014 kiss omg ftw
Arne Jørgensen
 
Google C++ Testing Framework in Visual Studio 2008
Google C++ Testing Framework in Visual Studio 2008Google C++ Testing Framework in Visual Studio 2008
Google C++ Testing Framework in Visual Studio 2008
Andrea Francia
 
Testing Toolbox
Testing ToolboxTesting Toolbox
Testing Toolbox
Michael Peters
 
PHPUnit with CakePHP and Yii
PHPUnit with CakePHP and YiiPHPUnit with CakePHP and Yii
PHPUnit with CakePHP and Yii
madhavi Ghadge
 

What's hot (20)

utPLSQL: Unit Testing for Oracle PL/SQL
utPLSQL: Unit Testing for Oracle PL/SQLutPLSQL: Unit Testing for Oracle PL/SQL
utPLSQL: Unit Testing for Oracle PL/SQL
 
Integration Group - Robot Framework
Integration Group - Robot Framework Integration Group - Robot Framework
Integration Group - Robot Framework
 
Test driving QML
Test driving QMLTest driving QML
Test driving QML
 
Automated php unit testing in drupal 8
Automated php unit testing in drupal 8Automated php unit testing in drupal 8
Automated php unit testing in drupal 8
 
TDD in Go with Ginkgo and Gomega
TDD in Go with Ginkgo and GomegaTDD in Go with Ginkgo and Gomega
TDD in Go with Ginkgo and Gomega
 
Successful Joomla migrations that don't hurt Search Engine Rankings
Successful Joomla migrations that don't hurt Search Engine RankingsSuccessful Joomla migrations that don't hurt Search Engine Rankings
Successful Joomla migrations that don't hurt Search Engine Rankings
 
Unit Testing your React / Redux app (@BucharestJS)
Unit Testing your React / Redux app (@BucharestJS)Unit Testing your React / Redux app (@BucharestJS)
Unit Testing your React / Redux app (@BucharestJS)
 
Unit testing - A&BP CC
Unit testing - A&BP CCUnit testing - A&BP CC
Unit testing - A&BP CC
 
Php Inspections (EA Extended): The Cookbook
Php Inspections (EA Extended): The CookbookPhp Inspections (EA Extended): The Cookbook
Php Inspections (EA Extended): The Cookbook
 
20150314 - Functional Testing for Configuration Management @ Cascadia IT Con...
20150314  - Functional Testing for Configuration Management @ Cascadia IT Con...20150314  - Functional Testing for Configuration Management @ Cascadia IT Con...
20150314 - Functional Testing for Configuration Management @ Cascadia IT Con...
 
Smolder Introduction
Smolder IntroductionSmolder Introduction
Smolder Introduction
 
Test driving-qml
Test driving-qmlTest driving-qml
Test driving-qml
 
Into The Box 2018 | Assert control over your legacy applications
Into The Box 2018 | Assert control over your legacy applicationsInto The Box 2018 | Assert control over your legacy applications
Into The Box 2018 | Assert control over your legacy applications
 
DDD with Behat
DDD with BehatDDD with Behat
DDD with Behat
 
Test your code
Test your codeTest your code
Test your code
 
Ratpack JVM_MX Meetup February 2016
Ratpack JVM_MX Meetup February 2016Ratpack JVM_MX Meetup February 2016
Ratpack JVM_MX Meetup February 2016
 
Drupalhagen 2014 kiss omg ftw
Drupalhagen 2014   kiss omg ftwDrupalhagen 2014   kiss omg ftw
Drupalhagen 2014 kiss omg ftw
 
Google C++ Testing Framework in Visual Studio 2008
Google C++ Testing Framework in Visual Studio 2008Google C++ Testing Framework in Visual Studio 2008
Google C++ Testing Framework in Visual Studio 2008
 
Testing Toolbox
Testing ToolboxTesting Toolbox
Testing Toolbox
 
PHPUnit with CakePHP and Yii
PHPUnit with CakePHP and YiiPHPUnit with CakePHP and Yii
PHPUnit with CakePHP and Yii
 

Similar to POUG Meetup 1st MArch 2019 - utPLSQL v3 - Testing Framework for PL/SQL

OUG Ireland 2019 - building free, open-source, PL/SQL products in cloud
OUG Ireland 2019 - building free, open-source, PL/SQL products in cloudOUG Ireland 2019 - building free, open-source, PL/SQL products in cloud
OUG Ireland 2019 - building free, open-source, PL/SQL products in cloud
Jacek Gebal
 
Working With Legacy Code
Working With Legacy CodeWorking With Legacy Code
Working With Legacy Code
Andrea Polci
 
Developer Tests - Things to Know (Vilnius JUG)
Developer Tests - Things to Know (Vilnius JUG)Developer Tests - Things to Know (Vilnius JUG)
Developer Tests - Things to Know (Vilnius JUG)
vilniusjug
 
Testing with Express, Mocha & Chai
Testing with Express, Mocha & ChaiTesting with Express, Mocha & Chai
Testing with Express, Mocha & Chai
Joerg Henning
 
Validating Big Data Pipelines - Big Data Spain 2018
Validating Big Data Pipelines - Big Data Spain 2018Validating Big Data Pipelines - Big Data Spain 2018
Validating Big Data Pipelines - Big Data Spain 2018
Holden Karau
 
Validating Big Data Jobs—Stopping Failures Before Production on Apache Spark...
 Validating Big Data Jobs—Stopping Failures Before Production on Apache Spark... Validating Big Data Jobs—Stopping Failures Before Production on Apache Spark...
Validating Big Data Jobs—Stopping Failures Before Production on Apache Spark...
Databricks
 
TDD - Designing with Expectations, not Implementations
TDD - Designing with Expectations, not ImplementationsTDD - Designing with Expectations, not Implementations
TDD - Designing with Expectations, not Implementations
Harshith Shetty
 
Test driven development - Zombie proof your code
Test driven development - Zombie proof your codeTest driven development - Zombie proof your code
Test driven development - Zombie proof your code
Pascal Larocque
 
The Professional Programmer
The Professional ProgrammerThe Professional Programmer
The Professional Programmer
Dave Cross
 
Validating big data jobs - Spark AI Summit EU
Validating big data jobs  - Spark AI Summit EUValidating big data jobs  - Spark AI Summit EU
Validating big data jobs - Spark AI Summit EU
Holden Karau
 
Journey through high performance django application
Journey through high performance django applicationJourney through high performance django application
Journey through high performance django application
bangaloredjangousergroup
 
Automated testing
Automated testingAutomated testing
Automated testing
Aiste Stikliute
 
Green Custard Friday Talk 8: GraphQL
Green Custard Friday Talk 8: GraphQLGreen Custard Friday Talk 8: GraphQL
Green Custard Friday Talk 8: GraphQL
Green Custard
 
Object Oriented Javascript
Object Oriented JavascriptObject Oriented Javascript
Object Oriented Javascript
NexThoughts Technologies
 
A la découverte des google/test (aka gtest)
A la découverte des google/test (aka gtest)A la découverte des google/test (aka gtest)
A la découverte des google/test (aka gtest)
Thierry Gayet
 
Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)
Lars Thorup
 
Collaborating with Developers: How-to Guide for Test Engineers - By Gil Tayar
Collaborating with Developers: How-to Guide for Test Engineers - By Gil Tayar Collaborating with Developers: How-to Guide for Test Engineers - By Gil Tayar
Collaborating with Developers: How-to Guide for Test Engineers - By Gil Tayar
Applitools
 
An evening with Postgresql
An evening with PostgresqlAn evening with Postgresql
An evening with Postgresql
Joshua Drake
 
How to establish ways of working that allows shifting-left of the automation ...
How to establish ways of working that allows shifting-left of the automation ...How to establish ways of working that allows shifting-left of the automation ...
How to establish ways of working that allows shifting-left of the automation ...
Max Barrass
 

Similar to POUG Meetup 1st MArch 2019 - utPLSQL v3 - Testing Framework for PL/SQL (20)

OUG Ireland 2019 - building free, open-source, PL/SQL products in cloud
OUG Ireland 2019 - building free, open-source, PL/SQL products in cloudOUG Ireland 2019 - building free, open-source, PL/SQL products in cloud
OUG Ireland 2019 - building free, open-source, PL/SQL products in cloud
 
Spock pres
Spock presSpock pres
Spock pres
 
Working With Legacy Code
Working With Legacy CodeWorking With Legacy Code
Working With Legacy Code
 
Developer Tests - Things to Know (Vilnius JUG)
Developer Tests - Things to Know (Vilnius JUG)Developer Tests - Things to Know (Vilnius JUG)
Developer Tests - Things to Know (Vilnius JUG)
 
Testing with Express, Mocha & Chai
Testing with Express, Mocha & ChaiTesting with Express, Mocha & Chai
Testing with Express, Mocha & Chai
 
Validating Big Data Pipelines - Big Data Spain 2018
Validating Big Data Pipelines - Big Data Spain 2018Validating Big Data Pipelines - Big Data Spain 2018
Validating Big Data Pipelines - Big Data Spain 2018
 
Validating Big Data Jobs—Stopping Failures Before Production on Apache Spark...
 Validating Big Data Jobs—Stopping Failures Before Production on Apache Spark... Validating Big Data Jobs—Stopping Failures Before Production on Apache Spark...
Validating Big Data Jobs—Stopping Failures Before Production on Apache Spark...
 
TDD - Designing with Expectations, not Implementations
TDD - Designing with Expectations, not ImplementationsTDD - Designing with Expectations, not Implementations
TDD - Designing with Expectations, not Implementations
 
Test driven development - Zombie proof your code
Test driven development - Zombie proof your codeTest driven development - Zombie proof your code
Test driven development - Zombie proof your code
 
The Professional Programmer
The Professional ProgrammerThe Professional Programmer
The Professional Programmer
 
Validating big data jobs - Spark AI Summit EU
Validating big data jobs  - Spark AI Summit EUValidating big data jobs  - Spark AI Summit EU
Validating big data jobs - Spark AI Summit EU
 
Journey through high performance django application
Journey through high performance django applicationJourney through high performance django application
Journey through high performance django application
 
Automated testing
Automated testingAutomated testing
Automated testing
 
Green Custard Friday Talk 8: GraphQL
Green Custard Friday Talk 8: GraphQLGreen Custard Friday Talk 8: GraphQL
Green Custard Friday Talk 8: GraphQL
 
Object Oriented Javascript
Object Oriented JavascriptObject Oriented Javascript
Object Oriented Javascript
 
A la découverte des google/test (aka gtest)
A la découverte des google/test (aka gtest)A la découverte des google/test (aka gtest)
A la découverte des google/test (aka gtest)
 
Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)
 
Collaborating with Developers: How-to Guide for Test Engineers - By Gil Tayar
Collaborating with Developers: How-to Guide for Test Engineers - By Gil Tayar Collaborating with Developers: How-to Guide for Test Engineers - By Gil Tayar
Collaborating with Developers: How-to Guide for Test Engineers - By Gil Tayar
 
An evening with Postgresql
An evening with PostgresqlAn evening with Postgresql
An evening with Postgresql
 
How to establish ways of working that allows shifting-left of the automation ...
How to establish ways of working that allows shifting-left of the automation ...How to establish ways of working that allows shifting-left of the automation ...
How to establish ways of working that allows shifting-left of the automation ...
 

Recently uploaded

Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
Mukeshwaran Balu
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Christina Lin
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptxTOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
nikitacareer3
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
Kamal Acharya
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
MIGUELANGEL966976
 
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
obonagu
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.pptPROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
bhadouriyakaku
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
ssuser7dcef0
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
SyedAbiiAzazi1
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 

Recently uploaded (20)

Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptxTOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
 
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.pptPROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 

POUG Meetup 1st MArch 2019 - utPLSQL v3 - Testing Framework for PL/SQL

  • 1. Jacek Gębal twitter: @GebalJacek mail: jgebal@gmail.com blog: oraclethoughts.com Principal Software Engineer @Fidelity Investments - Ireland co-author & maintainer of: utPLSQL
  • 2. About me ● Software engineer since ~2000 - mainly Oracle database ● Infected with testing and automation since ~2013 ● Key contributor, author and maintainer of utPLSQL v3 ● Active developer, learner, testing advocate
  • 5. ● Check that software “works” Why do we test? ● Find bugs ● Prove that solution meets requirements and expectations ● Prove that change didn’t break existing functionality ● Document requirements and reveal intention
  • 6. Automatic test generators ● Find bugs ● Check that software “works” ● Prove that solution meets requirements and expectations ● Prove that change didn’t break existing functionality ● Document requirements and reveal intention ● Created from the code ● Created for the code ● Confirm that code “does stuff” ● No confidence that code “does the right thing” ● No reference to requirements
  • 7. ● Behavior ○ Logic ○ in / out structures ○ State (?) ● Avoid ○ under / over testing ○ unstable tests ○ slow tests ○ testing code you don’t own What to test?
  • 8. ● Test early (TDD) ● Test often ● Test automatically (CI/CD) When to test? https://www.google.com/search?q=test+early...
  • 9. Properties of Unit Tests ● Fast ● Isolated ● Repeatable ● Self-verifying (obvious) ● Thorough & Timely https://github.com/ghsukumar/.../F.I.R.S.T-Principles-of... https://pragprog.com/magazines/2012-01/unit-tests-are-first How to test?
  • 10. Test Driven Development ● write a test ● see 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 With TDD you get: ● Fast feedback loop ● Visible & iterative progress ● Code is tested before it exists ● Feeling of accomplishment with every new test
  • 12. function - Create room ● Creates a room with given name and returns it’s id ● Throws exception when room name is null ● Throws exception when room exists
  • 13. Remove room by name ● Removes room that has no content ● Throws exception when room is not empty, keeps the room and it’s content ● Throws exception when room does not exist ● Throws exception when null room name given
  • 14. Add room content ● Fails when room does not exist ● Fails when content name is null ● Adds content to existing room
  • 15. ● free & open source ● self tested & compatible with Oracle 11gR2+ ● IDE independent ● pure PL/SQL ● tests described only by annotations & expectations ● implements best testing patterns ● easy to Version Control ● transportable ● automatic transaction - no rollback/cleanup needed ● data type - aware comparison (expectations) Why utPLSQL v3 ?
  • 16. utPLSQL core Annotation syntax: --%suite( description ) --%test( description ) Expectations: ut.expect( actual_value ).to_( equal( 1 ) ); ut.expect( ‘Chuck’ ).to_equal( ‘Chuck’ ); Running tests: exec ut.run( [options] );
  • 17. Annotations Package: ● --%suite(<description>) ● --%suitepath(<path>) ● --%rollback(auto/manual) ● --%disabled ● --%displayname(<description>) ● --%context(<name>) ● --%endcontext Test procedure: ● --%test(<description>) ● --%throws(<error>[,...]) ● --%beforetest(<proc_name>[,...]) ● --%aftertest(<proc_name>[,...]) ● --%rollback(auto/manual) ● --%disabled Procedure: ● --%beforeall, --%afterall ● --%beforeeach, --%aftereach http://utplsql.org/utPLSQL/latest/userguide/annotations.html
  • 18. Supported data-types ● clob, blob ● timestamp (with (local) timezone) ● interval (day to second / year to month) ● cursor ● object, nested table, varray ● number (integer) ● varchar2 (char / varchar) ● date ● boolean
  • 19. Expectations & matchers ● equal( expected ) ● be_null / be_not_null ● be_true / be_false ● be_like( mask [, escape_char] ) ● match( pattern [, modifiers] ) ● contain( expected ) ● be_within( offset, expected ) ut.expect( actual ).to_( matcher(param[, param...]) ); ut.expect( actual ).not_to( matcher(param[, param...]) ); ● be_between( lower, upper ) ● be_greater_than( expected ) ● be_less_than( expected ) ● be_greater_or_equal( expected ) ● be_less_or_equal( expected ) ● have_count( count ) / be_empty Matchers:
  • 20. Equality rules in tests ut.expect( 100 ).to_equal( ‘100’ ); ut.expect( ‘abcdef’ ).to_equal( to_clob( ‘abcdef’ ) ); ut.expect( systimestamp ).to_equal( current_timestamp ); ut.expect( sysdate ).to_equal( ‘20-MAR-2018’ ); When it comes to unit testing ... Data types matter!
  • 21. Organizing tests with suitepath ● suites hierarchy with suitepath ● parent, siblings, ancestors ● shared beforeall / afterall ● suites isolation / setup scope
  • 22. demo
  • 23. Test run options ● default options ● single schema ● single package ● single test ● suite ● multiple schema ● specifying reporter
  • 24. demo
  • 25. utplsql-cli ● Windows/Linux/Mac ● real-time reporting ● multi-reporting & saving reports to files ● Oracle client independent ● CI/CD oriented
  • 26. demo
  • 27. Integration ● CI/CD servers ○ Jenkins ○ TeamCity ○ Travis ○ other... ● Sonar ○ generic test results ○ code coverage ● Coveralls ○ code coverage
  • 28. demo
  • 29. Resources Downloads: https://github.com/utPLSQL/utPLSQL/releases Documentation: http://utplsql.org/utPLSQL/ Cheat-sheet: https://www.cheatography.com/jgebal/cheat-sheets/utplsql-v3-1-2/ Source code: https://github.com/utPLSQL/utPLSQL utPLSQL-cli: https://github.com/utPLSQL/utPLSQL-cli/releases SQLDeveloper-extension: https://github.com/utPLSQL/utPLSQL-SQLDeveloper/releases Maven plugin: https://github.com/utPLSQL/utPLSQL-maven-plugin/releases Twitter: @utplsql Demo project: https://github.com/utPLSQL/utPLSQL-demo-project Sonar results: https://sonarcloud.io/dashboard?id=utPLSQL Coveralls results: https://coveralls.io/github/utPLSQL/utPLSQL Travis-CI builds: https://travis-ci.org/utPLSQL/utPLSQL