- Notifications
You must be signed in to change notification settings - Fork187
Testing Framework for PL/SQL
License
utPLSQL/utPLSQL
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
utPLSQL version 3 is a complete rewrite of utPLSQL v2 from scratch.Version 2 still supports older versions of Oracle that are no longer available.The community that had developed on GitHub decided that a new internal architecture was needed, from that version 3 was born.
utPLSQL is a Unit Testing framework for Oracle PL/SQL and SQL.The framework follows industry standards and best patterns of modern Unit Testing frameworks likeJUnit andRSpec
- multiple ways to compare data withmatchers
- native comparison of complex types (objects/collections/cursors)
- in-depth and consistent reporting of failures and errors for tests
- tests identified and configured byannotations
- hierarchies of test suites configured with annotations
- automatic (configurable) transaction control
- Build-incoverage reporting
- Integration with SonarQube, Coveralls, Jenkins and Teamcity withreporters
- plugin architecture for reporters and matchers
- flexible and simple test invocation
- multi-reporting from test-run fromcommand line
Requirements:
- Version of Oracle underextended support (Currently 11.2 and above)
Published releases are available for download on theutPLSQL GitHub Releases Page.
Full documentation of the project is automatically published onutPLSQL github pages
To install the utPLSQL into a new database schema and grant it to public, execute the scriptinstall_headless.sql
.This will create a new userUT3
, grant all required privileges to that user and create PUBLIC synonyms needed.
For detailed instructions on other install options see theInstall Guide
To execute using development IDE (TOAD/SQLDeveloper/PLSQLDeveloper/other) use one of following commands.
beginut.run();end;/
execut.run();
select*from table(ut.run());
The above commands will run all the suites in the current schema and provide report to dbms_output or as a select statement.
You can use the utPLSQL command line clientutPLSQL-cli to run tests without the need for Oracle Client or any IDE like SQLDeveloper/TOAD etc.
Amongst many benefits it provides ability to:
- see the progress of test execution for long-running tests - real-time reporting
- use many reporting formats simultaneously and save reports to files (publish)
- map your project source files and test files into database objects
Download thelatest client and are good to go.Seeproject readme for details.
For examples of using Continuous Integration Server & SonarCloud with utPLSQL see theutPLSQL demo project.
The below test package is a fully-functional Unit Test package for testing abetwnstr
function.The package specification isannotated with special comments.The annotations define that a package is a unit test suite, they also allow defining a description for the suite as well as the test itself.The package body consists of procedures containing unit test code. To validatean expectation in test, useut.expect( actual_data ).to_( ... )
syntax.
createor replace package test_between_stringas-- %suite(Between string function)-- %test(Returns substring from start position to end position) procedure normal_case;-- %test(Returns substring when start position is zero) procedure zero_start_position;-- %test(Returns string until end if end position is greater than string length) procedure big_end_position;-- %test(Returns null for null input string value) procedure null_string;end;/createor replace package body test_between_stringas procedure normal_case isbeginut.expect( betwnstr('1234567',2,5 ) ).to_( equal('2345') ); end; procedure zero_start_position isbeginut.expect( betwnstr('1234567',0,5 ) ).to_( equal('12345') ); end; procedure big_end_position isbeginut.expect( betwnstr('1234567',0,500 ) ).to_( equal('1234567') ); end; procedure null_string isbeginut.expect( betwnstr(null,2,5 ) ).to_( be_null ); end;end;/
Outputs from running the above tests
Between string function Returns substring from start position to end position Returns substring when start position is zero Returns string until end if end position is greater than string length Returns null for null input string valueFinished in .036027 seconds4 tests, 0 failures
We welcome new developers to join our community and contribute to the utPLSQL project.If you are interested in helping please read ourguide to contributingThe best place to start is to read the documentation and get familiar with the existing code base.Aslack chat is the place to go if you want to talk with team members.To sign up to the chat usethis link.
Project Directories
- .github - contains files needed for github Actions integration
- .travis - contains files needed for travis-ci integration
- client_source - Sources to be used on the client-side. Developer workstation or CI platform to run the tests.
- development - Set of useful scripts and utilities for development and debugging of utPLSQL
- docs - Documentation of the project
- examples - Example source code and unit tests
- source - The installation code for utPLSQL
- tests - Tests for utPLSQL framework
If you have a great feature in mind, that you would like to see in utPLSQL v3 please create anissue on GitHub or discuss it with us in theslack chat rooms. Useinvite link to join the chat.
Version 2 to Version 3 Comparison
The utPLSQL project is community-driven and is not commercially motivated. Nonetheless, donations and other contributions are always welcome, and are detailed below.
![]() | utPLSQL has been supported by Redgate in the form of sponsored stickers and t-shirts. Thank you for helping us spreading the word! |
About
Testing Framework for PL/SQL
Topics
Resources
License
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.