+ If you want utPLSQL to automatically recompile your test packages, you
+ will need to make sure that UTL_FILE is enabled in your database (this
+ allows you to read/write operating system files). The database initialization
+ parameter file (aka, the "init.ora" file) must have at least one utl_file_dir
+ parameter in it for this to work. Here is some background and guidelines
+ for working with UTL_FILE:
+
+
+ UTL_FILE lets you read and write files accessible from the server on
+ which your database is running. So, theoretically, you could use UTL_FILE
+ to write right over your tablespace data files, control files and so on.
+ That is, of course, a very bad idea. Server security requires the ability
+ to place restrictions on where you can read and write your files.
+
+
+ UTL_FILE implements this security by limiting access to files that reside
+ in one of the directories specified in the init.ora file (parameter initialization
+ file) for the database instance on which UTL_FILE is running.
+
+
+ When you call UTL_FILE.FOPEN to open a file, you must specify both the
+ location and the name of the file, in separate arguments. This file location
+ is then checked against the list of accessible directories.
+
+
+ The format of the parameter for file access in the init.ora file is:
+
+
+utl_file_dir = <directory>
+
+
+ Include a parameter for utl_file_dir for each directory you want to make
+ accessible for UTL_FILE operations. The following entries, for example,
+ enable four different directories in Unix:
+
+ To bypass server security and allow read/write access to all directories,
+ you can use this special syntax:
+
+
+
+utl_file_dir = *
+
+
+
+ You should not use this option on production systems. In a development
+ system, this entry certainly makes it easier for developers to get up and
+ running on UTL_FILE and test their code. You should, however, only allow
+ access to a few specific directories when you move the application to production.
+
+
Some observations on working with and setting up accessible directories with UTL_FILE:
+
+ Access is not recursive through subdirectories. If the following lines
+ were in your init.ora file, for example,
+
+ then you would not be able to open a file in the c:\group\prod\oe\reports
+ subdirectory.
+
+
+ Do not include the following entry in Unix systems:
+
+
+
+utl_file_dir = .
+
+
+
+ This would allow you to read/write on the current directory in the operating
+ system.
+
+
+ Do not enclose the directory names within single or double quotes.
+
+
+ In the UNIX environment, a file created by UTL_FILE.FOPEN has as its
+ owner the shadow process running the Oracle instance. This is usually the
+ oracle owner. If you try to access these files outside of UTL_FILE, you
+ will need to have the correct privileges (or be logged in as oracle) to
+ access or change these files.
+
+
+ You should not end your directory name with a delimiter, such as the
+ forward slash in Unix. The following specification of a directory will
+ result in problems when trying to read from or write to the directory:
+
+
+
+utl_file_dir = /tmp/orafiles/
+
+
+
+ After you modify your parameter initialization file, you will need to stop
+ and then restart your database instance.
+
+
Test UTL_FILE Access
+
+ If you have never before used or relied on UTL_FILE, you should write
+ a simple test to verify that UTL_FILE is now working. You can use the code
+ shown below (after changing your directory names and names for existing
+ and new files) to make sure you've got it running properly.
+
+
+
+SET SERVEROUTPUT ON
+
+DECLARE
+ fid UTL_FILE.FILE_TYPE;
+ v VARCHAR2(32767);
+ PROCEDURE recNgo (str IN VARCHAR2)
+ IS
+ BEGIN
+ DBMS_OUTPUT.PUT_LINE ('UTL_FILE error ' || str);
+
+ UTL_FILE.FCLOSE (fid);
+ END;
+BEGIN
+ /* Change the directory name to one to which you at least
+ || THINK you have read/write access.
+ */
+ fid := UTL_FILE.FOPEN ('e:\demo', 'existing_file', 'R');
+ UTL_FILE.GET_LINE (fid, v);
+ dbms_output.put_line (v);
+
+ UTL_FILE.FCLOSE (fid);
+
+ fid := UTL_FILE.FOPEN ('e:\demo', 'new_file', 'W');
+
+ UTL_FILE.PUT_LINE (fid, v);
+
+ UTL_FILE.FCLOSE (fid);
+EXCEPTION
+ WHEN UTL_FILE.INVALID_PATH
+ THEN recNgo ('invalid_path');
+ WHEN UTL_FILE.INVALID_MODE
+ THEN recNgo ('invalid_mode');
+ WHEN UTL_FILE.INVALID_FILEHANDLE
+ THEN recNgo ('invalid_filehandle');
+ WHEN UTL_FILE.INVALID_OPERATION
+ THEN recNgo ('invalid_operation');
+ WHEN UTL_FILE.READ_ERROR
+ THEN recNgo ('read_error');
+ WHEN UTL_FILE.WRITE_ERROR
+ THEN recNgo ('write_error');
+ WHEN UTL_FILE.INTERNAL_ERROR
+ THEN recNgo ('internal_error');
+END;
+/
+
+
+ If an error occurs, it will be displayed on your screen (note: the "set
+ serveroutput on" is not required for UTL_FILE to work, but simply to display
+ any errors which might occur).
+
+
+
Join the utPLSQL Project Team
+
+
+ To take part in the utPLSQL project, have a look round the
+ utPLSQL project site,
+ in particular the CONTRIBUTING.md
+ and issues tracker.
+ Once you are up to speed on the project, you can choose a issue and begin to contribute.
+
+
+
Reporting Bugs and Enhancement Requests
+
+
+ To identify the version of utPLSQL you are running,
+ you can execute the following program in SQL*Plus:
+
+
+
+SQL> set serveroutput on
+SQL> exec dbms_output.put_line (utPLSQL.version)
+
+
+
+ You can also look inside the utPLSQL package (utPLSQL.pkb)
+ and check the value of the g_version private variable.
+
\n";
+ $footer .= "\n";
+ $footer .= "";
+
+ return $footer;
+}
\ No newline at end of file
diff --git a/documentation/src/buildpack.html b/documentation/src/buildpack.html
new file mode 100644
index 000000000..180cf2f19
--- /dev/null
+++ b/documentation/src/buildpack.html
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
Build Test Packages
+
+
+ We learn best by following the examples of those who have gone before
+ us. So you will find in this document sample test packages and different
+ approaches to using utPLSQL to test your PL/SQL code like it has never
+ been tested before!
+
+
+ Spend some time in the general How to Build a Test
+ Package so that you are comfortable with the basic steps necessary
+ to integrate your test code into the utPLSQL framework. The Test Run section
+ offers a narrative presentation of building a test package; it makes a
+ nice follow-up to the How To section if you still feel any uncertainty.
+ Then you will be more than ready to explore the Examples.
+
+
+
+
+
diff --git a/documentation/src/copyright_years.txt b/documentation/src/copyright_years.txt
new file mode 100644
index 000000000..1c07d8fc8
--- /dev/null
+++ b/documentation/src/copyright_years.txt
@@ -0,0 +1,4 @@
+# This contains a list of years for the copyright notices
+#
+2000-2005
+2014-2016
\ No newline at end of file
diff --git a/documentation/src/defsuite.html b/documentation/src/defsuite.html
new file mode 100644
index 000000000..9577786af
--- /dev/null
+++ b/documentation/src/defsuite.html
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
+
+
+
Defining Test Suites
+
+
+ If you define test suites and register packages
+ within those suites, then utPLSQL will run an unlimited number of
+ tests with a single command.
+
+
+
Note
+
+
+
+ All suite names are stored in upper case.
+
+
+
+ If you do not specify a directory (dir_in),
+ you will need to call utConfig.setdir if you want automatic compilation
+ of your packages to occur.
+
+
+
+ If you supply a value for seq_in, packages
+ will be compiled and tested in ascending numeric sequence order.
+
+
+
+ When you call utSuite.rem, it will remove all
+ packages for that suite by calling utPackage.rem.
+
+
+
+
utSuite - Define Test Suites
+
+
To create and remove test suites, call these programs:
+
+
+PROCEDURE utSuite.add (
+ name_in IN VARCHAR2,
+ desc_in IN VARCHAR2 := NULL,
+ rem_if_exists_in IN BOOLEAN := TRUE
+);
+
+PROCEDURE utSuite.rem (name_in IN VARCHAR2);
+
+
+
+ These programs manipulate the contents of the ut_suite
+ table. See the tables.sql file for the DDL creating this table.
+
+
+
utPackage - Define Test Packages for a Suite
+
+
To register a package in a suite, call the following:
+
+
+PROCEDURE utPackage.add (
+ suite_in IN VARCHAR2,
+ package_in IN VARCHAR2,
+ samepackage_in IN BOOLEAN := FALSE,
+ prefix_in IN VARCHAR2 := NULL,
+ dir_in IN VARCHAR2 := NULL,
+ seq_in IN PLS_INTEGER := NULL,
+ owner_in IN VARCHAR2 := NULL,
+ add_tests_in IN BOOLEAN := FALSE,
+ test_overloads_in IN BOOLEAN := FALSE
+);
+
+
+
+ This manipulates the contents of the ut_package
+ table. See the tables.sql file for the DDL creating this table.
+
+
+
+ Here is a sample script that defines a very small
+ portion of the PL/Vision test suite:
+
+ We learn best by following the examples of those who have gone before
+ us. So you will find in this document sample test packages and different
+ approaches to using utPLSQL to test your PL/SQL code like it has never
+ been tested before!
+
+ By default, the results of a test run are written to the screen
+ (via the default Output Reporter). The subprograms described in this
+ section were created by Rainer Medert to allow these results to be written
+ to file instead. They form part of the utConfig package. Don't forget that
+ you will first need to enable file output from the database via the
+ UTL_FILE_DIR parameter in order to do this.
+
+
+
Turning file output on
+
+
+ To turn on file output, you will need to switch to using the File
+ Reporter, or a custom reporter that uses it. See the page on Custom Reporter Packages for details.
+
+
+
Setting the directory to be used
+
+
+ Once file output has been turned on, you can specify which directory the
+ files will be written to using the following procedure:
+
+
+
+PROCEDURE setfiledir (
+ dir_in IN VARCHAR2 := NULL,
+ username_in IN VARCHAR2 := NULL
+);
+
+
+
+ the directory given will have to have been specified for output in a
+ UTL_FILE_DIR database parameter, as mentioned above.
+
+
+
To see which directory is being used for output, use the following:
+
+
+FUNCTION filedir (username_in IN VARCHAR2 := NULL) RETURN VARCHAR2;
+
+
+
Formatting the output filenames
+
+
The structure of the filenames used for output is as follows:
+
+
+<user-prefix>_[program-name_]<date><extension>
+
+
+
Each of these elements can be configured using the following procedures.
+
+
+ The user-prefix is an arbitrary string. It defaults to the username of
+ the currently connected user, but can be set (and returned) using the
+ following:
+
+
+
+-- Set the file prefix for a user
+PROCEDURE setuserprefix (
+ userprefix_in IN VARCHAR2 := NULL,
+ username_in IN VARCHAR2 := NULL
+);
+
+-- Get the file prefix for a user
+FUNCTION userprefix (username_in IN VARCHAR2 := NULL) RETURN VARCHAR2;
+
+
+
+ The program-name is the name of the tested program, or the test suite
+ being run. By default, this is element is not used in the generated filename.
+ To turn this on or off (and to determine the current setting), use the
+ following:
+
+
+
+-- Set the include program name flag for a user
+PROCEDURE setincludeprogname (
+ incname_in IN BOOLEAN := FALSE,
+ username_in IN VARCHAR2 := NULL
+);
+
+-- Get the include program name flag for a user
+FUNCTION includeprogname (username_in IN VARCHAR2 := NULL) RETURN BOOLEAN;
+
+
+
+ The date element of the filename is simply SYSDATE converted to a string.
+ The default format is 'YYYYDDMMHH24MISS', but this can be set (and
+ returned) using the following:
+
+
+
+-- Set the date format for a user
+PROCEDURE setdateformat (
+ dateformat_in IN VARCHAR2 := 'yyyyddmmhh24miss',
+ username_in IN VARCHAR2 := NULL
+);
+
+-- Get the date format for a user
+FUNCTION dateformat (username_in IN VARCHAR2 := NULL) RETURN VARCHAR2;
+
+
+
+ The final element of the filename that can be configured is the extension.
+ This defaults to ".UTF" but can be set (and returned) using the following:
+
+
+
+-- Set the file extension for a user
+PROCEDURE setfileextension (
+ fileextension_in IN VARCHAR2 := '.UTF',
+ username_in IN VARCHAR2 := NULL
+);
+
+-- Get the file extension for a user
+FUNCTION fileextension (username_in IN VARCHAR2 := NULL) RETURN VARCHAR2;
+
+
+
+ Note The initial dot must be included, otherwise there will be none
+ in the resulting filename!
+
+
+
Setting all the parameters at once
+
+
+ It is possible to set all the file output parameters at once using the
+ following procedure:
+
+
+
+PROCEDURE setfileinfo (
+ dir_in IN VARCHAR2 := NULL,
+ userprefix_in IN VARCHAR2 := NULL,
+ incname_in IN BOOLEAN := FALSE,
+ dateformat_in IN VARCHAR2 := 'yyyyddmmhh24miss',
+ fileextension_in IN VARCHAR2 := '.UTF',
+ username_in IN VARCHAR2 := NULL
+);
+
+
+
+ To get back all of the file output parameters simultaneously, use the
+ following function:
+
+
+
+FUNCTION fileinfo (username_in IN VARCHAR2 := NULL) RETURN rec_fileinfo;
+
+
+
+ The record type rec_fileinfo is defined in the utConfig
+ package and has one field for each of the parameters.
+
+ Note: if you have already installed a previous version of
+ utPLSQL, you will use these same steps to perform your install. The
+ installation procedure does not remove any objects, such as tables,
+ prior to installation. If you wish to install a fresh copy of utPLSQL, and not upgrade
+ over the existing installation, please follow the steps below for removing
+ utPLSQL.
+
+
+
+ Connect via SQL*Plus to the session that will own the
+ utPLSQL components. If you do not already have a schema defined, then you must
+ create it. The utPLSQL schema must have the authority to:
+
+
+
+
Create a session.
+
Create tables, views, packages and sequences.
+
+
+
+ If you like, you can install utPLSQL into the SYSTEM schema, which will avoid the need to create
+ a new user. However, you may prefer to keep everything in a separate place.
+ The following is an example script submitted by Bill Pribyl, which creates a user "UTP" with sufficient privileges
+ to install utPLSQL. Obviously it is only an example and will need to be changed for your environment:
+
+
+
+connect system/manager
+create user utp identified by utp default tablespace
+ users temporary tablespace temp;
+
+grant create session, create table, create procedure,
+ create sequence, create view, create public synonym,
+ drop public synonym to utp;
+
+alter user utp quota unlimited on users;
+
+
+
+ Note If the schema in question does not have the ability to create
+ and drop public synonyms or execute privilege on DBMS_PIPE, you may get
+ error messages when installing. However, utPLSQL will still function
+ correctly.
+
+
+
+ Once you have connected to the schema, run the ut_i_do.sql
+ file with the parameter "install" to install all utPLSQL objects. You should ensure that
+ the working directory of your SQL*Plus
+ session is the directory holding the utPLSQL files, then issue this as follows:
+
+
+
+SQL> @ut_i_do install
+
+
+
+ This file will create all tables, packages and other objects needed.
+ Note that the installation script
+ creates some files dynamically using the SPOOL command. For this reason, it is
+ necessary that you have write permission in the directory.
+
+
+
To check the installation of utPLSQL, examine the ut_i_install.log file.
+
+
Removing utPLSQL
+
+
+ To de-install the product, run the ut_i_do.sql
+ script again, but with the parameter "uninstall", as in:
+
+
+
+SQL> @ut_i_do uninstall
+
+
+
Step 2. Choose a program to test and identify the test cases.
+
+
+ You may want to test a single stand-alone procedure or
+ function, or a set of programs in a package. Pick the program and then come up
+ with the set of different cases you want to test. This data will determine what
+ kind of and how many tests you run for your program.
+
+
+
+ Suppose, for example, that I have created a stand alone function called
+ betwnStr (a variation on SUBSTR that returns a sub-string based on a starting
+ and ending location) that is stored in betwnstr.sf (1):
+
+
+
+CREATE OR REPLACE FUNCTION betwnStr (
+ string_in IN VARCHAR2,
+ start_in IN INTEGER,
+ end_in IN INTEGER
+)
+RETURN VARCHAR2
+IS
+BEGIN
+ RETURN (
+ SUBSTR (
+ string_in,
+ start_in,
+ end_in - start_in + 1
+ )
+ );
+END;
+
+
+
+ To test this function, I will want to pass in a variety of
+ inputs, as shown in this table:
+
+
+
+
+
+
Start
+
+
+
+
End
+
+
+
+
Result
+
+
+
+
+
+
NULL
+
+
+
NOT NULL
+
+
+
NULL
+
+
+
+
+
NOT NULL
+
+
+
NULL
+
+
+
NULL
+
+
+
+
+
NULL
+
+
+
NULL
+
+
+
NULL
+
+
+
+
+
3 (positive number)
+
+
+
1 (smaller positive number)
+
+
+
NULL
+
+
+
+
+
3 (positive number)
+
+
+
100 (larger than length of string)
+
+
+
Remainder of string from 3
+
+
+
+
+
So now I know what I want to test and how I want to test it.
+
+
Step 3. Build a test package.
+
+
+ utPLSQL offers an easy, automated way to run your tests. To
+ work automatically, though, you have to follow some rules so that utPLSQL can
+ find and execute your test code. Here are the rules:
+
+
+
The test code must be placed inside a test package.
+
+
+ The test package specification should
+ be stored in a file named ut_<program>.pks and the body must be stored in
+ a file named ut_<program>.pkb (by following this naming convention,
+ utPLSQL can be set to automatically recompile your test package before each
+ test).
+
+
+
+ The test package must contain a setup procedure called ut_setup and a teardown procedure called ut_teardown, neither of
+ which take any arguments.
+
+
+
+ The test package should have a separate procedure for each program to be
+ tested in this package.
+
+
+
+ Now, you should know that there are a number of bells and
+ whistles in utPLSQL that allow you to change many default values (such as the
+ prefixes used for the setup, teardown and test procedures) and behavior of the
+ utPLSQL packages. While you are "Getting Started", however, we will
+ rely completely on the defaults and get you up and testing ASAP.
+
+
+
+ So if I am going to test the stand-alone procedure, betwnstr, my test
+ package specification, saved in ut_betwnstr.pks(1),
+ will look like this:
+
+ Now let's build the package body, saved in ut_betwnstr.pkb(1). In this very simple
+ case, I don't have to set up any data structures and I do not, therefore, have
+ to tear anything down. My teardown procedure can be empty (but it must
+ be present). So I have:
+
+
+
+CREATE OR REPLACE PACKAGE BODY ut_betwnstr
+IS
+ PROCEDURE ut_setup IS
+ BEGIN
+ NULL;
+ END;
+
+ PROCEDURE ut_teardown
+ IS
+ BEGIN
+ NULL;
+ END;
+
+
+
+ Time to build the unit test procedure. To do this, I need to
+ go back to my grid of test cases and translate those sets of data inputs and
+ results into calls to programs in the utAssert
+ package.
+
+
+
+ utAssert offers a number of "assertion routines" that test the
+ values or expression you pass to them and then record the results in utPLSQL.
+ You can, with utAssert, test for equality between two strings or files or
+ tables or collections. You can test to see if an expression evaluates to NULL.
+ I can use both of these types of assertions (equality and IS NULL) for my test
+ cases, which I repeat below:
+
+
+
+
+
+
Start
+
+
+
+
End
+
+
+
+
Result
+
+
+
+
+
+
NULL
+
+
+
NOT NULL
+
+
+
NULL
+
+
+
+
+
NOT NULL
+
+
+
NULL
+
+
+
NULL
+
+
+
+
+
NULL
+
+
+
NULL
+
+
+
NULL
+
+
+
+
+
3 (positive number)
+
+
+
1 (smaller positive number)
+
+
+
NULL
+
+
+
+
+
3 (positive number)
+
+
+
100 (larger than length of string)
+
+
+
Remainder of string
+
+
+
+
+
+ Here's how it works: for each test case, I provide a string description of
+ the case, then the expression I want to evaluate. Let's start with
+ "typical valid usage". I pass a string "abcdefg", a start
+ location of 3 and end location of 5, and betwnstr should return
+ "cde". I express that in my unit test procedure as follows:
+
+ Notice that I call utAssert.eq because I want to compare the
+ value returned by betwnstr with the string "cde". They should
+ be equal.
+
+
+
+ I can now write another call to a utAssert program for each of my cases. In
+ this very next example, I call utAssert.isnull, because I am expecting betwnstr
+ to return a NULL value.
+
+ Note: when you run your test, utPLSQL will by default
+ attempt to recompile your test package to ensure that the latest changes are
+ incorporated into the test. It is still worth doing an initial compile to make
+ sure you built your test properly. You will also need to make sure that UTL_FILE is installed and configured so that your
+ test package files can be read and compiled by utPLSQL.
+
+
+
+ So with the test package in place and compiling, now let's
+ see how we go about running the test.
+
+
+
Step 4. Run your test.
+
+
+ You've built your code, you've built your test package,
+ you've compiled that test package. Now it's time to run the test. Start up
+ SQL*Plus and connect to the schema owning the code you want to test.
+
+
+
+ Then run your test package within the utPLSQL testing framework by calling utPLSQL.test:
+
+ That second parameter in the call to utplsql.test,
+ "recompile_in => FALSE", tells utPLSQL that you have already
+ compiled your test package. You can also have utPLSQL automatically recompile your test package
+ each time you run a test.
+
+
+
+ If the test does not find any errors (which means that the assertion
+ programs did not detect any conflicts), you will see this output:
+
If the test detected a failure, you will see output along these lines:
+
+
+SQL> exec utplsql.test ('betwnstr', recompile_in => FALSE)
+FAILURE: "betwnstr"
+BETWNSTR: IS NULL: NULL start
+BETWNSTR: End larger than string length; expected "cdeg", got "cdefg"
+
+
+
+ As you can see, utPLSQL tells you the description of the
+ test case that failed, and also shows you as much as it can about what caused
+ the failure.
+
+
+
+ You have now successfully installed utPLSQL, written a test package and run
+ your test!
+
+
+
Automatic Recompilation of Test Package
+
+
+ utPLSQL will, by default, attempt to recompile your test package code
+ (which must be put in two files <name>.pks for the package specification
+ and <name>.pkb for the package body). This of course assumes that the files
+ are situated on the same machine as your database. If this is not the case, you can
+ turn off this functionality by calling utConfig.autocompile
+ as follows:
+
+
+
+utConfig.autocompile(false);
+
+
+
+ If you do wish to use this functionality, utPLSQL needs
+ the UTL_FILE package provided by Oracle to read the source code files and then
+ compile the code found in those files. Before using UTL_FILE you must configure it for use from within PL/SQL.
+ Once you have confirmed that UTL_FILE works in your database instance, you
+ must tell utPLSQL where the test package is located by calling utPLSQL.setdir.
+ If you do not do this, then utPLSQL will not be able to recompile your test
+ package before each run, and instead will display an error message.
+
+
+
+ Call the utConfig.setdir program to tell
+ utPLSQL the location of your source code. Suppose that I stored all my code in e:\utplsql\testall. Then I would make this
+ call in SQL*Plus:
+
+ In step 1, above, we described which user should own the objects which make up the utPLSQL framework.
+ However, there has often been confusion about which schema should contain the test packages and which schema to connect as
+ when running the tests. There are many ways to do it, but the simplest is as follows:
+
+
+
It doesn't matter which schema owns utPLSQL itself, so long as other users have access to it.
+
The test packages should go in the same schema as the code that is being tested.
+
You should connect as the user who owns the test packages (and hence the tested code) when running the tests
+
+
+
Where to go from here
+
+
+ If you proceeded through all four steps, you should now have
+ used utPLSQL successfully to test a very simple function (betwnstr) or your own
+ functionality. This will undoubtedly leave you very excited about using utPLSQL
+ to handle much more complex code and elaborate testing requirements.
+
+
+
+ To find out more about the different features and
+ functionality available in utPLSQL, visit the User
+ Guide.
+
+
+
+ To read through a more thorough presentation of how to build
+ test packages in utPLSQL, visit How to
+ Build Test Packages.
+
+
+
+ To see a wide array of examples of building test cases and
+ different kinds of test packages, visit the Examples
+ document.
+
+ Before diving into the details, let's make sure
+ we have a common vocabulary.
+
+
+
Unit Test
+
+
+ A test of a single unit or program. Suppose you
+ have built product.total_sales, a function to calculate and return total
+ sales of the specified product for a given date period. You will then build
+ a single procedure to perform the test for that function.
+
+
+
Test Case
+
+
+ Individual cases or test scenarios for a unit test.
+ You will want to try out different scenarios (valid and invalid product
+ Ids, various date ranges, etc.). Each different combination of inputs (parameter
+ values) is a different test case. These are bundled up and executed within
+ the single unit test procedure.
+
+
+
Package Test
+
+
+ A set of unit tests which test the functionality
+ of all programs in a single PL/SQL package (or a single stand-alone program
+ unit - procedure or function).
+
+
+
+ The way utPLSQL works today, you must define
+ your various tests cases and unit tests within a test package (though it
+ could be the same package containing the functionality).
+
+
+
Test Suite
+
+
+ A series of package tests. Obviously, any application
+ of non-trivial complexity will consist of multiple packages, each covering
+ their own area of functionality. A test suite contains a series of packages
+ that can then be tested in sequence by executing the test suite as a whole.
+
+
+
Requirements
+
+
+ If you are using Oracle8i or above, utPLSQL takes advantage
+ of a number of Oracle8i features, including autonomous transactions, invoker
+ rights and native dynamic SQL. utPLSQL will however still run on Oracle7
+ (7.3.4 and above) and Oracle8.
+
+
+
Requirements for using utPLSQL include:
+
+
+
+
+ The schema owning utPLSQL objects must have the ability to create tables and packages.
+
+
+
+
+ If you want utPLSQL to automatically recompile test packages for you, you
+ will need to have UTL_FILE installed and
+ configured to read from the directory or directories in which your package
+ source files are located.
+
+
+
+
+ Optional: The ability to create public synonyms. The installation script will attempt
+ to create public synonyms. If your schema does not have the authority to
+ do so, these commands will fail, but utPLSQL will still be available for
+ use in the owning schema.
+
+
+
+
+ Optional:Execute privilege on the DBMS_PIPE package. Without this, the UTPIPE package will not compile.
+ However, this is only required if you want to test data accessed via DBMS_PIPE.
+
+
+
+
+
Requirements for Executing Test Code
+
+
+ If you install and use utPLSQL from within a single schema (ie, the same schema that owns utPLSQL code and tables owns the code
+ you want to test, as well as the test packages), then no additional privileges are needed.
+
+
+ If, however, you install utPLSQL in a shared schema and then access it from other schemas, you may need to grant additional
+ privileges to the utPLSQL schema. utPLSQL uses dynamic PL/SQL to run the test code. It therefore requires directly granted
+ EXECUTE privileges on those code elements (both the code to be tested and the test packages) -- or the AUTHID CURRENT_USER
+ capability of Oracle8i and above.
+
+
+
For Oracle8i and above
+
+ You do not need to grant any additional privileges, unless you want to test code owned by one schema from another schema.
+ In that case, you will need to grant EXECUTE to the schema from which you run your tests on both the code to be tested and the test package.
+
+
+
For Oracle7 and Oracle8
+
+ You must grant EXECUTE to the utPLSQL schema on both the code to be tested and the test package.
+ These grants must be made directly and not through roles.
+
+ To use utPLSQL, you will build a test package containing your unit tests.
+ This test package must conform to the API (application programmatic interface)
+ rules of utPLSQL, so that utPLSQL can run your tests automatically.
+
+
+
Every test package must have:
+
+
+
+ A setup procedure - register your unit test and set
+ up any data structures needed for testing.
+
+ The names you give to your test package, setup, teardown and unit test
+ proceedures must also follow the utPLSQL Naming Conventions.
+
+
+
Setup Procedure
+
+
+ The utPLSQL.test and utPLSQL.testsuite programs
+ will call the setup procedure of your test package before it runs any unit
+ tests. Use this procedure to define your unit tests and also initialize
+ any data structures needed for your units. The package specification header
+ for this procedure must be of this form:
+
+
+
+CREATE OR REPLACE PACKAGE <prefix><package>
+IS
+ PROCEDURE <prefix>setup;
+
+
+
+ where <prefix> is the unit test prefix and <package>
+ is the name of the package (or stand alone program) to be tested. The default
+ naming convention is that your test package and all utPLSQL programs, including
+ the setup procedure, have a prefix of "ut_", as in:
+
+
+
+CREATE OR REPLACE PACKAGE ut_<program>
+IS
+ PROCEDURE ut_setup;
+
+
+
+ Note: if you are using manual
+ registration of unit tests (which is not the default setting
+ and is not recommeded), see Naming Conventions
+ for details on when and how to apply prefixes to your package and procedure
+ names.
+
+
+
+ Now let's take a look at the body/implementation
+ of the setup procedure and how you can use it to define test data structures
+ and, optionally, register unit tests.
+
+
+
Define test data structures
+
+
+ You should use the setup procedure to define data structures you
+ need in one or more of your tests. You might, for example, want to create
+ a temporary table to hold information for comparison. You might populate
+ a collection or a record a scalar global variable.
+
+
+
+ Here is an example of such a procedure (see the file ut_te_employee.pkb
+ in the Examples directory of the utPLSQL distribution for the full implementation):
+
+
+
+PROCEDURE ut_setup
+IS
+BEGIN
+ ut_teardown;
+
+ EXECUTE IMMEDIATE 'CREATE TABLE ut_employee AS
+ SELECT * FROM employee';
+
+ EXECUTE IMMEDIATE 'CREATE TABLE ut_DEL1 AS
+ SELECT * FROM employee';
+
+ EXECUTE IMMEDIATE 'CREATE TABLE ut_DELBY_EMP_DEPT_LOOKUP AS
+ SELECT * FROM employee';
+END;
+
+
+
+ For each of my tests, I create a separate table to modify and then use
+ in my utAssert comparison.
+
+
+
+ You could place these statements in each of the individual unit test
+ procedures. The advantage of storing them all in the single setup procedure
+ is that they are easier to manage -- and also easier to tear down or destroy
+ when you are done.
+
+
+
Manual registration of unit tests
+
+
+ If you have decided to choose manual
+ registration of your unit test procedures, then you will need to register
+ each procedure with a call to utPLSQL.registertest
+ in the setup procedure. This is not recommended. But if you insist...
+
+
+
+ Here is an example of a setup procedure for the
+ PLVdate package:
+
+
+
+CREATE OR REPLACE PACKAGE BODY ut_plvdate
+IS
+ PROCEDURE ut_setup
+ IS
+ BEGIN
+ utplsql.addtest ('ut_to_date');
+ utplsql.addtest ('ut_to_char');
+ END;
+
+
+
+ The names passed to the utPLSQL.addtest procedure
+ must match the interface of the defined unit test procedures
+ with the following interface. So the above two calls to addtest tell utPLSQL
+ to look for two unit test procedures named ut_to_date and ut_to_char.
+
+
+
Teardown Procedure
+
+
+ The utPLSQL.test and utPLSQL.testsuite programs
+ will call the teardown procedure of your test package after it runs all
+ unit tests. Use this procedure to destroy or remove any data structures
+ that were needed for your units. The contents of this procedure should,
+ in general, be the logical reverse of the contents of the setup
+ procedure. The package specification header for this procedure must
+ be of this form:
+
+
+
+CREATE OR REPLACE PACKAGE <prefix><package>
+IS
+ PROCEDURE <prefix>teardown;
+
+
+
+ where <prefix> is the unit test prefix and <package>
+ is the name of the package (or stand alone program) to be tested.
+
+
+
+ The default naming convention is that your test
+ package and all utPLSQL programs, including the teardown procedure, have
+ a prefix of "ut_", as in:
+
+
+
+CREATE OR REPLACE PACKAGE ut_<program>
+IS
+ PROCEDURE ut_teardown;
+
+
+
+ Note: if you are using manual
+ registration of unit tests (which is not the default setting
+ and is not recommeded), see Naming Conventions
+ for details on when and how to apply prefixes to your package and procedure
+ names.
+
+
+
+ Now let's take a look at the body/implementation
+ of the teardown procedure and how you can use it to remove test data structures.
+
+
+
+ Here is an example of the most common type of teardown
+ procedure -- it does nothing:
+
+
+
+CREATE OR REPLACE PACKAGE ut_sales_pkg
+IS
+ PROCEDURE teardown
+ IS
+ BEGIN
+ NULL;
+ END;
+
+
+
+ This is what your teardown procedure will look like
+ when you do not need to create any special data structures for your tests.
+ If I were testing a simple string utility, for example, I do not need a
+ database table or collection to run my tests. Note that even if your teardown
+ procedure does nothing, it still must be present in the package specification
+ and body. utPLSQL will look for and try to execute the procedure as
+ part of its S.O.P. (standard operating procedure).
+
+
+
+ Now, if your setup procedure creates something,
+ you should probably destroy it in teardown. You might drop or truncate
+ tables, do a ROLLBACK or simply make sure files and cursors are closed.
+ Here is an example of such a procedure:
+
+ The unit test procedure is, of course, where it
+ gets really interesting and very application specific.
+
+
+
The general format for a test procedure is as follows:
+
+
+CREATE OR REPLACE PACKAGE <prefix><package>
+IS
+ PROCEDURE <prefix><program>;
+
+
+
+ where <prefix> is the unit test prefix and <package>
+ is the name of the package (or stand alone program) to be tested. The default
+ naming convention is that your test package and the unit test procedure
+ each have a prefix of "ut_". You can override that prefix with another
+ of your own choosing in your call to utPLSQL.test
+ or utPLSQL.testsuite. Under some circumstances, you can drop
+ the prefix on the unit test procedure, but this is not recommended. see
+ Naming Conventions. for details.
+
+
+
+ Here is a very generic version of a unit test package
+ specification and a single unit test procedure:
+
+
+
+-- Test package for stand alone program
+CREATE OR REPLACE PACKAGE ut_<package>
+IS
+ PROCEDURE ut_setup;
+ PROCEDURE ut_teardown;
+ PROCEDURE ut_<program>;
+END;
+
+
+
+ The body of your unit test procedure is, well, mostly
+ yours to figure out, since we don't know what you are testing and how you
+ need to test it. The basic format of this test procedure, however, should
+ be:
+
+
+
+PROCEDURE <myprogram>
+IS
+BEGIN
+ <run package.myprogram or set up for test>
+
+ -- call a utAssert assertion to check results:
+ utAssert.<assertion> (...);
+
+ <repeat of the above for different test cases>
+EXCEPTION
+ WHEN OTHERS
+ THEN
+ utAssert.this (
+ 'Unknown failure of <package.myprogram>: ' || SQLERRM,
+ FALSE);
+END;
+
+
+
+ You should include a call to a utAssert assertion program in the exception
+ section to trap unexpected errors and register a test failure (I pass FALSE
+ for the second argument, which guarantees a failure!). You might, of course,
+ have other handlers to trap specific exceptions like NO_DATA_FOUND and
+ either register a failure or ignore the exception, since it might not be
+ an actual test failure.
+
+
+
+ Here is an example of a unit test procedure that contains multiple calls
+ to assertion programs for different test cases.
+
+ In the above case, I am testing a function, so I call the function "in
+ line" with the assertion program. When testing a procedure, you will call
+ the procedure first and then call the appropriate assertion program to
+ test the outcome.
+
+
+
+ Explore the Examples to learn about different
+ ways to write unit test procedures.
+
+
+
Naming Conventions
+
+
+ When you execute a test or test suite, utPLSQL looks for a test package,
+ based on the name of the program you are testing. It then attempts to execute
+ specific programs within that package. utPLSQL allows you to test stand-alone
+ programs (procedure or function) or package-based programs. When testing
+ the contents of a package, you can place your unit test procedures in the
+ same
+ package or a separate test package. That's a lot of flexibility, and
+ flexibility generally leads to confusion.
+
+
+
+ To make things as simple as possible, the default mode of utPLSQL follows
+ this simple rule:
+
+
+
+ Your unit test package and each utPLSQL-related program in that package
+ (setup, teardown and unit tests) must all use the same prefix.
+
+
+
+ The default prefix is "ut_", but you can override that with your own.
+ If you follow this rule (and you can follow it very easily by using the
+ utGen
+ package to generate a starting point for your test packages), utPLSQL
+
+
+
+ If you are following the utPLSQL defaults and letting the utility automatically
+ detect and execute unit tests, do not read any further!
+
+
+
+ If you choose to perform manual
+ registration of your unit tests, then read the following sections carefully,
+ as there is a scenario in which you should not apply the utPLSQL
+ prefix to your unit test procedures.
+
+
+
+ This section describes the conventions or rules that utPLSQL follows
+ to locate and execute your unit tests. There are three different "scenarios"
+ to consider:
+
+ While these rules might seem confusing at first glance, you will find
+ over time that they are designed to make the issue of what things are named
+ as transparent as possible when you run your tests. In other words, you
+ simply ask to test "mypackage"; you don't have to run some oddly-named
+ program with a prefix in front of it.
+
+
+
+ In addition, you can use the utGen package to
+ generate a starting point for your test packages. utGen will automatically
+ follow the rules; you only need to "fill in the blanks" of your unit test
+ procedures within the established headers.
+
+
+
Separate test package to test package-based programs
+
+
+ If you are placing your unit test code in a package separate from your
+ source code (the default setting), then the name of that test package must
+ be of the form:
+
+
+
+<prefix><package>
+
+
+
+ where <prefix> is the utPLSQL prefix and <package> is the name of
+ the package containing the programs to be tested.
+
+
+
You specify the prefix in one of the following ways:
+
+
+
+ When you call utPLSQL.test or utPLSQL.testsuite, you can pass a value for
+ the prefix_in parameter (the default is "ut_").
+
+
+
+ When you call utPackage.add to add a package
+ to a suite, you can pass a value for the prefix_in parameter (the default
+ is "ut_"). This prefix is then stored in the ut_package table.
+
+
+
+
+ The names of the test package programs, on the other hand, should not
+ have a prefix before them. These prefixes are not necessary to distinguish
+ the test procedure with the program being tested, since they are defined
+ in different packages.
+
+
+
Separate test package to test a stand-alone program
+
+
+ If you are placing your unit test code in a package separate from your
+ source code (the default setting), then the name of that test package must
+ be of the form:
+
+
+
+<prefix><program>
+
+
+
+ where <prefix> is the utPLSQL prefix and <program> is the name of
+ the stand-alone program you plan to test.
+
+
+ You specify the prefix in one of the following ways:
+
+
+
+
+ When you call utPLSQL.test or utPLSQL.testsuite, you can pass a value for
+ the prefix_in parameter (the default is "ut_").
+
+
+
+ When you call utPackage.add to add a package
+ to a suite, you can pass a value for the prefix_in parameter (the default
+ is "ut_"). This prefix is then stored in the ut_package table.
+
+
+
+
+ The names of the test package programs, on the other hand, also must have
+ the same prefix. This is necessary to avoid confusing naming conflicts
+ between the program you are testing and the name of the unit test procedure
+ for that program, as in the following package that tests the betwnstr function:
+
+ I suppose that looks odd; I have created a function named ut_betwnstr.ut_betwnstr
+ and it would be very strange to write code like that. But that is the whole
+ point of utPLSQL: I don't have to write code like that. I just run
+ my test with nothing more than this:
+
+
+
+SQL> exec utPLSQL.test ('betwnstr')
+
+
+
Single package containing both source to be tested and unit test programs
+
+
+ Finally, there is the scenario in which a developer places all of her test
+ programs (setup, teardown and unit tests) in the same package as the code
+ to be tested. In this case, there is no separate test package, so all of
+ the test programs must use the utPLSQL prefix, as in:
+
+
+
+CREATE OR REPLACE PACKAGE str
+IS
+ FUNCTION betwn (
+ string_in IN VARCHAR2,
+ start_in IN PLS_INTEGER,
+ end_in IN PLS_INTEGER
+ )
+ RETURN VARCHAR2;
+
+ PROCEDURE ut_setup;
+ PROCEDURE ut_teardown;
+ PROCEDURE ut_betwn;
+
+END str;
+/
+
+
+
You specify the prefix in one of the following ways:
+
+
+
+
+ When you call utPLSQL.test or utPLSQL.testsuite, you can pass a value for
+ the prefix_in parameter (the default is "ut_"). When you call utPackage.add
+ to add a package to a suite, you can pass a value for the prefix_in parameter
+ (the default is "ut_"). This prefix is then stored in the ut_package table.
+
+ This document tells you the minimum you need
+ to know in order to get started with utPLSQL: how to install the software,
+ build simple test packages, and run your tests.
+
+ utPLSQL provides with you a framework in which
+ to run your tests. You still have to write your test code, and that code
+ must follow some rules if utPLSQL is going to know how to run those tests.
+
+ Once you are familiar with utPLSQL basics, have
+ run some tests, and are ready to learn and use more of the many utPLSQL
+ features, the User Guide will tell you all you need to know about the different
+ features and programs of utPLSQL.
+
For support, bug reports or enhancement ideas, you can always visit the issue tracker page.
+
+
+
+
+
+
diff --git a/documentation/src/map.txt b/documentation/src/map.txt
new file mode 100644
index 000000000..b974631a9
--- /dev/null
+++ b/documentation/src/map.txt
@@ -0,0 +1,35 @@
+# This file contains a list of files and titles to
+# make up the documentation. The filename and title
+# should be separated by a comma. An asterisk after
+# the title means that that file gets added to the
+# Navigation Bar and is highlighted in the document
+# Map. Note that the document map is not in this list
+# but is added automatically at the end.
+#
+index.html,Home*
+started.html,Getting Started*
+glossreq.html,Glossary and Requirements
+fourstep.html,The Four Step Program to using utPLSQL
+admin.html,Administrative Topics
+buildpack.html,Build Test Packages*
+howto.html,How to build a test package
+testrun.html,A 'Test Run' with utPLSQL
+examples.html,Examples*
+testproc.html,Test a Procedure
+testfunc.html,Test a Function
+testapi.html,Test an Entire Package API
+samepack.html,Put Test Code in Same Package
+prefix.html,Use Non-Default Prefix
+suite.html,Create and Run a Test Suite
+userguide.html,User Guide*
+utplsql.html,utPLSQL Package
+utconfig.html,utConfig Package
+utresult.html,utResult Package
+utassert.html,utAssert Package
+utgen.html,utGen Package
+utoutput.html,utOutput Package
+utreceq.html,utRecEq Package
+defsuite.html,Defining Test Suites
+reporter.html,Custom Reporter Packages
+fileout.html,Configuring the File Reporter
+release.html,Release Notes*
diff --git a/documentation/src/prefix.html b/documentation/src/prefix.html
new file mode 100644
index 000000000..fcf968062
--- /dev/null
+++ b/documentation/src/prefix.html
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
Use Non-Default Prefix
+
+
+ The default prefix for utPLSQL is "ut_", but you don't have to use that
+ prefix. There are some situations where you absolutely will not want to
+ use the default prefix. Suppose, for example, that you have written a package
+ with ten procedures, each of which already have "ut_" as a prefix
+ (it might stand for "Unified Technologies" or "Underside Treatment: or...well,
+ you get the picture).
+
+
+
+ Since this prefix is not hard-coded into utPLSQL, you can very easily
+ specify your own prefix. You can do this when you run a test, as in:
+
+ Of course, when you specify a non-default prefix, you must also build your
+ test package using that prefix. If you plan to generate a starting point
+ for your package with utGen, be sure to specify your prefix at that point,
+ as in:
+
+ For an example of a package with a non-default prefix, check out test_te_employee.pks
+ and test_te_employee.pkb (Both to be found in the Examples directory of the utPLSQL distribution).
+
+
+
+
+
diff --git a/documentation/src/readme.txt b/documentation/src/readme.txt
new file mode 100644
index 000000000..3c81d826f
--- /dev/null
+++ b/documentation/src/readme.txt
@@ -0,0 +1,71 @@
+==================================
+HOW TO BUILD UTPLSQL DOCUMENTATION
+==================================
+$Id$
+==================================
+
+The utPLSQL documentation is built from a series of simple HTML files in the
+src directory. These files have none of the navigation bars, logos or
+next/previous links which appear in the final documentation. They are also
+stripped of font, color and style information at compile-time to let the
+stylesheet (utplsql.css) determine the overall look-and-feel.
+
+---------
+THE FILES
+---------
+
+The files are compiled into a documentation set situated in the top-level
+documentation directory using the 2 control files, map.txt and authors.txt.
+The first of these is the driving file, giving a list of the files to be
+included. The second gives a list of authors to be included in the copyright
+notice on each page and referenced in the Meta tags.
+
+The format of map.txt is as follows:
+
+ # Any line starting with a # is
+ # considered a comment
+ #
+ index.html,Home*
+ started.html,Getting Started*
+ another.html,Further Docs
+ another2.html,Yet more docs
+
+Each line consists of the filename to be included and the title of the page,
+separated with a comma. Any file whose title is followed by an asterisk is
+considered the start of a new section. This means a link to the file will
+appear in the navigation bar at the top of each page and it will appear in
+bold in the document map. Note that the document map itself does not appear
+in map.txt, but is always added at the end and is considered a new section.
+This page is entirely generated at compile-time.
+
+The format of authors.txt is as follows:
+
+ # Again, lines starting # are ignored
+ #
+ Steven Feuerstein,steven@stevenfeuerstein.com
+ Chris Rimmer,c@24.org.uk
+ A N Other,ano@ther.net
+
+Each line in this file simply gives the name of the author and their email
+address, separated with a comma.
+
+-----------
+THE SCRIPTS
+-----------
+
+The 2 Perl scripts used to build the documentation are clean_html.pl and
+build_docs.pl.
+
+The first of these simply strips HTML files down to the basics, removing
+everything from the header and removing Javascript, fonts, color etc. It
+requires the HTML::TagFilter module which in turn also requires the
+HTML::Parser and HTML::Tagset modules (all available from search.cpan.org).
+
+The second script goes through each file listed in map.txt, cleans it using
+the previous script and then adds logos, navigation bars, next/previous links,
+copyright information etc. The resulting files are put in the top-level
+documentation directory.
+
+NOTE: Anything within a source file before the
+"" comment line and after the
+"" comment line is ignored.
diff --git a/documentation/src/release.html b/documentation/src/release.html
new file mode 100644
index 000000000..b63702964
--- /dev/null
+++ b/documentation/src/release.html
@@ -0,0 +1,693 @@
+
+
+
+
+
+
+
+
+
+
Release Notes
+
+
Known Issues
+
utPLSQL version 2.x
+
+
+ There is an issue surrounding the use of utPLSQL on Oracle 8.1.7 where
+ the tests use database links. This is because Oracle will consider
+ the transaction to be distributed and utPLSQL v2 uses autonomous transactions
+ while the tests are running. This situation causes ORA-00164 in 8.1.7
+ (and apparently should not have been allowed in 8.1.5 or 8.1.6 either). It
+ is possible to work around this problem by turning off autonomous transactions
+ , but this can cause other problems if the tests themselves have rollbacks
+ within them.
+
+
+
+ The utAssert.eqtable assertion program will not work with tables that
+ contain non-scalar datatypes, such as LOBs, XMLType, collections and so on.
+
+ Bug 35: Fixed an issue with utAssert.eqQuery failing with long select statements.
+
+
+ Bug 39: Corrected a spelling mistake in the documentation.
+
+
+
+
utPLSQL version 2.2.2 (4th May 2014)
+
+
+
+ Bug 32: Fixed issue with "eqquery" failing if a statement contained "UNION ALL".
+
+
+ Bug 33: Fixed issue which meant tests ran in an undetermined order (they will now run in alphabetical order).
+
+
+
+
utPLSQL version 2.2.1 (6th April 2014)
+
+
+
+ Bug 29: Fixed issue with the Uninstall leaving two views behind.
+
+
+ Bug 38: Fixed issue which prevented building the documentation depending on the build environment.
+
+
+ Feature Request 6: Updated documentation and made it all valid XHTML.
+
+
+
+
utPLSQL version 2.2
+
+
+
+ This version introduces the concept of Output Reporters. The existing code to output to DBMS_OUPUT or to file has been refactored to
+ fit into this framework. As a result of this, the pl procedure in the utplsql package has been moved to the utreport package.
+
+
+ The installation procedure has been changed so that the database version is picked up more robustly. Version 2.2 works with 10g,
+ which previous versions did not. It should also work with future versions (so long as the version is to be found in the same place
+ in the data dictionary).
+
+
+ There are also a variety of small fixes in this release.
+
+
+
+
utPLSQL version 2.1.1
+
+
+
+ This version has a variety of small fixes and is released to coincide
+ with OUnit version 1.0.
+
+
+ The installation procedure has been changed and a variety of bugs with it have been fixed.
+
+
+ utGen.exe has been removed from the "core" utPLSQL distribution. The functionallity it supplied will be included in a future version of Ounit.
+
+
+
+
utPLSQL version 2.0.10.1
+
+
+
+ Allow user to specify (as part of their individual configuration) that they
+ only want to show failed tests, and then whether all information or just the
+ description (request from Heinz of UBS). Supersedes the
+ utresult.ignore_successes and utresult.include_successes (whose settings do not
+ persist across sessions).
+
+
+ Support for testing contents of REF CURSORs (cursor variables) has been added
+ (provided by Venky Mangapillai) with the eq_refc_table and eq_refc_query
+ assertion routines.
+
+
+ Adds testpkg_from_table to utgen to allow generation of a test package directly
+ from the new ut_grid table (provided by Patrick Barel). Patrick has also built
+ a Windows-based front end, utGen.exe, that allows us to populate this grid very
+ easily. Thanks, Patrick!
+
+
+ Add ut_outcome_seq sequence for ut_outcome table.
+
+
+ Add control_info and test_info columns to ut_outcome table.
+
+
+ Add ability to direct output from utPLSQL's test run (the test results) to a
+ file instead of to the screen. This functionality was provided by Rainer
+ Medert. The documentation for this feature has not yet been integrated into the
+ documentation set. You will find the "beta" documentation in the
+ file_output_spec.doc in the doc directory.
+
+
+
+
utPLSQL version 2.0.9.2
+
+
+
+ Surround AUTHID CURRENT_USER clause of utreceq.pks to allow for installation on
+ Oracle7 and Oracle8.
+
+
+ Add override_package_in argument to utPLSQL.test so that you can bypass the
+ standard ut_<package> naming conventions for testing. This is useful
+ when your package name's length is 28 or above. By passing in the override
+ package name, you can avoid the name limitation.
+
+
+ New assertion programs to validate DBMS_OUTPUT text that is generated from
+ within a program.
+
+
+ Add utplsql.run and utplsql.runsuite to run a named test package directly, and
+ not correlate it via the name of the program being tested.
+
+
+
+
utPLSQL version 2.0.9.1
+
+
+
+ Add ut_reqeq table and utreceq package to support the creation of "record
+ equal" functions (contributed by Dan Spencer).
+
+
+ Modify utPLSQL.test so that the record comparison functions are generated
+ and recompiled whenever the source code is recompiled.
+ Call utreceq.add to register a package-table combination.
+
+
+ Modified utpackage.id_from_name to take an owner_in parameter with a
+ NULL default value. v_owner is set to nvl(owner_in,user). added
+ owner = v_owner and suite_id is null to the WHERE clause.
+
+
+ Modified utpackage.add to add in a record with suite_id NULL if one
+ doesn't exist.
+
+
+ Modified utpackage.upd - changed parameter suite_in to suite_id_in (the
+ type was INTEGER). Changed the UPDATE WHERE clause first line
+ to NVL(suite_id,0) = NVL(suite_id_in,0).
+
+
+ Modified utplsql.testsuite - v_suite (the suite id) was in the
+ call to utplsql.test while the utplsql.test parameter list was expecting
+ the suite name. The results of a test run are now logged to the
+ appropriate record in ut_package [the record for the suite if run from
+ testsuite, the record with suite_id NULL if run via an EXEC UTPLSQL.TEST('packagename')].
+
+
+ Add objExists and objNotExists assertion programs
+
+
+ Changes to utPLSQL.test engine so that you can test programs define
+ in one schema from another schema.
+
+
+ Add previous_passed and previous_failed to utAssert and utAssert2
+
+
+ Set order in which test case results are displayed to the order in which
+ they are run by adding the tc_run_id to the utr_outcome table.
+
+
+
+
utPLSQL version 2.0.8.2
+
+
+
+ Change ut_utp LOB column to VARCHAR2 for the time being.
+
+
+ Fixed ALTER TABLE statement in ut_config.tab.
+
+
+ Change utplsql.test to allow for compilation of test package before
+ extracting list of test procedures from that package (avoids the "
+ Warning...no tests were identified for execution!" message).
+
+
+
+ Add utAssert2.eval generic comparison program, and also utAssert.eval,
+ with an overloading for just two values, to make it really easy to use.
+
+
+ Add utGen.receq_package procedure. It currently ONLY writes the code
+ out to the screen via DBMS_OUTPUT.PUT_LINE. It does not, in other words,
+ support the multiple outputs of utGen.testpkg.
+
+
+ Update the utplsql_install.sql script to recognize Oracle9.0 and Oracle9.1
+ versions and install all 8i features for those versions (there is nothing
+ specific to 9i at this time).
+
+
+
+
utPLSQL version 2.0.8.1
+
+
+
+ Fixes to a number of minor installation errors.
+
+
+ Offers option in utPLSQL.test to request that setup and teardown is
+ executed with each test procedure and not the test package level.
+ Implements a new features in utPLSQL.test that allows you to specify
+ that you want to run the setup and teardown procedures before and after
+ EACH unit test procedure, as opposed to running them once for the unit
+ test package as a whole. To utilize this feature, simply pass a value
+ of TRUE to the new per_method_setup_in parameter of utPLSQL.test as
+ shown below:
+
+ Revamp utAssert2.define_message implement to simplify creation of new assertion
+ programs
+
+
+ Modify implementation if ieqminus to avoid duplicate column
+
+
+ Change naming conventions for utPLSQL2 from prefix to delimiter driven
+ (utconfig.delimiter):QU##NNN. This affects only those test packages
+ which use the utPLSQL2.test program to run the tests (ie for version 1
+ utPLSQL test packages and utPLSQL.test, you can still use your prefix-based approaches).
+
+
+ Add utAssert2.fileExists
+
+
+ Compile utAssert2 with AUTHID CURRENT_USER for Oracle8i and above.
+
+
+ (2.0.7.2) Fix index creation for ut_assertion table.
+
+
+ (2.0.7.2) Fix foreign key definition in ut_argument.
+
+
+ (2.0.7.2) Fix foreign key definition in uta_eq.
+
+
+
+
utPLSQL version 2.0.6
+
+
+
+ Fix to utgen.pkb to allow generation of procedure bodies when no grid is used.
+
+
+ Allow developers to turn off display of successful results (utResult.include_successes)
+
+
+
+
utPLSQL version 2.0.5
+
+
+
+ Allow user to specify individual program or programs (via wildcard) to be tested
+ from a whole package.
+
+
+ Add ut_deterministic and ut_deterministic_arg tables to facilitate generate of
+ test packages for deterministic functions.
+
+
+ Add ut_deterministic.fmx Oracle Forms GUI to allow easy generation of test packages
+ for deterministic functions.
+
+
+
+
utPLSQL version 2.0.4
+
+
+
+ Implement test suite execution in utPLSQL2.
+
+
+ Implement ut_suite_utp table (and the corresponding utsuiteutp package) as an intersection
+ of ut_suite and ut_utp, defining all those UTPs in a given suite.
+
+
+ Improved error handling with utrerror assertions and general reporting mechanisms.
+ Assertion and error handling logic applied to define-time packages like utsuite
+ and utsuiteutp.
+
+
+ Revamp installation process; no longer use OraShare, remove testcase2 entirely.
+
+
+ Create stand alone utverify procedure.
+
+
+
+
utPLSQL version 2.0.3
+
+
+
+ Add utr_error table and utrerror package; now all errors are logged to the table
+ for viewing afterwards. utPLSQL NEVER passes back an unhandled exception
+ to the console.
+
+
+ utAssert.eqfile now flags problems when opening files.
+
+
+
+
utPLSQL version 2.0.2
+
+
+
+ Clarify how that null_ok_in is supposed to work. For utAssert.this, it should
+ mean that if the value of the Boolean expression coming in is null, then
+ that means "success". For eq, it shoudl mean that if BOTH values coming in
+ are NULL, that is "success". For eqfile, if both files are empty...etc.
+
+
+ Add null_ok_in to eqqueryvalue assertions.
+
+
+ Add utassert.eqqueryvalue for NUMBER
+
+
+ Enhance utgen to properly generate code for overloaded programs in packages
+
+
+
+
utPLSQL version 2.0.1
+
+
+
+ Store results in utr_outcome tables
+
+
+ Support results reporting compatibility with V1
+
+
+ Display results of all test, success and failure.
+
+
+
+
utPLSQL version 1.5.6
+
+
+
+ New version of documentation courtesy of Chris Rimmer. Thanks, Chris!
+
+
+ utAssert fix in eqcoll to check for both values being null.
+
+
+ Enhancements to utGen to generate more self-explanatory code; comments
+ are now inserted to show the different sections in a standard test case
+ sequence.
+
+
+ Revamped installation procedure based on OraShare utility.
+
+
+ Add utGen.testpkg overloadings and new programs to support passing of
+ argument grids via collection, file or string (this feature is currently
+ undocumented outside of the release notes).
+
+
+
+
utPLSQL version 1.5.5
+
+
Bug Fixes
+
+
+
+ Change calls from DBMS_OUTPUT.PUT_LINE to utPLSQL.pl to avoid output
+ errors.
+
+
+ Avoid use of DBMS_SQL to obtain sequence values for Oracle7 and Oracle8
+ installations of utPLSQL.
+
+
+
+
Enhancements
+
+
+
+ Addition of utConfig package (created and integrated by Chris Rimmer)
+ to isolate all tester configuration information.
+
+
+
+
utPLSQL version 1.5.4
+
+
Bug Fixes
+
+
+
+ utPLSQL.setconfig now sets the user information properly when
+ the package is first initialized (bug introduced in 1.5.3).
+
+
+
+
utPLSQL version 1.5.3
+
+
Documentation and Usage Changes
+
+
+
+ If you choose to manually register your tests with calls to utPLSQL.addtest
+ in your setup procedure, you must now INCLUDE the unit test prefix,
+ as in:
+
+
+
+
+utPLSQL.addtest ('ut_betwnstr');
+
+
+ utPLSQL
+ will no longer add the prefix for you. This means that you may need to change
+ your calls to addtest -- or remove them entirely and rely on auto-registration.
+
+
+
+
Bug Fixes
+
+
+
+ Auto-registration (using the ALL_ARGUMENTS data dictionary view) now
+ correctly ignores the setup and teardown procedures.
+
+
+
+
Enhancements
+
+
+
+ If no tests are run for the specified program, then a warning is displayed,
+ after which the SUCCESS message is displayed.
+
+
+
+
utPLSQL version 1.5.2
+
+
Bug Fixes
+
+
+
+ Fix setting of default prefix value in utPLSQL.pkb.
+
+
+
+ If you request execution of a test suite that does not exist, that failure
+ will be reported.
+
+
+ If you request execution of a test for a program or package that does
+ not exist, that failure will be reported.
+
+
+ Unique index on ut_package changed to allow multiple entries for same
+ package, in different suites.
+
+
+
+
Known Problems
+
+
+
+ When running a suite of test packages, the SUCCESS and FAILURE headers
+ will display for each package, and not for the overall suite.
+
+
+
+
Enhancements
+
+
+
+ The utAssert package now offers isnull and isnotnull assertions overloaded
+ for Boolean values.
+
+
+
+
utPLSQL version 1.5.1
+
+
Support for Oracle7.3, Oracle8 and Oracle8i
+
+
+ utPLSQL can now be used on any version of Oracle from 7.3.4 and above! The
+ installation script automatically detects your Oracle RDBMS version and adjusts
+ the code accordingly (Using a great SQL*Plus trick, courtesy of Vladimir
+ Trusevich; check out the references to &start81 and &start73 in the
+ source code, as well as the queries in code.sql, to get a sense of how we
+ can maintain a single base of code for all these versions!).
+
+
+
There are some differences in how the code works:
+
+
+
+ In Oracle8i, the autonomous transaction feature is used to immediately
+ COMMIT any changes to underlying utPLSQL tables (such as defining a
+ test suite). In earlier versions, no COMMITs are performed by utPLSQL.
+
+
+
+
+ In Oracle8i, the Invoker Rights model is used to allow all of utPLSQL code
+ to run under the authority of the invoker, not the owner/definer. In earlier
+ versions, the Definer Rights model is followed. So if you define utPLSQL
+ in a central schema and then share it with others via GRANTs and synonyms,
+ you may need to grant additional authority to the utPLSQL schema.
+
+
+
+
Stores Additional Configuration Information
+
+
+ When you set the directory for your test code (through a call to
+ utPLSQL.setdir
+ , utPLSQL.test or utPLSQL.testsuite), that value is stored in the uPLSQL
+ configuration table (ut_config). It will be used for current and future sessions
+ as the default, until you change it.
+
+
+
+ The prefix you specify in calls to utPLSQL.setprefix
+ , utPLSQL.test or utPLSQL.testsuite will also be saved in the uPLSQL configuration
+ table. It will be used for current and future sessions as the default, until
+ you change it.
+
+
+
Shows All Configuration Information
+
+
+ Call the utPLSQL.showconfig
+ procedure to display all of the stored configuration values for the specified
+ schema.
+
+
+
utPLSQL version 1.4.1
+
+
Automatic Test Registration
+
+
+ You no longer have to manually register
+ your unit test procedures
+ in the setup procedure. Instead, utPLSQL will (in default mode) read and
+ execute the list of public procedures and functions from the ALL_ARGUMENTS
+ data dictionary view that conform to utPLSQL naming conventions. This enhancement
+ makes utPLSQL much easier and simpler to use than before. Simply use the
+ designated prefix (default being "ut_") on your program names, and they will
+ be executed.
+
+
+
Improved error handling and reporting
+
+
Rather than display a small, easily missed test result, as in :
+
+
+SUCCESS: PLVstr
+
+
+
+ utPLSQL now displays a much more noticeable (though still lacking in
+ colors, as in red for failure and green for success) display of the "big
+ picture", as in:
+
+
+
+SQL> exec utplsql.test ('str', dir_in=>'e:\openoracle\utplsql\utinstall\examples')
+.
+> SSSS U U CCC CCC EEEEEEE SSSS SSSS
+> S S U U C C C C E S S S S
+> S U U C C C C E S S
+> S U U C C E S S
+> SSSS U U C C EEEE SSSS SSSS
+> S U U C C E S S
+> S U U C C C C E S S
+> S S U U C C C C E S S S S
+> SSSS UUU CCC CCC EEEEEEE SSSS SSSS
+.
+ SUCCESS: "str"
+
+
+
utPLSQL version 1.3.2
+
+
Improved Statistics Recording
+
+
+ utPLSQL will now record the status of the last test run in the ut_package
+ and ut_suite tables. It also correctly updates those tables with a count
+ of executions and failures. Finally, it is no longer necessary to define
+ your package in and run it from a test suite for results to be recorded.
+
+
+
New Assertions and Assertion Features
+
+
+ utAssert now offers assertion routines that allow you to easily validate
+ the contents of PL/SQL collections (index-by tables, nested tables and varying
+ arrays) by running either the utassert.eqcoll
+ or utassert.ecollAPI
+ assertions.
+
+
+
+ You can also now request that utAssert show the
+ results of a test immediately
+ after execution. This allows you to build small test scripts without have
+ to create a test package and run it through the utPLSQL test engine.
+
+
+
Bug Fixes
+
+
+ Generally, error handling is now improved, particularly for compile errors
+ on test packages and modifications to underlying tables, such as ut_package.
+
+
+
+ When a test has been completed, utPLSQL clears out the results information.
+
+ Generally, the default output provided by utPLSQL is sufficient. This
+ just writes to the screen using DBMS_OUTPUT. If you are running it
+ interactively while doing some development, you just need to know if the
+ tests are passing and details of the failing tests. However, there are
+ cases where you'd like the results to be reported in a different format,
+ especially when the tests are being run in batch mode. To support this,
+ utPLSQL has the concept of Reporter Packages. utPLSQL is distributed with
+ the following reporter packages as standard:
+
+ The naming convention is that reporter packages are called
+ UT<NAME>REPORTER. To set which reporter is used, you will
+ need to call utConfig.Setreporter, passing the name of the reporter.
+ To use the HTML reporter for example, you should issue the following command:
+
+
+
+BEGIN
+ utConfig.setreporter('HTML');
+END;
+
+
+
+ For more details of how to develop your own custom
+ reporter package, see below.
+
+
+
Output Reporter
+
+
+ Contained in the UTOUTPUTREPORTER package, this simply encapsulates the
+ standard behaviour, whereby the output is written out to DBMS_OUTPUT. When a
+ problem occurs with another reporter, utPLSQL will automatically fall back on
+ this mechanism to report problems. This means it is wise to have DBMS_OUTPUT
+ enabled even if you are using another output method.
+
+
+
File Reporter
+
+
+ This reporter, contained in the UTFILEREPORTER package, writes test results
+ out to a file. For details on how to configure this process, see the details
+ which can be found here. This functionality was
+ available before version 2.2 of utPLSQL, but has now been moved into its own
+ package.
+
+
+
HTML Reporter
+
+
+ The package UTHTMLREPORTER is really just an example package to be used as
+ a basis for your own custom reporters. It builds on the filereporter described above to
+ send results to a file. The difference is that the results are presented in a (rather crude)
+ HTML table.
+
+
+
Writing your own Reporter
+
+
+ To define your own reporter package you need it conform to a particular API. The various
+ procedures are then registered as 'callbacks' for utPLSQL to use.
+ An example package spec is given below.
+
+
+
+CREATE OR REPLACE PACKAGE utMyRssReporter
+IS
+
+ PROCEDURE open;
+ PROCEDURE pl (str IN VARCHAR2);
+
+ PROCEDURE before_results(run_id IN utr_outcome.run_id%TYPE);
+ PROCEDURE show_failure;
+ PROCEDURE show_result;
+ PROCEDURE after_results(run_id IN utr_outcome.run_id%TYPE);
+
+ PROCEDURE before_errors(run_id IN utr_error.run_id%TYPE);
+ PROCEDURE show_error;
+ PROCEDURE after_errors(run_id IN utr_error.run_id%TYPE);
+
+ PROCEDURE close;
+
+ PROCEDURE before_suite_results(suite_id IN ut_suite.id%TYPE);
+
+END utMyRssReporter;
+/
+
+
+
+ Your reporter package can define other functions and procedures, for
+ example to allow configuration, but all the procedures shown above should
+ be defined. The usage of these procedures follows. Note If you
+ want to keep the format of the output the same as for the Output Reporter,
+ but wish to send it elsewhere, you can define open, close and pl, but
+ simply call the equivalent procedure in utOutputReporter for the others.
+ For an example of this, see the File Reporter.
+
+
+
open
+
+
+ This is called at the very start of the process and is the ideal place to
+ do initialization, such as opening any files that you will be writing to.
+
+
+
pl
+
+ This is a general routine to simply write out the given string for purposes of logging etc.
+ If you don't want this to show up in your output, you can simply call utoutputreporter.pl to send this to DBMS_OUTPUT instead.
+
+
+
before_results
+
+
+ As the name suggests, this is called before the results are output. Note that the tests have already completed at this point,
+ so it is possible to call utresult.success (run_id) to determine if the run was a success or not and display a large banner.
+
+
+
show_failure
+
+
+ This is called when a failure is reported and we are only showing failures (i.e. utconfig.showfailuresonly has been set).
+ To get details of the failure, you will need to examine the package level record utreport.outcome.
+
+
+
show_result
+
+
+ This is called whenever a result is reported and we are showing all
+ results. To get details, you will need to examine
+ utreport.outcome. See below for details.
+
+
+
after_results
+
This is called after all the results have been sent for output.
+
+
before_errors
+
This is called before any errors are sent for output.
+
+
show_error
+
+ This is called for each error to output. To get details, you will need
+ to examine the package level record utreport.error.
+ See below for details.
+
+
+
after_errors
+
This is called after any errors have been sent for output.
+
+
before_suite_results
+
+ This is called only when a suite is executed. It displays the overall
+ banner and suite execution statistics.
+
+
+
Outcome and Error records
+
+ In order to keep the API as simple as possible, many of the procedures defined above take no parameters. In particular, details of the outcome or error which
+ triggered the callback are not passed through to your procedure. These are stored as package level records in the utReport package as shown below.
+
status - This is a string which is either "SUCCESS" or "FAILURE" depending on the outcome of this test.
+
description - The text describing the success or failure.
+
+
+
The important fields in the error record are:
+
+
+
errlevel - The Error Level
+
errcode - The Error Code
+
errtext - The Description of the error that occurred
+
+
+
Using Your Custom Reporter
+
+ To use your custom reporter, you simply call utConfig.Setreporter with the name of your reporter. So if
+ you have defined your reporter in the utMyRssReporter package, you need to call:
+
+
+
+BEGIN
+ utConfig.setreporter('MyRss');
+END;
+
+
+
+ Then you just run your tests as usual and hopefully your reporter will
+ format the results as you expect.
+
+
+
Sending output to the current reporter
+
+ If you wish to send output to the current reporter, for example, for logging purposes, you should call utReport.pl.
+ This is part of the utReport package, which acts as a facade and passes any calls through to the current reporter package.
+ So if you have set up a custom reporter package 'utMyRssReporter' as shown above and called utConfig.setreporter('MyRss'),
+ any calls such as the following:
+
+ In some cases (usually when your packages are small and the code you
+ need to write to construct your tests is also constrained), you will not
+ want to bother with creating a separate package to test your code. To do
+ this, you will put the setup, teardown and unit test procedures inside
+ the package specification and body. We look at two examples:
+
+ Suppose I have my basic sting package, containing (for now at least) just
+ a single function:
+
+
+
+/*file str.pks */
+CREATE OR REPLACE PACKAGE str
+IS
+ FUNCTION betwn (
+ string_in IN VARCHAR2,
+ start_in IN PLS_INTEGER,
+ end_in IN PLS_INTEGER
+ )
+ RETURN VARCHAR2;
+END str;
+/
+
+
+
+ Now it is time to test the function. I really don't want to bother with
+ a separate package; let's keep it together. To do this, I change the specification
+ to:
+
+
+
+CREATE OR REPLACE PACKAGE str
+IS
+ FUNCTION betwn (
+ string_in IN VARCHAR2,
+ start_in IN PLS_INTEGER,
+ end_in IN PLS_INTEGER
+ )
+ RETURN VARCHAR2;
+
+ PROCEDURE ut_setup;
+ PROCEDURE ut_teardown;
+
+ -- For each program to test...
+ PROCEDURE ut_betwn;
+
+END str;
+/
+
+
+
+ The package body contains nothing unusual; it is the same test for str.betwn
+ that you can find in the Testing
+ a Scalar Function example. But when I execute my test, I need to tell
+ utPLSQL that my test code is located in the same package:
+
+
+
+SQL> exec utconfig.showconfig
+=============================================================
+utPLSQL Configuration for SCOTT
+ Directory: e:\openoracle\utplsql\utinstall\examples
+ Autcompile? Y
+ Manual test registration? N
+ Prefix = ut_
+=============================================================
+
+PL/SQL procedure successfully completed.
+
+SQL> exec utPLSQL.test ('str', samepackage_in => TRUE)
+.
+> SSSS U U CCC CCC EEEEEEE SSSS SSSS
+> S S U U C C C C E S S S S
+> S U U C C C C E S S
+> S U U C C E S S
+> SSSS U U C C EEEE SSSS SSSS
+> S U U C C E S S
+> S U U C C C C E S S
+> S S U U C C C C E S S S S
+> SSSS UUU CCC CCC EEEEEEE SSSS SSSS
+.
+ SUCCESS: "str"
+
+ Collections are very useful structures, but they can be difficult to analyze
+ and compare. utPLSQL provides the utAssert.eqColl and utAssert.eqCollAPI
+ programs to help you do this.
+
+
+ For this example, consider the fileIO package: it implements a path
+ feature for the UTL_FILE package. In other words, you request to open a
+ file and your file-opening program will search through each of the directories
+ in the path in sequence until it finds the file or exhausts the list. Here
+ is the specification of this package:
+
+
+/*file filepath1.pkg */
+CREATE OR REPLACE PACKAGE fileIO
+IS
+ c_delim CHAR(1) := ';';
+
+ dirs dirs_tabtype := dirs_tabtype ();
+
+ -- Unit test list
+ ut_dirs dirs_tabtype := dirs_tabtype ();
+
+ PROCEDURE setpath (str IN VARCHAR2, delim IN VARCHAR2 := c_delim);
+ FUNCTION path RETURN VARCHAR2;
+ FUNCTION pathlist RETURN dirs_tabtype;
+
+ FUNCTION open (file IN VARCHAR2, loc IN VARCHAR2 := NULL) RETURN UTL_FILE.FILE_TYPE;
+
+ -- Unit test code in same package
+ PROCEDURE ut_setup;
+ PROCEDURE ut_teardown;
+ PROCEDURE ut_setpath;
+END;
+/
+
+
+
A few things to notice about this package:
+
+
+ It declares a publicly available collection, fileIO.dirs, in which the
+ path is deposited. Because it is declared in the package specification,
+ I can use the utAssert.eqColl procedure (if the collection was hidden in
+ the package body, I would have to use utAssert.eqCollAPI).
+
+
+ The test code is in the same package: the setup,
+ teardown and test pogram for fileIO.setpath.
+
+
+ I declare a second, publicly available collection,
+ fileIO.ut_dirs, against which I will compare the path that is populated
+ by fileIO.setpath.
+
+
+
+
Given that, let's take a look at the implementation of the test program:
+ Populate the test collection with direct assignments. Call the setPath
+ program to populate the actual collection (fileIO.dirs). Call the assertion
+ program to compare the two. Notice that I pass the names of the
+ collections to the assertion program. utAssert uses dynamic SQL to build
+ a PL/SQL block "on the fly" that compares values from the collections.
+
+ This document gives you all the information you need to get started
+ with utPLSQL: how to install the product, build a test package and run
+ your test. If you are new to unit testing, you should take a few moments
+ to review the Glossary to familiarize yourself with the terminology.
+
+
+
+ And it is always worthwhile reviewing requirements before installing
+ the software!
+
+ Usually our applications are composed of multiple packages. To test
+ our application, we must test all of the packages. utPLSQL makes it easier
+ for you to do that by offering test suites.
+
+
+ Here is an example of a script that defines a (partial) test suite for
+ PL/Vision, a code library available from RevealNet
+ as part of its Active PL/SQL Knowledge Base:
+
+
+
+/*file plvision.tst */
+BEGIN
+ -- Define a test suite for PL/Vision
+ utsuite.add ('PLVision');
+
+ -- Add packages for testing
+ utpackage.add (
+ 'PLVision', 'PLVstr', dir_in => 'e:\openoracle\utplsql\examples');
+ utpackage.add (
+ 'PLVision', 'PLVdate', dir_in => 'e:\openoracle\utplsql\examples');
+END;
+/
+
+
+
+ This is a very simple test suite definition. I rely on all defaults, but
+ I specify a location for my test package code. By doing this, utPLSQL will
+ be able to find my test packages even if the default/current utPLSQL directory
+ is set to another location.
+
+
+ If I want to, I can also specify the order in which packages are tested
+ by passing a value for the seq_in argument. I can request that the test
+ code be looked for in the same package as the source code, and so on. Here
+ is a rewriting of the above sutie creation script that demonstrates these
+ options:
+
+ Most packages consist of lots more than a single program, and you will
+ generally want to test each and every of the programs listed in the package
+ specification. When you generate a test package with utGen,
+ it will produce a template unit test procedure for each program in the
+ package specification. You will then need to modify each of these programs.
+
+
+ One example of this more complex package structure is the table encapsulation
+ package. This kind of package establishes a layer of code and therefore
+ control between application requirements and underlying data structures.
+ While the building of such a layer is uncommon in the world of PL/SQL developers,
+ it is strongly recommended practice. A variety of tools, in fact, offer
+ automated table encapsulation package generation, including Oracle
+ Designer, RevealNet's PL/Generator
+ and a variety of IDE (integrated development environment) tools.
+
+
+ Suppose, then, that I used PL/Generator to generate a table encapsulation
+ package for the employee table. It would look like the code found in te_employee.pks
+ and te_employee.pkb(1) (being rather
+ lengthy, we will not reproduce it in the documentation. If you take a look,
+ you will see that their are dozens of programs in the API, which means
+ that you would have lots of work to do in building your unit test cases.
+ In addition, many of the programs will be performing DML operations (updating,
+ deleting, inserting). How you can easily and dependably test those programs?
+
+
+ When you are dealing with lots of programs that have a uniform structure
+ and behavior (which should be the case if you are building table
+ API packages), then you should look for ways to generate, rather
+ than write manually, your test package. utGen cannot do this generation
+ work for you, since the logic in your encapsulation package is specific
+ to your environment.
+
+
+ You can, instead, build your own custom generator or use an existing
+ generator that is sufficiently flexible to meet your needs. The original
+ creator of utPLSQL, Steven Feuerstein,
+ has also been working on generator utilities for a number of years. One
+ of these utilities, currently "code named" GenX, came in very handy for
+ creating a test package for his PL/Generator-generated encapsulation packages.
+
+
+ Using CGML (Code Generation Markup Language), Steven created a template
+ (See te_utpkg.gdr in the Examples directory of the utPLSQL distribution)
+ that reads information from the data dictionary and defines the setup,
+ teardown and at least a good starting point for the unit test procedures.
+ Here is the template logic for the setup procedure:
+
+
+ PROCEDURE {utprefix}setup
+ IS
+ BEGIN
+ -- Clean start
+ {utprefix}teardown;
+[ASIS]
+ -- Generic copy of base table for testing
+ EXECUTE IMMEDIATE
+ 'CREATE TABLE {tabprefix}[objname] AS
+ SELECT * FROM [objname]';
+
+[ENDASIS]
+ [FOREACH]prog
+ [IF]{allprogs}[EQ]Y[OR][progname][LIKE]UPD%[OR][progname][LIKE]INS%[OR][progname][LIKE]DEL%
+ -- Create copy of base table for this unit test.
+ EXECUTE IMMEDIATE
+ 'CREATE TABLE ^{progtab}^ AS
+[ASIS]
+ SELECT * FROM [objname]';
+[ENDASIS]
+
+ [ENDIF]
+ [ENDFOREACH]
+ END;
+
+
+
+ You are not, of course, expected to understand all the logic and syntax
+ in this fragment. If you are interested in pursuing these sorts of genreation
+ opportunities and would like to check out GenX, drop a note to Steven
+ Feuerstein.
+
+
+ Here is a portion of the generated logic (found in ut_te_employee.pks
+ and ut_te_employee.pkb"(1)), the
+ program that tests the delete operation in the encapsulation package:
+
+
+
+ PROCEDURE ut_del1
+ IS
+ fdbk PLS_INTEGER;
+ BEGIN
+ /* Delete that finds now rows. */
+
+ EXECUTE IMMEDIATE '
+ DELETE FROM ut_DEL1
+ WHERE employee_id = -1
+ ';
+ te_employee.del (-1, rowcount_out => fdbk);
+ -- Test results
+ utassert.eqtable ('Delete rows', 'EMPLOYEE', 'ut_DEL1');
+ /* Successful delete */
+
+ EXECUTE IMMEDIATE '
+ DELETE FROM ut_DEL1
+ WHERE employee_id between 7800 and 7899
+ ';
+
+ FOR rec IN (SELECT *
+ FROM employee
+ WHERE employee_id BETWEEN 7800 AND 7899)
+ LOOP
+ te_employee.del (
+ rec.employee_id,
+ rowcount_out => fdbk
+ );
+ END LOOP;
+
+ -- Test results
+ utassert.eqtable ('Delete rows', 'EMPLOYEE', 'ut_DEL1');
+ ROLLBACK;
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ utassert.this (
+ 'DEL1 exception ' || SQLERRM,
+ SQLCODE = 0
+ );
+ END;
+
+
+
+ In this procedure, I test for two scenarios: a delete that removes zero
+ rows and a delete that removes a specific set of rows. In both cases, I
+ perform the explicit (non-encapsulated) DML logic against a copy
+ of the actual table (this copy is created in the setup
+ procedure; that is the reason I use dynamic SQL to refer to this table
+ -- it doesn't exist when the package is compiled!). Then I do the (hopefully)
+ same operation by using the API program. Finally, I call the appropriate
+ utAssert assertion program to compare the results -- and at the end of
+ the procedure issue a ROLLBACK so that my "source" table (employee, in
+ this case), i set back to the original data state. Notice that I also put
+ an assertion program in the exception section to trap any errors and flag
+ it as a failed test.
+
+
+ That should give you a good feel for the kind of code you might write
+ to test a table encapsulation package. The next two sections show you how
+ I used the setup and teardown procedures to manage the data structures
+ I use in my tests.
+
+
+
Set Up Data Structures
+
+
+ As I contemplated how best to test these large packages, I revisited some
+ of my testing principles and found one to be of particular importance:
+
+
+
Build isolated tests.
+
+
+ This principle is important because it allows you to run one, all or
+ a subset of your tests without having to worry about the impact or dependencies
+ on the other tests. And test isolation is particularly important
+ when testing DML operations. The way to validate a successful DML operation
+ is by analyzing the contents of the "source" table against a "test" table.
+ If all the tests modify the same test table, ti will be very difficult
+ if not impossible to verify success or notice failure.
+
+
+ So I decided that the best way to run my unit tests for DML operations
+ was to create a separate test table for each unit test. As a consequence,
+ my setup procedure for the te_employee package looks like this:
+ (See ut_te_employee.pkb in the Examples directory of the utPLSQL distribution)
+
+
+
+ PROCEDURE ut_setup
+ IS
+ BEGIN
+ ut_teardown;
+ EXECUTE IMMEDIATE 'CREATE TABLE ut_employee AS
+ SELECT * FROM employee';
+ EXECUTE IMMEDIATE 'CREATE TABLE ut_DEL1 AS
+ SELECT * FROM employee';
+ EXECUTE IMMEDIATE 'CREATE TABLE ut_DELBY_EMP_DEPT_LOOKUP AS
+ SELECT * FROM employee';
+ EXECUTE IMMEDIATE 'CREATE TABLE ut_DELBY_EMP_JOB_LOOKUP AS
+ SELECT * FROM employee';
+ EXECUTE IMMEDIATE 'CREATE TABLE ut_DELBY_EMP_MGR_LOOKUP AS
+ SELECT * FROM employee';
+ EXECUTE IMMEDIATE 'CREATE TABLE ut_INS1 AS
+ SELECT * FROM employee';
+ EXECUTE IMMEDIATE 'CREATE TABLE ut_UPD1 AS
+ SELECT * FROM employee';
+ EXECUTE IMMEDIATE 'CREATE TABLE ut_UPD$HIRE_DATE1 AS
+ SELECT * FROM employee';
+ EXECUTE IMMEDIATE 'CREATE TABLE ut_UPD$SALARY1 AS
+ SELECT * FROM employee';
+ END;
+
+
+
+ I first remove all my data structures using the teardown procedure to make
+ sure I have a clean start. Then I use dynamic SQL (the Oracle8i version)
+ to create all my tables. I must rely on dynamic SQL because PL/SQL does
+ not yet support native DDL statements, such as CREATE TABLE.
+
+
+ Then I am set to test.
+
+
+
Tear Down Data Structures
+
+
+ Well, if I am going to create a whole bunch of data structures to run my
+ tests, I had better get rid of those structures when I am done. Here is
+ the teardown program I generated for the te_employee package:
+
+
+
+ PROCEDURE ut_teardown
+ IS
+ BEGIN
+ BEGIN
+ EXECUTE IMMEDIATE 'DROP TABLE ut_employee';
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ NULL;
+ END;
+
+ BEGIN
+ EXECUTE IMMEDIATE 'DROP TABLE ut_DEL1';
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ NULL;
+ END;
+
+ BEGIN
+ EXECUTE IMMEDIATE 'DROP TABLE ut_DELBY_EMP_DEPT_LOOKUP';
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ NULL;
+ END;
+
+ BEGIN
+ EXECUTE IMMEDIATE 'DROP TABLE ut_DELBY_EMP_JOB_LOOKUP';
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ NULL;
+ END;
+
+ BEGIN
+ EXECUTE IMMEDIATE 'DROP TABLE ut_DELBY_EMP_MGR_LOOKUP';
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ NULL;
+ END;
+
+ BEGIN
+ EXECUTE IMMEDIATE 'DROP TABLE ut_INS1';
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ NULL;
+ END;
+
+ BEGIN
+ EXECUTE IMMEDIATE 'DROP TABLE ut_UPD1';
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ NULL;
+ END;
+
+ BEGIN
+ EXECUTE IMMEDIATE 'DROP TABLE ut_UPD$HIRE_DATE1';
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ NULL;
+ END;
+
+ BEGIN
+ EXECUTE IMMEDIATE 'DROP TABLE ut_UPD$SALARY1';
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ NULL;
+ END;
+
+ END;
+
+
+
+ Again, I use dynamic SQL, but enclose each DROP TABLE statement inside
+ its own exception section so that if for any reason the DROP fails, I continue
+ on in an attempt to get as much done as possible.
+
+ As with the procedure, there are a couple of scenarios to consider:
+
+
+
+
+ The function returns a scalar value (number,
+ date, string, Boolean). In this case, you can embed your call to the function
+ directly inside a call to a uAssert assertion program, making your test
+ procedure very concise and easy to write.
+
+
+ The function returns a non-scalar value,
+ such as an object or a collection. In this case, you will need to call
+ the function and then evaluate the contents of the returned structure.
+
+
+ A third situation to consider is that your function returns a value, but
+ it also takes a number of other actions, the success of which is not reflected
+ in the returned value. Fully testing such a function (one with "side effects")
+ can be very difficult, since you must test for a variety of conditions.
+
+
+
+
Testing a Scalar Function
+
+
+ First, a test of a function returning a scalar value. Consider the following
+ packaged function:
+
+
+
+/*file str.pks and str.pkb */
+CREATE OR REPLACE PACKAGE str
+IS
+ FUNCTION betwn (
+ string_in IN VARCHAR2,
+ start_in IN PLS_INTEGER,
+ end_in IN PLS_INTEGER
+ )
+ RETURN VARCHAR2;
+END str;
+/
+
+
+
+ The str.betwn function returns the sub-string of a string_in that is found
+ between the start and end locations specified by start_in and end_in.
+
+
+
+ So...time to test! I generate a test package
+ and then modify the unit test procedure to check for various conditions:
+
+
+
+/*file ut_str.pkb */
+CREATE OR REPLACE PACKAGE BODY ut_str
+IS
+ PROCEDURE ut_setup
+ IS
+ BEGIN
+ NULL;
+ END;
+
+ PROCEDURE ut_teardown
+ IS
+ BEGIN
+ NULL;
+ END;
+
+ -- For each program to test...
+ PROCEDURE ut_betwn IS
+ BEGIN
+ utAssert.eq (
+ 'Typical Valid Usage',
+ str.betwn ('this is a string', 3, 7),
+ 'is is'
+ );
+
+ utAssert.eq (
+ 'Test Negative Start',
+ str.betwn ('this is a string', -3, 7),
+ 'ing'
+ );
+
+ utAssert.isNULL (
+ 'Start bigger than end',
+ str.betwn ('this is a string', 3, 1)
+ );
+ END ut_betwn;
+
+END ut_str;
+/
+
+
+
+ As you can see, my calls to str.betwn are embedded right within calls to
+ utAssert.eq and utAssert.isNULL, making my test code compact.
+
+ The procedure runs some code and then passes back results through the parameter
+ list. In this case, I can write a unit test that analyzes the OUT and IN
+ OUT argument values.
+
+
+ The procedure runs some code, which changes
+ other elements of the application (such as a database table or a file).
+ The parameter list does not contain arguments that can be analyzed for
+ successful execution. So to assert success, I will need to analyze/compare
+ the data structures that have been modified.
+
+
+
+
Test Success Through Parameters
+
+
+ We'll start with a really simple example. I
+ have built a procedure that accepts two dates and returns the number of
+ seconds between them. Here it is:
+
+
+
+/*file calc_secs_between.sp */
+CREATE OR REPLACE PROCEDURE calc_secs_between (
+ date1 IN DATE,
+ date2 IN DATE,
+ secs OUT NUMBER)
+IS
+BEGIN
+ -- 24 hours in a day,
+ -- 60 minutes in an hour,
+ -- 60 seconds in a minute...
+ secs := (date2 - date1) * 24 * 60 * 60;
+END;
+/
+
+SQL> SET SERVEROUTPUT ON FORMAT WRAPPED
+SQL> exec utGen.testpkg ('calc_secs_between ')
+CREATE OR REPLACE PACKAGE ut_calc_secs_between
+IS
+ PROCEDURE ut_setup;
+ PROCEDURE ut_teardown;
+
+ -- For each program to test...
+ PROCEDURE ut_CALC_SECS_BETWEEN;
+END ut_calc_secs_between;
+/
+CREATE OR REPLACE PACKAGE BODY ut_calc_secs_between
+IS
+ PROCEDURE ut_setup
+ IS
+ BEGIN
+ NULL;
+ END;
+
+ PROCEDURE ut_teardown
+ IS
+ BEGIN
+ NULL;
+ END;
+
+ -- For each program to test...
+ PROCEDURE ut_CALC_SECS_BETWEEN IS
+ BEGIN
+ CALC_SECS_BETWEEN (
+ DATE1 => ''
+ ,
+ DATE2 => ''
+ ,
+ SECS => ''
+ );
+
+ utAssert.this (
+ 'Test of CALC_SECS_BETWEEN',
+ '<boolean expression>'
+ );
+ END ut_CALC_SECS_BETWEEN;
+
+END ut_calc_secs_between;
+/
+
+
+
+ I generated the output to the screen, but it
+ is actually easier to deposit the code directly into two separate files
+ for package spec and body, ut_calc_secs_between.pks and ut_calc_secs_between.pkb,
+ which I do as follows:
+
+ By conforming to this standard, utPLSQL can
+ automatically compile this code before each test. I now edit the ut_calc_secs_between
+ procedure to test for various cases:
+
+SQL> exec utplsql.test ('calc_secs_between')
+.
+> SSSS U U CCC CCC EEEEEEE SSSS SSSS
+> S S U U C C C C E S S S S
+> S U U C C C C E S S
+> S U U C C E S S
+> SSSS U U C C EEEE SSSS SSSS
+> S U U C C E S S
+> S U U C C C C E S S
+> S S U U C C C C E S S S S
+> SSSS UUU CCC CCC EEEEEEE SSSS SSSS
+.
+ SUCCESS: "calc_secs_between"
+
+
+
+ Certainly, there are a variety of other conditions
+ to test, but this should give you a good idea of how to go about it!
+
+
+
Test Success by Analyzing Impact
+
+
+ Now let's consider a more complicated situation.
+ I have a procedure that truncates all the rows in the specified table.
+ To do this I just use dynamic SQL, as you can see in:
+
+ After I run this test, I cannot simply check
+ the value returned by the procedure. Instead, I must check to see how many
+ rows are left in the table. Fortunately, I have another dynamic SQL utility
+ to help me out here, one that returns the count of rows in any table:
+ (Note that you could also use utAssert.eqqueryvalue here.)
+
+
+
+/*file tabcount.sf */
+CREATE OR REPLACE FUNCTION tabcount (
+ sch IN VARCHAR2,
+ tab IN VARCHAR2)
+ RETURN INTEGER
+IS
+ retval INTEGER;
+BEGIN
+ EXECUTE IMMEDIATE
+ 'SELECT COUNT(*) FROM ' || sch || '.' || tab
+ INTO retval;
+ RETURN retval;
+EXCEPTION
+ WHEN OTHERS
+ THEN
+ RETURN NULL;
+END;
+/
+
+
+
+ So I will generate a package
+ to test truncit and then modify the package body:
+
+
+
+SQL> SET SERVEROUTPUT ON FORMAT WRAPPED
+SQL> exec utGen.testpkg ('truncit', output_type_in => utGen.c_file)
+
+
+
+ To run my test, I need to truncate a table.
+ That is an irreversible action, so I will create a "temporary" table in
+ the setup procedure and drop it in the teardown procedure. Then I will
+ run my code and use tabCount to validate the results:
+
+
+
+/*file ut_truncit.pkb */
+CREATE OR REPLACE PACKAGE BODY ut_truncit
+IS
+ PROCEDURE ut_setup
+ IS
+ BEGIN
+ EXECUTE IMMEDIATE
+ 'CREATE TABLE temp_emp AS SELECT * FROM employee';
+ END;
+
+ PROCEDURE ut_teardown
+ IS
+ BEGIN
+ EXECUTE IMMEDIATE
+ 'DROP TABLE temp_emp';
+ END;
+
+ -- For each program to test...
+ PROCEDURE ut_TRUNCIT IS
+ BEGIN
+ TRUNCIT (
+ TAB => 'temp_emp'
+ ,
+ SCH => USER
+ );
+
+ utAssert.eq (
+ 'Test of TRUNCIT',
+ tabcount (USER, 'temp_emp'),
+ 0
+ );
+ END ut_TRUNCIT;
+
+END ut_truncit;
+/
+
+
+
+ Not quite as straightforward as checking values
+ returned in OUT or IN OUT arguments, but not too awful, right? Of course,
+ things can get considerably more complicated as your code (and the results
+ you must test for) grows more complex. Regardless, you will find it easier
+ to build and run your tests through utPLSQL than through more ad hoc and
+ considerably less organized approaches.
+
+ I will put utPLSQL to work in a small-scale development
+ effort, to show you how it all hangs together. I've got a "hangnail" in
+ my PL/SQL development work, called SUBSTR. This function bothers me and
+ I want to take care of it. What's the problem? SUBSTR is great when you
+ know the starting location of a string and number of characters you want. In
+ many situations, though, I have the start and end locations and I need
+ to figure out the number of characters I then want. Is it:
+
+ Why should I have to remember stuff like this? I
+ never do, and so I take out a scrap of paper, write down 'abcdefgh', put
+ a mark over the "c" and another over the "g", count on my fingers and then
+ remember that of course the formula is "end - start + 1".
+
+
+
+ All right, so I did that a dozen times, I am sick
+ of it and determined to stop wasting my time in the future. I will write
+ a function called "str.betwn" (the betwn function defined in the str package)
+ that does the work and the remembering for me.
+
+
+
+ Instead of immediately coding the function, however,
+ I will first write my unit tests with utPLSQL! Since my source package
+ is named "str", I will create a test package named "ut_str". I am a lazy
+ fellow, so I will take the lazy way out and generate the starting point
+ for my package:
+
+ Note: for the above call to work, I must have already
+ set my default directory for utPLSQL, which I do via a SQL*Plus login script
+ that looks like this:
+
+
+
+exec utplsql.setdir ('e:\utplsql\test')
+
+SET SERVEROUTPUT ON SIZE 1000000 FORMAT WRAPPED
+
+
+
+ Otherwise, I would need to specify the directory
+ in my call to genpkg, as in:
+
I then will find this package spec in the ut_str.pks file:
+
+
+CREATE OR REPLACE PACKAGE ut_str
+IS
+ PROCEDURE ut_setup;
+ PROCEDURE ut_teardown;
+
+ -- For each program to test...
+ PROCEDURE ut_betwn;
+END ut_str;
+/
+
+
+
+ And I don't really have to modify the specification
+ at all. The body will, on the other hand, require some work, since I haven't
+ yet figured out a way to automatically generate the test code itself. Here
+ is the purely generated test package body found
+ in the ut_str.pkb file:
+
+
+
+CREATE OR REPLACE PACKAGE BODY ut_str
+IS
+ PROCEDURE ut_setup
+ IS
+ BEGIN
+ NULL;
+ END;
+
+ PROCEDURE ut_teardown
+ IS
+ BEGIN
+ NULL;
+ END;
+
+ -- For each program to test...
+ PROCEDURE ut_betwn
+ IS
+ BEGIN
+ utAssert.this (
+ 'Test of betwn',
+ <boolean expression>,
+ );
+ END;
+
+END ut_str;
+/
+
+
+
+ The setup and teardown procedures are fine (I don't
+ have any special setup and therefore teardown requirements), but the ut_betwn
+ needs lots of work. It doesn't really test anything yet.
+
+
+
+ Before I start writing my test code, however, I
+ will just sit back and think about what I want to test. Here are some inputs
+ that I can think of:
+
+
+
+
+
String
+
Start
+
End
+
Expected Result
+
+
+
"this is a string"
+
3 (positive number)
+
7 (bigger positive number)
+
"is is"
+
+
+
"this is a string"
+
-3 (invalid negative number)
+
7 (bigger positive number)
+
"ing" (consistent with SUBSTR behavior)
+
+
+
"this is a string"
+
3 (positive number)
+
1 (smaller positive number)
+
NULL
+
+
+
+
+
+ We could easily come up with a whole lot more test
+ cases - and if this was real life and not product documentation, I would
+ not move forward until I had identified all interesting tests. So let's
+ suppose I have done that and now I am ready to do some coding. Since I
+ am testing a function, I will want to compare the result of the function
+ call to my expected results. I will therefore change my assertion from
+ the generic "assert this" procedure to the utAssert.eq program, and put
+ the call to the function right into the assertion routine. Here, then,
+ is my first crack at transforming my ut_betwn procedure:
+
+
+
+PROCEDURE ut_betwn IS
+BEGIN
+ utAssert.eq (
+ 'Test of betwn',
+ str.betwn ('this is a string', 3, 7),
+ 'is is'
+ );
+END;
+
+
+
+ Following the Extreme Programming philosophy ("code
+ a little, test a lot"), I will test this test case before I add all the
+ other test cases. I do this with a very simple call:
+
+
+
+SQL> exec utplsql.test ('str')
+
+> SSSS U U CCC CCC EEEEEEE SSSS SSSS
+> S S U U C C C C E S S S S
+> S U U C C C C E S S
+> S U U C C E S S
+> SSSS U U C C EEEE SSSS SSSS
+> S U U C C E S S
+> S U U C C C C E S S
+> S S U U C C C C E S S S S
+> SSSS UUU CCC CCC EEEEEEE SSSS SSSS
+
+>SUCCESS: "str"
+
+
+
+ Now, you could say: "Great it worked!" Or you could
+ say: "I have no idea if it worked. Maybe it always says success."
+ I go for the latter, so let's deliberately cause a failure:
+
+
+
+PROCEDURE ut_betwn IS
+BEGIN
+ utAssert.eq (
+ 'Test of betwn',
+ str.betwn ('this is a string', 3, 7),
+ 'this is a pipe'
+ );
+END;
+
+
+
+ Saving the file (but not bothering to recompile,
+ since utPLSQL will do it for me automagically),
+ I then run my test again:
+
+
+
+SQL> exec utplsql.test ('str', recompile_in=>false)
+
+> FFFFFFF AA III L U U RRRRR EEEEEEE
+> F A A I L U U R R E
+> F A A I L U U R R E
+> F A A I L U U R R E
+> FFFF A A I L U U RRRRRR EEEE
+> F AAAAAAAA I L U U R R E
+> F A A I L U U R R E
+> F A A I L U U R R E
+> F A A III LLLLLLL UUU R R EEEEEEE
+
+FAILURE: "str"
+
+BETWN: Typical Valid Usage; expected "is is", got "this is a pipe"
+
+
+
+ Now I have a higher degree of confidence that I
+ am getting this right. Excellent! Now I will add the other test cases:
+
+
+
+PROCEDURE ut_betwn IS
+BEGIN
+ utAssert.eq (
+ 'Typical Valid Usage',
+ str.betwn ('this is a string', 3, 7),
+ 'is is'
+ );
+
+ utAssert.eq (
+ 'Test Negative Start',
+ str.betwn ('this is a string', -3, 7),
+ 'ing'
+ );
+
+ utAssert.isNULL (
+ 'Start bigger than end',
+ str.betwn ('this is a string', 3, 1)
+ );
+END;
+
+
+
+ I will deliberately cause each of these tests to
+ fail, to give you a sense of the quality of feedback:
+
+
+
+> FFFFFFF AA III L U U RRRRR EEEEEEE
+> F A A I L U U R R E
+> F A A I L U U R R E
+> F A A I L U U R R E
+> FFFF A A I L U U RRRRRR EEEE
+> F AAAAAAAA I L U U R R E
+> F A A I L U U R R E
+> F A A I L U U R R E
+> F A A III LLLLLLL UUU R R EEEEEEE
+
+FAILURE: "str"
+betwn: Typical Valid Usage; expected "is is", got "this is a pipe"
+betwn: Test Negative Start; expected "ing", got "BRRRING"
+betwn: IS NOT NULL: Start bigger than end
+
+
+
+ Faced with these results, I can zoom in on the code
+ within str.betwn that is causing these incorrect results. I resist the
+ temptation to fix the code for all my tests all at once. Instead, I make
+ one change at a time, then run my test again. I do that over and over again
+ until the failure for the single test case goes away. Then I move to the
+ next one. Eventually, I get a green light and am highly confident of my
+ program - if, of course, I really did come up with an exhaustive list of
+ tests.
+
+
+
+ As I think of another test case, I add a call to
+ utAssert to run that test.
+
+
+
+ As a bug is reported to me, I add a call to utAssert
+ to reproduce that bug. Then I repair my code.
+
+ The utAssert package provides a set of assertion routines ("assert that
+ the following condition is true") that you will use to register the outcome
+ of a test case. You must call a utAssert assertion program after (or containing)
+ a test case so that the results of that test can be recorded and then reported.
+ See Build Test Packages for many examples and
+ more details on this process. Here is a very simple example, though, to give
+ you an idea of the code you would write:
+
+ utAssert offers a wide (and ever expanding) set of assertion programs that
+ allow you to efficiently (a) test the outcome of your unit test and (b) report
+ the results of that test to utPLSQL. You should review
+ Common Assertion Parameters and Behavior before using any specific assertion
+ program. It is also possible to build your own assertion
+ routine. Note: all utAssert assertions are defined in the ut_assertion
+ table, as well as actually coded in the utAssert package.
+
+
+
Common Assertion Parameters and Behavior
+
+
+ Each type of assertion routine accepts different kinds of data, but there
+ are lots of similarities between the assertions, as well. Here is an explanation
+ of the common assertion parameters:
+
+
+
+
+
msg_in
+
+ A message to be displayed if the assertion
+ fails. This is the first argument and is mandatory, because the tests need
+ to be self documenting.
+
+
+
+
check_this_in
+
+ The value to be checked.. If a Boolean expression,
+ this will usually include the invocation of the method being tested, resulting
+ in a single line of code for the entire test case.
+
+
+
+
against_this_in
+
+ For assert_eq, the assertion routine will
+ check the check_this_in value against the against_this_in value. This parameter
+ should be the certifiably correct value.
+
+
+
+
null_ok_in
+
+ TRUE if a NULL value should be interpreted
+ as a successful test, FALSE if NULL indicates failure.
+
+
+
+
raise_exc_in
+
+ TRUE if it is OK for the assertion routine
+ to allow an exception to be propagated out unhandled.
+
+
+
+
+
Generic "Assert This" Assertion Procedure
+
+
+ This most generic assertion program simply says "assert this" and passes
+ a Boolean expression. It is used by all the other assertion routines, which
+ construct a Boolean expression from their specific values and logic.
+
+
+
+ PROCEDURE utAssert.this (
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+
+
+ Use utAssert.this when you have a Boolean expression that you want to check,
+ as in:
+
+ You can also use this assertion to register a failure, most usually in
+ an exception section, as in:
+
+
+
+EXCEPTION
+ WHEN OTHERS
+ THEN
+ utAssert.this (
+ SQLERRM,
+ FALSE
+ );
+
+
+
+ Generally, you should avoid utAssert.this and instead use a specialized
+ assertion routine, documented below. Most of the assertions give you the
+ ability check for equality (of scalars, such as strings, or more complex
+ data structures like tables, pipes and files): does the data generated by
+ my code match the expected value(s)?
+
+
+
Check for NULL and NOT NULL Values
+
+
+ You can check to see if a value is NULL or is NOT NULL with the following
+ assertions:
+
+
+
+PROCEDURE utAssert.isnotnull (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+PROCEDURE utAssert.isnull (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+PROCEDURE utAssert.isnotnull (
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+PROCEDURE utAssert.isnull (
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+
+
+ Use these assertions when you simply want to check if a scalar expression
+ (string, date, number and Boolean are supported) is NULL or NOT NULL, as
+ in:
+
+ If you need to compare two dates or two strings or two numbers or two Booleans,
+ use the utAssert.eq assertion program.
+
+
+
Here is the header for the scalar equality check assertion:
+
+
+PROCEDURE utAssert.eq (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2|BOOLEAN|DATE|NUMBER,
+ against_this_in IN VARCHAR2|BOOLEAN|DATE|NUMBER,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+
+
+ If the two values are equal, your code gets a green light. Otherwise, utAssert
+ writes the test results to the utResult package, resulting in a red light
+ for the test. If NULL values are considered value for this test, pass TRUE
+ for null_ok_in. If you want the assertion to raise an exception on failure
+ and stop the test from proceeding, pass TRUE for raise_exc_in. Here is an
+ example of using the utAssert.eq program:
+
+
+
+ PROCEDURE ut_emp_dept_lookuprowcount
+ IS
+ l_rowcount1 PLS_INTEGER;
+ l_rowcount2 PLS_INTEGER;
+ BEGIN
+ -- Run baseline code.
+ SELECT COUNT (*)
+ INTO l_rowcount1
+ FROM employee
+ WHERE department_id = 30;
+
+ -- Compare to program call:
+ l_rowcount2 := te_employee.emp_dept_lookuprowcount (30);
+
+ -- Test results
+ utassert.eq (
+ 'Successful EMP_DEPT_LOOKUPROWCOUNT',
+ l_rowcount2,
+ l_rowcount1
+ );
+ END;
+
+
+
Check Equality of DatabaseTables
+
+
+ If your test performs DML operations (update, insert or delete), you will
+ need to check your results in a database table. You could do this by querying
+ the results into local variables and then calling utAssert.eq to check those
+ values against your expected data. That can be a very laborious process,
+ so utAssert offers the eqtable and equerry assertion routines to streamline
+ the process. Both these procedures use the MINUS SQL operator to essentially
+ "subtract" the contents of one table (query) from the other. If anything
+ is left, then the two tables (queries) are not the same and the test is given
+ a red light. As you can probably see, the structure of the two tables (queries)
+ must be identical for this assertion to work properly. The utAssert.eqtable
+ allows you to compare the contents of your data table (changed by your code)
+ against another table, which you can preset with the data you expect to see
+ after the test. Here is the header for eqtable:
+
+
+
+PROCEDURE utAssert.eqtable (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ check_where_in IN VARCHAR2 := NULL,
+ against_where_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+
+
+ where check_this_in and against_this_in are the names of tables or views.
+ You can supply an optional WHERE clause to restrict the rows you wish to
+ compare. Here is an example that calls eqTable twice, to test two different
+ conditions.
+
+
+
+PROCEDURE ut_del1
+IS
+ fdbk PLS_INTEGER;
+BEGIN
+ /* Delete that finds now rows. */
+
+ EXECUTE IMMEDIATE '
+ DELETE FROM ut_DEL1
+ WHERE employee_id = -1
+ ';
+ te_employee.del (-1, rowcount_out => fdbk);
+
+ -- Test results
+ utassert.eqtable ('Delete rows', 'EMPLOYEE', 'ut_DEL1');
+
+ /* Successful delete */
+
+ EXECUTE IMMEDIATE '
+ DELETE FROM ut_DEL1
+ WHERE employee_id between 7800 and 7899
+ ';
+
+ FOR rec IN (SELECT *
+ FROM employee
+ WHERE employee_id BETWEEN 7800 AND 7899)
+ LOOP
+ te_employee.del (
+ rec.employee_id,
+ rowcount_out => fdbk
+ );
+ END LOOP;
+
+ -- Test results
+ utassert.eqtable ('Delete rows', 'EMPLOYEE', 'ut_DEL1');
+ ROLLBACK;
+EXCEPTION
+ WHEN OTHERS
+ THEN
+ utassert.this (
+ 'DEL1 exception ' || SQLERRM,
+ SQLCODE = 0
+ );
+END;
+
+
+
Check Equality of Table Counts
+
+
+ If your tests simply produce the right number of rows in a table but not
+ a fixed set of values, you will not be able to use
+ utAssert.eqtable above. However, utAssert.eqtabcount allows you to simply
+ test that the numbers of rows are equal. The declaration of the procedure
+ is as follows:
+
+
+
+PROCEDURE utAssert.eqtabcount (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ check_where_in IN VARCHAR2 := NULL,
+ against_where_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+
+
+ where check_this_in and against_this_in are the names of tables or views.
+ As in utAssert.eqtable, you can supply an optional WHERE clause to restrict
+ the rows you wish to compare. The following test will compare the number
+ of rows in the CD_COLLECTION and UT_TEST_5_1 tables where the given condition
+ holds:
+
+ The utAssert.eqquery allows you to compare the data returned by two queries
+ (strings that are contained in the check_this_in and against_this_in parameters).
+ In this case, you specify the full SELECT statements for each query as the
+ parameters. By using equery, you may be able to avoid constructing a separate
+ table with preset data.
+
+
+
+PROCEDURE utAssert.eqquery (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+
+
+ If you want the assertion to raise an exception on failure and stop the
+ test from proceeding, pass TRUE for raise_exc_in. Here is an example of
+ using eqQuery:
+
+
+
+PROCEDURE ut_upd1
+IS
+BEGIN
+ /* Update 3 columns by ID */
+ EXECUTE IMMEDIATE '
+ UPDATE ut_UPD1 SET
+ FIRST_NAME = ''SILLY'',
+ HIRE_DATE = trunc (SYSDATE+100),
+ COMMISSION = 5000
+ WHERE
+ EMPLOYEE_ID = 7600
+ ';
+ te_employee.upd (
+ 7600,
+ first_name_in => 'SILLY',
+ commission_in => 5000,
+ hire_date_in => TRUNC (SYSDATE + 100),
+ rowcount_out => fdbk
+ );
+ -- Test results (audit fields are different so do a query)
+ utassert.eqquery (
+ 'Update three columns',
+ 'select first_name, commission, hire_date from EMPLOYEE',
+ 'select first_name, commission, hire_date from ut_upd1'
+ );
+ ROLLBACK;
+END;
+
+
+
Check Query Equality against a Single Value
+
+ Often we will wish to test the result of a query against a single value rather
+ than another query as in utAssert.eqquery above.
+ It is possible to get around this problem by using a trivial query of the
+ form:
+
+
+
+SELECT fixed_value
+FROM DUAL;
+
+
+
+ Unfortunately, if the query returns multiple values or the wrong value we
+ will only be told that the test has failed with no details. This is where
+ utAssert.eqqueryvalue comes to the rescue. The procedure is declared as
+ follows:
+
+
+
+PROCEDURE utAssert.eqqueryvalue (
+ msg_in IN VARCHAR2,
+ check_query_in IN VARCHAR2,
+ against_value_in IN VARCHAR2|NUMBER|DATE,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+
+
+ Where check_query_in is the query in question and against_value_in is the
+ value to check it against. If the query returns more than one value, the
+ resulting error message will tell you this. Similarly, if the query returns
+ the wrong value, the message will state the expected and obtained values.
+ The following call compares the maximum value found in a table against a
+ given number value:
+
+
+
+utAssert.eqqueryvalue('Maximum value test',
+ 'SELECT MAX(MEMORY)
+ FROM COMPUTERS
+ WHERE OS IN (''Linux'', ''Unix'')',
+ 256);
+
+
+
+ Obviously this should only return a single value, but if it returns something
+ other than 256, we'll know about it.
+
+
+
Check Equality of Files
+
+
+ Many programs generate output to operating system files; alternatively,
+ you might write data to a file simply to test results. Use the eqfile assertion
+ for either of these scenarios. This procedure uses PL/SQL's UTL_FILE package
+ to compare the contents of two different files. Note: If you have not used
+ UTL_FILE in the past, you must configure
+ it before it can be used -- by utPLSQL or by your own code. UTL_FILE must
+ be allowed accss to either or both of the directories you specify (this involves
+ setting the utl_file_dir database parameter).
+
+
+
+PROCEDURE utAssert.eqfile (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ check_this_dir_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ against_this_dir_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+
+
+ If you want the assertion to raise an exception on failure and stop the
+ test from proceeding, pass TRUE for raise_exc_in. You must specify the directory
+ containing the "check this" file; if you do not specify a directory for the
+ "against this" file, the "check this" directory will be used. Here is an
+ example of using eqFile (see ut_DEPARTMENT2file.pkg in the Examples directory
+ for the full implementation):
+
+ Database pipes offer a handy mechanism for passing data between different
+ sessions connected to the RDBMS. It is important to know that pipes are being
+ filled properly; use the eqpipe to check this condition. With the eqpipe
+ procedure, you compare the contents of two different pipes.
+
+
+
+PROCEDURE utAssert.eqpipe (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+
+
+ If you want the assertion to raise an exception on failure and stop the
+ test from proceeding, pass TRUE for raise_exc_in. To check the contents
+ of a pipe based on the execution of code, you will need to populate a pipe
+ against which to test equality. The employee_pipe.pkg file in the Examples
+ directory contains a demonstration of the kind of code you might write to
+ do this. This package contains all of the unit test code within the same
+ package. Here is my unit test program, which relies on the utAssert.eqpipe
+ program:
+
+
+
+PROCEDURE ut_fillpipe IS
+ stat PLS_INTEGER;
+BEGIN
+ emptypipe ('emps');
+ emptypipe ('emps2');
+
+ fillpipe ('emps');
+
+ /* Direct filling of pipe. */
+
+ FOR rec IN (SELECT *
+ FROM employee)
+ LOOP
+ DBMS_PIPE.RESET_BUFFER;
+ DBMS_PIPE.PACK_MESSAGE (rec.EMPLOYEE_ID);
+ DBMS_PIPE.PACK_MESSAGE (rec.LAST_NAME);
+ DBMS_PIPE.PACK_MESSAGE (rec.FIRST_NAME);
+ DBMS_PIPE.PACK_MESSAGE (rec.MIDDLE_INITIAL);
+ DBMS_PIPE.PACK_MESSAGE (rec.JOB_ID);
+ DBMS_PIPE.PACK_MESSAGE (rec.MANAGER_ID);
+ DBMS_PIPE.PACK_MESSAGE (rec.HIRE_DATE);
+ DBMS_PIPE.PACK_MESSAGE (rec.SALARY);
+ DBMS_PIPE.PACK_MESSAGE (rec.COMMISSION);
+ DBMS_PIPE.PACK_MESSAGE (rec.DEPARTMENT_ID);
+ DBMS_PIPE.PACK_MESSAGE (rec.CHANGED_BY);
+ DBMS_PIPE.PACK_MESSAGE (rec.CHANGED_ON);
+
+ stat := DBMS_PIPE.SEND_MESSAGE ('emps2', 0);
+ END LOOP;
+
+ /* Compare the two */
+ utassert.eqpipe (
+ 'Two employee pipes', 'emps', 'emps2');
+
+END ut_fillpipe;
+
+
+
+ Since I have stored my unit test logic with my source code package, I would
+ run my test as follows:
+
+ Collections are as close as you come to arrays in PL/SQL. They are very
+ useful for managing lists of information, but can be difficult to debug and
+ maintain. With the eqcoll and eqcollAPI procedures, you can compare the
+ contents of two different arrays. Use the eqColl procedure when you want
+ to compare two collections that are defined in the specification of a package.
+ Use the eqCollAPI procedure when you want to compare two collections that
+ are defined in the body of a package, with programs defined in the specification
+ (an API) to access and manipulate the collections. The collection equality
+ check headers are:
+
+
+
+ /* Direct access to collections */
+ PROCEDURE utAssert.eqcoll (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2, /* pkg1.coll */
+ against_this_in IN VARCHAR2, /* pkg2.coll */
+ eqfunc_in IN VARCHAR2 := NULL,
+ check_startrow_in IN PLS_INTEGER := NULL,
+ check_endrow_in IN PLS_INTEGER := NULL,
+ against_startrow_in IN PLS_INTEGER := NULL,
+ against_endrow_in IN PLS_INTEGER := NULL,
+ match_rownum_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ /* API based access to collections */
+ PROCEDURE utAssert.eqcollapi (
+ msg_in IN VARCHAR2,
+ check_this_pkg_in IN VARCHAR2,
+ against_this_pkg_in IN VARCHAR2,
+ eqfunc_in IN VARCHAR2 := NULL,
+ countfunc_in IN VARCHAR2 := 'COUNT',
+ firstrowfunc_in IN VARCHAR2 := 'FIRST',
+ lastrowfunc_in IN VARCHAR2 := 'LAST',
+ nextrowfunc_in IN VARCHAR2 := 'NEXT',
+ getvalfunc_in IN VARCHAR2 := 'NTHVAL',
+ check_startrow_in IN PLS_INTEGER := NULL,
+ check_endrow_in IN PLS_INTEGER := NULL,
+ against_startrow_in IN PLS_INTEGER := NULL,
+ against_endrow_in IN PLS_INTEGER := NULL,
+ match_rownum_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+
+
where the eqcoll-specific parameters are as follows:
+
+
+
+
Parameter
+
Description
+
+
+
msg_in
+
The message to be displayed if the test failes
+
+
+
check_this_in
+
+ The name of the collection to be checked.
+ Format: package.collection. In other words, the collection must be defined
+ in a package specification. Use eqCollAPI (and check_this_pkg_in) if you
+ want to hide the declaration of your collection in your package body (recommended).
+
+
+
+
against_this_in
+
+ The name of the collection to be checked
+ against. Format: package.collection. In other words, the collection must
+ be defined in a package specification. Use eqCollAPI (and check_this_pkg_in)
+ if you want to hide the declaration of your collection in your package body
+ (recommended).
+
+
+
+
+
and the eqcollAPI-specific parameters are as follows:
+
+
+
+
Parameter
+
Description
+
+
+
msg_in
+
The message to be displayed if the test failes
+
+
+
check_this_pkg_in
+
+ The name of the package that contains the
+ collection to be checked.
+
+
+
+
against_this_pkg_in
+
+ The name of the package that contains the
+ collection to be checked against.
+
+
+
+
countfunc_in
+
+ The name of the function in the package that
+ returns the number of rows defined in the collection.
+
+
+
+
firstrowfunc_in
+
+ The name of the function in the package that
+ returns the first defined row in the collection.
+
+
+
+
lastrowfunc_in
+
+ The name of the function in the package that
+ returns the last defined row in the collection.
+
+
+
+
nextrowfunc_in
+
+ The name of the function in the package that
+ returns the next defined row in the collection from the specified row.
+
+
+
+
getvalfunc_in
+
+ The name of the function in the package that
+ returns the contents of the specified row.
+
+
+
+
+
The parameters common to both eqColl and eqCollAPI are as follows
+
+
+
+
Parameter
+
Description
+
+
+
eqfunc_in
+
+ The function used to determine if the contents
+ of each row of the two collections are the same. If you pass NULL for this
+ argument, then a standard equality check will be used. This is fine for scalar
+ values, but will not work, for example, with tables of records.
+
+
+
+
check_startrow_in
+
+ The starting row in the check collection
+ for comparison. If NULL, then first row is used.
+
+
+
+
check_endrow_in
+
+ The ending row in the check collection for
+ comparison. If NULL, then last row is used.
+
+
+
+
against_startrow_in
+
+ The starting row in the against collection
+ for comparison. If NULL, then first row is used.
+
+
+
+
against_endrow_in
+
+ The ending row in the against collection
+ for comparison. If NULL, then last row is used.
+
+
+
+
match_rownum_in
+
+ Pass TRUE if you want to make sure that the
+ same row numbers are used in each collection. If FALSE, then the row numbers
+ can be different, but the contents of each corresponding row must be the same.
+
+
+
+
null_ok_in
+
+ Pass TRUE if the assertion routine should
+ consider two NULL collections to be equal.
+
+
+
+
raise_exc_in
+
+ If you want the assertion to raise an exception
+ on failure and stop the test from proceeding, pass TRUE for raise_exc_in.
+
+
+
+
+
+ Here is an example of a script that uses utAssert.eqColl (taken from filepath1.pkg
+ in the Examples directory):
+
Checking a Procedure or Function throws an exception
+
+
+ Sometimes we design a procedure or function to throw an exception under certain
+ circumstances. This is something we'd like to be able to test for. Obviously
+ this is not particularly easy due to the way exceptions propagate through
+ the call stack. If we simply call the procedure in our test code, the exception
+ will have no chance of being caught within the utAssert package! Therefore,
+ we need to pass the tested call in to the package as a string. The procedure
+ utAssert.throws allows us to do this:
+
+
+
+PROCEDURE throws (
+ msg_in VARCHAR2,
+ check_call_in IN VARCHAR2,
+ against_exc_in IN VARCHAR2|NUMBER
+ );
+
+
+ Where check_call_in is the call to be made, complete with parameters and
+ terminating semicolon. The argument against_exc_in is the exception we expect
+ to be thrown. This can be specified either as a named exception, or a SQLCODE
+ value.
+
+
The following example shows both usages:
+
+
+/* Test the Except Function */
+PROCEDURE ut_except
+IS
+BEGIN
+
+ /* Call the procedure with a negative number */
+ /* We expect a NO_DATA_FOUND exception */
+ utAssert.throws('Negative Number',
+ 'Except(-1);',
+ 'NO_DATA_FOUND'
+ );
+
+ /* Call the procedure with zero and a string */
+ /* over 2 in length - We expect a SQLCODE of -1 */
+ utAssert.throws('Zero and String',
+ 'Except(0, ''Hello'');',
+ -1
+ );
+END;
+
+
+
+ Note how we have to quote the string parameters to the call and terminate
+ the string with a semicolon.
+
+
+
Check if the Previous Assertion Passed or Failed
+
+
+ Sometimes, a procedure may have a large number of effects that need to be
+ tested. For example, it might insert and update data in a series of
+ tables. To test all of these changes, it will be necessary to make
+ a series of calls to utAssert. This can have the effect that if the
+ procedure is not behaving as expected, then the user is presented with a
+ screenful of errors. To avoid this and just present them with a single
+ error, the functions previous_passed and previous_failed can be used.
+ These return a BOOLEAN argument giving the success or failure of the previously
+ called assertion.
+
+
+
The following example gives a demonstration:
+
+
+/* Test the BookTrips Procedure */
+PROCEDURE ut_bookTrips
+IS
+BEGIN
+
+ /* Call the procedure */
+ Vacation.bookTrips(5, 'Rio de Janeiro');
+
+ /* Did it insert 5 rows into TRIPS table */
+ utAssert.eqqueryvalue('Insert 5 rows',
+ 'SELECT COUNT(*)
+ FROM TRIPS
+ WHERE CITY = ''Rio de Janeiro''',
+ 5);
+
+ /* If that worked, look in more detail */
+ IF utAssert.previous_passed THEN
+
+ /* Do they all have today's date? */
+ utAssert.eqqueryvalue('All with todays date',
+ 'SELECT COUNT(*)
+ FROM TRIPS
+ WHERE CITY = ''Rio de Janeiro'''
+ AND TRUNC(CREATED) = TRUNC(SYSDATE)',
+ 5);
+
+ /* Do they all have a hotel specified? */
+ utAssert.eqqueryvalue('Hotel Specfied',
+ 'SELECT COUNT(*)
+ FROM TRIPS T, HOTELS H
+ WHERE T.CITY = ''Rio de Janeiro'''
+ AND T.HOTEL = H.ID',
+ 5);
+
+ END IF;
+
+END;
+
+ To complement the utOutput package, these
+ assertions allow you to easily compare collections of the type
+ DBMS_OUTPUT.CHARARR. Unlike the eqcoll and
+ eqcollapi assertions, this allows the comparison of locally defined
+ collections. The procedures are declared as follows:
+
+
+
+PROCEDURE eqoutput (
+ msg_in IN VARCHAR2,
+ check_this_in IN DBMS_OUTPUT.CHARARR,
+ against_this_in IN DBMS_OUTPUT.CHARARR,
+ ignore_case_in IN BOOLEAN := FALSE,
+ ignore_whitespace_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+PROCEDURE eqoutput (
+ msg_in IN VARCHAR2,
+ check_this_in IN DBMS_OUTPUT.CHARARR,
+ against_this_in IN VARCHAR2,
+ line_delimiter_in IN CHAR := NULL,
+ ignore_case_in IN BOOLEAN := FALSE,
+ ignore_whitespace_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+
+
+ The first version simply compares two collections, whereas the second compares a collection against a delimited string. The delimiter
+ can be specified by the line_delimiter_in parameter. If NULL is passed in (which is the default) then the lines are delimited by carriage returns.
+ Thus to test a collection mybuff which should look like:
+
+ The following assertions (created by Raji) check that a named database
+ object exists or does not exist:
+
+
+
+PROCEDURE objExists (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+PROCEDURE objnotExists (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+
+
+ In both cases, the check_this_in parameter gives the name of the object to
+ check for. So passing 'MYTHING' will check if the MYTHING object exists. This
+ is assumed to be in the current schema. To check for objects in a schema other
+ than the current one, simply add the name of the schema, separated by a dot.
+ So passing 'ANOTHER.THATTHING' will check for the existence of the THATTHING
+ object in the ANOTHER schema.
+
+
+
Check Equality of RefCursor and Query
+
+
+ If you have a procedure or function that returns a REF CURSOR type you
+ often would like to compare the data of the REF CURSOR against a query (if
+ your REF CURSOR returns a complete table you can use
+ utAssert.eq_refc_table below). In this case,
+ you specify the REF CURSOR of the procedure or function and the full
+ SELECT statement as parameters. By using eq_refc_query, you may be able to
+ avoid the huge workload of constructing separate tables with preset data.
+
+
+
+ Before calling the comparison you have to specifiy the parameters of the procedure or function you are going to use.
+ This is done with the procedures utPLSQL_Util.reg_In_Param, utPLSQL_Util.reg_InOut_Param or utPLSQL_Util.reg_Out_Param.
+ The details of the parameters are built up in a variable of type utplsql_util.utplsql_params, which is then passed into eq_refc_query.
+
+
+
+PROCEDURE utPLSQL_Util.reg_In_Param (
+ par_pos PLS_INTEGER,
+ par_val VARCHAR2 | NUMBER | DATE,
+ params IN OUT utplsql_util.utplsql_params );
+
+PROCEDURE utPLSQL_Util.reg_InOut_Param (
+ par_pos PLS_INTEGER,
+ par_val VARCHAR2 | NUMBER | DATE,
+ params IN OUT utplsql_util.utplsql_params );
+
+PROCEDURE utPLSQL_Util.reg_Out_Param (
+ par_pos PLS_INTEGER,
+ par_type VARCHAR2,
+ params IN OUT utplsql_util.utplsql_params );
+
+
+
+ Having specified all the parameters for the procedure or function
+ returning the REF CURSOR, the comparison can be started.
+
+
+
+PROCEDURE utAssert.eq_refc_query (
+ p_msg_nm IN VARCHAR2,
+ proc_name IN VARCHAR2,
+ params IN utplsql_util.utplsql_params,
+ cursor_position IN PLS_INTEGER,
+ qry IN VARCHAR2 );
+
+
+
where the reg_In_Param, reg_InOut_Param and reg_Out_Param-specific parameters are as follows:
+
+
+
+
Parameter
+
Description
+
+
+
par_pos
+
Defines the parameter position beginning with 1, or 0 specifying the return value
+
+
+
par_type
+
Specifies the data type of the return value and must be one out of 'NUMBER', 'VARCHAR', 'CHAR' or 'REFCURSOR'
+
+
+
params
+
The local variable to keep the values that is used as a parameter for eq_refc_query
+
+
+
+
and the eq_refc_query-specific parameters are as follows:
+
+
+
+
Parameter
+
Description
+
+
+
p_msg_nm
+
The message to be displayed if the test fails
+
+
+
proc_name
+
Specifies the procedure or function that delivers the REF CURSOR
+
+
+
params
+
The parameter setting for the procedure or function
+
+
+
cursor_position
+
Position of the REF CURSOR parameter to be checked, beginning with 1, or 0 to specify the return value of a function
+
+
+
qry
+
The SELECT statement to be checked against
+
+
+
+
Finally, note that only the record itself is compared. These assertions do not care about how the records within the cursor are numbered.
+
+
+
Check Equality of RefCursor and Database Table
+
+
+ If you have a procedure or function that returns a REF CURSOR type that represents a complete table or view you
+ often would like to compare the data of this REF CURSOR against the table or view
+ (if your REF CURSOR doesn't return a complete table or view you can use utAssert.eq_refc_query above).
+ In this case, you specify the REF CURSOR of the procedure or function and the table or view name as parameters.
+ By using eq_refc_table, you may be able to avoid the huge workload of constructing separate tables with preset data.
+
+
+
+ Before calling the comparison you have to specifiy the parameters of the procedure or function you are going to use.
+ This is done with the procedures utPLSQL_Util.reg_In_Param, utPLSQL_Util.reg_InOut_Param or utPLSQL_Util.reg_Out_Param.
+ The details of the parameters are built up in a variable of type utplsql_util.utplsql_params, which is then passed into eq_refc_query.
+
+
+
+PROCEDURE utPLSQL_Util.reg_In_Param (
+ par_pos PLS_INTEGER,
+ par_val VARCHAR2 | NUMBER | DATE,
+ params IN OUT utplsql_util.utplsql_params );
+
+PROCEDURE utPLSQL_Util.reg_InOut_Param (
+ par_pos PLS_INTEGER,
+ par_val VARCHAR2 | NUMBER | DATE,
+ params IN OUT utplsql_util.utplsql_params );
+
+PROCEDURE utPLSQL_Util.reg_Out_Param (
+ par_pos PLS_INTEGER,
+ par_type VARCHAR2,
+ params IN OUT utplsql_util.utplsql_params );
+
+
+
Having specified all the parameters for the procedure or function returning the REF CURSOR, the comparison can be started.
+
+
+PROCEDURE utAssert.eq_refc_table (
+ p_msg_nm IN VARCHAR2,
+ proc_name IN VARCHAR2,
+ params IN utplsql_util.utplsql_params,
+ cursor_position IN PLS_INTEGER,
+ table_name IN VARCHAR2 );
+
+
+
where the reg_In_Param, reg_InOut_Param and reg_Out_Param-specific parameters are as follows:
+
+
+
+
Parameter
+
Description
+
+
+
par_pos
+
Defines the parameter position beginning with 1, or 0 specifying the return value
+
+
+
par_type
+
Specifies the data type of the return value and must be one out of 'NUMBER', 'VARCHAR', 'CHAR' or 'REFCURSOR'
+
+
+
params
+
The local variable to keep the values that is used as a parameter for eq_refc_query
+
+
+
+
and the eq_refc_query-specific parameters are as follows:
+
+
+
+
Parameter
+
Description
+
+
+
p_msg_nm
+
The message to be displayed if the test fails
+
+
+
proc_name
+
Specifies the procedure or function that delivers the REF CURSOR
+
+
+
params
+
The parameter setting for the procedure or function
+
+
+
cursor_position
+
Position of the REF CURSOR parameter to be checked, beginning with 1, or 0 to specify the return value of a function
+
+
+
table_name
+
The name of the table name or view to be checked against
+
+
+
+
Finally, note that only the record itself is compared. These assertions do not care about how the records within the cursor are numbered.
+
+
Building Your Own Assertion
+
+
+ You may want to build assertion routines that fit your specific needs.
+ If PL/SQL supported inheritance, you could extend the utAssert assertion
+ routines and then customize them through polymorphism. Lacking this feature,
+ however, you will write your own procedures that follow the same steps as
+ the pre-build assertions. In order to integrate the results of your assertion
+ test into the utResult package, you will want to mimic the utAssert.this procedure.
+ Here is its current implementation (Release 1.3.2); check the body of the
+ utAssert package for any changes.
+
+
+
+PROCEDURE this (
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE,
+ register_in IN BOOLEAN := TRUE
+ )
+IS
+BEGIN
+ IF NOT check_this_in
+ OR ( check_this_in IS NULL
+ AND NOT null_ok_in)
+ THEN
+ IF register_in
+ THEN
+ -- Registers the results in the utResult databank.
+ utresult.report (msg_in);
+ ELSE
+ utreport.pl (msg_in); -- used to be utplsql.pl (msg_in) (PBA 20050621)
+ END IF;
+
+ IF showing_results AND register_in
+ THEN
+ -- Show the results of the test more recently run.
+ utresult.showlast;
+ END IF;
+
+ IF raise_exc_in
+ THEN
+ RAISE test_failure;
+ END IF;
+ END IF;
+END;
+
+
+
+ The most important statement to include in your assertion routine is the
+ call to utResult.report, which will log the results of the test.
+
+ To make it as easy as possible for you to run your tests, utPLSQL stores
+ various pieces of configuration data in the ut_config table. This data
+ is stored by schema name and is automatically loaded into utPLSQL the first
+ time you use this utility in your session. This configuration information
+ is also automatically updated whenever you call utPLSQL.test -- or any
+ of the utPLSQL programs specifically designed to change the configuration
+ settings.
+
+
+
+ You can at any time view the utPLSQL configuration for the currently-connected
+ schema or for another schema (there is not at this point any schema-level
+ security; all utPLSQL users can view the configurations of all other users).
+
+
+
The data that is currently maintained for a utPLSQL user are:
+
+
+ Test package directory - the location of the test package code
+ you want to run. You must specify a directory in order to allow utPLSQL
+ to automatically compile your test packages before each test run.
+
+
+
+ Unit test prefix - the prefix used for test package names and
+ the program names within the package. If you do not specify a prefix, the
+ default of "ut_" is automatically applied.
+
+
+
+ Unit test registration mode - This setting determines whether
+ utPLSQL will automatically identify the unit tests to be run (strongly
+ recommended) or if you have chosen to manually register your unit tests
+ in the test package setup procedure.
+
+
+
+ Auto-compilation of test packages - By default, utPLSQL will
+ recompile your test package before execution. You can turn off this feature
+ and manually recompile only when you desire (a fine idea if your test package
+ has gotten very large!).
+
+
+
Return whose configuration is being used
+
+
+ By default, the configuration stored for the currently-connected user will
+ be used. However, it is possible to use configurations stored against
+ other usernames. To show whose configuration is currently being used
+ the following function is used:
+
+
+
+FUNCTION utConfig.tester RETURN VARCHAR2;
+
+
+
Set whose configuration is being used
+
+
+ This returns the configuration that will be used whenever a username is
+ not specified. To set this, the following procedure is used:
+
+
+
+PROCEDURE utConfig.settester (username_in IN VARCHAR2 := USER);
+
+
+
View a schema's configuration
+
+
+ Call the utconfig.showconfig procedure to view the configuration for a specified
+ schema. The header is:
+
+
+
+PROCEDURE utConfig.showconfig (username_in IN VARCHAR2 := NULL);
+
+
+
+ If you do not specify a schema, then the currently
+ used configuration is returned. Here is an example of output from this
+ procedure:
+
+
+
+SQL> exec utconfig.showconfig
+=============================================================
+utPLSQL Configuration for SCOTT
+ Directory: /apps/utplsql/code
+ Autcompile? Y
+ Manual test registration? N
+ Prefix = test_
+=============================================================
+
+
+
And here is an example of calling showConfig for a different schema:
+
+
+SQL> exec utconfig.showconfig ('COMP')
+=============================================================
+utPLSQL Configuration for COMP
+ Directory: M:\shared_apps\utplsql\comp
+ Autcompile? N
+ Manual test registration? N
+ Prefix = ut_
+=============================================================
+
+
+
+ You might want to put a call to showConfig in your SQL*Plus login file
+ so that you are reminded on startup as to what the current settings are.
+ Here is such a script (to be found in Examples\login_sample.sql):
+
+
+
+exec utconfig.setdir ('e:\openoracle\utplsql\utinstall\examples')
+SET SERVEROUTPUT ON SIZE 1000000 FORMAT WRAPPED
+exec utconfig.showconfig
+
+
+
Set the directory containing the test package code
+
+
+ If you want utPLSQL to compile your test package, you must tell it the
+ directory in which your code is found. You can do this either when you
+ define your test suite and packages within the suite, or you can call the
+ utConfig.setdir procedure to set the directory for your current session.
+
+
+
+ Note: as of v1.5.1, the value you pass in any of these programs is saved
+ in the configuration table and will be used in the future -- until you
+ change it by passing a different value.
+
+
+
The header for this procedure is:
+
+
+PROCEDURE utConfig.setdir (dir_in IN VARCHAR2, username_in IN VARCHAR2 := NULL);
+
+
+
+ where dir_in is the directory and username_in is the name of the schema
+ to which this directory applies (NULL means the currently
+ used configuration is set), as in:
+
+
+
+SQL> exec utconfig.setdir ('e:\demo\utplsql');
+
+
+
or, with the specification of a non-current schema:
Note that this directory must be accessible through UTL_FILE.
+
+
+ You might consider putting the the call to utConfig.setdir into your
+ login.sql so that it is run automatically, each time your start up SQL*Plus
+ -- if you are always working from the same directory.
+
+
+
Return the directory containing the test package code
+
+
You can obtain the current directory with a call to utConfig.dir:
+ The unit test prefix is very important in utPLSQL; the utility uses the
+ prefix to associate source code to be tested with the test package. The
+ prefix also allows utPLSQL to automatically identify the programs within
+ a test package that are to be executed as unit tests.
+
+
+
+ The default prefix in utPLSQL is "ut_", but you can override this when
+ you call utPLSQL.test or by calling the utConfig.setprefix procedure:
+
+
+
+PROCEDURE utConfig.setPrefix (
+ prefix_in IN VARCHAR2, username_in IN VARCHAR2 := NULL)
+
+
+
+ where prefix_in is the prefix and username_in is the name of the schema
+ to which this prefix applies (NULL means the currently
+ used configuration is set), as in:
+
+
+
+SQL> exec utconfig.setPrefix ('tst#');
+
+
+
or, with the specification of a non-current schema:
+ uPLSQL currently does not support the use of a suffix, or combination of
+ suffix and prefix, to identify test packages and unit test procedures.
+
+
+
Set the registration mode (manual or automatic).
+
+
+ As of utPLSQL v1.5.1, you no longer have to register your unit test procedures
+ in the setup procedure of your test package. Instead, utPLSQL will scan
+ the data dictionary (via theALL_ARGUMENTS view) for the names of all the
+ unit test procedures you have defined, and then run them. utPLSQL identifies
+ these programs by looking for all programs whose names start with the specified
+ prefix.
+
+
+
+ If you so choose, you can request that utPLSQL turn off automatic detection
+ of unit test procedures and only run those programs listed in the setup
+ procedure. To do this, you call the utConfig.registerTest procedure:
+
+
+
+PROCEDURE utConfig.registerTest (
+ onoff_in IN BOOLEAN,
+ username_in IN VARCHAR2 := NULL
+ );
+
+
+
as in:
+
+
+SQL> exec utConfig.registerTest (TRUE)
+
+
+
+ Note: if you are using automatic unit test detection, any calls to utPLSQL.addtest
+ in the setup procedure will be ignored.
+
+
+
You can return the current registration mode using the following function:
This returns TRUE if the registration mode has been set to manual and FALSE otherwise.
+
+
Set autocompile feature
+
+
+ The default settings for utPLSQL is to re-compile
+ your base package before each unit test. This guarantees that any recent
+ changes will be tested. It also saves you the step of doing an explicit
+ compile.
+
+
+
In order to perform automatic compilation:
+
+
+
+ Your schema will need to
+ have either CREATE PROCEDURE or CREATE ANY PROCEDURE privileges granted
+ directly;
+ you cannot grant these privileges through roles.
+
+
+
+ You will need to set or
+ pass the location of the source code. You can do this by calling utConfig.setdir
+ or by including the directory location in your call to utPLSQL.test
+ or utPLSQL.testsuite (the dir_in
+ parameter).
+
+
+
+ The package specification
+ must be contained in a file named <package>.pks; the body must be stored
+ in <package>.pkb.
+
+
+
+ You must have configured
+ the
+ UTL_FILE built-in package for use
+ on your database instance.
+
+
+
+
+ In general (and the default), you should allow your
+ test package to be recompiled with each execution. You might want to avoid
+ recompilation if:
+
+
+
+
+ You have made a copy of the package body with some
+ temporary changes and already compiled that. If you recompile automatically,
+ you will wipe out those changes.
+
+
+ You have not set up UTL_FILE
+ and you don't want to deal with it.
+
+
+ You are running the tests
+ on a server to which you have no access other than via a database connection.
+
+
+
+
Turning off Auto-compile
+
+
+ If you are working with products like SQL*Navigator,
+ you may be always editing from code stored in the database. In this case,
+ you will never want to have utPLSQL recompile your code for you - it will
+ already be compiled and you do not need to hassle with UTL_FILE.
+
+
+
You can avoid auto-recompilation in two ways:
+
+
+ 1. Pass a value of FALSE for the recompile_in argument
+ to utPLSQL.test or utPLSQL.testsuite. Here is an example:
+
+
+
+BEGIN
+ -- Define a test suite for PL/Vision
+ utsuite.add ('PLVision');
+
+ -- Add two packages for testing
+ utsuite.addpkg (
+ 'PLVision', 'PLVstr', dir_in => 'e:\utplsql');
+ utsuite.addpkg (
+ 'PLVision', 'PLVdate', dir_in => 'e:\utplsql');
+
+ -- Run the test suite
+ utplsql.testsuite (
+ 'PLVision', recompile_in => FALSE);
+END;
+/
+
+
+ If you know that you will never want to recompilation,
+ however, you can set the default behavior at the schema level by calling
+ the autocompile procedure
+
+
+
+ PROCEDURE utConfig.autocompile (
+ onoff_in IN BOOLEAN,
+ username_in IN VARCHAR2 := NULL
+ );
+
+
+
+ So I can make the following
+ call to turn off autocompilation for the SCOTT schema:
+
+ This program updates the ut_config table with your information and then
+ commits the setting.
+
+
+
+ You can determine the current
+ setting for auto-compilation at any time by calling the following function:
+
+
+
+ FUNCTION utConfig.autocompiling (username_in IN VARCHAR2 := NULL)
+ RETURN BOOLEAN;
+
+
+
+ Note: When you set the schema-level recompilation
+ value to FALSE, that will override anything you pass in a call to utPLSQL.test
+ or utPLSQL.testsuite.
+
+
+
V2 Delimiter
+
+
You can set the delimiter to be used in V2 procedure names using the following procedure:
+
+
+PROCEDURE setdelimiter (
+ delimiter_in IN VARCHAR2,
+ username_in IN VARCHAR2 := NULL
+);
+
+
+
while the current delimiter can be obtained by the function:
+ By default, the results of all the tests are shown. This includes both successful and unsuccessful
+ results. The following procedure allows you to limit the tests shown to only those that have failed:
+
+
+
+PROCEDURE showfailuresonly (
+ onoff_in IN BOOLEAN,
+ username_in IN VARCHAR2 := NULL
+ );
+
+
+
the current setting can be obtained by the function:
+ By default, all results are sent to the screen via DBMS_OUTPUT. However, it is possible to use other output reporters as described in more detail
+ on this page. The following procedure allows you to set which output reporter should be used by default:
+
+
+
+PROCEDURE setreporter (
+ reporter_in IN VARCHAR2
+ ,username_in IN VARCHAR2 := NULL
+ );
+
+
+
as usual, the current setting can be obtain by the following function:
+ The utGen contains a procedure that allows you to generate a starting point
+ for a unit test package. This package can be sent to the screen,
+ a file, a delimited string or
+ an array (best for interfacing with a front end).
+ You can generate a stand-alone test package or code "fragments" to be placed
+ inside an existing source package.
+
+
+
+ We strongly recommend that you use utGen.testpkg
+ as a starting point for all of your utPLSQL unit test construction. By
+ taking this approach, you will most easily (and transparently) conform
+ to the most up to date guidelines for utPLSQL test packages.
+
+
+
+ Note: While utGen.testpkg goes as far as
+ possible to generate sensible unit test code, you will need to edit this
+ code before you can compile and use it.
+
+
+
Here is the header of the testpkg procedure:
+
+
+ PROCEDURE utGen.testpkg (
+ package_in IN VARCHAR2,
+ program_in IN VARCHAR2 := '%',
+ samepackage_in IN BOOLEAN := FALSE,
+ prefix_in IN VARCHAR2 := NULL,
+ schema_in IN VARCHAR2 := NULL,
+ output_type_in IN PLS_INTEGER := c_screen,
+ dir_in IN VARCHAR2 := NULL,
+ delim_in IN VARCHAR2 := c_delim
+ );
+
+
+
And here is a description of the parameters:
+
+
+
+
Parameter Name
+
Usage
+
+
+
package_in
+
+ The name of the package or stand-alone program for
+ which a test package is to be generated.
+
+
+
+
program_in
+
+ The filter to be applied to the list of programs
+ for which unit test procedures will be generated. So if you only wanted
+ to generate unit tests for programs that start with "UPD", you would pass
+ 'UPD%' for this argument.
+
+
+
+
samepackage_in
+
+ TRUE if you plan to insert the generated code into
+ the source package, FALSE if you want a stand-alone test package.
+
+
+
+
prefix_in
+
+ The prefix to be used for the test package and/or
+ unit test procedures. See section " Organizing Your Test Code" for details.
+
+
+
+
schema_in
+
+ The schema that owns the package or program specified
+ by package_in. The default is the currently connected schema.
+
+
+
+
output_type_in
+
+ The type of output that will receive the generated
+ code. Valid options are defined as packaged constants:
+
+
utGen.c_file
+
utGen.c_screen
+
utGen.c_string
+
utGen.c_array
+
+ The following sections explain the way you would
+ work with these constants and the resulting generated code.
+
+
+
+
dir_in
+
+ The location of the file containing the generated
+ code. Used only if you specify utGen.c_file for the output type.
+
+
+
+
delim_in
+
+ The delimiter used to separate lines of generated
+ code. Used only if you specify utGen.c_string for the output type.
+
+
+
+
+
+ Before you use utGen.testpkg, you should make a few
+ decisions about your generated code:
+
+
+
+
+ Do you want the generated test code to be a stand-alone package or to be
+ inserted into an existing package? The default is stand-alone. Pass TRUE
+ for samepackage_in if you want to generate code that can be easily cut
+ and pasted into your source package. Note that utGen.testpkg does not
+ actually modify your source package.
+
+
+
+ Do you want to generate a unit test program
+ for every procedure and function in your package? If so, then go with the
+ default for program_in. If, on the other hand, your package has one hundred
+ programs and you only want to test, say, only those programs that perform
+ updates, you might want to pass a non-trivial filter, such as "UPD%".
+
+
+
+ Where do you want to send your output? You
+ can display to the screen, which can then be grabbed and put into a file
+ (or in SQL*Plus spool it directly to a file). You can send the code to
+ a file. You can deposit the code in a delimited string and then parse it
+ within your own environment. Finally -- and of most relevance if you are
+ building a GUI interface to utPLSQL -- you can generate to an internal
+ array and then retrieve individual rows of the arrays through the utGen
+ API.
+
+
+
+
Here are some examples of using utGen.testpkg:
+
+
+
+ Generate to the screen a stand-alone test package for the STR package:
+
+
+
+
+
+
+SQL> exec utGen.testpkg ('str')
+
+
+
+
+
+
+ Generate to the screen unit test code to be embedded inside the STR package:
+
+ Now let's explore how to direct the generated code
+ to different types of output.
+
+
+
Generating to Screen
+
+
+ The default behavior of utGen.testpkg is to generate
+ code to your screen (via DBMS_OUTPUT.PUT_LINE). So unless you specify some
+ other value for output_type_in, the code will be displayed on your screen
+ or within a window of your PL/SQL IDE (such as TOAD or SQL*Programmer and
+ so on). You can then transfer that content to a file, or move it to another
+ window for immediate editing and compilation.
+
+
+ Here is an example of using utGen.testpkg, while
+ also spooling to a file:
+
+
+
+SQL> set serveroutput on size 1000000
+SQL> spool str.pkg
+SQL> exec utgen.testpkg ('str')
+
+
+
...out comes the code...
+
+
+SQL> spool off
+
+
+
+ If DBMS_OUTPUT is not enabled in your session, then
+ utGen.testpkg will not generate any output.
+
+
+
Generating to File
+
+
+ If you are working with utGen in a command line
+ style (ie, you are not using a utGen-enabled GUI), then you will probably
+ find it most useful to generate testing code directly to file. You do this
+ by specifying utGen.c_file for the output type. You must also specify the
+ directory in which you want the files (one for the package specification
+ and another for the body)created.
+
+
+
+ Here's a generation request that creates two files
+ named ut_str.pks and ut_str.pkb in the /newcode directory:
+
+ You do not have to specify a directory if you have previously (in your
+ current session) called utConfig.setdir to set the default directory for
+ all file-related utPLSQL operations. The following two lines of code are,
+ in other words, equivalent to the single line shown above:
+
+ You set up the UTL_FILE package (add at least one utl_file_dir entry in
+ your database parameter initialization file) and make sure your directory
+ is accessible through UTL_FILE, before this operation can succeed.
+
+
+
+
Generating to String
+
+
+ If you are accessing utPLSQL functionality through
+ a GUI, you might find it more useful to direct output to a string (or array,
+ see next section). You probably don't want to hassle with UTL_FILE (server-based
+ file IO) and grabbing information from DBMS_OUTPUT.PUT_LINE is just a general
+ hassle.
+
+
+
+ If you generate to a string, you can then retrieve
+ that string value into a local variable and then parse it for display and
+ manipulation. Here is an example of redirection to string:
+
+ The generated code is composed of multiple lines
+ of information, so they need to be separated by a delimiter. The default
+ delimiter is the vertical bar, '|'. You can override that and provide your
+ own delimiter. In the following example, I have decided to use the carriage
+ return character as my delimiter:
+
+ Great, so the code has been put in a string. How
+ do you get all that generated code? Call the utGen.pkgstring function:
+
+
+
+FUNCTION utGen.pkgString RETURN VARCHAR2;
+
+
+
Generating to Array
+
+
+ If you are accessing utPLSQL functionality through
+ a GUI, you might find it more useful to direct output to an array. You
+ probably don't want to hassle with UTL_FILE (server-based file IO) and
+ grabbing information from DBMS_OUTPUT.PUT_LINE is just a general hassle.
+
+
+
+ If you generate to an array, you can then retrieve
+ the individual lines of code in the array through an API provided by utGen
+ (the array itself is "hidden"). Here is an example of redirection to the
+ utGen array:
+
+ Great, so the code has been put in an array. How
+ do you get all that generated code? Take advantage of the utGen
+ API to retrieve individual rows in the array, which offers these features:
+
+
+
Get the number of rows currently in the array:
+
+
+ FUNCTION utGen.countRows RETURN PLS_INTEGER;
+
+
+
Get the absolute index of the first row in the array:
+
+
+ FUNCTION utGen.firstRow RETURN PLS_INTEGER;
+
+
+
Get the absolute index of the last row in the array:
+
+
+ FUNCTION utGen.lastRow RETURN PLS_INTEGER;
+
+
+
+ The API offers a set of programs to iterate through
+ the array, by maintaining a "current row" inside the package. You can:
+
+
+
+ Find out if you are positioned at the first row
+ in the set:
+
+
+
+ FUNCTION utGen.atFirstRow RETURN BOOLEAN;
+
+
+
+ Find out if you are positioned at the last row in
+ the set:
+
+
+
+ FUNCTION utGen.atLastRow RETURN BOOLEAN;
+
+
+
+ Find the first relative row containing the start
+ of the package body definition. This is handy when you want to put the
+ code for the specification and body in separate windows and/or files:
+
+
+
+ FUNCTION utGen.firstBodyRow RETURN PLS_INTEGER;
+
+
+
+ Retrieve the text in the Nth row of the array. This
+ gives you "random access" to the contents of the array. You can even specify
+ a negative direction to get the Nth row from the end of the array.
+
+
+
+ FUNCTION utGen.nthRow (nth IN PLS_INTEGER, direction utGen.IN SIGNTYPE := 1) RETURN codeline_t;
+
+
+
+ Set the pointer in the array to the specified row
+ number. This allows you then move either forward or backward from that
+ row in the array (using nextRow and prevRow, respectively):
+
+
+
+ PROCEDURE utGen.setRow (nth IN PLS_INTEGER);
+
+
+
+ Retrieve the line of code stored in the current
+ row in the array (set via setRow, nextRow or prevRow):
+
+
+
+ FUNCTION utGen.getRow RETURN codeline_t;
+
+
+
Go to the next row in the array:
+
+
+ PROCEDURE utGen.nextRow;
+
+
+
Go to the previous row in the array:
+
+
+ PROCEDURE utGen.prevRow;
+
+
+
Show the contents of the array using DBMS_OUTPUT.PUT_LINE:
+
+
+ PROCEDURE utGen.showRows (
+ startRow IN PLS_INTEGER := NULL,
+ endRow IN PLS_INTEGER := NULL);
+
+
+
+ Here is the code I would write in PL/SQL using this
+ API to display the contents of the array (actually, it is the implementation
+ of showRows):
+
+
+
+ PROCEDURE showrows (
+ startrow IN PLS_INTEGER := NULL,
+ endrow IN PLS_INTEGER := NULL
+ )
+ IS
+ v_start PLS_INTEGER
+ := NVL (startrow, 1);
+ v_end PLS_INTEGER
+ := NVL (endrow, utGen.countRows);
+ BEGIN
+ FOR indx IN 1 .. utGen.countRows
+ LOOP
+ DBMS_OUTPUT.put_line (utGen.getRow (indx));
+ END LOOP;
+ END;
+
+
+
+ Here is the code I would write to separate out the
+ contents of the specification from the body:
+
+
+
+ PROCEDURE showrows (
+ startrow IN PLS_INTEGER := NULL,
+ endrow IN PLS_INTEGER := NULL
+ )
+ IS
+ v_start PLS_INTEGER
+ := NVL (startrow, 1);
+ v_end PLS_INTEGER
+ := NVL (endrow, utGen.countRows);
+ BEGIN
+ FOR indx IN 1 .. utGen.countRows
+ LOOP
+ IF indx = utGen.firstBodyRow
+ THEN
+ -- switch to Body window or file
+ END IF;
+ write_to_target (utGen.getRow (indx));
+ END LOOP;
+ END;
+
+
+
+
Generating Test Packages with Test Cases
+
+
+ The procedures to generate test packages with test cases are similar to
+ testpkg above, but with a number of extra parameters:
+
+
+
+ PROCEDURE testpkg (
+ package_in IN VARCHAR2,
+ grid_in IN grid_tt,
+ program_in IN VARCHAR2 := '%',
+ samepackage_in IN BOOLEAN := FALSE,
+ prefix_in IN VARCHAR2 := NULL,
+ schema_in IN VARCHAR2 := NULL,
+ output_type_in IN PLS_INTEGER := c_screen,
+ dir_in IN VARCHAR2 := NULL,
+ delim_in IN VARCHAR2 := c_delim,
+ date_format_in IN VARCHAR2 := 'MM/DD/YYYY',
+ only_if_in_grid_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE testpkg_from_file (
+ package_in IN VARCHAR2,
+ gridfile_loc_in IN VARCHAR2,
+ gridfile_in IN VARCHAR2,
+ program_in IN VARCHAR2 := '%',
+ samepackage_in IN BOOLEAN := FALSE,
+ prefix_in IN VARCHAR2 := NULL,
+ schema_in IN VARCHAR2 := NULL,
+ output_type_in IN PLS_INTEGER := c_screen,
+ dir_in IN VARCHAR2 := NULL,
+ field_delim_in IN VARCHAR2 := '|',
+ arg_delim_in IN VARCHAR2 := c_delim,
+ date_format_in IN VARCHAR2 := 'MM/DD/YYYY',
+ only_if_in_grid_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE testpkg_from_string (
+ package_in IN VARCHAR2,
+ grid_in IN VARCHAR2,
+ program_in IN VARCHAR2 := '%',
+ samepackage_in IN BOOLEAN := FALSE,
+ prefix_in IN VARCHAR2 := NULL,
+ schema_in IN VARCHAR2 := NULL,
+ output_type_in IN PLS_INTEGER := c_screen,
+ dir_in IN VARCHAR2 := NULL,
+ line_delim_in IN VARCHAR := CHR (10),
+ field_delim_in IN VARCHAR2 := '|',
+ arg_delim_in IN VARCHAR2 := c_delim,
+ date_format_in IN VARCHAR2 := 'MM/DD/YYYY',
+ only_if_in_grid_in IN BOOLEAN := FALSE
+ );
+
+
+
+ In each case, the idea is the same. We have to provide not only the
+ arguments supplied to the basic version of testpkg, but also details of each of
+ the test cases in a grid. In the first case, this is as a PL/SQL table, in the
+ second this is as a file and in the final case, this is as a string.
+
+
+
The PL/SQL table passed to testpkg is defined as follows:
+
+
+TYPE grid_rt IS RECORD (
+ progname VARCHAR2 (100),
+ overload PLS_INTEGER,
+ tcname VARCHAR2 (100),
+ message VARCHAR2 (2000),
+ arglist VARCHAR2 (2000),
+ return_value VARCHAR2 (2000),
+ assertion_type VARCHAR2 (100));
+
+ TYPE grid_tt IS TABLE OF grid_rt
+ INDEX BY BINARY_INTEGER;
+
+
+
Where the definitions of the fields are as follows:
+
+
+
progname - This is the name of the subprogram to be tested.
+
+ overload - This is the version of the subprogram where
+ overladed versions exist. (You may have to look in the data dictionary to
+ work this out).
+
+
tcname - The name of the test case.
+
message - The message to be used in the assertion code.
+
arglist - The list of arguments to be passed to the subprogram.
+
return_value - The return value to be checked against.
+
+ assertion_type - The type of assertion to be used.
+ Currently this is ignored unless it contains 'EQ' or 'ISNULL'
+
+
+
+
+ In testpkg_from_file and testpkg_from_string, exactly the same fields need
+ to be passed (and in the same order). These fields are separated by the
+ character given by the field_delim_in parameter which defaults to '|', the pipe
+ symbol. In the case of testpkg_from_string, we can also specify the line
+ delimiter in the line_delim_in parameter, which defaults to an ASCII linefeed
+ character.
+
+
+
+ In all cases, the arguments specified in the arglist field are separated
+ by yet another delimiter, which is passed in the arg_delim_in parameter (
+ or just delim_in in the case of testpkg). This defaults to a semicolon.
+
+
+
+ The remaining arguments passed to these routines are date_format_in and
+ only_if_in_grid_in. The former gives the date format used in dates passed
+ through the arglist and return_values fields. The latter specifies if
+ tests should only be generated for subprograms listed in the grid or not.
+
+
+
An Example
+
+
All of this is probably best explained with an example. Suppose I have a package defined as:
+
+
+CREATE OR REPLACE PACKAGE lottery AS
+ FUNCTION Draw (seed_in NUMBER := NULL, when_in DATE := NULL) RETURN VARCHAR2;
+END;
+
+
+
+ This returns a string describing a lottery draw, given a seed and a date. I
+ want to test the following conditions: (It doesn't make much sense, but hey,
+ it's only an example)
+
+
+
+
Passing both parameters as NULL, we should get back '01 02 03 04 05 06'.
+
Passing in 7 for the seed and 1 January 2001 for the date, we should get back '23 24 27 37 39 48'.
+
Passing in 0 for the seed and today's date, we should get back NULL
+
+
+
So to generate the skeleton I require I could run the following through SQL*Plus:
+set serveroutput on size 1000000
+begin
+ utgen.testpkg_from_string (
+ package_in => 'LOTTERY',
+ grid_in =>
+'Draw||Test Case 1|The First Test||01 02 03 04 05 06|EQ
+Draw||Test Case 2|The Second Test|7;2001-01-01|23 24 27 37 39 48|EQ
+Draw||Test Case 3|The Third Test|0;!SYSDATE||ISNULL',
+ date_format_in => 'YYYY-MM-DD'
+ );
+end;
+/
+
+
+
which generate the following for the body of ut_draw (tidied up a little for compactness):
+
+
+PROCEDURE ut_DRAW
+IS
+ -- Verify and complete data types.
+ against_this VARCHAR2(2000);
+ check_this VARCHAR2(2000);
+BEGIN
+
+ -- Define "control" operation for "Test Case 1"
+ against_this := '01 02 03 04 05 06';
+
+ -- Execute test code for "Test Case 1"
+ check_this :=
+ LOTTERY.DRAW (SEED_IN => '', WHEN_IN => '');
+
+ -- Assert success for "Test Case 1"
+ -- Compare the two values.
+ utAssert.eq ( 'The First Test', check_this, against_this);
+
+ -- End of test for "Test Case 1"
+
+ -- Define "control" operation for "Test Case 2"
+ against_this := '23 24 27 37 39 48';
+
+ -- Execute test code for "Test Case 2"
+ check_this := LOTTERY.DRAW (SEED_IN => 7, WHEN_IN => TO_DATE ('2001-01-01', 'YYYY-MM-DD'));
+
+ -- Assert success for "Test Case 2"
+ -- Compare the two values.
+ utAssert.eq ( 'The Second Test', check_this, against_this);
+
+ -- End of test for "Test Case 2"
+
+ -- Define "control" operation for "Test Case 3"
+ against_this := NULL;
+
+ -- Execute test code for "Test Case 3"
+ check_this :=
+ LOTTERY.DRAW (SEED_IN => 0, WHEN_IN => SYSDATE);
+
+ -- Assert success for "Test Case 3"
+ -- Check for NULL return value.
+ utAssert.isNULL ( 'The Third Test', check_this);
+
+ -- End of test for "Test Case 3"
+
+END ut_DRAW;
+
+
+
+ Note that the different data types are handled automatically. So '2001-01-01' is converted to
+ a date using TO_DATE and the specified date format. However, we wanted to enter SYSDATE for our
+ argument in one of these cases. How do we stop this being converted into a date? The answer
+ is that we need to prefix the value with a '!' (an exclamation mark). This causes utGen to
+ pass this along 'as is' without attempting any conversion. Note that this cannot currently
+ be overridden, so if your data starts with an exclamation mark, you'll have to work around
+ this problem.
+
+ The problem with attempting to test output in PL/SQL is that there is a single
+ DBMS_OUTPUT buffer. When your test is run, there may already be output in the
+ buffer from other tests, or from the tested code. So what state should you
+ leave it in once you have finished? Perhaps you want all the output created by
+ your tested code to end up in the buffer as if it had been run normally (i.e.
+ not from within utPLSQL), or maybe you want only the text that was in the
+ buffer before you started to be left.
+
+
+
+ This package attempts to allow to do any of these. There is a flag in the
+ package to determine whether text pulled from the output buffer should be
+ saved. This is set with 'save' and 'nosave' and returned by
+ 'saving'. Data is pulled from the buffer using 'extract',
+ while the procedure 'replace' puts any saved data back into the output
+ buffer.
+
+
+
The intent is that it is used like this:
+
+
+PROCEDURE ut_my_test IS
+BEGIN
+
+ --Pull out any text already in the output buffer
+ utoutput.save;
+ utoutput.extract;
+
+ --Your testing code here, with saving turned on or off as you see fit
+
+ --Put text back in the output buffer
+ utoutput.replace;
+
+END;
+
+
+
+ So to start with, we save any text already in the buffer. We then carry out
+ our testing. If we want the output generated by the testing to end up back in
+ the output buffer, we turn on saving. Finally, we put the saved text back.
+
+
+
Warning
+
+
+ In the current version of utPLSQL (2.0.9.1) use of this package is virtually impossible with
+ utPLSQL tracing turned on. The reason for this is that this facility writes output using
+ DBMS_OUTPUT every time an assertion is called.
+
+ The raise_exc_in flag determines if the function should throw the
+ exception utOutput.EMPTY_OUTPUT_BUFFER when asked for the next line from
+ an empty buffer. If no exception is thrown, NULL is returned. As with
+ extract, the save_in flag simply overrides the global save flag setting.
+
+ With utPLSQL, you can run all the unit tests contained in a
+ single test package, or run the tests for a series of test packages defined in
+ a test suite.
+
+
+
+ The utPLSQL package offers two procedures, test and testsuite, to make it
+ easy for you to run "red light, green light" tests. Before you can
+ use these programs, however, you must build
+ your own test package.
+
+
+
To run a test for a single package, use the utPLSQL.test procedure:
+
+
+PROCEDURE utPLSQL.test (
+ package_in IN VARCHAR2,
+ samepackage_in IN BOOLEAN := FALSE,
+ prefix_in IN VARCHAR2 := NULL,
+ recompile_in IN BOOLEAN := TRUE,
+ dir_in IN VARCHAR2 := NULL,
+ suite_in in VARCHAR2 := NULL,
+ owner_in IN VARCHAR2 := NULL,
+ reset_results_in IN BOOLEAN := TRUE ,
+ from_suite_in IN BOOLEAN := FALSE,
+ subprogram_in IN VARCHAR2 := '%',
+ per_method_setup_in IN BOOLEAN := FALSE
+);
+
+
+
where the parameters are defined as follows:
+
+
+
+
+ package_in
+
+
+ The name of the package or stand-alone program to be tested.
+
+
+
+
+ samepackage_in
+
+
+ Pass TRUE if your unit test programs are defined in the same
+ package as the source code to be tested. The default is that you have created
+ a separate package.
+
+
+
+
+ prefix_in
+
+
+ The prefix to be appended to package_in to come up with
+ the name of the test package. If you do not provide a value, the last prefix
+ you specified (or the default) will be used.
+
+
+
+
+ recompile_in
+
+
+ Pass FALSE if you do not want utPLSQL to automatically recompile your test package
+ before running the test.
+
+
+
+
+ dir_in
+
+
+ The directory containing the test package source code. If
+ you do not provide a value in your call to utPLSQL.test (the default) and if
+ you have not turned off automatic recompilation, utPLSQL will look for the
+ test package source code in the directory specified by a call to utConfig.setdir. If you do not provide a
+ value, the last directory you specified (if any) will be used.
+
+
+
+
+ suite_in
+
+
+ The name of the suite that contains the specified test
+ package. This is an optional value and is used to update statistics
+ for the test.
+
+
+
+
+ owner_in
+
+
+ The name of the schema that was specified when the test
+ suite was defined and the packaged added to the suite. This is an
+ optional value and is used to update statistics for
+ the test.
+
+
+
+
+ reset_results_in
+
+
+ Pass FALSE to tell utPLSQL to not reset the results
+ information, in which case you will still be able to view results by calling utResult.show . Otherwise, utPLSQL clears the result
+ data after each test.
+
+
+
+
+ from_suite_in
+
+
+ Pass TRUE to tell utPLSQL that this test is being run from
+ within a test suite (for internal use only).
+
+
+
+
+ subprogram_in
+
+
+ Pass a string to restrict which of the test procedures
+ will be executed for this run. Default of % means all tests will be run.
+
+
+
+
+ per_method_setup_in
+
+
+ Pass TRUE to run the setup and teardown procedure before
+ and after each unit test procedure is executed. Default of FALSE means that
+ these programs will be run once, at the start and end of the package test
+ execution as a whole.
+
+
+
+
+
+ override_package_in
+
+
+ Override the automatic determination of package names thus removing the
+ one to one relationship between test package and package to test.
+ Default is NULL. Instead of using this parameter consider the procedure run.
+
+
+
+
+
+
Here are some examples of using the utPLSQL.test procedure:
+
+
+ 1. Run the unit test for the betwnstr function (by executing the ut_betwnstr
+ test package, since the default prefix is used). Do not recompile the test
+ package.
+
+ 2. Run all of the unit tests for the te_employee package,
+ stored in a test package called "test_te_employee" in the /tmp
+ directory. Recompile the test package before execution.
+
+ Since utPLSQL follows the red light-green light approach on
+ reporting results, each time you run utPLSQL.test, it will display the results.
+ If successful, you will see output like this:
+
+
+
+SUCCESS: "betwnstr"
+
+
+
If the test fails at some point, you will see output like this:
+
+
+FAILURE: "betwnstr"
+BETWNSTR: IS NULL: NULL start
+BETWNSTR: End larger than string length; expected "cdeg", got "cdefg"
+
+
+
+
Running a Test the other way
+
+
+ The normal usage of the test procedure as described above assumes that for
+ each package you want to test, say mypackage, has a package for
+ testing this package having the same name but with an additional prefix:
+ ut_mypackage. Instead of using this approach, you can use the procedure
+ run. This procedure runs a test package directly without any further
+ conditions on the name or other packages. The only condition that still applies
+ is the naming conventions necessary to make it a valid test package.
+
+
+
+PROCEDURE run (
+ testpackage_in IN VARCHAR2,
+ prefix_in IN VARCHAR2 := NULL,
+ suite_in IN VARCHAR2 := NULL,
+ owner_in IN VARCHAR2 := NULL,
+ reset_results_in IN BOOLEAN := TRUE,
+ from_suite_in IN BOOLEAN := FALSE,
+ subprogram_in IN VARCHAR2 := '%',
+ per_method_setup_id IN BOOLEAN := FALSE);
+
+
+
where the parameters are defined as follows:
+
+
+
+
+ test_package_in
+
+
+ The name of the test package to run.
+
+
+
+
+ prefix_in
+
+
+ The prefix to be appended to package_in to come up with
+ the name of the test package. If you do not provide a value, NULL is used as
+ a default. i.e. the package name is used as provided in the first parameter
+
+
+
+
+ suite_in
+
+
+ The name of the suite that contains the specified test
+ package. This is an optional value and is used to update statistics
+ for the test.
+
+
+
+
+ owner_in
+
+
+ The name of the schema that was specified when the test
+ suite was defined and the packaged added to the suite. This is an
+ optional value and is used to update statistics for
+ the test.
+
+
+
+
+ reset_results_in
+
+
+ Pass FALSE to tell utPLSQL to not reset the results
+ information, in which case you will still be able to view results by calling utResult.show . Otherwise, utPLSQL clears the result
+ data after each test.
+
+
+
+
+ from_suite_in
+
+
+ Pass TRUE to tell utPLSQL that this test is being run from
+ within a test suite (for internal use only).
+
+
+
+
+ subprogram_in
+
+
+ Pass a string to restrict which of the test procedures
+ will be executed for this run. Default of '%' means all tests will be run.
+
+
+
+
+ per_method_setup_in
+
+
+ Pass TRUE to run the setup and teardown procedure before
+ and after each unit test procedure is executed. Default of FALSE means that
+ these programs will be run once, at the start and end of the package test
+ execution as a whole.
+
+
+
+
+
+
+
Running a Test Suite
+
+
+ In addition to running a test for a single test package, you
+ can set up a test suite that consists of one or more test packages. You can
+ then run an entire suite of tests with a call to utPLSQL.testsuite:
+
+
+
+PROCEDURE utPLSQL.testsuite (
+ suite_in IN VARCHAR2,
+ recompile_in IN BOOLEAN := TRUE,
+ reset_results_in IN BOOLEAN := TRUE
+ per_method_setup_in in BOOLEAN := FALSE
+ );
+
+
+
+ where suite_in is the name of the suite and recompiled_in
+ determines the auto compilation behavior.
+
+
+
+ Here is an example of the call I would make to run all my tests for the
+ PL/Vision library:
+
+
+
+SQL> exec utplsql.testsuite ('plvision');
+
+
+
+ The parameter list for utPLSQL.testSuite is much shorter
+ than utPLSQL.test; rather than pass information like directory, owner name and
+ same-package through a parameter list, you define these characteristics in the
+ suite itself (stored in a series of utPLSQL tables).
+
+ Similiar to the run procedure for single packages, there is the
+ runsuite procedure to run testsuites. When you use this procedure
+ there is no relationship assumed between the names of test packages specified in the
+ test suite and the procedures to be tested.
+
+
+
+PROCEDURE utPLSQL.runsuite (
+ suite_in IN VARCHAR2,
+ reset_results_in IN BOOLEAN := TRUE
+ per_method_setup_in in BOOLEAN := FALSE
+ );
+
+
+
+ The usage of the parameters is just as in testsuite.
+
+
+
+
Recording and Accessing Test Statistics
+
+
+ If you have defined test suites, and packages within those
+ test suites, utPLSQL will update those definitions with the follow statistics
+ after each test is run:
+
+
+
+
Status of last run: success or failure?
+
Start and end times of last run
+
Total number of failures
+
Total number of executions of the test
+
+
+
+ All of this is done for you automatically. You can then write queries and reports against the
+ ut_package and ut_suite tables.
+
+
+
+
Return utPLSQL version
+
+
+ Run the utPLSQL.version function to return the version of
+ utPLSQL you have installed:
+
+
+
+FUNCTION utPLSQL.version RETURN VARCHAR2
+
+
+
utPLSQL Trace
+
+
These routines are very simple and take no arguments:
+ The procedures trc and notrc are used to turn tracing on and off
+ respectively. The function tracing returns TRUE if tracing is currently turned
+ on and FALSE otherwise. This facility is useful when writing code in utPLSQL
+ (the framework itself, not your test code). An example of the output generated
+ is:
+
+
+
+Initialized utPLSQL session...
+Setpkg to Lottery
+Package and program = ut_Lottery
+Same package? N
+Is package? Y
+Prefix = ut_
+Recompiling ut_Lottery in
+Runprog of ut_SETUP
+Package and program = ut_Lottery.ut_SETUP
+Same package? N
+Is package? Y
+Prefix = ut_
+Addtest
+Package and program = Lottery.UT_DRAW
+Same package? N
+Override? Y
+Prefix = ut_
+Runprog of UT_DRAW
+Package and program = ut_Lottery.UT_DRAW
+Same package? N
+Is package? Y
+Prefix = ut_
+.
+> FFFFFFF AA III L U U RRRRR EEEEEEE
+> F A A I L U U R R E
+> F A A I L U U R R E
+> F A A I L U U R R E
+> FFFF A A I L U U RRRRRR EEEE
+> F AAAAAAAA I L U U R R E
+> F A A I L U U R R E
+> F A A I L U U R R E
+> F A A III LLLLLLL UUU R R EEEEEEE
+.
+FAILURE: "Lottery"
+.
+> Individual Test Case Results:
+>
+FAILURE - EQ "Test of DRAW" Expected "01 02 05 27 43 49" and got "02 04 27 28 31 33"
+>
+>
+> Errors recorded in utPLSQL Error Log:
+>
+> NONE FOUND
+Runprog of ut_TEARDOWN
+Package and program = ut_Lottery.ut_TEARDOWN
+Same package? N
+Is package? Y
+Prefix = ut_
+
+PL/SQL procedure successfully completed.
+
+
+
Register a Unit Test
+
+
+ As of version 1.4.1, you
+ no longer have to explicitly register a unit test! The default
+ behavior of utPLSQL is now to extract from the data dictionary (via the
+ ALL_ARGUMENTS data dictionary view) the names of all the unit test procedures
+ you have defined, and then run them. utPLSQL identifies these programs by
+ looking for all programs whose names start with the specified prefix.
+
+
+
+ If you decide that you want to explicitly register your unit
+ tests, then you will need to turn on manual registration:
+
+
+
+SQL> exec utConfig.registertest (TRUE)
+
+
+
+ This setting is immediately saved in the database for your
+ schema. To turn off manual registration:
+
+
+
+SQL> exec utConfig.registertest (FALSE)
+
+
+
+ So read no further unless you have turned on manual
+ registration! You might do this, for example, if you have already built a
+ number of test packages in a version of utPLSQL prior to 1.4.1 and do not want
+ to make any changes to your test package code.
+
+
+
+ All aspects of manual registration of unit tests for a
+ program or package actually occur within the Unit Test Package itself, in the setup procedure. No persistent unit test information
+ is stored between runs of the unit test, unless you define that unit test
+ within a test suite.
+
+
+
Use the utPLSQL.addtest procedure to register a unit test.
+
+
+ PROCEDURE utPLSQL.addtest (
+ NAME_IN IN VARCHAR2,
+ utprefix_in IN VARCHAR2,
+ iterations_in IN PLS_INTEGER := 1
+ );
+
+ PROCEDURE utPLSQL.addtest (
+ package_in IN VARCHAR2,
+ NAME_IN IN VARCHAR2,
+ utprefix_in IN VARCHAR2,
+ iterations_in IN PLS_INTEGER := 1
+ );
+
+
+
where
+
+
+ name_in is the name of the program you are
+ testing. Note that this is the name of the unit test procedure itself,
+ including the unit test prefix..
+
+
+
+ utprefix_in is the prefix to be applied to
+ name_in to construct the unit tst procedure. This is currently NOT IN USE; only
+ the package prefix specified in your call to utPLSQL.test and utPLSQL.testsuite
+ is used.
+
+
+
+ iterations_in is the number of times you wish to
+ run the test (currently NOT IN USE).
+
+
+
+ package_in is the name of the package containing
+ the unit test procedure. If you provide a package name when you call
+ utPLSQL.addtest, you will override the package name set when you called
+ utPLSQL.test -- but only for that one test. We recommend that you not change
+ the package name.
+
+
+
+ Here is a setup procedure that sets up a series of tests for
+ a query-only encapsulation of the employee table:
+
+ This package (created by Dan Spencer) allows the creation of functions to
+ allow the comparison of record types based on tables or views (%ROWTYPE
+ records in other words). They are generated by the add procedure:
+
+
+
+PROCEDURE add(
+ pkg_name_in IN ut_package.name%TYPE,
+ record_in IN ut_receq.name%TYPE,
+ rec_owner_in IN ut_receq.created_by%TYPE := USER
+);
+
+
+
+ The pkg_name_in parameter contains the name of a tested package you wish to
+ associate with this record type. Note that this package name should already
+ exist in the ut_package table. The record_in parameter contains the name of
+ the view or table whose record type is to be compared. The final (optional)
+ parameter contains the name of the schema in which the table or view exists.
+ It defaults to the current user.
+
+
+
+ The generated function will be named EQ_{Record_Schema_}Record_Name. The
+ schema is only inserted when the record type is not within the current one. The
+ function will return TRUE if the two records are identical on a field-by-field
+ comparison and FALSE otherwise. Note that NULL fields are considered
+ equal.
+
+
+
+ The details of the EQ_* functions and their association with tested packages held in two tables:
+
+
+
+
+ UT_RECEQ - This table holds a list of the EQ_* functions including the
+ target table/view and the schema in which it is found.
+
+
+ UT_RECEQ_PKG - This table cross-references the tested packages against the functions listed in UT_RECEQ.
+
+
+
+
Compile a package's record comparison functions
+
+
This routine recompiles all the EQ_* functions associated with a given package:
+
+
+PROCEDURE compile(pkg_name_in IN ut_package.name%TYPE);
+
+
+
+ when autocompiling is turned on, this is called by
+ utplsql.test or utplsql.testsuite before the test packages themselves are recompiled.
+
+
+
Remove record comparison functions
+
+
To remove record comparison functions, use the following:
+
+
+PROCEDURE rem(
+ name_in IN ut_receq.name%TYPE,
+ rec_owner_in IN ut_receq.created_by%TYPE := USER
+ for_package_in IN BOOLEAN := FALSE
+);
+
+
+
+ If for_package_in is FALSE, then name_in is taken to refer to a record type to
+ remove, with rec_owner_in specifying the schema the record type is in. All package associations for this record type are removed and the EQ_* function is dropped.
+
+
+
+ On the other hand, if for_package_in is TRUE, then name_in is taken to refer
+ to a package. In this case, all the package's associations are removed. If no
+ other package is associated with a given record, then the EQ_* function is
+ dropped. (Note that the rec_owner_in parameter is ignored here).
+
+ The utResult package offers an API to the information
+ sent by the various utAssert assertion routines after a test is run. If
+ you employ the utPLSQL.test and utPLSQL.testsuite to run your tests, then
+ the results will be displayed by calling the utResult.show procedure.
+
+
+ So, generally, you do not have to do anything to see or evaluate the results of
+ a test (or suite of tests). The information will be displayed on your screen
+ using DBMS_OUTPUT, or elsewhere if you use a custom output reporter. You might,
+ however, want to access this information in another environment (say, Oracle
+ Forms or Java, etc.). You might also want to build your own assertion logic or
+ test engine. In either of these cases, you will want to use the programs in the
+ utResult package.
+
+
+
Initialize
+
+
Initialize the utResult data, setting it all back to NULL:
+
+
+PROCEDURE utResult.init;
+
+
+
Show Results
+
+
Show the results of your test with one of the following three procedures.
+
+
+PROCEDURE utResult.show (reset_in IN BOOLEAN := FALSE);
+PROCEDURE utResult.showone (indx_in in pls_integer);
+PROCEDURE utResult.showlast;
+
+
+
+ Use the show procedure to display the full set of results stored
+ in the utResult array. If you pass TRUE for its single argument, the results
+ informatino will be initialized.
+
+
+
Use the showone procedure to show the Nth result.
+
+
Use the showlast procedure to show the results of the last test run.
+
+
Retrieve Test Status
+
+
+ The success and failure functions return the status of the most recently
+ executed test.
+
+ The utPLSQL.show procedure iterates through the contents of the utResult
+ array and displays the information found there. You can write the same
+ kind of logic by calling a combination of the following programs:
+
+
+
+PROCEDURE utResult.firstresult;
+
+FUNCTION utResult.nextresult RETURN utResult.result_rt;
+
+PROCEDURE utResult.nextresult (
+ name_out OUT VARCHAR2,
+ msg_out OUT VARCHAR2,
+ case_indx_out OUT PLS_INTEGER
+);
+
+FUNCTION utResult.nthresult (indx_in IN PLS_INTEGER)
+ RETURN utResult.result_rt;
+
+PROCEDURE utResult.nthresult (
+ indx_in IN PLS_INTEGER,
+ name_out OUT VARCHAR2,
+ msg_out OUT VARCHAR2,
+ case_indx_out OUT PLS_INTEGER
+);
+
+FUNCTION utResult.resultcount RETURN PLS_INTEGER;
+
+
+
Control the Display of Success Messages
+
+
+ The following procedures turn on or off the display of success messages. In other words,
+ when turned on (as is the default) a message will be displayed for each successful assertion.
+ The specifications are as follows:
+
+
+
+
+
diff --git a/documentation/src/writedoc.html b/documentation/src/writedoc.html
new file mode 100644
index 000000000..376fc10b6
--- /dev/null
+++ b/documentation/src/writedoc.html
@@ -0,0 +1,149 @@
+
+
+
+
+ How to add to the utPLSQL documentation set
+
+
+
+
Writing Documentation
+
+
+ The utPLSQL documentation is built from a series of simple HTML files in the
+ src directory. These files have none of the navigation bars, logos or
+ next/previous links which appear in the final documentation. They are also
+ stripped of font, color and style information at compile-time to let the
+ stylesheet (utplsql.css) determine the overall look-and-feel.
+
+
+
+ Like the code, the documentation is held within GIT.
+ Changes should be made to the documentation/src directory.
+ Details on how to change and submit the changes back to the
+ project can be found in the CONTRIBUTING.md
+
+
+
The HTML Files
+
+
+ As described above, the base files in the src directory are used to generate the final
+ product. To add new documentation to one of these files, or to correct errors,
+ simply edit it. It makes sense to follow the layout that is already present in the
+ file, adding links at the top of the page where appropriate. The HTML should be
+ kept simple, so use the relevant header styles (<H1>...<H6>) to label your sections
+ and subsections, use <pre> to mark sections of code etc. Let the stylesheet
+ do the work of setting the colors and fonts.
+
+
+
+ If you are adding an entirely new file to the documentation, use the file
+ template.html as a basis. This contains the relevant comment
+ lines which tell the scripts which parts of the file to use
+ (see the note below). Finally, you will need to
+ edit map.txt to ensure that the file is linked from the other pages in
+ the documentation. This is described in the next section.
+
+
+
The Control Files
+
+
+ The files are compiled into a documentation set situated in the top-level
+ documentation directory using the 3 control files: map.txt, authors.txt and copyright_years.txt.
+ The first of these is the driving file, giving a list of the files to be
+ included. The second gives a list of authors to be included in the copyright
+ notice on each page and referenced in the Meta tags (this is for
+ historical reasons and lists the original contributors of the
+ documentation - to keep it in line with the policy for source-code, all
+ future contributions will go under the name of "the utPLSQL Project"). The
+ third file lists the years for the copyright statement - i.e. years when
+ significant changes were published.
+
+
+
The format of map.txt is as follows:
+
+
+ # Any line starting with a # is
+ # considered a comment
+ #
+ index.html,Home*
+ started.html,Getting Started*
+ another.html,Further Docs
+ another2.html,Yet more docs
+
+
+
+ Each line consists of the filename to be included and the title of the page,
+ separated with a comma. Any file whose title is followed by an asterisk is
+ considered the start of a new section. This means a link to the file will
+ appear in the navigation bar at the top of each page and it will appear in
+ bold in the document map. Note that the document map itself does not appear
+ in map.txt, but is always added at the end and is considered a new section.
+ This page is entirely generated at compile-time.
+
+
+
+ To add a new page to the documentation, simply add it to this file in the
+ correct position. Note that generally you will not be adding a new section!
+
+
+
The format of authors.txt is as follows:
+
+
+ # Again, lines starting # are ignored
+ #
+ Steven Feuerstein,steven@stevenfeuerstein.com
+ Chris Rimmer,c@24.org.uk
+ A N Other,ano@ther.net
+
+
+
+ Each line in this file simply gives the name of the author and their email
+ address, separated with a comma. So if you've made a contribution and your name
+ is not listed, add it!
+
+ Each line will be separated by a comma in the copyright statement, so the
+ above will generate: "2000-2005, 2014"
+
+
+
The Scripts
+
+
+ The Perl script used to build the documentation is build_docs.pl.
+
+
+
+ The script goes through each file listed in map.txt, cleans it up
+ and then adds logos, navigation bars, next/previous links,
+ copyright information etc. The resulting files are put in the top-level
+ documentation directory.
+
+
+
+ The "cleaning" strips the source HTML files down to the basics, removing
+ everything from the header and removing Javascript, fonts, color, etc. It
+ requires the HTML::TagFilter module which in turn also requires the
+ HTML::Parser and HTML::Tagset modules (all available from search.cpan.org).
+
+
+
+ NOTE: Anything within a source file before the
+ <!-- Begin utPLSQL Body --> comment line and after the
+ <!-- End utPLSQL Body --> comment line is ignored.
+
+
+
Copyright 2002, 2014 Chris Rimmer and the utPLSQL Project. All rights reserved
';
-
- ut_utils.append_to_list(l_result, l_file_part);
- return l_result;
- end;
-
-end;
-/
diff --git a/source/reporters/ut_coverage_report_html_helper.pks b/source/reporters/ut_coverage_report_html_helper.pks
deleted file mode 100644
index a6dd7eb30..000000000
--- a/source/reporters/ut_coverage_report_html_helper.pks
+++ /dev/null
@@ -1,44 +0,0 @@
-create or replace noneditionable package ut_coverage_report_html_helper authid current_user is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- function get_default_html_assets_path return varchar2 deterministic;
-
- function coverage_pct(a_covered_lines integer, a_uncovered_lines integer) return number;
-
- function coverage_css_class(a_covered_pct number) return varchar2;
-
- function line_status(a_executions in ut_coverage.t_line_executions) return varchar2;
-
- function link_to_source_file(a_object_full_name varchar2) return varchar2;
-
- function object_id(a_object_full_name varchar2) return varchar2;
-
- function executions_per_line(a_executions number, a_lines integer) return integer;
-
- function line_hits_css_class(a_line_hist number) return varchar2;
-
- function get_index(
- a_coverage_data ut_coverage.t_coverage,
- a_assets_path varchar2,
- a_project_name varchar2 := null,
- a_command_line varchar2 := null,
- a_charset varchar2 := null,
- a_support_info boolean := true
- ) return ut_varchar2_rows;
-
-end;
-/
diff --git a/source/reporters/ut_coverage_sonar_reporter.tpb b/source/reporters/ut_coverage_sonar_reporter.tpb
deleted file mode 100644
index 8eb4c57aa..000000000
--- a/source/reporters/ut_coverage_sonar_reporter.tpb
+++ /dev/null
@@ -1,112 +0,0 @@
-create or replace noneditionable type body ut_coverage_sonar_reporter is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_coverage_sonar_reporter(
- self in out nocopy ut_coverage_sonar_reporter
- ) return self as result is
- begin
- self.init($$plsql_unit,ut_output_bulk_buffer());
- return;
- end;
-
-
- overriding member procedure after_calling_run(self in out nocopy ut_coverage_sonar_reporter, a_run in ut_run) as
-
- function get_lines_xml(a_unit_coverage ut_coverage.t_unit_coverage) return ut_varchar2_rows is
- l_file_part varchar2(32767);
- l_result ut_varchar2_rows := ut_varchar2_rows();
- l_line_no binary_integer;
- begin
- l_line_no := a_unit_coverage.lines.first;
- if l_line_no is null then
- for i in 1 .. a_unit_coverage.total_lines loop
- ut_utils.append_to_list(l_result, '');
- end loop;
- else
- while l_line_no is not null loop
- if a_unit_coverage.lines(l_line_no).executions = 0 then
- l_file_part := '';
- else
- l_file_part := '';
- end if;
- ut_utils.append_to_list(l_result, l_file_part);
- l_line_no := a_unit_coverage.lines.next(l_line_no);
- end loop;
- end if;
- return l_result;
- end;
-
- function get_coverage_xml(
- a_coverage_data ut_coverage.t_coverage,
- a_run ut_run
- ) return ut_varchar2_rows is
- l_result ut_varchar2_rows := ut_varchar2_rows();
- l_unit ut_coverage.t_object_name;
- c_coverage_header constant varchar2(30) := '';
- c_file_footer constant varchar2(30) := '';
- c_coverage_footer constant varchar2(30) := '';
- begin
-
- ut_utils.append_to_list(l_result, ut_utils.get_xml_header(a_run.client_character_set));
- ut_utils.append_to_list(l_result, c_coverage_header);
- l_unit := a_coverage_data.objects.first;
- while l_unit is not null loop
- ut_utils.append_to_list(l_result, '');
-
- ut_utils.append_to_list(l_result,get_lines_xml(a_coverage_data.objects(l_unit)));
-
- ut_utils.append_to_list(l_result, c_file_footer);
-
- l_unit := a_coverage_data.objects.next(l_unit);
- end loop;
- ut_utils.append_to_list(l_result, c_coverage_footer);
- return l_result;
- end;
-
- begin
--- execute immediate 'alter session set statistics_level=all';
--- dbms_hprof.start_profiling(
--- location => 'PLSHPROF_DIR'
--- , filename => 'profiler_utPLSQL_run_on_'||$$plsql_unit||'_'||rawtohex(self.id)||'.txt'
--- );
---
- ut_coverage.coverage_stop();
-
- self.print_text_lines(
- get_coverage_xml(
- ut_coverage.get_coverage_data(a_run.coverage_options),
- a_run
- )
- );
--- dbms_hprof.stop_profiling;
- end;
-
- overriding member function get_description return varchar2 as
- begin
- return 'Generates an XML coverage report providing information on code coverage with line numbers.
-Designed for [SonarQube](https://www.sonarsource.com/products/sonarqube/) to report coverage.
-XML format returned conforms with the [Sonar specification](https://docs.sonarsource.com/sonarqube-server/analyzing-source-code/test-coverage/generic-test-data).';
- end;
-
-end;
-/
diff --git a/source/reporters/ut_coverage_sonar_reporter.tps b/source/reporters/ut_coverage_sonar_reporter.tps
deleted file mode 100644
index 0268fee64..000000000
--- a/source/reporters/ut_coverage_sonar_reporter.tps
+++ /dev/null
@@ -1,31 +0,0 @@
-create or replace noneditionable type ut_coverage_sonar_reporter under ut_coverage_reporter_base(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /**
- * Builds a coverage XML report that follows rules described in
- * https://docs.sonarqube.org/latest/analysis/generic-test/
- */
- constructor function ut_coverage_sonar_reporter(
- self in out nocopy ut_coverage_sonar_reporter
- ) return self as result,
-
- overriding member procedure after_calling_run(self in out nocopy ut_coverage_sonar_reporter, a_run in ut_run),
-
- overriding member function get_description return varchar2
-)
-/
diff --git a/source/reporters/ut_debug_reporter.tpb b/source/reporters/ut_debug_reporter.tpb
deleted file mode 100644
index a2b797021..000000000
--- a/source/reporters/ut_debug_reporter.tpb
+++ /dev/null
@@ -1,79 +0,0 @@
-create or replace noneditionable type body ut_debug_reporter is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_debug_reporter(self in out nocopy ut_debug_reporter) return self as result is
- begin
- self.init($$plsql_unit,ut_output_clob_table_buffer());
- self.start_time := current_timestamp();
- self.event_time := current_timestamp();
- return;
- end;
-
- overriding member function get_supported_events return ut_varchar2_list is
- begin
- return ut_varchar2_list(ut_event_manager.gc_all);
- end;
-
- overriding member procedure on_event( self in out nocopy ut_debug_reporter, a_event_name varchar2, a_event_item ut_event_item) is
- c_time constant timestamp := current_timestamp();
- c_time_from_start constant interval day(0) to second(6) := (c_time - self.start_time);
- c_time_from_prev constant interval day(0) to second(6) := (c_time - self.event_time);
- l_stack varchar2(32767) := dbms_utility.format_call_stack();
- begin
- l_stack := regexp_replace(
- substr( l_stack, instr( l_stack, chr(10), 1, 6 ) +1 ),
- '[0-9abcdefx]+ +([0-9]+) +(package |type )?(body )?(.*)','at "\4", line \1');
-
- if a_event_name = ut_event_manager.gc_initialize then
- self.on_initialize(null);
- self.print_text('', ut_event_manager.gc_debug);
- end if;
- self.print_text('', ut_event_manager.gc_debug);
- self.print_text(
- ' ' || ut_utils.to_string(c_time) || '' || chr(10)
- || ' ' || c_time_from_start || '' || chr(10)
- || ' ' || c_time_from_prev || '' || chr(10)
- || ' ' || a_event_name || '',
- ut_event_manager.gc_debug
- );
- self.print_text( ' ' || l_stack || '', ut_event_manager.gc_debug);
- if a_event_item is not null then
- self.print_text_lines(
- ut_utils.convert_collection(
- ut_utils.clob_to_table( event_item_to_clob(a_event_item), ut_utils.gc_max_storage_varchar2_len )
- ),
- ut_event_manager.gc_debug
- );
- end if;
- self.print_text('', ut_event_manager.gc_debug);
- if a_event_name = ut_event_manager.gc_finalize then
- self.print_text('', ut_event_manager.gc_debug);
- self.on_finalize(null);
- end if;
- self.event_time := current_timestamp();
- end;
-
- member function event_item_to_clob(a_event_item ut_event_item) return clob is
- l_clob clob;
- begin
- select /*+ no_parallel */ xmlserialize( content deletexml(xmltype(a_event_item),'/*/ITEMS|/*/ALL_EXPECTATIONS|/*/FAILED_EXPECTATIONS') as clob indent size = 2 ) into l_clob from dual;
- return l_clob;
- end;
-
-end;
-/
\ No newline at end of file
diff --git a/source/reporters/ut_debug_reporter.tps b/source/reporters/ut_debug_reporter.tps
deleted file mode 100644
index 26e42cbc4..000000000
--- a/source/reporters/ut_debug_reporter.tps
+++ /dev/null
@@ -1,34 +0,0 @@
-create or replace noneditionable type ut_debug_reporter under ut_output_reporter_base(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- start_time timestamp,
- event_time timestamp,
- constructor function ut_debug_reporter(self in out nocopy ut_debug_reporter) return self as result,
- /**
- * Returns the list of events that are supported by particular implementation of the reporter
- */
- overriding member function get_supported_events return ut_varchar2_list,
-
- /**
- * Delegates execution of event into individual reporting procedures
- */
- overriding member procedure on_event( self in out nocopy ut_debug_reporter, a_event_name varchar2, a_event_item ut_event_item),
-
- member function event_item_to_clob(a_event_item ut_event_item) return clob
-
-)
-/
\ No newline at end of file
diff --git a/source/reporters/ut_documentation_reporter.tpb b/source/reporters/ut_documentation_reporter.tpb
deleted file mode 100644
index ad3d1fb69..000000000
--- a/source/reporters/ut_documentation_reporter.tpb
+++ /dev/null
@@ -1,232 +0,0 @@
-create or replace noneditionable type body ut_documentation_reporter is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_documentation_reporter(self in out nocopy ut_documentation_reporter) return self as result is
- begin
- self.init($$plsql_unit);
- self.lvl := 0;
- self.failed_test_running_count := 0;
- return;
- end;
-
- member function tab(self in ut_documentation_reporter) return varchar2 is
- begin
- return rpad(' ', self.lvl * 2);
- end tab;
-
- overriding member procedure print_clob(self in out nocopy ut_documentation_reporter, a_clob clob, a_item_type varchar2 := null) is
- l_lines ut_varchar2_list;
- l_out_lines ut_varchar2_rows := ut_varchar2_rows();
- begin
- if a_clob is not null and dbms_lob.getlength(a_clob) > 0 then
- l_lines := ut_utils.clob_to_table(a_clob, ut_utils.gc_max_storage_varchar2_len - length(nvl(tab(),0)));
- for i in 1 .. l_lines.count loop
- if l_lines(i) is not null then
- ut_utils.append_to_list(l_out_lines, tab() || l_lines(i) );
- end if;
- end loop;
- (self as ut_output_reporter_base).print_text_lines(l_out_lines, a_item_type);
- end if;
- end;
-
- overriding member procedure print_text(self in out nocopy ut_documentation_reporter, a_text varchar2, a_item_type varchar2 := null) is
- l_lines ut_varchar2_list;
- begin
- if a_text is not null then
- l_lines := ut_utils.string_to_table(a_text);
- for i in 1 .. l_lines.count loop
- (self as ut_output_reporter_base).print_text(tab || l_lines(i), a_item_type);
- end loop;
- end if;
- end;
-
- overriding member procedure before_calling_suite(self in out nocopy ut_documentation_reporter, a_suite ut_logical_suite) as
- begin
- self.print_text(coalesce(a_suite.description, a_suite.name));
- lvl := lvl + 1;
- end;
-
- overriding member procedure after_calling_test(self in out nocopy ut_documentation_reporter, a_test ut_test) as
- l_message varchar2(4000);
-
- begin
- l_message := coalesce(a_test.description, a_test.name)||' ['||round(a_test.execution_time,3)||' sec]';
- --if test failed, then add it to the failures list, print failure with number
- if a_test.result = ut_utils.gc_disabled then
- self.print_yellow_text(l_message || ' (DISABLED'||
- case when a_test.disabled_reason is not null
- then ' - '||a_test.disabled_reason
- else null
- end || ')');
- elsif a_test.result = ut_utils.gc_success then
- self.print_green_text(l_message);
- elsif a_test.result > ut_utils.gc_success then
- failed_test_running_count := failed_test_running_count + 1;
- self.print_red_text(l_message || ' (FAILED - ' || failed_test_running_count || ')');
- end if;
-
- -- reproduce the output from before/after procedures and the test
- self.print_clob(a_test.get_serveroutputs);
- end;
-
- overriding member procedure after_calling_before_all(self in out nocopy ut_documentation_reporter, a_executable in ut_executable) is
- begin
- if a_executable.serveroutput is not null and a_executable.serveroutput != empty_clob() then
- self.print_clob(a_executable.serveroutput);
- end if;
- end;
-
- overriding member procedure after_calling_after_all(self in out nocopy ut_documentation_reporter, a_executable in ut_executable) is
- begin
- if a_executable.serveroutput is not null and a_executable.serveroutput != empty_clob() then
- self.print_clob(a_executable.serveroutput);
- end if;
- end;
-
- overriding member procedure after_calling_suite(self in out nocopy ut_documentation_reporter, a_suite ut_logical_suite) as
- begin
- lvl := lvl - 1;
- if lvl = 0 then
- self.print_text(' ');
- end if;
- end;
-
- overriding member procedure after_calling_run(self in out nocopy ut_documentation_reporter, a_run in ut_run) as
- l_summary_text varchar2(4000);
- l_warning_index pls_integer := 0;
- -- make all warning indexes uniformly indented
- c_warnings_lpad constant integer := length(to_char(a_run.results_count.warnings_count));
-
- procedure print_failure_for_expectation(a_expectation ut_expectation_result) is
- l_lines ut_varchar2_list;
- begin
- l_lines := a_expectation.get_result_lines();
- for i in 1 .. l_lines.count loop
- self.print_red_text(l_lines(i));
- end loop;
- self.print_cyan_text(a_expectation.caller_info);
- self.print_text(' ');
- end;
-
- procedure print_failures_for_test(a_test ut_test, a_failure_no in out nocopy integer) is
- begin
- if a_test.result > ut_utils.gc_success then
- a_failure_no := a_failure_no + 1;
- self.print_text(lpad(a_failure_no, length(failed_test_running_count) + 2, ' ') || ') ' ||
- nvl(a_test.name, a_test.item.form_name));
- self.lvl := self.lvl + 3;
-
- self.print_red_text(ut_utils.table_to_clob(a_test.get_error_stack_traces()));
-
- for j in 1 .. a_test.failed_expectations.count loop
- print_failure_for_expectation(a_test.failed_expectations(j));
- end loop;
-
- self.lvl := self.lvl - 3;
- end if;
- end;
-
- procedure print_failures_from_suite(a_suite ut_logical_suite, a_failure_no in out nocopy integer) is
- begin
- for i in 1 .. a_suite.items.count loop
- if a_suite.items(i) is of(ut_logical_suite) then
- print_failures_from_suite(treat(a_suite.items(i) as ut_logical_suite), a_failure_no);
- elsif a_suite.items(i) is of(ut_test) then
- print_failures_for_test(treat(a_suite.items(i) as ut_test), a_failure_no);
- end if;
- end loop;
- end;
-
- procedure print_failures_details(a_run in ut_run) is
- l_failure_no integer := 0;
- begin
- if a_run.results_count.failure_count > 0 or a_run.results_count.errored_count > 0 then
-
- self.print_text('Failures:');
- self.print_text(' ');
- for i in 1 .. a_run.items.count loop
- print_failures_from_suite(treat(a_run.items(i) as ut_logical_suite), l_failure_no);
- end loop;
- end if;
- end;
-
- procedure print_item_warnings(a_item in ut_suite_item) is
- l_items ut_suite_items;
- begin
- if a_item is of (ut_logical_suite) then
- l_items := treat(a_item as ut_logical_suite).items;
- for i in 1 .. l_items.count loop
- print_item_warnings(l_items(i));
- end loop;
- end if;
-
- if a_item.warnings is not null and a_item.warnings.count > 0 then
- for i in 1 .. a_item.warnings.count loop
- l_warning_index := l_warning_index + 1;
- self.print_text(' ' || lpad(l_warning_index, c_warnings_lpad) || ') ' || a_item.path);
- self.lvl := self.lvl + 3;
- self.print_red_text(a_item.warnings(i));
- self.lvl := self.lvl - 3;
- end loop;
- self.print_text(' ');
- end if;
- end;
-
- procedure print_warnings(a_run in ut_run) is
- begin
- if a_run.results_count.warnings_count > 0 then
- self.print_text(' ');
- self.print_text('Warnings:');
- self.print_text(' ');
- for i in 1 .. a_run.items.count loop
- print_item_warnings(treat(a_run.items(i) as ut_suite_item));
- end loop;
- end if;
- end;
-
- begin
- print_failures_details(a_run);
- print_warnings(a_run);
- self.print_text('Finished in ' || ut_utils.interval_to_text(numtodsinterval(a_run.execution_time,'second')) );
-
- l_summary_text :=
- a_run.results_count.total_count || ' tests, '
- || a_run.results_count.failure_count || ' failed, ' || a_run.results_count.errored_count || ' errored, '
- || a_run.results_count.disabled_count ||' disabled, ' || a_run.results_count.warnings_count || ' warning(s)';
- if a_run.results_count.failure_count + a_run.results_count.errored_count + a_run.results_count.warnings_count > 0 then
- self.print_red_text(l_summary_text);
- else
- self.print_green_text(l_summary_text);
- end if;
- if a_run.random_test_order_seed is not null then
- self.print_text('Tests were executed with random order seed '''||a_run.random_test_order_seed||'''.');
- end if;
- if a_run.get_support_info_flag() then
- self.print_cyan_text(ut_utils.gc_support_text || ': ' || ut_utils.gc_support_url);
- end if;
- self.print_text(' ');
- (self as ut_reporter_base).after_calling_run(a_run);
- end;
-
- overriding member function get_description return varchar2 as
- begin
- return 'Creates a textual, pretty-print, human-readable report mirroring the suite hierarchy. Used for console runs, interactive development and log review.';
- end;
-
-end;
-/
diff --git a/source/reporters/ut_documentation_reporter.tps b/source/reporters/ut_documentation_reporter.tps
deleted file mode 100644
index 52a7911ce..000000000
--- a/source/reporters/ut_documentation_reporter.tps
+++ /dev/null
@@ -1,36 +0,0 @@
-create or replace noneditionable type ut_documentation_reporter under ut_console_reporter_base(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- lvl integer,
- failed_test_running_count integer,
- constructor function ut_documentation_reporter(self in out nocopy ut_documentation_reporter) return self as result,
- member function tab(self in ut_documentation_reporter) return varchar2,
-
- overriding member procedure print_clob(self in out nocopy ut_documentation_reporter, a_clob clob, a_item_type varchar2 := null),
- overriding member procedure print_text(self in out nocopy ut_documentation_reporter, a_text varchar2, a_item_type varchar2 := null),
- overriding member procedure before_calling_suite(self in out nocopy ut_documentation_reporter, a_suite ut_logical_suite),
- overriding member procedure after_calling_test(self in out nocopy ut_documentation_reporter, a_test ut_test),
- overriding member procedure after_calling_after_all (self in out nocopy ut_documentation_reporter, a_executable in ut_executable),
- overriding member procedure after_calling_before_all (self in out nocopy ut_documentation_reporter, a_executable in ut_executable),
- overriding member procedure after_calling_suite(self in out nocopy ut_documentation_reporter, a_suite ut_logical_suite),
- overriding member procedure after_calling_run(self in out nocopy ut_documentation_reporter, a_run in ut_run),
-
- overriding member function get_description return varchar2
-
-)
-not final
-/
diff --git a/source/reporters/ut_junit_reporter.tpb b/source/reporters/ut_junit_reporter.tpb
deleted file mode 100644
index e7741926d..000000000
--- a/source/reporters/ut_junit_reporter.tpb
+++ /dev/null
@@ -1,163 +0,0 @@
-create or replace noneditionable type body ut_junit_reporter is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_junit_reporter(self in out nocopy ut_junit_reporter) return self as result is
- begin
- self.init($$plsql_unit,ut_output_bulk_buffer());
- return;
- end;
-
- overriding member procedure after_calling_run(self in out nocopy ut_junit_reporter, a_run in ut_run) is
- l_suite_id integer := 0;
- l_tests_count integer := a_run.results_count.disabled_count + a_run.results_count.success_count +
- a_run.results_count.failure_count + a_run.results_count.errored_count;
-
- function get_path(a_path_with_name varchar2, a_name varchar2) return varchar2 is
- begin
- return regexp_substr(a_path_with_name, '(.*)\.' ||a_name||'$',subexpression=>1);
- end;
-
- procedure print_test_elements(a_test ut_test) is
- l_results ut_varchar2_rows := ut_varchar2_rows();
- l_output clob;
- begin
- ut_utils.append_to_list(
- l_results,
- ''
- );
- if a_test.result = ut_utils.gc_disabled then
- if a_test.disabled_reason is not null then
- ut_utils.append_to_list( l_results, '' );
- ut_utils.append_to_list( l_results, ut_utils.to_cdata( a_test.disabled_reason ) );
- ut_utils.append_to_list( l_results, '' );
- else
- ut_utils.append_to_list( l_results, '' );
- end if;
- end if;
- if a_test.result = ut_utils.gc_error then
- ut_utils.append_to_list( l_results, '');
- ut_utils.append_to_list( l_results, ut_utils.to_cdata( ut_utils.convert_collection( a_test.get_error_stack_traces() ) ) );
- ut_utils.append_to_list( l_results, '');
- elsif a_test.result > ut_utils.gc_success then
- ut_utils.append_to_list( l_results, '');
- ut_utils.append_to_list( l_results, ut_utils.to_cdata( a_test.get_failed_expectation_lines() ) );
- ut_utils.append_to_list( l_results, '');
- end if;
-
- l_output := a_test.get_serveroutputs();
- if l_output is not null then
- ut_utils.append_to_list( l_results, '');
- ut_utils.append_to_list( l_results, ut_utils.to_cdata( a_test.get_serveroutputs() ) );
- ut_utils.append_to_list( l_results, '' );
- else
- ut_utils.append_to_list( l_results, '');
- end if;
- ut_utils.append_to_list( l_results, '');
- ut_utils.append_to_list( l_results, '');
-
- self.print_text_lines(l_results);
- end;
-
- procedure print_suite_elements(a_suite ut_logical_suite, a_suite_id in out nocopy integer) is
- l_count integer := a_suite.results_count.disabled_count + a_suite.results_count.success_count +
- a_suite.results_count.failure_count + a_suite.results_count.errored_count;
- l_suite ut_suite;
- l_tests ut_suite_items := ut_suite_items();
- l_results ut_varchar2_rows := ut_varchar2_rows();
- l_data clob;
- l_errors ut_varchar2_list;
- begin
- a_suite_id := a_suite_id + 1;
- self.print_text('');
-
- -- Becasue testsuites have to appear before test we capture test and leave it for later.
- for i in 1 .. a_suite.items.count loop
- if a_suite.items(i) is of(ut_test) then
- l_tests.extend;
- l_tests(l_tests.last) := treat(a_suite.items(i) as ut_test);
- elsif a_suite.items(i) is of(ut_logical_suite) then
- print_suite_elements(treat(a_suite.items(i) as ut_logical_suite), a_suite_id);
- end if;
- end loop;
-
- -- Now when all testsuite are printed do the testcases.
- for i in 1 .. l_tests.count loop
- print_test_elements(treat(l_tests(i) as ut_test));
- end loop;
-
- if a_suite is of(ut_suite) then
- l_suite := treat(a_suite as ut_suite);
-
- l_data := l_suite.get_serveroutputs();
- if l_data is not null then
- ut_utils.append_to_list( l_results, '');
- ut_utils.append_to_list( l_results, ut_utils.to_cdata( l_data ) );
- ut_utils.append_to_list( l_results, '');
- else
- ut_utils.append_to_list( l_results, '');
- end if;
-
- l_errors := l_suite.get_error_stack_traces();
- if l_errors is not empty then
- ut_utils.append_to_list( l_results, '');
- ut_utils.append_to_list( l_results, ut_utils.to_cdata( ut_utils.convert_collection( l_errors ) ) );
- ut_utils.append_to_list( l_results, '');
- else
- ut_utils.append_to_list( l_results, '');
- end if;
- end if;
- ut_utils.append_to_list( l_results, '');
-
- self.print_text_lines(l_results);
- end;
-
- begin
- l_suite_id := 0;
- self.print_text(ut_utils.get_xml_header(a_run.client_character_set));
- self.print_text('');
- for i in 1 .. a_run.items.count loop
- print_suite_elements(treat(a_run.items(i) as ut_logical_suite), l_suite_id);
- end loop;
- self.print_text('');
- end;
-
- member function get_common_item_attributes(a_item ut_suite_item) return varchar2 is
- begin
- return '" name="' || dbms_xmlgen.convert(nvl(a_item.description, a_item.name))
- || '" time="' || ut_utils.to_xml_number_format(a_item.execution_time()) || '" ';
- end;
-
- member function get_common_suite_attributes(a_item ut_suite_item) return varchar2 is
- begin
- return ' disabled="' || a_item.results_count.disabled_count
- || '" errors="' || a_item.results_count.errored_count
- || '" failures="' || a_item.results_count.failure_count
- || get_common_item_attributes(a_item);
- end;
-
- overriding member function get_description return varchar2 as
- begin
- return 'Provides outcomes in a format conforming with JUnit 4 and above as defined in: https://gist.github.com/kuzuha/232902acab1344d6b578';
- end;
-
-end;
-/
diff --git a/source/reporters/ut_junit_reporter.tps b/source/reporters/ut_junit_reporter.tps
deleted file mode 100644
index 88292acbb..000000000
--- a/source/reporters/ut_junit_reporter.tps
+++ /dev/null
@@ -1,32 +0,0 @@
-create or replace noneditionable type ut_junit_reporter force under ut_output_reporter_base(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- /**
- * The XUnit reporter.
- * Provides outcomes in a format conforming with JUnit4 as defined in:
- * https://gist.github.com/kuzuha/232902acab1344d6b578
- */
- constructor function ut_junit_reporter(self in out nocopy ut_junit_reporter) return self as result,
-
- overriding member procedure after_calling_run(self in out nocopy ut_junit_reporter, a_run in ut_run),
- member function get_common_suite_attributes(a_item ut_suite_item) return varchar2,
- member function get_common_item_attributes(a_item ut_suite_item) return varchar2,
-
- overriding member function get_description return varchar2
-)
-not final
-/
diff --git a/source/reporters/ut_realtime_reporter.tpb b/source/reporters/ut_realtime_reporter.tpb
deleted file mode 100644
index b0ec5d2e2..000000000
--- a/source/reporters/ut_realtime_reporter.tpb
+++ /dev/null
@@ -1,288 +0,0 @@
-create or replace noneditionable type body ut_realtime_reporter is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_realtime_reporter(
- self in out nocopy ut_realtime_reporter
- ) return self as result is
- begin
- self.init($$plsql_unit,ut_output_clob_table_buffer());
- total_number_of_tests := 0;
- current_test_number := 0;
- current_indent := 0;
- print_buffer := ut_varchar2_rows();
- return;
- end;
-
- overriding member procedure before_calling_run(
- self in out nocopy ut_realtime_reporter,
- a_run in ut_run
- ) is
- procedure print_test_elements(
- a_test in ut_test
- ) is
- begin
- total_number_of_tests := total_number_of_tests + 1;
- self.print_start_node('test', 'id', a_test.path);
- self.print_node('executableType', a_test.item.executable_type);
- self.print_node('ownerName', a_test.item.owner_name);
- self.print_node('objectName', a_test.item.object_name);
- self.print_node('procedureName', a_test.item.procedure_name);
- self.print_node('disabled', case when a_test.get_disabled_flag() then 'true' else 'false' end);
- self.print_node('disabledReason', a_test.disabled_reason);
- self.print_node('name', a_test.name);
- self.print_node('description', a_test.description);
- self.print_node('testNumber', to_char(total_number_of_tests));
- self.print_end_node('test');
- end print_test_elements;
-
- procedure print_suite_elements(
- a_suite in ut_logical_suite
- ) is
- begin
- self.print_start_node('suite', 'id', a_suite.path);
- self.print_node('name', a_suite.name);
- self.print_node('description', a_suite.description);
- <>
- self.print_start_node('items');
- for i in 1 .. a_suite.items.count loop
- if a_suite.items(i) is of(ut_test) then
- print_test_elements(treat(a_suite.items(i) as ut_test));
- elsif a_suite.items(i) is of(ut_logical_suite) then
- print_suite_elements(treat(a_suite.items(i) as ut_logical_suite));
- end if;
- end loop suite_elements;
- self.print_end_node('items');
- self.print_end_node('suite');
- end print_suite_elements;
- begin
- xml_header := ut_utils.get_xml_header(a_run.client_character_set);
- self.print_xml_fragment(xml_header);
- self.print_start_node('event', 'type', 'pre-run');
- self.print_start_node('items');
- <>
- for i in 1 .. a_run.items.count loop
- print_suite_elements(treat(a_run.items(i) as ut_logical_suite));
- end loop items;
- self.print_end_node('items');
- self.print_node('totalNumberOfTests', to_char(total_number_of_tests));
- self.print_end_node('event');
- self.flush_print_buffer('pre-run');
- end before_calling_run;
-
- overriding member procedure after_calling_run(
- self in out nocopy ut_realtime_reporter,
- a_run in ut_run
- ) is
- begin
- self.print_xml_fragment(xml_header);
- self.print_start_node('event', 'type', 'post-run');
- self.print_start_node('run');
- self.print_node('startTime', to_char(a_run.start_time, 'YYYY-MM-DD"T"HH24:MI:SS.FF6'));
- self.print_node('endTime', to_char(a_run.end_time, 'YYYY-MM-DD"T"HH24:MI:SS.FF6'));
- self.print_node('executionTime', ut_utils.to_xml_number_format(a_run.execution_time()));
- self.print_start_node('counter');
- self.print_node('disabled', to_char(a_run.results_count.disabled_count));
- self.print_node('success', to_char(a_run.results_count.success_count));
- self.print_node('failure', to_char(a_run.results_count.failure_count));
- self.print_node('error', to_char(a_run.results_count.errored_count));
- self.print_node('warning', to_char(a_run.results_count.warnings_count));
- self.print_end_node('counter');
- self.print_cdata_node('errorStack', ut_utils.table_to_clob(a_run.get_error_stack_traces(), chr(10)||chr(10)));
- self.print_cdata_node('serverOutput', a_run.get_serveroutputs());
- self.print_end_node('run');
- self.print_end_node('event');
- self.flush_print_buffer('post-run');
- end after_calling_run;
-
- overriding member procedure before_calling_suite(
- self in out nocopy ut_realtime_reporter,
- a_suite in ut_logical_suite
- ) is
- begin
- self.print_xml_fragment(xml_header);
- self.print_start_node('event', 'type', 'pre-suite');
- self.print_start_node('suite', 'id', a_suite.path);
- self.print_end_node('suite');
- self.print_end_node('event');
- self.flush_print_buffer('pre-suite');
- end before_calling_suite;
-
- overriding member procedure after_calling_suite(
- self in out nocopy ut_realtime_reporter,
- a_suite in ut_logical_suite
- ) is
- begin
- self.print_xml_fragment(xml_header);
- self.print_start_node('event', 'type', 'post-suite');
- self.print_start_node('suite', 'id', a_suite.path);
- self.print_node('startTime', to_char(a_suite.start_time, 'YYYY-MM-DD"T"HH24:MI:SS.FF6'));
- self.print_node('endTime', to_char(a_suite.end_time, 'YYYY-MM-DD"T"HH24:MI:SS.FF6'));
- self.print_node('executionTime', ut_utils.to_xml_number_format(a_suite.execution_time()));
- self.print_start_node('counter');
- self.print_node('disabled', to_char(a_suite.results_count.disabled_count));
- self.print_node('success', to_char(a_suite.results_count.success_count));
- self.print_node('failure', to_char(a_suite.results_count.failure_count));
- self.print_node('error', to_char(a_suite.results_count.errored_count));
- self.print_node('warning', to_char(a_suite.results_count.warnings_count));
- self.print_end_node('counter');
- self.print_cdata_node('errorStack', ut_utils.table_to_clob(a_suite.get_error_stack_traces(), chr(10)||chr(10)));
- self.print_cdata_node('serverOutput', a_suite.get_serveroutputs());
- self.print_cdata_node('warnings', ut_utils.table_to_clob(a_suite.warnings, chr(10)||chr(10)));
- self.print_end_node('suite');
- self.print_end_node('event');
- self.flush_print_buffer('post-suite');
- end after_calling_suite;
-
- overriding member procedure before_calling_test(
- self in out nocopy ut_realtime_reporter,
- a_test in ut_test
- ) is
- begin
- current_test_number := current_test_number + 1;
- self.print_xml_fragment(xml_header);
- self.print_start_node('event', 'type', 'pre-test');
- self.print_start_node('test', 'id', a_test.path);
- self.print_node('testNumber', to_char(current_test_number));
- self.print_node('totalNumberOfTests', to_char(total_number_of_tests));
- self.print_end_node('test');
- self.print_end_node('event');
- self.flush_print_buffer('pre-test');
- end before_calling_test;
-
- overriding member procedure after_calling_test(
- self in out nocopy ut_realtime_reporter,
- a_test in ut_test
- ) is
- begin
- self.print_xml_fragment(xml_header);
- self.print_start_node('event', 'type', 'post-test');
- self.print_start_node('test', 'id', a_test.path);
- self.print_node('testNumber', to_char(current_test_number));
- self.print_node('totalNumberOfTests', to_char(total_number_of_tests));
- self.print_node('startTime', to_char(a_test.start_time, 'YYYY-MM-DD"T"HH24:MI:SS.FF6'));
- self.print_node('endTime', to_char(a_test.end_time, 'YYYY-MM-DD"T"HH24:MI:SS.FF6'));
- self.print_node('executionTime', ut_utils.to_xml_number_format(a_test.execution_time()));
- self.print_start_node('counter');
- self.print_node('disabled', to_char(a_test.results_count.disabled_count));
- self.print_node('success', to_char(a_test.results_count.success_count));
- self.print_node('failure', to_char(a_test.results_count.failure_count));
- self.print_node('error', to_char(a_test.results_count.errored_count));
- self.print_node('warning', to_char(a_test.results_count.warnings_count));
- self.print_end_node('counter');
- self.print_cdata_node('errorStack', ut_utils.table_to_clob(a_test.get_error_stack_traces(), chr(10)||chr(10)));
- self.print_cdata_node('serverOutput', a_test.get_serveroutputs());
- if a_test.failed_expectations.count > 0 then
- self.print_start_node('failedExpectations');
- <>
- for i in 1 .. a_test.failed_expectations.count loop
- self.print_start_node('expectation');
- self.print_node('description', a_test.failed_expectations(i).description);
- self.print_cdata_node('message', a_test.failed_expectations(i).message);
- self.print_cdata_node('caller', a_test.failed_expectations(i).caller_info);
- self.print_end_node('expectation');
- end loop expectations;
- self.print_end_node('failedExpectations');
- end if;
- self.print_cdata_node('warnings', ut_utils.table_to_clob(a_test.warnings, chr(10)||chr(10)));
- self.print_end_node('test');
- self.print_end_node('event');
- self.flush_print_buffer('post-test');
- end after_calling_test;
-
- member procedure print_start_node(
- self in out nocopy ut_realtime_reporter,
- a_node_name in varchar2,
- a_attr_name in varchar2 default null,
- a_attr_value in varchar2 default null
- ) is
- begin
- self.print_xml_fragment(
- '<' || a_node_name
- || case
- when a_attr_name is not null and a_attr_value is not null then
- ' ' || a_attr_name || '="' || dbms_xmlgen.convert(a_attr_value) || '"'
- end
- || '>',
- 0, 1
- );
- end print_start_node;
-
- member procedure print_end_node(
- self in out nocopy ut_realtime_reporter,
- a_name in varchar2
- ) is
- begin
- self.print_xml_fragment('' || a_name || '>', -1);
- end print_end_node;
-
- member procedure print_node(
- self in out nocopy ut_realtime_reporter,
- a_name in varchar2,
- a_content in clob
- ) is
- begin
- if a_content is not null then
- self.print_xml_fragment('<' || a_name || '>' || dbms_xmlgen.convert(a_content) || '' || a_name || '>');
- end if;
- end print_node;
-
- member procedure print_cdata_node(
- self in out nocopy ut_realtime_reporter,
- a_name in varchar2,
- a_content in clob
- ) is
- begin
- if a_content is not null then
- self.print_xml_fragment('<' || a_name || '>' || ut_utils.to_cdata(a_content) || '' || a_name || '>');
- end if;
- end print_cdata_node;
-
- member procedure print_xml_fragment(
- self in out nocopy ut_realtime_reporter,
- a_fragment in clob,
- a_indent_summand_before in integer default 0,
- a_indent_summand_after in integer default 0
- ) is
- begin
- current_indent := current_indent + a_indent_summand_before;
- ut_utils.append_to_list(print_buffer, lpad(' ', 2 * current_indent) || a_fragment);
- current_indent := current_indent + a_indent_summand_after;
- end print_xml_fragment;
-
- member procedure flush_print_buffer(
- self in out nocopy ut_realtime_reporter,
- a_item_type in varchar2
- ) is
- l_doc clob;
- l_rows integer := print_buffer.count;
- begin
- for i in 1 .. l_rows loop
- ut_utils.append_to_clob(l_doc, print_buffer(i));
- ut_utils.append_to_clob(l_doc, chr(10));
- end loop;
- self.print_clob(l_doc, a_item_type);
- print_buffer.delete;
- end flush_print_buffer;
-
- overriding member function get_description return varchar2 is
- begin
- return 'Provides live test execution progress that can be consumed from another session, enabling clients such as SQL Developer to show progress in real time as tests run.';
- end get_description;
-
-end;
-/
diff --git a/source/reporters/ut_realtime_reporter.tps b/source/reporters/ut_realtime_reporter.tps
deleted file mode 100644
index 7efdd1bb3..000000000
--- a/source/reporters/ut_realtime_reporter.tps
+++ /dev/null
@@ -1,163 +0,0 @@
-create or replace noneditionable type ut_realtime_reporter force under ut_output_reporter_base(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /**
- * Cached XML header to be used for every XML document
- */
- xml_header varchar2(4000),
-
- /**
- * Total number of all tests in the run (incl. disabled tests).
- */
- total_number_of_tests integer,
-
- /**
- * Currently executed test number.
- */
- current_test_number integer,
-
- /**
- * Current indentation in logical tabs.
- */
- current_indent integer,
-
- /**
- * Buffers lines to be printed.
- */
- print_buffer ut_varchar2_rows,
-
- /**
- * The realtime reporter.
- * Provides test results in a XML format, for clients such as SQL Developer interested in showing progressing details.
- */
- constructor function ut_realtime_reporter(
- self in out nocopy ut_realtime_reporter
- ) return self as result,
-
- /**
- * Provides meta data of complete run in advance.
- */
- overriding member procedure before_calling_run(
- self in out nocopy ut_realtime_reporter,
- a_run in ut_run
- ),
-
- /**
- * Provides meta data of a completed run.
- */
- overriding member procedure after_calling_run(
- self in out nocopy ut_realtime_reporter,
- a_run in ut_run
- ),
-
- /**
- * Indicates the start of a test suite execution.
- */
- overriding member procedure before_calling_suite(
- self in out nocopy ut_realtime_reporter,
- a_suite in ut_logical_suite
- ),
-
- /**
- * Provides meta data of completed test suite.
- */
- overriding member procedure after_calling_suite(
- self in out nocopy ut_realtime_reporter,
- a_suite in ut_logical_suite
- ),
-
- /**
- * Indicates the start of a test.
- */
- overriding member procedure before_calling_test(
- self in out nocopy ut_realtime_reporter,
- a_test in ut_test
- ),
-
- /**
- * Provides meta data of a completed test.
- */
- overriding member procedure after_calling_test(
- self in out nocopy ut_realtime_reporter,
- a_test in ut_test
- ),
-
- /**
- * Provides the description of this reporter.
- */
- overriding member function get_description return varchar2,
-
- /**
- * Prints the start tag of a XML node with an optional attribute.
- */
- member procedure print_start_node(
- self in out nocopy ut_realtime_reporter,
- a_node_name in varchar2,
- a_attr_name in varchar2 default null,
- a_attr_value in varchar2 default null
- ),
-
- /**
- * Prints the end tag of a XML node.
- */
- member procedure print_end_node(
- self in out nocopy ut_realtime_reporter,
- a_name in varchar2
- ),
-
- /**
- * Prints a child node with content. Special characters are encoded.
- */
- member procedure print_node(
- self in out nocopy ut_realtime_reporter,
- a_name in varchar2,
- a_content in clob
- ),
-
- /**
- * Prints a child node with content. Content is passed 1:1 using CDATA.
- */
- member procedure print_cdata_node(
- self in out nocopy ut_realtime_reporter,
- a_name in varchar2,
- a_content in clob
- ),
-
- /**
- * Prints a line of the resulting XML document using the current indentation.
- * a_indent_summand_before is added before printing a line.
- * a_indent_summand_after is added after printing a line.
- * All output is produced through this function.
- */
- member procedure print_xml_fragment(
- self in out nocopy ut_realtime_reporter,
- a_fragment in clob,
- a_indent_summand_before in integer default 0,
- a_indent_summand_after in integer default 0
- ),
-
- /**
- * Flushes the local print buffer to the output buffer.
- */
- member procedure flush_print_buffer(
- self in out nocopy ut_realtime_reporter,
- a_item_type in varchar2
- )
-)
-not final
-/
diff --git a/source/reporters/ut_sonar_test_reporter.tpb b/source/reporters/ut_sonar_test_reporter.tpb
deleted file mode 100644
index 6b8003ecb..000000000
--- a/source/reporters/ut_sonar_test_reporter.tpb
+++ /dev/null
@@ -1,115 +0,0 @@
-create or replace noneditionable type body ut_sonar_test_reporter is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_sonar_test_reporter(
- self in out nocopy ut_sonar_test_reporter
- ) return self as result is
- begin
- self.init($$plsql_unit,ut_output_bulk_buffer());
- return;
- end;
-
- overriding member procedure after_calling_run(self in out nocopy ut_sonar_test_reporter, a_run in ut_run) is
-
- function map_package_to_file(a_suite ut_suite, a_file_mappings ut_file_mappings) return varchar2 is
- l_file_name varchar2(4000);
- begin
- if a_file_mappings is not null then
- for i in 1 .. a_file_mappings.count loop
- if upper(a_file_mappings(i).object_name) = upper(a_suite.object_name)
- and upper(a_file_mappings(i).object_owner) = upper(a_suite.object_owner)
- and a_file_mappings(i).object_type = 'PACKAGE BODY' then
- l_file_name := a_file_mappings(i).file_name;
- exit;
- end if;
- end loop;
- end if;
- return coalesce(l_file_name, a_suite.path);
- end;
-
- procedure print_test_results(a_test ut_test) is
- l_results ut_varchar2_rows := ut_varchar2_rows();
- begin
- ut_utils.append_to_list( l_results, '');
- if a_test.result = ut_utils.gc_disabled then
- ut_utils.append_to_list( l_results, '');
- elsif a_test.result = ut_utils.gc_error then
- ut_utils.append_to_list( l_results, '');
- ut_utils.append_to_list( l_results, ut_utils.to_cdata( ut_utils.convert_collection( a_test.get_error_stack_traces() ) ) );
- ut_utils.append_to_list( l_results, '');
- elsif a_test.result > ut_utils.gc_success then
- ut_utils.append_to_list( l_results, '');
- ut_utils.append_to_list( l_results, ut_utils.to_cdata( a_test.get_failed_expectation_lines() ) );
- ut_utils.append_to_list( l_results, '');
- end if;
- ut_utils.append_to_list( l_results, '');
-
- self.print_text_lines(l_results);
- end;
-
- procedure print_suite_results(a_suite ut_logical_suite, a_file_mappings ut_file_mappings) is
- begin
-
- for i in 1 .. a_suite.items.count loop
- if a_suite.items(i) is of(ut_logical_suite) and a_suite.items(i) is not of(ut_suite_context) then
- print_suite_results(treat(a_suite.items(i) as ut_logical_suite), a_file_mappings);
- end if;
- end loop;
-
- if a_suite is of(ut_suite) and a_suite is not of(ut_suite_context) then
- self.print_text('');
- end if;
-
- for i in 1 .. a_suite.items.count loop
- if a_suite.items(i) is of(ut_suite_context) then
- print_suite_results(treat(a_suite.items(i) as ut_suite_context), a_file_mappings);
- end if;
- end loop;
-
- if a_suite is of(ut_suite) then
- for i in 1 .. a_suite.items.count loop
- if a_suite.items(i) is of(ut_test) then
- print_test_results(treat(a_suite.items(i) as ut_test));
- end if;
- end loop;
- end if;
-
- if a_suite is of(ut_suite) and a_suite is not of(ut_suite_context) then
- self.print_text('');
- end if;
- end;
-
- begin
- self.print_text(ut_utils.get_xml_header(a_run.client_character_set));
- self.print_text('');
- for i in 1 .. a_run.items.count loop
- print_suite_results(treat(a_run.items(i) as ut_logical_suite), a_run.test_file_mappings);
- end loop;
-
- self.print_text('');
- end;
-
- overriding member function get_description return varchar2 as
- begin
- return 'Generates an XML report providing detailed information on test execution.
-Designed for [SonarQube](https://www.sonarsource.com/products/sonarqube/) to report test execution.
-XML format returned conforms with the [Sonar specification](https://docs.sonarsource.com/sonarqube-server/analyzing-source-code/test-coverage/generic-test-data).';
- end;
-
-end;
-/
diff --git a/source/reporters/ut_sonar_test_reporter.tps b/source/reporters/ut_sonar_test_reporter.tps
deleted file mode 100644
index f7f5aeb39..000000000
--- a/source/reporters/ut_sonar_test_reporter.tps
+++ /dev/null
@@ -1,28 +0,0 @@
-create or replace noneditionable type ut_sonar_test_reporter under ut_output_reporter_base(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_sonar_test_reporter(
- self in out nocopy ut_sonar_test_reporter
- ) return self as result,
-
- overriding member procedure after_calling_run(self in out nocopy ut_sonar_test_reporter, a_run in ut_run),
-
- overriding member function get_description return varchar2
-)
-not final
-/
diff --git a/source/reporters/ut_tap_reporter.tpb b/source/reporters/ut_tap_reporter.tpb
deleted file mode 100644
index e1b3b617d..000000000
--- a/source/reporters/ut_tap_reporter.tpb
+++ /dev/null
@@ -1,142 +0,0 @@
-create or replace noneditionable type body ut_tap_reporter is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_tap_reporter(self in out nocopy ut_tap_reporter) return self as result is
- begin
- self.init($$plsql_unit);
- self.lvl := 0;
- return;
- end ut_tap_reporter;
-
- member procedure print_comment(self in out nocopy ut_tap_reporter, a_comment clob) as
- begin
- self.print_clob(regexp_replace(a_comment, '^(.+)', '# \1', 1, 0, 'm'));
- end print_comment;
-
- member function escape_special_chars(self in out nocopy ut_tap_reporter, a_string_to_escape clob) return clob as
- begin
- return regexp_replace(a_string_to_escape, '([\\#])', '\\\1');
- end escape_special_chars;
-
- overriding member procedure before_calling_suite(self in out nocopy ut_tap_reporter, a_suite ut_logical_suite) as
- begin
- self.print_text('# Subtest: ' || self.escape_special_chars(coalesce(a_suite.description, a_suite.name)));
- lvl := lvl + 2;
- self.print_text('1..' || a_suite.items.count);
- end before_calling_suite;
-
-
- overriding member procedure after_calling_test(self in out nocopy ut_tap_reporter, a_test ut_test) as
- l_message varchar2(4000);
- l_test_name varchar2(4000) := self.escape_special_chars(coalesce(a_test.description, a_test.name));
-
- procedure print_failed_expectation(a_test ut_test) is
- l_lines ut_varchar2_list;
- l_failed boolean;
- begin
- if a_test.get_error_stack_traces().count = 0 then
- -- If no error occurred, print failed expectation
- l_lines := a_test.all_expectations(a_test.all_expectations.last).get_result_lines();
- l_failed := a_test.all_expectations(a_test.all_expectations.last).status >= ut_utils.gc_success;
- if l_failed then
- self.print_text('message: ''' || l_lines(1) || '''');
- self.print_text('severity: fail');
- end if;
- else
- -- Print multi-line YAML-String with implicit newline characters
- self.print_text('message: |');
- self.lvl := self.lvl + 1;
- self.print_text(ut_utils.table_to_clob(a_test.get_error_stack_traces()));
- self.lvl := self.lvl - 1;
- self.print_text('severity: error');
- end if;
- end print_failed_expectation;
-
- begin
-
- if a_test.result = ut_utils.gc_disabled then
- self.print_text('ok - ' || l_test_name || ' # SKIP'||
- case when a_test.disabled_reason is not null
- then ': '|| self.escape_special_chars(a_test.disabled_reason)
- else null
- end );
- elsif a_test.result = ut_utils.gc_success then
- self.print_text('ok - ' || l_test_name);
- elsif a_test.result > ut_utils.gc_success then
- if self.lvl = 0 then
- self.print_text(ut_ansiconsole_helper.red('not ok') || ' - ' || l_test_name);
- else
- self.print_text('not ok - ' || l_test_name);
- end if;
- self.lvl := self.lvl + 1;
- self.print_text('---');
- print_failed_expectation(a_test);
- self.print_text('...');
- self.lvl := self.lvl - 1;
- end if;
-
- self.print_comment(a_test.get_serveroutputs);
-
- end after_calling_test;
-
- overriding member procedure after_calling_before_all(self in out nocopy ut_tap_reporter, a_executable in ut_executable) is
- begin
- if a_executable.serveroutput is not null and a_executable.serveroutput != empty_clob() then
- self.print_comment(a_executable.serveroutput);
- end if;
- end after_calling_before_all;
-
- overriding member procedure after_calling_after_all(self in out nocopy ut_tap_reporter, a_executable in ut_executable) is
- begin
- if a_executable.serveroutput is not null and a_executable.serveroutput != empty_clob() then
- self.print_comment(a_executable.serveroutput);
- end if;
- end after_calling_after_all;
-
- overriding member procedure after_calling_suite(self in out nocopy ut_tap_reporter, a_suite ut_logical_suite) as
- l_suite_name varchar2(4000) := coalesce(a_suite.description, a_suite.name);
- begin
- lvl := lvl - 2;
- if lvl = 0 then
- if a_suite.result = ut_utils.gc_success or a_suite.result = ut_utils.gc_disabled then
- self.print_text('ok - ' || self.escape_special_chars(l_suite_name));
- elsif a_suite.result > ut_utils.gc_success then
- self.print_text(ut_ansiconsole_helper.red('not ok') || ' - ' || self.escape_special_chars(l_suite_name));
- end if;
-
- self.print_text(' ');
- end if;
-
- end after_calling_suite;
-
- overriding member procedure before_calling_run(self in out nocopy ut_tap_reporter, a_run in ut_run) as
- begin
- self.print_text('TAP version 14');
- self.print_text('1..' || a_run.items.count);
- self.print_text(' ');
- end before_calling_run;
-
- overriding member procedure after_calling_run(self in out nocopy ut_tap_reporter, a_run in ut_run) as
- begin
- self.lvl := 0;
- if a_run.get_support_info_flag() then
- self.print_comment(ut_utils.gc_support_text || ': ' || ut_utils.gc_support_url);
- end if;
- end;
-end;
-/
diff --git a/source/reporters/ut_tap_reporter.tps b/source/reporters/ut_tap_reporter.tps
deleted file mode 100644
index 127256cf8..000000000
--- a/source/reporters/ut_tap_reporter.tps
+++ /dev/null
@@ -1,34 +0,0 @@
-create or replace noneditionable type ut_tap_reporter under ut_documentation_reporter(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_tap_reporter(self in out nocopy ut_tap_reporter) return self as result,
- member procedure print_comment(self in out nocopy ut_tap_reporter, a_comment clob),
- member function escape_special_chars(self in out nocopy ut_tap_reporter, a_string_to_escape clob) return clob,
- overriding member procedure before_calling_suite(self in out nocopy ut_tap_reporter, a_suite ut_logical_suite),
-
- overriding member procedure after_calling_test(self in out nocopy ut_tap_reporter, a_test ut_test),
-
- overriding member procedure after_calling_before_all (self in out nocopy ut_tap_reporter, a_executable in ut_executable),
- overriding member procedure after_calling_after_all (self in out nocopy ut_tap_reporter, a_executable in ut_executable),
- overriding member procedure before_calling_run(self in out nocopy ut_tap_reporter, a_run in ut_run),
- overriding member procedure after_calling_suite(self in out nocopy ut_tap_reporter, a_suite ut_logical_suite),
- overriding member procedure after_calling_run(self in out nocopy ut_tap_reporter, a_run in ut_run)
-
-)
-not final
-/
diff --git a/source/reporters/ut_teamcity_reporter.tpb b/source/reporters/ut_teamcity_reporter.tpb
deleted file mode 100644
index 2e76e3e3f..000000000
--- a/source/reporters/ut_teamcity_reporter.tpb
+++ /dev/null
@@ -1,159 +0,0 @@
-create or replace noneditionable type body ut_teamcity_reporter is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_teamcity_reporter(self in out nocopy ut_teamcity_reporter) return self as result is
- begin
- self.init($$plsql_unit);
- return;
- end;
-
- overriding member procedure before_calling_suite(self in out nocopy ut_teamcity_reporter, a_suite in ut_logical_suite) is
- begin
- self.print_text(
- ut_teamcity_reporter_helper.test_suite_started(
- a_suite_name => nvl(replace(trim(a_suite.description),'.'),a_suite.path)
- )
- );
- end;
-
- overriding member procedure after_calling_suite(self in out nocopy ut_teamcity_reporter, a_suite in ut_logical_suite) is
- begin
- self.print_text(
- ut_teamcity_reporter_helper.test_suite_finished(
- a_suite_name => nvl(replace(trim(a_suite.description),'.'),a_suite.path)
- )
- );
- end;
-
- overriding member procedure before_calling_test(self in out nocopy ut_teamcity_reporter, a_test in ut_test) is
- l_test_full_name varchar2(4000);
- begin
-
- l_test_full_name := lower(a_test.item.owner_name) || '.' || lower(a_test.item.object_name) || '.' ||
- lower(a_test.item.procedure_name);
-
- self.print_text(
- ut_teamcity_reporter_helper.test_started(
- a_test_name => l_test_full_name,
- a_capture_standard_output => true
- )
- );
-
- end;
-
- overriding member procedure after_calling_test(self in out nocopy ut_teamcity_reporter, a_test in ut_test) is
- l_results ut_varchar2_rows := ut_varchar2_rows();
- l_test_full_name varchar2(4000);
- l_std_err_msg varchar2(32767);
- function add_error_message( a_message varchar2, a_message_name varchar2) return varchar2 is
- begin
- return
- case
- when a_message is not null
- then a_message_name || chr(10) || a_message || chr(10)
- end;
- end;
- function add_error_messages(a_executables ut_executables, a_message_name varchar2) return varchar2 is
- l_message varchar2(32767);
- l_idx binary_integer;
- begin
- l_idx := a_executables.first;
- while l_idx is not null loop
- l_message := l_message || add_error_message( a_executables(l_idx).get_error_stack_trace(), a_message_name );
- l_idx := a_executables.next(l_idx);
- end loop;
- return l_message;
- end;
- begin
- l_test_full_name := lower(a_test.item.owner_name) || '.' || lower(a_test.item.object_name) || '.' ||
- lower(a_test.item.procedure_name);
-
- if a_test.result = ut_utils.gc_disabled then
- ut_utils.append_to_list( l_results, ut_teamcity_reporter_helper.test_disabled(l_test_full_name,a_test.disabled_reason));
- else
-
- ut_utils.append_to_list( l_results, a_test.get_serveroutputs());
-
- if a_test.result = ut_utils.gc_error then
- l_std_err_msg := l_std_err_msg || add_error_messages(a_test.before_each_list, 'Before each exception:');
- l_std_err_msg := l_std_err_msg || add_error_messages(a_test.before_test_list, 'Before test exception:');
- l_std_err_msg := l_std_err_msg || add_error_message(a_test.item.get_error_stack_trace(), 'Test exception:');
- l_std_err_msg := l_std_err_msg || add_error_messages(a_test.after_test_list, 'After test exception:');
- l_std_err_msg := l_std_err_msg || add_error_messages(a_test.after_each_list, 'After each exception:');
-
- ut_utils.append_to_list(
- l_results,
- ut_teamcity_reporter_helper.test_std_err(
- a_test_name => l_test_full_name,
- a_out => trim(l_std_err_msg)
- )
- );
- ut_utils.append_to_list(
- l_results,
- ut_teamcity_reporter_helper.test_failed(
- a_test_name => l_test_full_name,
- a_msg => 'Error occured',
- a_details => trim(l_std_err_msg)
- )
- );
- for i in 1 .. a_test.failed_expectations.count loop
- ut_utils.append_to_list(
- l_results,
- ut_teamcity_reporter_helper.test_failed(
- a_test_name => l_test_full_name,
- a_msg => a_test.failed_expectations(i).description,
- a_details => a_test.failed_expectations(i).message )
- );
- end loop;
- elsif a_test.failed_expectations is not null and a_test.failed_expectations.count > 0 then
- for i in 1 .. a_test.failed_expectations.count loop
- ut_utils.append_to_list(
- l_results,
- ut_teamcity_reporter_helper.test_failed(
- a_test_name => l_test_full_name,
- a_msg => a_test.failed_expectations(i).description,
- a_details => a_test.failed_expectations(i).message )
- );
- end loop;
- elsif a_test.result = ut_utils.gc_failure then
- ut_utils.append_to_list(
- l_results,
- ut_teamcity_reporter_helper.test_failed(
- a_test_name => l_test_full_name,
- a_msg => 'Test failed'
- )
- );
- end if;
-
- ut_utils.append_to_list(
- l_results,
- ut_teamcity_reporter_helper.test_finished(l_test_full_name, trunc(a_test.execution_time * 1e3))
- );
-
- end if;
- self.print_text_lines(l_results);
- end;
-
- overriding member function get_description return varchar2 as
- begin
- return 'Provides the TeamCity (a CI server by jetbrains) reporting-format that allows tracking of progress of a CI step/task as it executes.' || chr(10) ||
- 'https://confluence.jetbrains.com/display/TCD9/Build+Script+Interaction+with+TeamCity';
- end;
-
-end;
-/
diff --git a/source/reporters/ut_teamcity_reporter.tps b/source/reporters/ut_teamcity_reporter.tps
deleted file mode 100644
index e70ad4a4b..000000000
--- a/source/reporters/ut_teamcity_reporter.tps
+++ /dev/null
@@ -1,31 +0,0 @@
-create or replace noneditionable type ut_teamcity_reporter under ut_output_reporter_base(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- constructor function ut_teamcity_reporter(self in out nocopy ut_teamcity_reporter) return self as result,
-
- overriding member procedure before_calling_suite(self in out nocopy ut_teamcity_reporter, a_suite in ut_logical_suite),
-
- overriding member procedure after_calling_suite(self in out nocopy ut_teamcity_reporter, a_suite in ut_logical_suite),
-
- overriding member procedure before_calling_test(self in out nocopy ut_teamcity_reporter, a_test in ut_test),
-
- overriding member procedure after_calling_test(self in out nocopy ut_teamcity_reporter, a_test in ut_test),
-
- overriding member function get_description return varchar2
-)
-not final
-/
diff --git a/source/reporters/ut_teamcity_reporter_helper.pkb b/source/reporters/ut_teamcity_reporter_helper.pkb
deleted file mode 100644
index ac9d4b567..000000000
--- a/source/reporters/ut_teamcity_reporter_helper.pkb
+++ /dev/null
@@ -1,126 +0,0 @@
-create or replace noneditionable package body ut_teamcity_reporter_helper is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- subtype t_prop_index is varchar2(2000 char);
- type t_props is table of varchar2(32767) index by t_prop_index;
-
- function escape_value(a_value in varchar2) return varchar2 is
- begin
- return translate(regexp_replace(a_value, q'/(\'|\||\[|\]|/' || chr(13) || '|' || chr(10) || ')', '|\1'),chr(13)||chr(10),'rn');
- end;
-
- function message(a_command in varchar2, a_props t_props default cast(null as t_props)) return varchar2 is
- l_message varchar2(32767);
- l_index t_prop_index;
- l_value varchar2(32767);
- l_max_len binary_integer := 2000;
- begin
- l_message := '##teamcity[' || a_command || ' timestamp=''' ||
- regexp_replace(to_char(systimestamp, 'YYYY-MM-DD"T"HH24:MI:ss.FF3TZHTZM'), '(\.\d{3})\d+(\+)', '\1\2') || '''';
-
- l_index := a_props.first;
- while l_index is not null loop
- if a_props(l_index) is not null then
- l_value := escape_value(a_props(l_index));
- if length(l_value) > l_max_len then
- l_value := substr(l_value,1,l_max_len-7)||escape_value('[...]');
- end if;
- l_message := l_message || ' ' || l_index || '=''' || l_value || '''';
- end if;
- l_index := a_props.next(l_index);
- end loop;
- l_message := l_message || ']';
- return l_message;
-
- end message;
-
- function test_suite_started(a_suite_name varchar2, a_flow_id varchar2 default null) return varchar2 is
- l_props t_props;
- begin
- l_props('name') := a_suite_name;
- l_props('flowId') := a_flow_id;
- return message('testSuiteStarted', l_props);
- end;
- function test_suite_finished(a_suite_name varchar2, a_flow_id varchar2 default null) return varchar2 is
- l_props t_props;
- begin
- l_props('name') := a_suite_name;
- l_props('flowId') := a_flow_id;
- return message('testSuiteFinished', l_props);
- end;
-
- function test_started(a_test_name varchar2, a_capture_standard_output boolean default null, a_flow_id varchar2 default null) return varchar2 is
- l_props t_props;
- begin
- l_props('name') := a_test_name;
- l_props('captureStandardOutput') := case a_capture_standard_output
- when true then
- 'true'
- when false then
- 'false'
- end;
- l_props('flowId') := a_flow_id;
- return message('testStarted', l_props);
- end;
-
- function test_finished(a_test_name varchar2, a_test_duration_milisec number default null, a_flow_id varchar2 default null) return varchar2 is
- l_props t_props;
- begin
- l_props('name') := a_test_name;
- l_props('duration') := a_test_duration_milisec;
- l_props('flowId') := a_flow_id;
- return message('testFinished', l_props);
- end;
-
- function test_disabled(a_test_name varchar2,a_msg varchar2 default null, a_flow_id varchar2 default null) return varchar2 is
- l_props t_props;
- begin
- l_props('name') := a_test_name;
- if a_msg is not null then
- l_props('message') := a_msg;
- end if;
- l_props('flowId') := a_flow_id;
- return message('testIgnored', l_props);
- end;
- function test_failed(a_test_name varchar2, a_msg in varchar2 default null, a_details varchar2 default null, a_flow_id varchar2 default null, a_actual varchar2 default null, a_expected varchar2 default null) return varchar2 is
- l_props t_props;
- begin
- l_props('name') := a_test_name;
- l_props('message') := a_msg;
- l_props('details') := a_details;
- l_props('flowId') := a_flow_id;
-
- if a_actual is not null and a_expected is not null then
- l_props('actual') := a_actual;
- l_props('expected') := a_expected;
- end if;
-
- return message('testFailed', l_props);
- end;
-
- function test_std_err(a_test_name varchar2, a_out in varchar2, a_flow_id in varchar2 default null) return varchar2 is
- l_props t_props;
- begin
- l_props('name') := a_test_name;
- l_props('out') := a_out;
- l_props('flowId') := a_flow_id;
- return message('testStdErr', l_props);
- end;
-
-end ut_teamcity_reporter_helper;
-/
diff --git a/source/reporters/ut_teamcity_reporter_helper.pks b/source/reporters/ut_teamcity_reporter_helper.pks
deleted file mode 100644
index 03c655c33..000000000
--- a/source/reporters/ut_teamcity_reporter_helper.pks
+++ /dev/null
@@ -1,29 +0,0 @@
-create or replace noneditionable package ut_teamcity_reporter_helper is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- function test_suite_started(a_suite_name varchar2, a_flow_id varchar2 default null) return varchar2;
- function test_suite_finished(a_suite_name varchar2, a_flow_id varchar2 default null) return varchar2;
-
- function test_started(a_test_name varchar2, a_capture_standard_output boolean default null, a_flow_id varchar2 default null) return varchar2;
- function test_finished(a_test_name varchar2, a_test_duration_milisec number default null, a_flow_id varchar2 default null) return varchar2;
- function test_disabled(a_test_name varchar2,a_msg varchar2 default null, a_flow_id varchar2 default null) return varchar2;
- function test_failed(a_test_name varchar2, a_msg in varchar2 default null, a_details varchar2 default null, a_flow_id varchar2 default null, a_actual varchar2 default null, a_expected varchar2 default null) return varchar2;
- function test_std_err(a_test_name varchar2, a_out in varchar2, a_flow_id in varchar2 default null) return varchar2;
-
-end ut_teamcity_reporter_helper;
-/
diff --git a/source/reporters/ut_tfs_junit_reporter.tpb b/source/reporters/ut_tfs_junit_reporter.tpb
deleted file mode 100644
index 38aa41bfa..000000000
--- a/source/reporters/ut_tfs_junit_reporter.tpb
+++ /dev/null
@@ -1,180 +0,0 @@
-create or replace noneditionable type body ut_tfs_junit_reporter is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_tfs_junit_reporter(self in out nocopy ut_tfs_junit_reporter) return self as result is
- begin
- self.init($$plsql_unit,ut_output_bulk_buffer());
- return;
- end;
-
- overriding member procedure after_calling_run(self in out nocopy ut_tfs_junit_reporter, a_run in ut_run) is
- begin
- junit_version_one(a_run);
- end;
-
- member procedure junit_version_one(self in out nocopy ut_tfs_junit_reporter,a_run in ut_run) is
- l_suite_id integer := 0;
-
- function get_common_suite_attributes(a_item ut_suite_item) return varchar2 is
- begin
- return ' errors="' ||a_item.results_count.errored_count || '"' ||
- ' failures="' || a_item.results_count.failure_count ||
- '" name="' || dbms_xmlgen.convert(nvl(a_item.description, a_item.name)) || '"' ||
- ' time="' || ut_utils.to_xml_number_format(a_item.execution_time()) || '" '||
- ' timestamp="' || to_char(sysdate,'RRRR-MM-DD"T"HH24:MI:SS') || '" '||
- ' hostname="' || sys_context('USERENV','HOST') || '" ';
- end;
-
- function get_common_testcase_attributes(a_item ut_suite_item) return varchar2 is
- begin
- return ' name="' || dbms_xmlgen.convert(nvl(a_item.description, a_item.name)) || '"' ||
- ' time="' || ut_utils.to_xml_number_format(a_item.execution_time()) || '"';
- end;
-
- function get_path(a_path_with_name varchar2, a_name varchar2) return varchar2 is
- begin
- return regexp_substr(a_path_with_name, '(.*)\.' ||a_name||'$',subexpression=>1);
- end;
-
- function add_test_results(a_test ut_test) return ut_varchar2_rows is
- l_results ut_varchar2_rows := ut_varchar2_rows();
- begin
- ut_utils.append_to_list( l_results,'');
-
- /*
- According to specs :
- - A failure is a test which the code has explicitly failed by using the mechanisms for that purpose.
- e.g., via an assertEquals
- - An errored test is one that had an unanticipated problem.
- e.g., an unchecked throwable; or a problem with the implementation of the test.
- */
-
- if a_test.result = ut_utils.gc_error then
- ut_utils.append_to_list( l_results, '');
- ut_utils.append_to_list( l_results, ut_utils.to_cdata( ut_utils.convert_collection( a_test.get_error_stack_traces() ) ) );
- ut_utils.append_to_list( l_results, '');
- -- Do not count error as failure
- elsif a_test.result = ut_utils.gc_disabled then
- if a_test.disabled_reason is not null then
- ut_utils.append_to_list( l_results, '');
- else
- ut_utils.append_to_list( l_results, '' );
- end if;
- elsif a_test.result = ut_utils.gc_failure then
- ut_utils.append_to_list( l_results, '');
- ut_utils.append_to_list( l_results, ut_utils.to_cdata( a_test.get_failed_expectation_lines() ) );
- ut_utils.append_to_list( l_results, '');
- end if;
-
- ut_utils.append_to_list( l_results, '');
-
- return l_results;
- end;
-
- procedure print_suite_results(a_suite ut_logical_suite, a_suite_id in out nocopy integer, a_nested_tests in out nocopy ut_varchar2_rows) is
- l_tests_count integer := a_suite.results_count.disabled_count + a_suite.results_count.success_count +
- a_suite.results_count.failure_count + a_suite.results_count.errored_count;
- l_results ut_varchar2_rows := ut_varchar2_rows();
- l_suite ut_suite;
- l_outputs clob;
- l_errors ut_varchar2_list;
- l_tests ut_varchar2_list;
- begin
- for i in 1 .. a_suite.items.count loop
- if a_suite.items(i) is of(ut_suite_context) then
- print_suite_results(treat(a_suite.items(i) as ut_suite_context), a_suite_id, a_nested_tests);
- elsif a_suite.items(i) is of(ut_suite) then
- print_suite_results(treat(a_suite.items(i) as ut_suite), a_suite_id, a_nested_tests);
- elsif a_suite.items(i) is of(ut_logical_suite) then
- print_suite_results(treat(a_suite.items(i) as ut_logical_suite), a_suite_id, a_nested_tests);
- end if;
- end loop;
- --Due to fact tha TFS and junit5 accepts only flat structure we have to report in suite level only.
- if a_suite is of(ut_suite_context) then
- for i in 1 .. a_suite.items.count loop
- if a_suite.items(i) is of(ut_test) then
- ut_utils.append_to_list( a_nested_tests,(add_test_results(treat(a_suite.items(i) as ut_test))));
- end if;
- end loop;
- elsif a_suite is of(ut_suite) then
- for i in 1 .. a_suite.items.count loop
- if a_suite.items(i) is of(ut_test) then
- ut_utils.append_to_list( a_nested_tests,(add_test_results(treat(a_suite.items(i) as ut_test))));
- end if;
- end loop;
- --TFS doesnt report on empty test suites, however all we want to make sure is that we dont pring parents suites
- -- showing test count but not tests.
- if (a_nested_tests.count > 0 and l_tests_count > 0) or (a_nested_tests.count = 0 and l_tests_count = 0) then
- a_suite_id := a_suite_id + 1;
- ut_utils.append_to_list( l_results,'');
- ut_utils.append_to_list( l_results,'');
- ut_utils.append_to_list(l_results,a_nested_tests);
- l_suite := treat(a_suite as ut_suite);
- l_outputs := l_suite.get_serveroutputs();
- if l_outputs is not null and l_outputs != empty_clob() then
- ut_utils.append_to_list( l_results, '');
- ut_utils.append_to_list( l_results, ut_utils.to_cdata( l_suite.get_serveroutputs() ) );
- ut_utils.append_to_list( l_results, '');
- else
- ut_utils.append_to_list( l_results, '');
- end if;
-
- l_errors := l_suite.get_error_stack_traces();
- if l_errors is not empty then
- ut_utils.append_to_list( l_results, '');
- ut_utils.append_to_list( l_results, ut_utils.to_cdata( ut_utils.convert_collection( l_errors ) ) );
- ut_utils.append_to_list( l_results, '');
- else
- ut_utils.append_to_list( l_results, '');
- end if;
- ut_utils.append_to_list( l_results, '');
-
- self.print_text_lines(l_results);
- --We have resolved a context and we now reset value.
- a_nested_tests := ut_varchar2_rows();
- end if;
- end if;
- end;
-
- procedure get_suite_results(a_suite ut_logical_suite, a_suite_id in out nocopy integer) is
- l_nested_tests ut_varchar2_rows:= ut_varchar2_rows();
- begin
- print_suite_results(a_suite, l_suite_id,l_nested_tests);
- end;
-
- begin
- l_suite_id := 0;
- self.print_text(ut_utils.get_xml_header(a_run.client_character_set));
- self.print_text('');
- for i in 1 .. a_run.items.count loop
- get_suite_results(treat(a_run.items(i) as ut_logical_suite), l_suite_id);
- end loop;
- self.print_text('');
- end;
-
- overriding member function get_description return varchar2 as
- begin
- return 'Provides outcomes in a format conforming with JUnit version for TFS / VSTS
-as defined by [specification](https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/publish-test-results-v2?view=azure-pipelines)
-The implementation is based on [windyroad junit schema](https://github.com/windyroad/JUnit-Schema/blob/master/JUnit.xsd).';
- end;
-
-end;
-/
diff --git a/source/reporters/ut_tfs_junit_reporter.tps b/source/reporters/ut_tfs_junit_reporter.tps
deleted file mode 100644
index 3212085ea..000000000
--- a/source/reporters/ut_tfs_junit_reporter.tps
+++ /dev/null
@@ -1,34 +0,0 @@
-create or replace noneditionable type ut_tfs_junit_reporter under ut_output_reporter_base(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- /**
- * The JUnit reporter for publishing results in TFS/VSTS
- * Provides outcomes in a format conforming with specs as defined in:
- * https://docs.microsoft.com/en-us/vsts/build-release/tasks/test/publish-test-results?view=vsts
- */
-
- constructor function ut_tfs_junit_reporter(
- self in out nocopy ut_tfs_junit_reporter
- ) return self as result,
-
- overriding member procedure after_calling_run(self in out nocopy ut_tfs_junit_reporter, a_run in ut_run),
- member procedure junit_version_one(self in out nocopy ut_tfs_junit_reporter, a_run in ut_run),
-
- overriding member function get_description return varchar2
-)
-not final
-/
diff --git a/source/reporters/ut_xunit_reporter.tpb b/source/reporters/ut_xunit_reporter.tpb
deleted file mode 100644
index 4b6007994..000000000
--- a/source/reporters/ut_xunit_reporter.tpb
+++ /dev/null
@@ -1,32 +0,0 @@
-create or replace noneditionable type body ut_xunit_reporter is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_xunit_reporter(self in out nocopy ut_xunit_reporter) return self as result is
- begin
- self.init($$plsql_unit,ut_output_bulk_buffer());
- return;
- end;
-
- overriding member function get_description return varchar2 as
- begin
- return 'Depracated reporter. Please use Junit.
- Provides outcomes in a format conforming with JUnit 4 and above as defined in: https://gist.github.com/kuzuha/232902acab1344d6b578';
- end;
-
-end;
-/
diff --git a/source/reporters/ut_xunit_reporter.tps b/source/reporters/ut_xunit_reporter.tps
deleted file mode 100644
index 2e7a84f95..000000000
--- a/source/reporters/ut_xunit_reporter.tps
+++ /dev/null
@@ -1,28 +0,0 @@
-create or replace noneditionable type ut_xunit_reporter under ut_junit_reporter(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- /**
- * The XUnit reporter.
- * Provides outcomes in a format conforming with JUnit4 as defined in:
- * https://gist.github.com/kuzuha/232902acab1344d6b578
- */
- constructor function ut_xunit_reporter(self in out nocopy ut_xunit_reporter) return self as result,
-
- overriding member function get_description return varchar2
-)
-not final
-/
diff --git a/source/set_install_params.sql b/source/set_install_params.sql
deleted file mode 100644
index 1d58ab09a..000000000
--- a/source/set_install_params.sql
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-set echo off
-set verify off
-column 1 new_value 1 noprint;
-column 2 new_value 2 noprint;
-column 3 new_value 3 noprint;
-select null as "1", null as "2" , null as "3" from dual where 1=0;
-column sep new_value sep noprint
-select '--------------------------------------------------------------' as sep from dual;
-
-column ut3_owner new_value ut3_owner noprint
-column ut3_password new_value ut3_password noprint
-column ut3_tablespace new_value ut3_tablespace noprint
-
-select coalesce('&&1','UT3') ut3_owner,
- coalesce('&&2','XNtxj8eEgA6X6b6f') ut3_password,
- coalesce('&&3','users') ut3_tablespace
- from dual;
diff --git a/source/uninstall.sql b/source/uninstall.sql
deleted file mode 100644
index ba1582844..000000000
--- a/source/uninstall.sql
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-@@define_ut3_owner_param.sql
-
-set feedback on
-
-spool uninstall.log
-
-prompt &&line_separator
-prompt Uninstalling UTPLSQL v3 framework
-prompt &&line_separator
-
-alter session set current_schema = &&ut3_owner;
-
-@@uninstall_objects.sql
-
-@@uninstall_synonyms.sql
-
-begin
- dbms_output.put_line('&&line_separator');
- dbms_output.put_line('Uninstall complete');
- dbms_output.put_line('&&line_separator');
-end;
-/
-
-spool off
-
-exit;
diff --git a/source/uninstall_all.sql b/source/uninstall_all.sql
deleted file mode 100644
index af94716c1..000000000
--- a/source/uninstall_all.sql
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-@@define_ut3_owner_param.sql
-
-set feedback on
-
-spool uninstall.log
-
-prompt &&line_separator
-prompt Uninstalling UTPLSQL v3 framework
-prompt &&line_separator
-
-alter session set current_schema = &&ut3_owner;
-
-@@uninstall_objects.sql
-
-@@uninstall_coverage_tables.sql
-
-@@uninstall_synonyms.sql
-
-begin
- dbms_output.put_line('&&line_separator');
- dbms_output.put_line('Uninstall complete');
- dbms_output.put_line('&&line_separator');
-end;
-/
-
-spool off
-
-exit;
-
diff --git a/source/uninstall_coverage_tables.sql b/source/uninstall_coverage_tables.sql
deleted file mode 100644
index 6912330ae..000000000
--- a/source/uninstall_coverage_tables.sql
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-set echo off
-set feedback off
-begin
- for to_be_dopped in (
- select table_name
- from all_tables
- where table_name in (
- 'PLSQL_PROFILER_RUNS','PLSQL_PROFILER_UNITS','PLSQL_PROFILER_DATA',
- 'DBMSPCC_BLOCKS','DBMSPCC_RUNS','DBMSPCC_UNITS'
- )
- and owner = sys_context( 'USERENV', 'CURRENT_SCHEMA' )
- )
- loop
- execute immediate 'drop table '||to_be_dopped.table_name||' cascade constraints purge';
- dbms_output.put_line('Table '||to_be_dopped.table_name||' dropped');
- end loop;
-end;
-/
-
-declare
- l_seq_exist number;
-begin
- select count(*) into l_seq_exist
- from all_sequences
- where sequence_name = 'PLSQL_PROFILER_RUNNUMBER'
- and sequence_owner = sys_context('USERENV','CURRENT_SCHEMA');
- if l_seq_exist = 1 then
- execute immediate 'drop sequence plsql_profiler_runnumber';
- dbms_output.put_line('Sequence PLSQL_PROFILER_RUNNUMBER dropped');
- end if;
-end;
-/
-
diff --git a/source/uninstall_objects.sql b/source/uninstall_objects.sql
deleted file mode 100644
index 5c6e41dc3..000000000
--- a/source/uninstall_objects.sql
+++ /dev/null
@@ -1,456 +0,0 @@
-/*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-set echo off
-declare
- procedure drop_if_exists(a_object_type varchar2, a_object_name varchar2) is
- l_count integer;
- begin
- select count(1)
- into l_count
- from all_objects
- where owner = sys_context('USERENV','CURRENT_SCHEMA')
- and object_type = a_object_type
- and object_name = a_object_name;
- if l_count > 0 then
- execute immediate 'drop '||a_object_type||' '||a_object_name;
- dbms_output.put_line(initcap(a_object_type)||' '||a_object_name||' dropped.');
- else
- dbms_output.put_line(initcap(a_object_type)||' '||a_object_name||' was not dropped, '||lower(a_object_type)||' does not exist.');
- end if;
- end;
-begin
- drop_if_exists('TRIGGER', 'UT_TRIGGER_ANNOTATION_PARSING');
- drop_if_exists('SYNONYM','UT3_TRIGGER_ALIVE');
-end;
-/
-set echo on
-
-drop synonym be_between;
-
-drop synonym have_count;
-
-drop synonym match;
-
-drop synonym contain;
-
-drop synonym be_false;
-
-drop synonym be_empty;
-
-drop synonym be_greater_or_equal;
-
-drop synonym be_greater_than;
-
-drop synonym be_less_or_equal;
-
-drop synonym be_less_than;
-
-drop synonym be_like;
-
-drop synonym be_not_null;
-
-drop synonym be_null;
-
-drop synonym be_true;
-
-drop synonym equal;
-
-drop synonym be_within;
-
-drop synonym be_within_pct;
-
-drop type ut_coverage_sonar_reporter force;
-
-drop type ut_coverage_cobertura_reporter force;
-
-drop package ut_coverage_report_html_helper;
-
-drop type ut_coverage_html_reporter force;
-
-drop type ut_sonar_test_reporter force;
-
-drop type ut_realtime_reporter force;
-
-drop package ut_coverage;
-
-drop package ut_coverage_helper;
-
-drop table ut_coverage_sources_tmp purge;
-
-drop table ut_coverage_runs purge;
-
-drop package ut_teamcity_reporter_helper;
-
-drop package ut_runner;
-
-drop type ut_suite_items_info force;
-
-drop type ut_suite_item_info force;
-
-drop type ut_path_items force;
-
-drop type ut_path_item force;
-
-drop package ut_suite_manager;
-
-drop package ut_suite_builder;
-
-drop package ut_suite_tag_filter;
-
-drop package ut_suite_cache_manager;
-
-drop package ut_suite_cache_macros;
-
-drop table ut_suite_cache purge;
-
-drop type ut_suite_cache_rows force;
-
-drop type ut_suite_cache_row force;
-
-drop sequence ut_suite_cache_seq;
-
-drop table ut_suite_cache_package purge;
-
-drop table ut_suite_cache_schema purge;
-
-drop package ut;
-
-drop table ut_dbms_output_cache purge;
-
-drop type ut_expectation_compound force;
-
-drop type ut_expectation_json force;
-
-drop type ut_expectation force;
-
-drop package ut_expectation_processor;
-
-drop type ut_match force;
-
-drop type ut_be_between force;
-
-drop type ut_contain force;
-
-drop type ut_equal force;
-
-drop type ut_be_true force;
-
-drop type ut_be_null force;
-
-drop type ut_be_not_null force;
-
-drop type ut_be_like force;
-
-drop type ut_be_greater_or_equal force;
-
-drop type ut_be_empty force;
-
-drop type ut_be_greater_than force;
-
-drop type ut_be_less_or_equal force;
-
-drop type ut_be_less_than force;
-
-drop type ut_be_false force;
-
-drop type ut_be_within_pct force;
-
-drop type ut_be_within force;
-
-drop package ut_be_within_helper;
-
-drop type ut_comparison_matcher force;
-
-drop type ut_matcher force;
-
-drop type ut_expectation_base force;
-
-drop type ut_matcher_base force;
-
-drop type ut_data_value_yminterval force;
-
-drop type ut_data_value_varchar2 force;
-
-drop type ut_data_value_timestamp_tz force;
-
-drop type ut_data_value_timestamp_ltz force;
-
-drop type ut_data_value_timestamp force;
-
-drop type ut_data_value_number force;
-
-drop type ut_data_value_refcursor force;
-
-drop type ut_data_value_json force;
-
-drop type ut_data_value_dsinterval force;
-
-drop type ut_data_value_date force;
-
-drop type ut_data_value_clob force;
-
-drop type ut_data_value_boolean force;
-
-drop type ut_data_value_blob force;
-
-drop type ut_data_value_anydata force;
-
-drop type ut_data_value_xmltype force;
-
-drop type ut_data_value force;
-
-drop type ut_matcher_options force;
-
-drop type ut_matcher_options_items force;
-
-drop type ut_json_tree_details force;
-
-drop type ut_json_leaf_tab force;
-
-drop type ut_json_leaf;
-
-drop type ut_cursor_details force;
-
-drop type ut_cursor_column_tab force;
-
-drop type ut_cursor_column force;
-
-drop table ut_compound_data_tmp purge;
-
-drop table ut_compound_data_diff_tmp purge;
-
-drop table ut_json_data_diff_tmp purge;
-
-drop package ut_annotation_manager;
-
-drop package ut_annotation_parser;
-
-drop package ut_annotation_cache_manager;
-
-drop package ut_annotation_cache_macros;
-
-drop table ut_annotation_cache cascade constraints purge;
-
-drop table ut_annotation_cache_info cascade constraints purge;
-
-drop table ut_annotation_cache_schema cascade constraints purge;
-
-drop sequence ut_annotation_cache_seq;
-
-drop type ut_annotation_objs_cache_info force;
-
-drop type ut_annotation_obj_cache_info force;
-
-drop type ut_annotated_objects force;
-
-drop type ut_annotated_object force;
-
-drop type ut_annotations force;
-
-drop type ut_annotation force;
-
-drop package ut_trigger_check;
-
-drop package ut_file_mapper;
-
-drop package ut_metadata;
-
-drop package ut_ansiconsole_helper;
-
-begin
- null;
- $if dbms_db_version.version < 21 $then
- begin execute immediate 'drop type json force'; exception when others then null; end;
- $end
-end;
-/
-
-drop package ut_utils;
-
-drop type ut_stack force;
-
-drop sequence ut_savepoint_seq;
-
-drop type ut_tap_reporter force;
-
-drop type ut_documentation_reporter force;
-
-drop type ut_debug_reporter force;
-
-drop type ut_teamcity_reporter force;
-
-drop type ut_xunit_reporter force;
-
-drop type ut_junit_reporter force;
-
-drop type ut_tfs_junit_reporter force;
-
-drop type ut_event_listener force;
-
-drop type ut_output_reporter_base force;
-
-drop type ut_coverage_reporter_base force;
-
-drop type ut_reporters force;
-
-drop type ut_reporter_base force;
-
-drop type ut_run force;
-
-drop type ut_coverage_options force;
-
-drop type ut_file_mappings force;
-
-drop type ut_file_mapping force;
-
-drop type ut_suite_context force;
-
-drop type ut_suite force;
-
-drop type ut_logical_suite force;
-
-drop type ut_test force;
-
-drop type ut_console_reporter_base force;
-
-drop type ut_executable_test force;
-
-drop type ut_executables force;
-
-drop type ut_executable force;
-
-drop type ut_suite_items force;
-
-drop type ut_suite_item force;
-
-drop type ut_output_table_buffer force;
-
-drop type ut_output_clob_table_buffer force;
-
-drop type ut_output_bulk_buffer force;
-
-drop type ut_output_buffer_base force;
-
-drop table ut_output_buffer_tmp purge;
-
-drop sequence ut_output_buffer_tmp_seq;
-
-drop table ut_output_clob_buffer_tmp purge;
-
-drop sequence ut_output_clob_buffer_tmp_seq;
-
-drop table ut_output_buffer_info_tmp purge;
-
-drop package ut_session_context;
-
-drop type ut_session_info force;
-
-drop type ut_output_data_rows force;
-
-drop type ut_output_data_row force;
-
-drop type ut_results_counter force;
-
-drop type ut_run_info force;
-
-drop type ut_expectation_results force;
-
-drop type ut_expectation_result force;
-
-drop package ut_event_manager;
-
-drop type ut_event_item force;
-
-drop type ut_reporters_info force;
-
-drop type ut_reporter_info force;
-
-drop type ut_key_anyval_pair force;
-
-drop type ut_key_anyval_pairs force;
-
-drop type ut_key_value_pairs force;
-
-drop type ut_key_value_pair force;
-
-drop type ut_key_anyvalues force;
-
-drop type ut_object_names force;
-
-drop type ut_object_name force;
-
-drop type ut_integer_list force;
-
-drop type ut_varchar2_list force;
-
-drop type ut_varchar2_rows force;
-
-drop package ut_coverage_profiler;
-
-drop package ut_compound_data_helper;
-
-drop package ut_coverage_helper_profiler;
-
-drop type ut_have_count;
-
-drop type ut_compound_data_value;
-
-set echo off
-set feedback off
-declare
- i integer := 0;
-begin
- dbms_output.put_line('Dropping block coverage packages ' || upper('&&ut3_owner'));
- for pkg in (
- select object_name, owner
- from all_objects
- where 1 = 1
- and owner = upper('&&ut3_owner')
- and object_type = 'PACKAGE'
- and object_name in ('UT_COVERAGE_HELPER_BLOCK','UT_COVERAGE_BLOCK'))
- loop
-
- begin
-
- execute immediate 'drop package ' || pkg.owner || '.' || pkg.object_name;
- dbms_output.put_line('Dropped '|| pkg.object_name);
- i := i + 1;
-
- exception
- when others then
- dbms_output.put_line('FAILED to drop ' || pkg.object_name);
- end;
-
- end loop;
-
- dbms_output.put_line('&&line_separator');
- dbms_output.put_line(i || ' packages dropped');
-end;
-/
-
-declare
- e_role_not_exists exception;
- pragma exception_init(e_role_not_exists, -1919);
-begin
- execute immediate 'drop role &&ut3_owner._cbac_modify_objects_role';
- dbms_output.put_line('Role ' || upper('&&ut3_owner._cbac_modify_objects_role') || ' dropped');
-exception
- when e_role_not_exists then
- dbms_output.put_line('Role ' || upper('&&ut3_owner._cbac_modify_objects_role') || ' does not exist');
-end;
-/
diff --git a/source/uninstall_synonyms.sql b/source/uninstall_synonyms.sql
deleted file mode 100644
index 783ac51e8..000000000
--- a/source/uninstall_synonyms.sql
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-set echo off
-set feedback off
-declare
- i integer := 0;
-begin
- dbms_output.put_line('Dropping synonyms pointing to non-existing objects in schema '||upper('&&ut3_owner'));
- for syn in (
- select
- case when owner = 'PUBLIC'
- then 'public synonym '
- else 'synonym ' || owner || '.' end || synonym_name as syn_name,
- table_owner||'.'||table_name as for_object
- from all_synonyms s
- where table_owner = upper('&&ut3_owner') and table_owner != owner
- and not exists (select 1 from all_objects o where o.owner = s.table_owner and o.object_name = s.table_name)
- )
- loop
- begin
- execute immediate 'drop '||syn.syn_name;
- dbms_output.put_line('Dropped '||syn.syn_name||' for object '||syn.for_object);
- i := i + 1;
- exception
- when others then
- dbms_output.put_line('FAILED to drop '||syn.syn_name||' for object '||syn.for_object);
- end;
- end loop;
- dbms_output.put_line('&&line_separator');
- dbms_output.put_line(i||' synonyms dropped');
-end;
-/
-
-declare
- i integer := 0;
-begin
- dbms_output.put_line('Dropping synonyms pointing to PL/SQL code coverage objects ' || upper('&&ut3_owner'));
- for syn in (
- select
- case when owner = 'PUBLIC' then 'public synonym '
- else 'synonym ' || owner || '.'
- end || synonym_name as syn_name,
- table_owner || '.' || table_name as for_object
- from all_synonyms s
- where 1 = 1
- and table_owner = upper('&&ut3_owner')
- and synonym_name in ('DBMSPCC_BLOCKS','DBMSPCC_RUNS','DBMSPCC_UNITS')
- )
- loop
-
- begin
-
- execute immediate 'drop '||syn.syn_name;
- dbms_output.put_line('Dropped '||syn.syn_name||' for object '||syn.for_object);
- i := i + 1;
-
- exception
- when others then
- dbms_output.put_line('FAILED to drop '||syn.syn_name||' for object '||syn.for_object);
- end;
-
- end loop;
- dbms_output.put_line('&&line_separator');
- dbms_output.put_line(i||' synonyms dropped');
-end;
-/
diff --git a/source/ut3_cbac_modify_objects_role_grants.sql b/source/ut3_cbac_modify_objects_role_grants.sql
deleted file mode 100644
index b8748c46a..000000000
--- a/source/ut3_cbac_modify_objects_role_grants.sql
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- utPLSQL - Version 3
- Copyright 2016 - 2026 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License").
- You may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- Code based access control for the invoker rights packages ut_annotation_cache_manager, ut_annotation_manager,
- ut_suite_cache_manager and ut_suite_manager.
- The packages access the annotation and suite cache tables through the role _cbac_modify_objects_role,
- directly or through the SQL macros of ut_annotation_cache_macros and ut_suite_cache_macros,
- so the users calling the framework do not need any privileges on those tables.
- The types and packages used in SQL statements of those packages are granted to the role too,
- so they do not need to be granted to the users calling the framework.
-*/
-
-prompt Granting privileges to role &&ut3_owner._cbac_modify_objects_role
-
---annotation cache
-grant select, insert, update, delete on &&ut3_owner..ut_annotation_cache to &&ut3_owner._cbac_modify_objects_role;
-grant select, insert, update, delete on &&ut3_owner..ut_annotation_cache_info to &&ut3_owner._cbac_modify_objects_role;
-grant select, insert, update, delete on &&ut3_owner..ut_annotation_cache_schema to &&ut3_owner._cbac_modify_objects_role;
-grant select on &&ut3_owner..ut_annotation_cache_seq to &&ut3_owner._cbac_modify_objects_role;
-grant execute on &&ut3_owner..ut_annotation_obj_cache_info to &&ut3_owner._cbac_modify_objects_role;
-grant execute on &&ut3_owner..ut_annotated_object to &&ut3_owner._cbac_modify_objects_role;
-grant execute on &&ut3_owner..ut_annotation to &&ut3_owner._cbac_modify_objects_role;
-grant execute on &&ut3_owner..ut_annotations to &&ut3_owner._cbac_modify_objects_role;
-grant execute on &&ut3_owner..ut_annotation_cache_macros to &&ut3_owner._cbac_modify_objects_role;
-
---suite cache
-grant select, insert, update, delete on &&ut3_owner..ut_suite_cache to &&ut3_owner._cbac_modify_objects_role;
-grant select, insert, update, delete on &&ut3_owner..ut_suite_cache_package to &&ut3_owner._cbac_modify_objects_role;
-grant select, insert, update, delete on &&ut3_owner..ut_suite_cache_schema to &&ut3_owner._cbac_modify_objects_role;
-grant select on &&ut3_owner..ut_suite_cache_seq to &&ut3_owner._cbac_modify_objects_role;
-grant execute on &&ut3_owner..ut_suite_cache_row to &&ut3_owner._cbac_modify_objects_role;
-grant execute on &&ut3_owner..ut_suite_item_info to &&ut3_owner._cbac_modify_objects_role;
-grant execute on &&ut3_owner..ut_suite to &&ut3_owner._cbac_modify_objects_role;
-grant execute on &&ut3_owner..ut_test to &&ut3_owner._cbac_modify_objects_role;
-grant execute on &&ut3_owner..ut_executables to &&ut3_owner._cbac_modify_objects_role;
-grant execute on &&ut3_owner..ut_executable_test to &&ut3_owner._cbac_modify_objects_role;
-grant execute on &&ut3_owner..ut_varchar2_rows to &&ut3_owner._cbac_modify_objects_role;
-grant execute on &&ut3_owner..ut_integer_list to &&ut3_owner._cbac_modify_objects_role;
-grant execute on &&ut3_owner..ut_path_item to &&ut3_owner._cbac_modify_objects_role;
-grant execute on &&ut3_owner..ut_object_name to &&ut3_owner._cbac_modify_objects_role;
-grant execute on &&ut3_owner..ut_utils to &&ut3_owner._cbac_modify_objects_role;
-grant execute on &&ut3_owner..ut_suite_tag_filter to &&ut3_owner._cbac_modify_objects_role;
-grant execute on &&ut3_owner..ut_suite_cache_macros to &&ut3_owner._cbac_modify_objects_role;
-
-grant &&ut3_owner._cbac_modify_objects_role to package &&ut3_owner..ut_annotation_cache_manager;
-grant &&ut3_owner._cbac_modify_objects_role to package &&ut3_owner..ut_annotation_manager;
-grant &&ut3_owner._cbac_modify_objects_role to package &&ut3_owner..ut_suite_cache_manager;
-grant &&ut3_owner._cbac_modify_objects_role to package &&ut3_owner..ut_suite_manager;
-
diff --git a/source/ut_argument.tab b/source/ut_argument.tab
new file mode 100644
index 000000000..5c6d8ba39
--- /dev/null
+++ b/source/ut_argument.tab
@@ -0,0 +1,14 @@
+CREATE TABLE ut_argument (
+ id INTEGER ,
+ testcase_id INTEGER,
+ name VARCHAR2(200),
+ assertion_id INTEGER,
+ CONSTRAINT ut_argument_pk PRIMARY KEY (id)
+);
+
+ALTER table ut_argument add CONSTRAINT ut_argument_testcase_fk
+ FOREIGN KEY (testcase_id) REFERENCES ut_testcase;
+
+ALTER table ut_argument add CONSTRAINT ut_argument_assertion_fk
+ FOREIGN KEY (assertion_id) REFERENCES ut_assertion;
+
diff --git a/source/ut_assert.pkb b/source/ut_assert.pkb
new file mode 100644
index 000000000..6f0278984
--- /dev/null
+++ b/source/ut_assert.pkb
@@ -0,0 +1,653 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE BODY utassert
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.4 2004/11/16 09:46:48 chrisrimmer
+Changed to new version detection system.
+
+Revision 1.3 2004/07/14 17:01:57 chrisrimmer
+Added first version of pluggable reporter packages
+
+Revision 1.2 2003/07/01 19:36:46 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ g_showresults BOOLEAN := FALSE;
+
+ PROCEDURE this (
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE,
+ register_in IN BOOLEAN := TRUE -- 2.0.1
+ )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.this (
+ l_outcome,
+ msg_in,
+ check_this_in,
+ null_ok_in,
+ raise_exc_in,
+ register_in
+ );
+ END;
+
+ PROCEDURE eval (
+ msg_in IN VARCHAR2,
+ using_in IN VARCHAR2, -- The expression
+ value_name_in IN utAssert2.value_name_tt,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.eval (
+ l_outcome,
+ msg_in,
+ using_in,
+ value_name_in,
+ null_ok_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eval (
+ msg_in IN VARCHAR2,
+ using_in IN VARCHAR2, -- The expression
+ value1_in IN VARCHAR2,
+ value2_in IN VARCHAR2,
+ name1_in IN VARCHAR2 := NULL,
+ name2_in IN VARCHAR2 := NULL,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ value_name utAssert2.value_name_tt;
+ BEGIN
+ value_name(1).value := value1_in;
+ value_name(1).name := name1_in;
+ value_name(2).value := value2_in;
+ value_name(2).name := name2_in;
+
+ utassert2.eval (
+ l_outcome,
+ msg_in,
+ using_in,
+ value_name,
+ null_ok_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eq (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.eq (
+ l_outcome,
+ msg_in,
+ check_this_in,
+ against_this_in,
+ null_ok_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eq (
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ against_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.eq (
+ l_outcome,
+ msg_in,
+ check_this_in,
+ against_this_in,
+ null_ok_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eq (
+ msg_in IN VARCHAR2,
+ check_this_in IN DATE,
+ against_this_in IN DATE,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE,
+ truncate_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.eq (
+ l_outcome,
+ msg_in,
+ check_this_in,
+ against_this_in,
+ null_ok_in,
+ raise_exc_in,
+ truncate_in
+ );
+ END;
+
+ PROCEDURE eqtable (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ check_where_in IN VARCHAR2 := NULL,
+ against_where_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.eqtable (
+ l_outcome,
+ msg_in,
+ check_this_in,
+ against_this_in,
+ check_where_in,
+ against_where_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eqtabcount (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ check_where_in IN VARCHAR2 := NULL,
+ against_where_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.eqtabcount (
+ l_outcome,
+ msg_in,
+ check_this_in,
+ against_this_in,
+ check_where_in,
+ against_where_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eqquery (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.eqquery (
+ l_outcome,
+ msg_in,
+ check_this_in,
+ against_this_in,
+ raise_exc_in
+ );
+ END;
+
+ --Check a query against a single VARCHAR2 value
+ PROCEDURE eqqueryvalue (
+ msg_in IN VARCHAR2,
+ check_query_in IN VARCHAR2,
+ against_value_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.eqqueryvalue (
+ l_outcome,
+ msg_in,
+ check_query_in,
+ against_value_in,
+ null_ok_in,
+ raise_exc_in
+ );
+ END;
+
+ -- Check a query against a single DATE value
+ PROCEDURE eqqueryvalue (
+ msg_in IN VARCHAR2,
+ check_query_in IN VARCHAR2,
+ against_value_in IN DATE,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.eqqueryvalue (
+ l_outcome,
+ msg_in,
+ check_query_in,
+ against_value_in,
+ null_ok_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eqqueryvalue (
+ msg_in IN VARCHAR2,
+ check_query_in IN VARCHAR2,
+ against_value_in IN NUMBER,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.eqqueryvalue (
+ l_outcome,
+ msg_in,
+ check_query_in,
+ against_value_in,
+ null_ok_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eqcursor (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ -- User passes in names of two packaged cursors.
+ -- Have to loop through each row and compare!
+ -- How do I compare the contents of two records
+ -- which have been defined dynamically?
+ IS
+ BEGIN
+ utreport.pl ('utAssert.eqCursor is not yet implemented!');
+ END;
+
+ PROCEDURE eqfile (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ check_this_dir_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ against_this_dir_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.eqfile (
+ l_outcome,
+ msg_in,
+ check_this_in,
+ check_this_dir_in,
+ against_this_in,
+ against_this_dir_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eqpipe (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ check_nth_in IN VARCHAR2 := NULL,
+ against_nth_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.eqpipe (
+ l_outcome,
+ msg_in,
+ check_this_in,
+ against_this_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eqcoll (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ eqfunc_in IN VARCHAR2 := NULL,
+ check_startrow_in IN PLS_INTEGER := NULL,
+ check_endrow_in IN PLS_INTEGER := NULL,
+ against_startrow_in IN PLS_INTEGER := NULL,
+ against_endrow_in IN PLS_INTEGER := NULL,
+ match_rownum_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.eqcoll (
+ l_outcome,
+ msg_in,
+ check_this_in,
+ against_this_in,
+ eqfunc_in,
+ check_startrow_in,
+ check_endrow_in,
+ against_startrow_in,
+ against_endrow_in,
+ match_rownum_in,
+ null_ok_in,
+ raise_exc_in
+ );
+ END;
+
+ /* API based access to collections */
+ PROCEDURE eqcollapi (
+ msg_in IN VARCHAR2,
+ check_this_pkg_in IN VARCHAR2,
+ against_this_pkg_in IN VARCHAR2,
+ eqfunc_in IN VARCHAR2 := NULL,
+ countfunc_in IN VARCHAR2 := 'COUNT',
+ firstrowfunc_in IN VARCHAR2 := 'FIRST',
+ lastrowfunc_in IN VARCHAR2 := 'LAST',
+ nextrowfunc_in IN VARCHAR2 := 'NEXT',
+ getvalfunc_in IN VARCHAR2 := 'NTHVAL',
+ check_startrow_in IN PLS_INTEGER := NULL,
+ check_endrow_in IN PLS_INTEGER := NULL,
+ against_startrow_in IN PLS_INTEGER := NULL,
+ against_endrow_in IN PLS_INTEGER := NULL,
+ match_rownum_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.eqcollapi (
+ l_outcome,
+ msg_in,
+ check_this_pkg_in,
+ against_this_pkg_in,
+ eqfunc_in,
+ countfunc_in,
+ firstrowfunc_in,
+ lastrowfunc_in,
+ nextrowfunc_in,
+ getvalfunc_in,
+ check_startrow_in,
+ check_endrow_in,
+ against_startrow_in,
+ against_endrow_in,
+ match_rownum_in,
+ null_ok_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE isnotnull (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.isnotnull (l_outcome, msg_in, check_this_in, raise_exc_in);
+ END;
+
+ PROCEDURE isnull (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.isnull (l_outcome, msg_in, check_this_in, raise_exc_in);
+ END;
+
+ PROCEDURE isnotnull (
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.isnotnull (l_outcome, msg_in, check_this_in, raise_exc_in);
+ END;
+
+ PROCEDURE isnull (
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.isnull (l_outcome, msg_in, check_this_in, raise_exc_in);
+ END;
+
+ --Check a given call throws a named exception
+ PROCEDURE throws (
+ msg_in VARCHAR2,
+ check_call_in IN VARCHAR2,
+ against_exc_in IN VARCHAR2
+ )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.throws (l_outcome, msg_in, check_call_in, against_exc_in);
+ END;
+
+ --Check a given call throws an exception with a given SQLCODE
+ PROCEDURE throws (
+ msg_in VARCHAR2,
+ check_call_in IN VARCHAR2,
+ against_exc_in IN NUMBER
+ )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.throws (l_outcome, msg_in, check_call_in, against_exc_in);
+ END;
+
+ PROCEDURE showresults
+ IS
+ BEGIN
+ g_showresults := TRUE;
+ END;
+
+ PROCEDURE noshowresults
+ IS
+ BEGIN
+ g_showresults := FALSE;
+ END;
+
+ FUNCTION showing_results
+ RETURN BOOLEAN
+ IS
+ BEGIN
+ RETURN g_showresults;
+ END;
+
+/* START username:studious Date:01/11/2002 Task_id:42690
+Description: Checking whether object exists */
+
+ PROCEDURE objExists (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ )IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.objExists (
+ l_outcome,
+ msg_in,
+ check_this_in,
+ null_ok_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE objnotExists (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ )IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.objnotExists (
+ l_outcome,
+ msg_in,
+ check_this_in,
+ null_ok_in,
+ raise_exc_in
+ );
+ END;
+/* END username:studious Task_id:42690*/
+
+ /* START chrisrimmer 42694 */
+ FUNCTION previous_passed
+ RETURN BOOLEAN
+ IS
+ BEGIN
+ RETURN utAssert2.previous_passed;
+ END;
+
+ FUNCTION previous_failed
+ RETURN BOOLEAN
+ IS
+ BEGIN
+ RETURN utAssert2.previous_failed;
+ END;
+ /* END chrisrimmer 42694 */
+
+ /* START chrisrimmer 42696 */
+ PROCEDURE eqoutput (
+ msg_in IN VARCHAR2,
+ check_this_in IN DBMS_OUTPUT.CHARARR,
+ against_this_in IN DBMS_OUTPUT.CHARARR,
+ ignore_case_in IN BOOLEAN := FALSE,
+ ignore_whitespace_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.eqoutput(
+ l_outcome,
+ msg_in,
+ check_this_in,
+ against_this_in,
+ ignore_case_in,
+ ignore_whitespace_in,
+ null_ok_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eqoutput (
+ msg_in IN VARCHAR2,
+ check_this_in IN DBMS_OUTPUT.CHARARR,
+ against_this_in IN VARCHAR2,
+ line_delimiter_in IN CHAR := NULL,
+ ignore_case_in IN BOOLEAN := FALSE,
+ ignore_whitespace_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.eqoutput(
+ l_outcome,
+ msg_in,
+ check_this_in,
+ against_this_in,
+ line_delimiter_in,
+ ignore_case_in,
+ ignore_whitespace_in,
+ null_ok_in,
+ raise_exc_in
+ );
+ END;
+ /* END chrisrimmer 42696 */
+
+ /* START VENKY11 45789 */
+
+ PROCEDURE eq_refc_table(
+ p_msg_nm IN VARCHAR2,
+ proc_name IN VARCHAR2,
+ params IN utplsql_util.utplsql_params,
+ cursor_position IN PLS_INTEGER,
+ table_name IN VARCHAR2 )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.eq_refc_table(l_outcome,p_msg_nm,proc_name,params,cursor_position,table_name);
+ END;
+
+ PROCEDURE eq_refc_query(
+ p_msg_nm IN VARCHAR2,
+ proc_name IN VARCHAR2,
+ params IN utplsql_util.utplsql_params,
+ cursor_position IN PLS_INTEGER,
+ qry IN VARCHAR2 )
+ IS
+ l_outcome ut_outcome.id%TYPE;
+ BEGIN
+ utassert2.eq_refc_query(l_outcome,p_msg_nm,proc_name,params,cursor_position,qry);
+ END;
+
+ /* END VENKY11 45789 */
+
+END utassert;
+/
diff --git a/source/ut_assert.pks b/source/ut_assert.pks
new file mode 100644
index 000000000..e271ce1f9
--- /dev/null
+++ b/source/ut_assert.pks
@@ -0,0 +1,323 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE utassert &start_ge_8_1 AUTHID CURRENT_USER &end_ge_8_1
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:46 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ test_failure EXCEPTION;
+ /* On Error behaviors */
+ c_continue CONSTANT CHAR (1) := 'c';
+ c_stop CONSTANT CHAR (1) := 's';
+
+ PROCEDURE this (
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE,
+ register_in IN BOOLEAN := TRUE -- 2.0.1
+ );
+
+ /*
+ 2.0.8 General evaluation program.
+ */
+ PROCEDURE eval (
+ msg_in IN VARCHAR2,
+ using_in IN VARCHAR2, -- The expression
+ value_name_in IN utAssert2.value_name_tt,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eval (
+ msg_in IN VARCHAR2,
+ using_in IN VARCHAR2, -- The expression
+ value1_in IN VARCHAR2,
+ value2_in IN VARCHAR2,
+ name1_in IN VARCHAR2 := NULL,
+ name2_in IN VARCHAR2 := NULL,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eq (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eq (
+ msg_in IN VARCHAR2,
+ check_this_in IN DATE,
+ against_this_in IN DATE,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE,
+ truncate_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eq (
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ against_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eqtable (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ check_where_in IN VARCHAR2 := NULL,
+ against_where_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eqtabcount (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ check_where_in IN VARCHAR2 := NULL,
+ against_where_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eqquery (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ --Check a query against a single VARCHAR2 value
+ PROCEDURE eqqueryvalue (
+ msg_in IN VARCHAR2,
+ check_query_in IN VARCHAR2,
+ against_value_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ -- Check a query against a single DATE value
+ PROCEDURE eqqueryvalue (
+ msg_in IN VARCHAR2,
+ check_query_in IN VARCHAR2,
+ against_value_in IN DATE,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ -- Check a query against a single NUMERIC value
+ PROCEDURE eqqueryvalue (
+ msg_in IN VARCHAR2,
+ check_query_in IN VARCHAR2,
+ against_value_in IN NUMBER,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ -- Not currently implemented
+ PROCEDURE eqcursor (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eqfile (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ check_this_dir_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ against_this_dir_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eqpipe (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ check_nth_in IN VARCHAR2 := NULL,
+ against_nth_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ /* Direct access to collections */
+ PROCEDURE eqcoll (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2, /* pkg1.coll */
+ against_this_in IN VARCHAR2, /* pkg2.coll */
+ eqfunc_in IN VARCHAR2 := NULL,
+ check_startrow_in IN PLS_INTEGER := NULL,
+ check_endrow_in IN PLS_INTEGER := NULL,
+ against_startrow_in IN PLS_INTEGER := NULL,
+ against_endrow_in IN PLS_INTEGER := NULL,
+ match_rownum_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ /* API based access to collections */
+ PROCEDURE eqcollapi (
+ msg_in IN VARCHAR2,
+ check_this_pkg_in IN VARCHAR2,
+ against_this_pkg_in IN VARCHAR2,
+ eqfunc_in IN VARCHAR2 := NULL,
+ countfunc_in IN VARCHAR2 := 'COUNT',
+ firstrowfunc_in IN VARCHAR2 := 'FIRST',
+ lastrowfunc_in IN VARCHAR2 := 'LAST',
+ nextrowfunc_in IN VARCHAR2 := 'NEXT',
+ getvalfunc_in IN VARCHAR2 := 'NTHVAL',
+ check_startrow_in IN PLS_INTEGER := NULL,
+ check_endrow_in IN PLS_INTEGER := NULL,
+ against_startrow_in IN PLS_INTEGER := NULL,
+ against_endrow_in IN PLS_INTEGER := NULL,
+ match_rownum_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE isnotnull (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE isnull (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ -- 1.5.2
+ PROCEDURE isnotnull (
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE isnull (
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ --Check a given call throws a named exception
+ PROCEDURE throws (
+ msg_in VARCHAR2,
+ check_call_in IN VARCHAR2,
+ against_exc_in IN VARCHAR2
+ );
+
+ --Check a given call throws an exception with a given SQLCODE
+ PROCEDURE throws (
+ msg_in VARCHAR2,
+ check_call_in IN VARCHAR2,
+ against_exc_in IN NUMBER
+ );
+
+ PROCEDURE showresults;
+
+ PROCEDURE noshowresults;
+
+ FUNCTION showing_results
+ RETURN BOOLEAN;
+
+/* START username:STUDIOUS Date:01/11/2002 Task_id:42690
+Description: Checking whether object exists*/
+
+ PROCEDURE objExists (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+PROCEDURE objnotExists (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+/* END username:STUDIOUS Task_id:42690*/
+
+ /* START chrisrimmer 42694 */
+ FUNCTION previous_passed
+ RETURN BOOLEAN;
+
+ FUNCTION previous_failed
+ RETURN BOOLEAN;
+ /* END chrisrimmer 42694 */
+
+ /* START chrisrimmer 42696 */
+ PROCEDURE eqoutput (
+ msg_in IN VARCHAR2,
+ check_this_in IN DBMS_OUTPUT.CHARARR,
+ against_this_in IN DBMS_OUTPUT.CHARARR,
+ ignore_case_in IN BOOLEAN := FALSE,
+ ignore_whitespace_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eqoutput (
+ msg_in IN VARCHAR2,
+ check_this_in IN DBMS_OUTPUT.CHARARR,
+ against_this_in IN VARCHAR2,
+ line_delimiter_in IN CHAR := NULL,
+ ignore_case_in IN BOOLEAN := FALSE,
+ ignore_whitespace_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+ /* END chrisrimmer 42696 */
+
+ /* START VENKY11 45789 */
+ PROCEDURE eq_refc_table(
+ p_msg_nm IN VARCHAR2,
+ proc_name IN VARCHAR2,
+ params IN utplsql_util.utplsql_params,
+ cursor_position IN PLS_INTEGER,
+ table_name IN VARCHAR2 );
+
+ PROCEDURE eq_refc_query(
+ p_msg_nm IN VARCHAR2,
+ proc_name IN VARCHAR2,
+ params IN utplsql_util.utplsql_params,
+ cursor_position IN PLS_INTEGER,
+ qry IN VARCHAR2 );
+
+ /* END VENKY11 45789 */
+
+
+END utassert;
+/
diff --git a/source/ut_assert2.pkb b/source/ut_assert2.pkb
new file mode 100644
index 000000000..3ccb65c94
--- /dev/null
+++ b/source/ut_assert2.pkb
@@ -0,0 +1,3658 @@
+CREATE OR REPLACE PACKAGE BODY utassert2
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.5 2004/11/16 09:46:48 chrisrimmer
+Changed to new version detection system.
+
+Revision 1.4 2004/07/14 17:01:57 chrisrimmer
+Added first version of pluggable reporter packages
+
+Revision 1.3 2003/07/11 14:32:52 chrisrimmer
+Added 'throws' bugfix from Ivan Desjardins
+
+Revision 1.2 2003/07/01 19:36:46 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ /* START chrisrimmer 42694 */
+ g_previous_pass BOOLEAN;
+ /* END chrisrimmer 42694 */
+
+ g_showresults BOOLEAN := FALSE ;
+ c_not_placeholder CONSTANT VARCHAR2 (10)
+ := '#$NOT$#';
+
+ FUNCTION id (name_in IN ut_assertion.NAME%TYPE)
+ RETURN ut_assertion.id%TYPE
+ IS
+ retval ut_assertion.id%TYPE;
+ BEGIN
+ SELECT id
+ INTO retval
+ FROM ut_assertion
+ WHERE NAME = UPPER (name_in);
+
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END;
+
+ FUNCTION NAME (id_in IN ut_assertion.id%TYPE)
+ RETURN ut_assertion.NAME%TYPE
+ IS
+ retval ut_assertion.NAME%TYPE;
+ BEGIN
+ SELECT NAME
+ INTO retval
+ FROM ut_assertion
+ WHERE id = id_in;
+
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END;
+
+ FUNCTION replace_not_placeholder (
+ stg_in IN VARCHAR2,
+ success_in IN BOOLEAN
+ )
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ IF success_in
+ THEN
+ RETURN REPLACE (
+ stg_in,
+ c_not_placeholder,
+ NULL
+ );
+ ELSE
+ RETURN REPLACE (
+ stg_in,
+ c_not_placeholder,
+ ' not '
+ );
+ END IF;
+ END;
+
+ PROCEDURE this (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE ,
+ raise_exc_in IN BOOLEAN := FALSE ,
+ register_in IN BOOLEAN := TRUE
+ )
+ IS
+ l_failure BOOLEAN
+ := NOT check_this_in
+ OR ( check_this_in IS NULL
+ AND NOT null_ok_in
+ );
+ BEGIN
+ /* START chrisrimmer 42694 */
+ g_previous_pass := NOT l_failure;
+
+ /* END chrisrimmer 42694 */
+
+ IF utplsql2.tracing
+ THEN
+ utreport.pl (
+ 'utPLSQL TRACE on Assert: '
+ || msg_in
+ );
+ utreport.pl ('Results:');
+ utreport.pl (l_failure);
+ END IF;
+
+ -- Report results failure and success
+
+ utresult2.report (
+ outcome_in,
+ l_failure,
+ utplsql.currcase.pkg || '.' || utplsql.currcase.name || ': ' || msg_in,
+ /* 2.0.10.2 Idea from Alistair Bayley msg_in */
+ register_in,
+ showing_results
+ );
+
+ IF raise_exc_in
+ AND l_failure
+ THEN
+ RAISE test_failure;
+ END IF;
+ END;
+
+ -- Support success and failure messages
+ PROCEDURE this (
+ outcome_in IN ut_outcome.id%TYPE,
+ success_msg_in IN VARCHAR2,
+ failure_msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE ,
+ raise_exc_in IN BOOLEAN := FALSE ,
+ register_in IN BOOLEAN := TRUE
+ )
+ IS
+ l_failure BOOLEAN
+ := NOT check_this_in
+ OR ( check_this_in IS NULL
+ AND NOT null_ok_in
+ );
+ BEGIN
+ IF l_failure
+ THEN
+ this (
+ outcome_in,
+ failure_msg_in,
+ check_this_in,
+ null_ok_in,
+ raise_exc_in,
+ register_in
+ );
+ ELSE
+ this (
+ outcome_in,
+ success_msg_in,
+ check_this_in,
+ null_ok_in,
+ raise_exc_in,
+ register_in
+ );
+ END IF;
+ END;
+
+ FUNCTION expected (
+ type_in IN VARCHAR2,
+ msg_in IN VARCHAR2,
+ value_in IN VARCHAR2
+ )
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ RETURN ( type_in
+ || ' "'
+ || msg_in
+ || '" Result: "'
+ || value_in
+ || '"'
+ );
+ END;
+
+ FUNCTION file_descrip (
+ file_in IN VARCHAR2,
+ dir_in IN VARCHAR2
+ )
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ RETURN file_in
+ || '" located in "'
+ || dir_in;
+ END;
+
+ FUNCTION message_expected (
+ type_in IN VARCHAR2,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2
+ )
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ RETURN ( type_in
+ || ' "'
+ || msg_in
+ || '" Expected "'
+ || against_this_in
+ || '" and got "'
+ || check_this_in
+ || '"'
+ );
+ END;
+
+ FUNCTION message (
+ type_in IN VARCHAR2,
+ msg_in IN VARCHAR2,
+ value_in IN VARCHAR2
+ )
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ RETURN ( type_in
+ || ' "'
+ || msg_in
+ || '" Result: '
+ || value_in
+ );
+ END;
+
+ -- Convert outcome name to ID.
+ PROCEDURE get_id (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ outcome_out OUT ut_outcome.id%TYPE
+ )
+ IS
+ l_id ut_outcome.id%TYPE;
+ BEGIN
+ l_id := utoutcome.id (outcome_in);
+
+ IF l_id IS NULL
+ THEN
+ IF utplsql2.tracing
+ THEN
+ utreport.pl (
+ 'Outcome '
+ || outcome_in
+ || ' is not defined.'
+ );
+ END IF;
+
+ utrerror.oc_report (
+ run_in=> utplsql2.runnum,
+ outcome_in=> NULL,
+ errcode_in=> utrerror.undefined_outcome,
+ errtext_in=> 'Outcome "'
+ || outcome_in
+ || '" is not defined.'
+ );
+ ELSE
+ outcome_out := l_id;
+ END IF;
+ END;
+
+ -- 2.0.8 General evaluation mechanism
+ PROCEDURE eval (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ using_in IN VARCHAR2, -- The expression
+ value_name_in IN value_name_tt,
+ null_ok_in IN BOOLEAN := FALSE ,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ fdbk PLS_INTEGER;
+ cur PLS_INTEGER
+ := DBMS_SQL.open_cursor;
+ eval_result CHAR (1);
+ eval_block utplsql.maxvc2_t; -- Clear issues of size limitation!
+ value_name_str utplsql.maxvc2_t;
+ eval_description utplsql.maxvc2_t;
+ parse_error EXCEPTION;
+ BEGIN
+ IF utplsql2.tracing
+ THEN
+ -- Optional trace of assertion call.
+ --utreport.pl ();
+ NULL;
+ END IF;
+
+ FOR indx IN
+ value_name_in.FIRST .. value_name_in.LAST
+ LOOP
+ value_name_str :=
+ value_name_str
+ || ' '
+ || NVL (
+ value_name_in (indx).NAME,
+ 'P'
+ || indx
+ )
+ || ' = '
+ || value_name_in (indx).VALUE;
+ END LOOP;
+
+ eval_description := 'Evaluation of "'
+ || using_in
+ || '" with'
+ || value_name_str;
+ eval_block :=
+ 'DECLARE
+ b_result BOOLEAN;
+ BEGIN
+ b_result := '
+ || using_in
+ || ';
+ IF b_result THEN :result := '''
+ || utplsql.c_yes
+ || '''; '
+ || 'ELSIF NOT b_result THEN :result := '''
+ || utplsql.c_no
+ || '''; '
+ || 'ELSE :result := NULL;
+ END IF;
+ END;';
+
+ BEGIN
+ DBMS_SQL.parse (
+ cur,
+ eval_block,
+ DBMS_SQL.native
+ );
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ -- Report the parse error!
+ IF DBMS_SQL.is_open (cur)
+ THEN
+ DBMS_SQL.close_cursor (cur);
+ END IF;
+
+ this (
+ outcome_in=> outcome_in,
+ success_msg_in=> NULL,
+ failure_msg_in=> 'Error '
+ || SQLCODE
+ || ' parsing '
+ || eval_block,
+ check_this_in=> FALSE ,
+ null_ok_in=> null_ok_in,
+ raise_exc_in=> raise_exc_in
+ );
+ RAISE parse_error;
+ END;
+
+ FOR indx IN
+ value_name_in.FIRST .. value_name_in.LAST
+ LOOP
+ DBMS_SQL.bind_variable (
+ cur,
+ NVL (
+ value_name_in (indx).NAME,
+ 'P'
+ || indx
+ ),
+ value_name_in (indx).VALUE
+ );
+ END LOOP;
+
+ DBMS_SQL.bind_variable (cur, 'result', 'a');
+ fdbk := DBMS_SQL.EXECUTE (cur);
+ DBMS_SQL.variable_value (
+ cur,
+ 'result',
+ eval_result
+ );
+ DBMS_SQL.close_cursor (cur);
+ this (
+ outcome_in=> outcome_in,
+ success_msg_in=> eval_description
+ || ' evaluated to TRUE',
+ failure_msg_in=> eval_description
+ || ' evaluated to FALSE',
+ check_this_in=> utplsql.vc2bool (
+ eval_result
+ ),
+ null_ok_in=> null_ok_in,
+ raise_exc_in=> raise_exc_in
+ );
+ EXCEPTION
+ WHEN parse_error
+ THEN
+ IF raise_exc_in
+ THEN
+ RAISE;
+ ELSE
+ NULL;
+ END IF;
+ WHEN OTHERS
+ THEN
+ IF DBMS_SQL.is_open (cur)
+ THEN
+ DBMS_SQL.close_cursor (cur);
+ END IF;
+
+ -- Likely the block got too large!
+ this (
+ outcome_in=> outcome_in,
+ success_msg_in=> NULL,
+ failure_msg_in=> 'Error in '
+ || eval_description
+ || ' SQLERRM: '
+ || SQLERRM,
+ check_this_in=> FALSE ,
+ null_ok_in=> null_ok_in,
+ raise_exc_in=> raise_exc_in
+ );
+ END;
+
+ PROCEDURE eval (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ msg_in IN VARCHAR2,
+ using_in IN VARCHAR2, -- The expression
+ value_name_in IN value_name_tt,
+ null_ok_in IN BOOLEAN := FALSE ,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_id ut_outcome.id%TYPE;
+ BEGIN
+ get_id (outcome_in, l_id);
+ eval (
+ l_id,
+ msg_in,
+ using_in,
+ value_name_in,
+ null_ok_in,
+ raise_exc_in
+ );
+ END;
+
+ /*
+ Template Assertion program
+
+ PROCEDURE (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ BEGIN
+ IF utplsql2.tracing
+ THEN
+ -- Optional trace of assertion call.
+ utreport.pl ();
+ END IF;
+
+ this (
+ outcome_in => outcome_in,
+ success_msg_in =>
+ ,
+ failure_msg_in =>
+ ,
+ check_this_in =>
+ ,
+ null_ok_in => FALSE,
+ raise_exc_in => raise_exc_in
+ );
+ END;
+
+ You might find the message_expected private program useful in
+ constructing your message. Also the replace_not_placeholder and
+ c_not_placeholder may come in handy if you want to use the this
+ assertion program that accepts just a single message, as many
+ of the original assertion programs do.
+
+ */
+
+ PROCEDURE eq (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE ,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ BEGIN
+ IF utplsql2.tracing
+ THEN
+ utreport.pl (
+ 'EQ Compare "'
+ || check_this_in
+ || '" to "'
+ || against_this_in
+ || '"'
+ );
+ END IF;
+
+ this (
+ outcome_in=> outcome_in,
+ msg_in=> message_expected (
+ 'EQ',
+ msg_in,
+ check_this_in,
+ against_this_in
+ ),
+ check_this_in=> (NVL (
+ check_this_in =
+ against_this_in,
+ FALSE
+ )
+ )
+ OR ( check_this_in IS NULL
+ AND against_this_in IS NULL
+ AND null_ok_in
+ ),
+ null_ok_in=> FALSE ,
+ raise_exc_in=> raise_exc_in
+ );
+ END;
+
+ FUNCTION b2v (bool_in IN BOOLEAN)
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ IF bool_in
+ THEN
+ RETURN 'TRUE';
+ ELSIF NOT bool_in
+ THEN
+ RETURN 'FALSE';
+ ELSE
+ RETURN 'NULL';
+ END IF;
+ END;
+
+ PROCEDURE eq (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ against_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE ,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ BEGIN
+ IF utplsql2.tracing
+ THEN
+ utreport.pl (
+ 'Compare "'
+ || b2v (check_this_in)
+ || '" to "'
+ || b2v (against_this_in)
+ || '"'
+ );
+ END IF;
+
+ this (
+ outcome_in,
+ message_expected (
+ 'EQ',
+ msg_in,
+ utplsql.bool2vc (check_this_in),
+ utplsql.bool2vc (against_this_in)
+ ),
+ (check_this_in = against_this_in)
+ OR ( check_this_in IS NULL
+ AND against_this_in IS NULL
+ AND null_ok_in
+ ),
+ FALSE ,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eq (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN DATE,
+ against_this_in IN DATE,
+ null_ok_in IN BOOLEAN := FALSE ,
+ raise_exc_in IN BOOLEAN := FALSE ,
+ truncate_in IN BOOLEAN := FALSE
+ )
+ IS
+ c_format CONSTANT VARCHAR2 (30)
+ := 'MONTH DD, YYYY HH24MISS';
+ v_check VARCHAR2 (100);
+ v_against VARCHAR2 (100);
+ BEGIN
+ IF truncate_in
+ THEN
+ v_check := TO_CHAR (
+ TRUNC (check_this_in),
+ c_format
+ );
+ v_against :=
+ TO_CHAR (
+ TRUNC (against_this_in),
+ c_format
+ );
+ ELSE
+ v_check :=
+ TO_CHAR (check_this_in, c_format);
+ v_against :=
+ TO_CHAR (against_this_in, c_format);
+ END IF;
+
+ IF utplsql2.tracing
+ THEN
+ utreport.pl (
+ 'Compare "'
+ || v_check
+ || '" to "'
+ || v_against
+ || '"'
+ );
+ END IF;
+
+ this (
+ outcome_in,
+ message_expected (
+ 'EQ',
+ msg_in,
+ TO_CHAR (
+ check_this_in,
+ 'MON-DD-YYYY HH:MI:SS'
+ ),
+ TO_CHAR (
+ against_this_in,
+ 'MON-DD-YYYY HH:MI:SS'
+ )
+ ),
+ (check_this_in = against_this_in)
+ OR ( check_this_in IS NULL
+ AND against_this_in IS NULL
+ AND null_ok_in
+ ),
+ FALSE ,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE ieqminus (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ query1_in IN VARCHAR2,
+ query2_in IN VARCHAR2,
+ minus_desc_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ &start_lt_8_1
+ fdbk PLS_INTEGER;
+ cur PLS_INTEGER
+ := DBMS_SQL.open_cursor;
+ &end_lt_8_1
+ ival PLS_INTEGER;
+ /* 2.0.8 suggested replacement below by Chris Rimmer
+to avoid duplicate column name issues
+:= 'DECLARE
+ CURSOR cur IS ('
+|| query1_in
+|| ' MINUS '
+|| query2_in
+|| ')
+UNION
+('
+|| query2_in
+|| ' MINUS '
+|| query1_in
+|| '); */
+ v_block VARCHAR2 (32767)
+ := 'DECLARE
+ CURSOR cur IS
+ SELECT 1
+ FROM DUAL
+ WHERE EXISTS (('
+ ||' ( ' || query1_in ||' ) '
+ || ' MINUS '
+ ||' ( ' || query2_in ||' ) '
+ || ')
+ UNION
+ ('
+ ||' ( ' || query2_in ||' ) '
+ || ' MINUS '
+ ||' ( ' || query1_in ||' ) '
+ || '));
+ rec cur%ROWTYPE;
+ BEGIN
+ OPEN cur;
+ FETCH cur INTO rec;
+ IF cur%FOUND
+ THEN
+ :retval := 1;
+ ELSE
+ :retval := 0;
+ END IF;
+ CLOSE cur;
+ END;';
+ BEGIN
+ &start_ge_8_1
+ EXECUTE IMMEDIATE v_block USING OUT ival;
+ &start_ge_8_1
+ &start_lt_8_1
+ DBMS_SQL.parse (
+ cur,
+ v_block,
+ DBMS_SQL.native
+ );
+ DBMS_SQL.bind_variable (
+ cur,
+ ':retval',
+ ival
+ );
+ -- 1.5.6
+ fdbk := DBMS_SQL.EXECUTE (cur);
+ DBMS_SQL.variable_value (
+ cur,
+ 'retval',
+ ival
+ );
+ DBMS_SQL.close_cursor (cur);
+ &end_lt_8_1
+
+ this (
+ outcome_in,
+ replace_not_placeholder (
+ msg_in,
+ ival = 0
+ ),
+ ival = 0,
+ FALSE ,
+ raise_exc_in
+ );
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ &start_lt_8_1
+ DBMS_SQL.close_cursor (cur);
+ &end_lt_8_1
+
+
+ this (
+ outcome_in,
+ replace_not_placeholder (
+ msg_in
+ || ' SQL Failure: '
+ || SQLERRM,
+ SQLCODE = 0
+ ),
+ SQLCODE = 0,
+ FALSE ,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eqtable (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ check_where_in IN VARCHAR2 := NULL,
+ against_where_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ CURSOR info_cur (
+ sch_in IN VARCHAR2,
+ tab_in IN VARCHAR2
+ )
+ IS
+ SELECT t.column_name
+ FROM all_tab_columns t
+ WHERE t.owner = sch_in
+ AND t.table_name = tab_in
+ ORDER BY column_id;
+
+ FUNCTION collist (tab IN VARCHAR2)
+ RETURN VARCHAR2
+ IS
+ l_schema VARCHAR2 (100);
+ l_table VARCHAR2 (100);
+ l_dot PLS_INTEGER
+ := INSTR (tab, '.');
+ retval VARCHAR2 (32767);
+ BEGIN
+ IF l_dot = 0
+ THEN
+ l_schema := USER;
+ l_table := UPPER (tab);
+ ELSE
+ l_schema := UPPER (
+ SUBSTR (
+ tab,
+ 1,
+ l_dot
+ - 1
+ )
+ );
+ l_table :=
+ UPPER (SUBSTR (tab, l_dot
+ + 1));
+ END IF;
+
+ FOR rec IN info_cur (l_schema, l_table)
+ LOOP
+ retval :=
+ retval
+ || ','
+ || rec.column_name;
+ END LOOP;
+
+ RETURN LTRIM (retval, ',');
+ END;
+ BEGIN
+ ieqminus (
+ outcome_in,
+ message (
+ 'EQTABLE',
+ msg_in,
+ 'Contents of "'
+ || check_this_in
+ || utplsql.ifelse (
+ check_where_in IS NULL,
+ '"',
+ '" WHERE '
+ || check_where_in
+ )
+ || ' does '
+ || c_not_placeholder -- utplsql.ifelse (NOT l_failure, NULL, ' not ')
+ || 'match "'
+ || against_this_in
+ || utplsql.ifelse (
+ against_where_in IS NULL,
+ '"',
+ '" WHERE '
+ || against_where_in
+ )
+ ),
+ 'SELECT T1.*, COUNT(*) FROM '
+ || check_this_in
+ || ' T1 WHERE '
+ || NVL (check_where_in, '1=1')
+ || ' GROUP BY '
+ || collist (check_this_in),
+ 'SELECT T2.*, COUNT(*) FROM '
+ || against_this_in
+ || ' T2 WHERE '
+ || NVL (against_where_in, '1=1')
+ || ' GROUP BY '
+ || collist (against_this_in),
+ 'Table Equality',
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eqtabcount (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ check_where_in IN VARCHAR2 := NULL,
+ against_where_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ ival PLS_INTEGER;
+ BEGIN
+ ieqminus (
+ outcome_in,
+ message (
+ 'EQTABCOUNT',
+ msg_in,
+ 'Row count of "'
+ || check_this_in
+ || utplsql.ifelse (
+ check_where_in IS NULL,
+ '"',
+ '" WHERE '
+ || check_where_in
+ )
+ || ' does '
+ || c_not_placeholder -- utplsql.ifelse (NOT l_failure, NULL, ' not ')
+ || 'match that of "'
+ || against_this_in
+ || utplsql.ifelse (
+ against_where_in IS NULL,
+ '"',
+ '" WHERE '
+ || against_where_in
+ )
+ ),
+ 'SELECT COUNT(*) FROM '
+ || check_this_in
+ || ' WHERE '
+ || NVL (check_where_in, '1=1'),
+ 'SELECT COUNT(*) FROM '
+ || against_this_in
+ || ' WHERE '
+ || NVL (against_where_in, '1=1'),
+ 'Table Count Equality',
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eqquery (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ -- User passes in two SELECT statements. Use NDS to minus them.
+ ival PLS_INTEGER;
+ BEGIN
+ ieqminus (
+ outcome_in,
+ message (
+ 'EQQUERY',
+ msg_in,
+ 'Result set for "'
+ || check_this_in
+ || ' does '
+ || c_not_placeholder -- utplsql.ifelse (NOT l_failure, NULL, ' not ')
+ || 'match that of "'
+ || against_this_in
+ || '"'
+ ),
+ check_this_in,
+ against_this_in,
+ 'Query Equality',
+ raise_exc_in
+ );
+ END;
+
+ --Check a query against a single VARCHAR2 value
+ PROCEDURE eqqueryvalue (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_query_in IN VARCHAR2,
+ against_value_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE ,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_value VARCHAR2 (2000);
+ l_success BOOLEAN;
+
+ &start_ge_8_1
+ TYPE cv_t IS REF CURSOR;
+
+ cv cv_t;
+ &start_ge_8_1
+ &start_lt_8_1
+ cur PLS_INTEGER
+ := DBMS_SQL.open_cursor;
+ fdbk PLS_INTEGER;
+ &end_lt_8_1
+
+ BEGIN
+ IF utplsql2.tracing
+ THEN
+ utreport.pl (
+ 'V EQQueryValue Compare "'
+ || check_query_in
+ || '" to "'
+ || against_value_in
+ || '"'
+ );
+ END IF;
+
+ &start_ge_8_1
+ OPEN cv FOR check_query_in;
+ FETCH cv INTO l_value;
+ CLOSE cv;
+ &start_ge_8_1
+ &start_lt_8_1
+ DBMS_SQL.parse (
+ cur,
+ check_query_in,
+ DBMS_SQL.native
+ );
+ DBMS_SQL.define_column (cur, 1, 'a', 2000);
+ fdbk := DBMS_SQL.execute_and_fetch (cur);
+ DBMS_SQL.column_value (cur, 1, l_value);
+ DBMS_SQL.close_cursor (cur);
+ &end_lt_8_1
+ l_success :=
+ (l_value = against_value_in)
+ OR ( l_value IS NULL
+ AND against_value_in IS NULL
+ AND null_ok_in
+ );
+ this (
+ outcome_in,
+ message (
+ 'EQQUERYVALUE',
+ msg_in,
+ 'Query "'
+ || check_query_in
+ || '" returned value "'
+ || l_value
+ || '" that does '
+ || utplsql.ifelse (
+ l_success,
+ NULL,
+ ' not '
+ )
+ || 'match "'
+ || against_value_in
+ || '"'
+ ),
+ l_success,
+ FALSE ,
+ raise_exc_in
+ );
+ /* For now ignore this condition.
+ How do we handle two assertions inside a single assertion call?
+ utAssert2.this (outcome_in, msg_in => ||
+ msg_in ||
+ ''' || ''; Got multiple values'',
+ check_this_in => FALSE,
+ raise_exc_in => ' ||
+ b2v (raise_exc_in) ||
+ ');
+ */
+ END;
+
+ PROCEDURE eqqueryvalue (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_query_in IN VARCHAR2,
+ against_value_in IN DATE,
+ null_ok_in IN BOOLEAN := FALSE ,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_value DATE;
+ l_success BOOLEAN;
+
+ &start_ge_8_1
+ TYPE cv_t IS REF CURSOR;
+
+ cv cv_t;
+ &start_ge_8_1
+ &start_lt_8_1
+ cur PLS_INTEGER
+ := DBMS_SQL.open_cursor;
+ fdbk PLS_INTEGER;
+ &end_lt_8_1
+
+ BEGIN
+ IF utplsql2.tracing
+ THEN
+ utreport.pl (
+ 'D EQQueryValue Compare "'
+ || check_query_in
+ || '" to "'
+ || against_value_in
+ || '"'
+ );
+ END IF;
+
+ &start_ge_8_1
+ OPEN cv FOR check_query_in;
+ FETCH cv INTO l_value;
+ CLOSE cv;
+ &start_ge_8_1
+ &start_lt_8_1
+ DBMS_SQL.parse (
+ cur,
+ check_query_in,
+ DBMS_SQL.native
+ );
+ DBMS_SQL.define_column (cur, 1, l_value);
+ fdbk := DBMS_SQL.execute_and_fetch (cur);
+ DBMS_SQL.column_value (cur, 1, l_value);
+ DBMS_SQL.close_cursor (cur);
+ &end_lt_8_1
+ l_success :=
+ (l_value = against_value_in)
+ OR ( l_value IS NULL
+ AND against_value_in IS NULL
+ AND null_ok_in
+ );
+ this (
+ outcome_in,
+ message (
+ 'EQQUERYVALUE',
+ msg_in,
+ 'Query "'
+ || check_query_in
+ || '" returned value "'
+ || TO_CHAR (
+ l_value,
+ 'DD-MON-YYYY HH24:MI:SS'
+ )
+ || '" that does '
+ || utplsql.ifelse (
+ l_success,
+ NULL,
+ ' not '
+ )
+ || 'match "'
+ || TO_CHAR (
+ against_value_in,
+ 'DD-MON-YYYY HH24:MI:SS'
+ )
+ || '"'
+ ),
+ l_success,
+ FALSE ,
+ raise_exc_in,
+ TRUE
+ );
+ /* For now ignore this condition.
+ How do we handle two assertions inside a single assertion call?
+ utAssert2.this (outcome_in, msg_in => ||
+ msg_in ||
+ ''' || ''; Got multiple values'',
+ check_this_in => FALSE,
+ raise_exc_in => ' ||
+ b2v (raise_exc_in) ||
+ ');
+ */
+ END;
+
+ --Check a query against a single VARCHAR2 value
+ PROCEDURE eqqueryvalue (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_query_in IN VARCHAR2,
+ against_value_in IN NUMBER,
+ null_ok_in IN BOOLEAN := FALSE ,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_value NUMBER;
+ l_success BOOLEAN;
+
+ &start_ge_8_1
+
+ TYPE cv_t IS REF CURSOR;
+
+ cv cv_t;
+ &start_ge_8_1
+ &start_lt_8_1
+ cur PLS_INTEGER
+ := DBMS_SQL.open_cursor;
+ fdbk PLS_INTEGER;
+ &end_lt_8_1
+
+ BEGIN
+ IF utplsql2.tracing
+ THEN
+ utreport.pl (
+ 'N EQQueryValue Compare "'
+ || check_query_in
+ || '" to "'
+ || against_value_in
+ || '"'
+ );
+ END IF;
+
+ &start_ge_8_1
+ OPEN cv FOR check_query_in;
+ FETCH cv INTO l_value;
+ CLOSE cv;
+ &start_ge_8_1
+ &start_lt_8_1
+ DBMS_SQL.parse (
+ cur,
+ check_query_in,
+ DBMS_SQL.native
+ );
+ DBMS_SQL.define_column (cur, 1, 1);
+ fdbk := DBMS_SQL.execute_and_fetch (cur);
+ DBMS_SQL.column_value (cur, 1, l_value);
+ DBMS_SQL.close_cursor (cur);
+ &end_lt_8_1
+
+ l_success :=
+ (l_value = against_value_in)
+ OR ( l_value IS NULL
+ AND against_value_in IS NULL
+ AND null_ok_in
+ );
+ this (
+ outcome_in,
+ message (
+ 'EQQUERYVALUE',
+ msg_in,
+ 'Query "'
+ || check_query_in
+ || '" returned value "'
+ || l_value
+ || '" that does '
+ || utplsql.ifelse (
+ l_success,
+ NULL,
+ ' not '
+ )
+ || 'match "'
+ || against_value_in
+ || '"'
+ ),
+ l_success,
+ FALSE ,
+ raise_exc_in,
+ TRUE
+ );
+ /* For now ignore this condition.
+ How do we handle two assertions inside a single assertion call?
+ utAssert2.this (outcome_in, msg_in => ||
+ msg_in ||
+ ''' || ''; Got multiple values'',
+ check_this_in => FALSE,
+ raise_exc_in => ' ||
+ b2v (raise_exc_in) ||
+ ');
+ */
+ END;
+
+ PROCEDURE eqcursor (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ -- User passes in names of two packaged cursors.
+ -- Have to loop through each row and compare!
+ -- How do I compare the contents of two records
+ -- which have been defined dynamically?
+ IS
+ BEGIN
+ utreport.pl (
+ 'utAssert.eqCursor is not yet implemented!'
+ );
+ END;
+
+ PROCEDURE eqfile (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ check_this_dir_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ against_this_dir_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ checkid UTL_FILE.file_type;
+ againstid UTL_FILE.file_type;
+ samefiles BOOLEAN := TRUE ;
+ checkline VARCHAR2 (32767);
+ diffline VARCHAR2 (32767);
+ againstline VARCHAR2 (32767);
+ check_eof BOOLEAN;
+ against_eof BOOLEAN;
+ diffline_set BOOLEAN;
+ nth_line PLS_INTEGER := 1;
+ cant_open_check_file EXCEPTION;
+ cant_open_against_file EXCEPTION;
+
+ PROCEDURE cleanup (
+ val IN BOOLEAN,
+ line_in IN VARCHAR2 := NULL,
+ line_set_in IN BOOLEAN := FALSE ,
+ linenum_in IN PLS_INTEGER := NULL,
+ msg_in IN VARCHAR2
+ )
+ IS
+ BEGIN
+ UTL_FILE.fclose (checkid);
+ UTL_FILE.fclose (againstid);
+ this (
+ outcome_in,
+ message (
+ 'EQFILE',
+ msg_in,
+ utplsql.ifelse (
+ line_set_in,
+ ' Line '
+ || linenum_in
+ || ' of ',
+ NULL
+ )
+ || 'File "'
+ || file_descrip (
+ check_this_in,
+ check_this_dir_in
+ )
+ || '" does '
+ || utplsql.ifelse (
+ val,
+ NULL,
+ ' not '
+ )
+ || 'match "'
+ || file_descrip (
+ against_this_in,
+ against_this_dir_in
+ )
+ || '".'
+ ),
+ val,
+ FALSE ,
+ raise_exc_in,
+ TRUE
+ );
+ END;
+ BEGIN
+ -- Compare contents of two files.
+ BEGIN
+ checkid :=
+ UTL_FILE.fopen (
+ check_this_dir_in,
+ check_this_in,
+ 'R' &start_ge_8_1, max_linesize => 32767 &start_ge_8_1
+ );
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ RAISE cant_open_check_file;
+ END;
+
+ BEGIN
+ againstid :=
+ UTL_FILE.fopen (
+ NVL (
+ against_this_dir_in,
+ check_this_dir_in
+ ),
+ against_this_in,
+ 'R'
+ &start_ge_8_1, max_linesize => 32767 &start_ge_8_1
+ );
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ RAISE cant_open_against_file;
+ END;
+
+ LOOP
+ BEGIN
+ UTL_FILE.get_line (
+ checkid,
+ checkline
+ );
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ check_eof := TRUE ;
+ END;
+
+ BEGIN
+ UTL_FILE.get_line (
+ againstid,
+ againstline
+ );
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ against_eof := TRUE ;
+ END;
+
+ IF ( check_eof
+ AND against_eof
+ )
+ THEN
+ samefiles := TRUE ;
+ EXIT;
+ ELSIF (checkline != againstline)
+ THEN
+ diffline := checkline;
+ diffline_set := TRUE ;
+ samefiles := FALSE ;
+ EXIT;
+ ELSIF ( check_eof
+ OR against_eof
+ )
+ THEN
+ samefiles := FALSE ;
+ EXIT;
+ END IF;
+
+ IF samefiles
+ THEN
+ nth_line := nth_line
+ + 1;
+ END IF;
+ END LOOP;
+
+ cleanup (
+ samefiles,
+ diffline,
+ diffline_set,
+ nth_line,
+ msg_in
+ );
+ EXCEPTION
+ WHEN cant_open_check_file
+ THEN
+ cleanup (
+ FALSE ,
+ msg_in=> 'Unable to open '
+ || file_descrip (
+ check_this_in,
+ check_this_dir_in
+ )
+ );
+ WHEN cant_open_against_file
+ THEN
+ cleanup (
+ FALSE ,
+ msg_in=> 'Unable to open '
+ || file_descrip (
+ against_this_in,
+ NVL (
+ against_this_dir_in,
+ check_this_dir_in
+ )
+ )
+ );
+ WHEN OTHERS
+ THEN
+ cleanup (FALSE , msg_in => msg_in);
+ END;
+
+ PROCEDURE compare_pipe_tabs (
+ tab1 utpipe.msg_tbltype,
+ tab2 utpipe.msg_tbltype,
+ same_out IN OUT BOOLEAN
+ )
+ IS
+ indx PLS_INTEGER := tab1.FIRST;
+ BEGIN
+ LOOP
+ EXIT WHEN indx IS NULL;
+
+ BEGIN
+ IF tab1 (indx).item_type = 9
+ THEN
+ same_out := tab1 (indx).mvc2 =
+ tab2 (indx).mvc2;
+ ELSIF tab1 (indx).item_type = 6
+ THEN
+ same_out := tab1 (indx).mnum =
+ tab2 (indx).mnum;
+ ELSIF tab1 (indx).item_type = 12
+ THEN
+ same_out := tab1 (indx).mdt =
+ tab2 (indx).mdt;
+ ELSIF tab1 (indx).item_type = 11
+ THEN
+ same_out := tab1 (indx).mrid =
+ tab2 (indx).mrid;
+ ELSIF tab1 (indx).item_type = 23
+ THEN
+ same_out := tab1 (indx).mraw =
+ tab2 (indx).mraw;
+ END IF;
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ same_out := FALSE ;
+ END;
+
+ EXIT WHEN NOT same_out;
+ indx := tab1.NEXT (indx);
+ END LOOP;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ same_out := FALSE ;
+ END;
+
+ PROCEDURE eqpipe (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ check_tab utpipe.msg_tbltype;
+ against_tab utpipe.msg_tbltype;
+ check_status PLS_INTEGER;
+ against_status PLS_INTEGER;
+ same_message BOOLEAN := FALSE ;
+ msgset BOOLEAN;
+ msgnum PLS_INTEGER;
+ nthmsg PLS_INTEGER := 1;
+ BEGIN
+ -- Compare contents of two pipes.
+ LOOP
+ utpipe.receive_and_unpack (
+ check_this_in,
+ check_tab,
+ check_status
+ );
+ utpipe.receive_and_unpack (
+ against_this_in,
+ against_tab,
+ against_status
+ );
+
+ IF ( check_status = 0
+ AND against_status = 0
+ )
+ THEN
+ compare_pipe_tabs (
+ check_tab,
+ against_tab,
+ same_message
+ );
+
+ IF NOT same_message
+ THEN
+ msgset := TRUE ;
+ msgnum := nthmsg;
+ EXIT;
+ END IF;
+
+ EXIT WHEN NOT same_message;
+ ELSIF ( check_status = 1
+ AND against_status = 1
+ ) -- time out
+ THEN
+ same_message := TRUE ;
+ EXIT;
+ ELSE
+ same_message := FALSE ;
+ EXIT;
+ END IF;
+
+ nthmsg := nthmsg
+ + 1;
+ END LOOP;
+
+ this (
+ outcome_in,
+ message (
+ 'EQPIPE',
+ msg_in,
+ utplsql.ifelse (
+ msgset,
+ ' Message '
+ || msgnum
+ || ' of ',
+ NULL
+ )
+ || 'Pipe "'
+ || check_this_in
+ || '" does '
+ || utplsql.ifelse (
+ same_message,
+ NULL,
+ ' not '
+ )
+ || 'match "'
+ || against_this_in
+ || '".'
+ ),
+ same_message,
+ FALSE ,
+ raise_exc_in,
+ TRUE
+ );
+ END;
+
+ FUNCTION numfromstr (str IN VARCHAR2)
+ RETURN NUMBER
+ IS
+ sqlstr VARCHAR2 (1000)
+ := 'begin :val := '
+ || str
+ || '; end;';
+ &start_lt_8_1
+ fdbk PLS_INTEGER;
+ cur PLS_INTEGER
+ := DBMS_SQL.open_cursor;
+ &end_lt_8_1
+ retval NUMBER;
+ BEGIN
+ &start_ge_8_1
+ EXECUTE IMMEDIATE sqlstr USING OUT retval;
+ &start_ge_8_1
+ &start_lt_8_1
+ DBMS_SQL.parse (
+ cur,
+ sqlstr,
+ DBMS_SQL.native
+ );
+ fdbk := DBMS_SQL.EXECUTE (cur);
+ DBMS_SQL.variable_value (cur, 'val', retval);
+ DBMS_SQL.close_cursor (cur);
+ &end_lt_8_1
+ RETURN retval;
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ &start_lt_8_1
+ DBMS_SQL.close_cursor (cur);
+ &end_lt_8_1
+ RAISE;
+ END;
+
+ PROCEDURE validatecoll (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ valid_out IN OUT BOOLEAN,
+ msg_out OUT VARCHAR2,
+ countproc_in IN VARCHAR2
+ := 'COUNT',
+ firstrowproc_in IN VARCHAR2
+ := 'FIRST',
+ lastrowproc_in IN VARCHAR2
+ := 'LAST',
+ check_startrow_in IN PLS_INTEGER
+ := NULL,
+ check_endrow_in IN PLS_INTEGER
+ := NULL,
+ against_startrow_in IN PLS_INTEGER
+ := NULL,
+ against_endrow_in IN PLS_INTEGER
+ := NULL,
+ match_rownum_in IN BOOLEAN
+ := FALSE ,
+ null_ok_in IN BOOLEAN
+ := TRUE ,
+ raise_exc_in IN BOOLEAN
+ := FALSE ,
+ null_and_valid IN OUT BOOLEAN
+ )
+ IS
+ dynblock VARCHAR2 (32767);
+ v_matchrow CHAR (1) := 'N';
+ badc PLS_INTEGER;
+ bada PLS_INTEGER;
+ badtext VARCHAR2 (32767);
+ eqcheck VARCHAR2 (32767);
+ BEGIN
+ valid_out := TRUE ;
+ null_and_valid := FALSE ;
+
+ IF numfromstr (
+ check_this_in
+ || '.'
+ || countproc_in
+ ) = 0
+ AND numfromstr (
+ against_this_in
+ || '.'
+ || countproc_in
+ ) = 0
+ THEN
+ IF NOT null_ok_in
+ THEN
+ valid_out := FALSE ;
+ msg_out := 'Invalid NULL collections';
+ ELSE
+ /* Empty and valid collections. We are done... */
+ null_and_valid := TRUE ;
+ END IF;
+ END IF;
+
+ IF valid_out
+ AND NOT null_and_valid
+ THEN
+ IF match_rownum_in
+ THEN
+ valid_out :=
+ NVL (
+ numfromstr (
+ check_this_in
+ || '.'
+ || firstrowproc_in
+ ) =
+ numfromstr (
+ against_this_in
+ || '.'
+ || firstrowproc_in
+ ),
+ FALSE
+ );
+
+ IF NOT valid_out
+ THEN
+ msg_out :=
+ 'Different starting rows in '
+ || check_this_in
+ || ' and '
+ || against_this_in;
+ ELSE
+ valid_out :=
+ NVL (
+ numfromstr (
+ check_this_in
+ || '.'
+ || lastrowproc_in
+ ) !=
+ numfromstr (
+ against_this_in
+ || '.'
+ || lastrowproc_in
+ ),
+ FALSE
+ );
+
+ IF NOT valid_out
+ THEN
+ msg_out :=
+ 'Different ending rows in '
+ || check_this_in
+ || ' and '
+ || against_this_in;
+ END IF;
+ END IF;
+ END IF;
+
+ IF valid_out
+ THEN
+ valid_out :=
+ NVL (
+ numfromstr (
+ check_this_in
+ || '.'
+ || countproc_in
+ ) =
+ numfromstr (
+ against_this_in
+ || '.'
+ || countproc_in
+ ),
+ FALSE
+ );
+
+ IF NOT valid_out
+ THEN
+ msg_out :=
+ 'Different number of rows in '
+ || check_this_in
+ || ' and '
+ || against_this_in;
+ END IF;
+ END IF;
+ END IF;
+ END;
+
+ FUNCTION dyncollstr (
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ eqfunc_in IN VARCHAR2,
+ countproc_in IN VARCHAR2,
+ firstrowproc_in IN VARCHAR2,
+ lastrowproc_in IN VARCHAR2,
+ nextrowproc_in IN VARCHAR2,
+ getvalfunc_in IN VARCHAR2
+ )
+ RETURN VARCHAR2
+ IS
+ eqcheck VARCHAR2 (32767);
+ v_check VARCHAR2 (100) := check_this_in;
+ v_against VARCHAR2 (100)
+ := against_this_in;
+ BEGIN
+ IF getvalfunc_in IS NOT NULL
+ THEN
+ v_check :=
+ v_check
+ || '.'
+ || getvalfunc_in;
+ v_against :=
+ v_against
+ || '.'
+ || getvalfunc_in;
+ END IF;
+
+ IF eqfunc_in IS NULL
+ THEN
+ eqcheck := '('
+ || v_check
+ || '(cindx) = '
+ || v_against
+ || ' (aindx)) OR '
+ || '('
+ || v_check
+ || '(cindx) IS NULL AND '
+ || v_against
+ || ' (aindx) IS NULL)';
+ ELSE
+ eqcheck := eqfunc_in
+ || '('
+ || v_check
+ || '(cindx), '
+ || v_against
+ || '(aindx))';
+ END IF;
+
+ RETURN ( 'DECLARE
+ cindx PLS_INTEGER;
+ aindx PLS_INTEGER;
+ cend PLS_INTEGER := NVL (:cendit, '
+ || check_this_in
+ || '.'
+ || lastrowproc_in
+ || ');
+ aend PLS_INTEGER := NVL (:aendit, '
+ || against_this_in
+ || '.'
+ || lastrowproc_in
+ || ');
+ different_collections exception;
+
+ PROCEDURE setfailure (
+ str IN VARCHAR2,
+ badc IN PLS_INTEGER,
+ bada IN PLS_INTEGER,
+ raiseexc IN BOOLEAN := TRUE)
+ IS
+ BEGIN
+ :badcindx := badc;
+ :badaindx := bada;
+ :badreason := str;
+ IF raiseexc THEN RAISE different_collections; END IF;
+ END;
+ BEGIN
+ cindx := NVL (:cstartit, '
+ || check_this_in
+ || '.'
+ || firstrowproc_in
+ || ');
+ aindx := NVL (:astartit, '
+ || against_this_in
+ || '.'
+ || firstrowproc_in
+ || ');
+
+ LOOP
+ IF cindx IS NULL AND aindx IS NULL
+ THEN
+ EXIT;
+
+ ELSIF cindx IS NULL and aindx IS NOT NULL
+ THEN
+ setfailure (
+ ''Check index NULL, Against index NOT NULL'', cindx, aindx);
+
+ ELSIF aindx IS NULL
+ THEN
+ setfailure (
+ ''Check index NOT NULL, Against index NULL'', cindx, aindx);
+ END IF;
+
+ IF :matchit = ''Y''
+ AND cindx != aindx
+ THEN
+ setfailure (''Mismatched row numbers'', cindx, aindx);
+ END IF;
+
+ BEGIN
+ IF '
+ || eqcheck
+ || '
+ THEN
+ NULL;
+ ELSE
+ setfailure (''Mismatched row values'', cindx, aindx);
+ END IF;
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ setfailure (''On EQ check: '
+ || eqcheck
+ || ''' || '' '' || SQLERRM, cindx, aindx);
+ END;
+
+ cindx := '
+ || check_this_in
+ || '.'
+ || nextrowproc_in
+ || '(cindx);
+ aindx := '
+ || against_this_in
+ || '.'
+ || nextrowproc_in
+ || '(aindx);
+ END LOOP;
+ EXCEPTION
+ WHEN OTHERS THEN
+ IF :badcindx IS NULL and :badaindx IS NULL
+ THEN setfailure (SQLERRM, cindx, aindx, FALSE);
+ END IF;
+ END;'
+ );
+ END;
+
+ FUNCTION collection_message (
+ collapi_in IN BOOLEAN,
+ msg_in IN VARCHAR2,
+ chkcoll_in IN VARCHAR2,
+ chkrow_in IN INTEGER,
+ agcoll_in IN VARCHAR2,
+ agrow_in IN INTEGER,
+ success_in IN BOOLEAN
+ )
+ RETURN VARCHAR2
+ IS
+ assert_name VARCHAR2 (100) := 'EQCOLL';
+ BEGIN
+ IF collapi_in
+ THEN
+ assert_name := 'EQCOLLAPI';
+ END IF;
+
+ RETURN message (
+ assert_name,
+ msg_in,
+ utplsql.ifelse (
+ success_in,
+ NULL,
+ ' Row '
+ || NVL (
+ TO_CHAR (agrow_in),
+ '*UNDEFINED*'
+ )
+ || ' of '
+ )
+ || 'Collection "'
+ || agcoll_in
+ || '" does '
+ || utplsql.ifelse (
+ success_in,
+ NULL,
+ ' not '
+ )
+ || 'match '
+ || utplsql.ifelse (
+ success_in,
+ NULL,
+ ' Row '
+ || NVL (
+ TO_CHAR (chkrow_in),
+ '*UNDEFINED*'
+ )
+ || ' of '
+ )
+ || chkcoll_in
+ || '".'
+ );
+ END;
+
+ PROCEDURE eqcoll (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ eqfunc_in IN VARCHAR2 := NULL,
+ check_startrow_in IN PLS_INTEGER
+ := NULL,
+ check_endrow_in IN PLS_INTEGER
+ := NULL,
+ against_startrow_in IN PLS_INTEGER
+ := NULL,
+ against_endrow_in IN PLS_INTEGER
+ := NULL,
+ match_rownum_in IN BOOLEAN := FALSE ,
+ null_ok_in IN BOOLEAN := TRUE ,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ dynblock VARCHAR2 (32767);
+ v_matchrow CHAR (1) := 'N';
+ valid_interim BOOLEAN;
+ invalid_interim_msg VARCHAR2 (4000);
+ badc PLS_INTEGER;
+ bada PLS_INTEGER;
+ badtext VARCHAR2 (32767);
+ null_and_valid BOOLEAN := FALSE ;
+ &start_lt_8_1
+ fdbk PLS_INTEGER;
+ cur PLS_INTEGER
+ := DBMS_SQL.open_cursor;
+ &end_lt_8_1
+
+ BEGIN
+ validatecoll (
+ msg_in,
+ check_this_in,
+ against_this_in,
+ valid_interim,
+ invalid_interim_msg,
+ 'COUNT',
+ 'FIRST',
+ 'LAST',
+ check_startrow_in,
+ check_endrow_in,
+ against_startrow_in,
+ against_endrow_in,
+ match_rownum_in,
+ null_ok_in,
+ raise_exc_in,
+ null_and_valid
+ );
+
+ IF NOT valid_interim
+ THEN
+ -- Failure on interim step. Flag and skip rest of processing
+ this (
+ outcome_in,
+ collection_message (
+ FALSE ,
+ msg_in
+ || ' - '
+ || invalid_interim_msg,
+ check_this_in,
+ NULL,
+ against_this_in,
+ NULL,
+ FALSE
+ ),
+ FALSE ,
+ FALSE ,
+ raise_exc_in,
+ TRUE
+ );
+ ELSE
+ -- We have some data to compare.
+ IF NOT null_and_valid
+ THEN
+ IF match_rownum_in
+ THEN
+ v_matchrow := 'Y';
+ END IF;
+
+ dynblock :=
+ dyncollstr (
+ check_this_in,
+ against_this_in,
+ eqfunc_in,
+ 'COUNT',
+ 'FIRST',
+ 'LAST',
+ 'NEXT',
+ NULL
+ );
+ &start_ge_8_1
+ EXECUTE IMMEDIATE dynblock
+ USING IN check_endrow_in,
+ IN against_endrow_in,
+ IN OUT badc,
+ IN OUT bada,
+ IN OUT badtext,
+ IN check_startrow_in,
+ IN against_startrow_in,
+ IN v_matchrow;
+ &start_ge_8_1
+ &start_lt_8_1
+ DBMS_SQL.parse (
+ cur,
+ dynblock,
+ DBMS_SQL.native
+ );
+ DBMS_SQL.bind_variable (
+ cur,
+ 'cendit',
+ check_endrow_in
+ );
+ DBMS_SQL.bind_variable (
+ cur,
+ 'cendit',
+ against_endrow_in
+ );
+ DBMS_SQL.bind_variable (
+ cur,
+ 'cendit',
+ check_startrow_in
+ );
+ DBMS_SQL.bind_variable (
+ cur,
+ 'cendit',
+ against_startrow_in
+ );
+ DBMS_SQL.bind_variable (
+ cur,
+ 'cendit',
+ v_matchrow
+ );
+ fdbk := DBMS_SQL.EXECUTE (cur);
+ DBMS_SQL.variable_value (
+ cur,
+ 'badcindx',
+ badc
+ );
+ DBMS_SQL.variable_value (
+ cur,
+ 'badaindx',
+ bada
+ );
+ DBMS_SQL.variable_value (
+ cur,
+ 'badreason',
+ badtext
+ );
+ DBMS_SQL.close_cursor (cur);
+ &end_lt_8_1
+ END IF;
+
+ this (
+ outcome_in,
+ collection_message (
+ FALSE ,
+ msg_in,
+ check_this_in,
+ badc,
+ against_this_in,
+ bada,
+ badc IS NULL
+ AND bada IS NULL
+ ),
+ badc IS NULL
+ AND bada IS NULL,
+ FALSE ,
+ raise_exc_in,
+ TRUE
+ );
+ END IF;
+ EXCEPTION
+ WHEN OTHERS
+ THEN --p.l (sqlerrm);
+ &start_lt_8_1
+ DBMS_SQL.close_cursor (cur);
+ &end_lt_8_1
+
+ this (
+ outcome_in,
+ collection_message (
+ FALSE ,
+ msg_in
+ || ' SQLERROR: '
+ || SQLERRM,
+ check_this_in,
+ badc,
+ against_this_in,
+ bada,
+ SQLCODE = 0
+ ),
+ SQLCODE = 0,
+ FALSE ,
+ raise_exc_in,
+ TRUE
+ );
+ END;
+
+ /* API based access to collections */
+ PROCEDURE eqcollapi (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_pkg_in IN VARCHAR2,
+ against_this_pkg_in IN VARCHAR2,
+ eqfunc_in IN VARCHAR2 := NULL,
+ countfunc_in IN VARCHAR2 := 'COUNT',
+ firstrowfunc_in IN VARCHAR2 := 'FIRST',
+ lastrowfunc_in IN VARCHAR2 := 'LAST',
+ nextrowfunc_in IN VARCHAR2 := 'NEXT',
+ getvalfunc_in IN VARCHAR2
+ := 'NTHVAL',
+ check_startrow_in IN PLS_INTEGER
+ := NULL,
+ check_endrow_in IN PLS_INTEGER
+ := NULL,
+ against_startrow_in IN PLS_INTEGER
+ := NULL,
+ against_endrow_in IN PLS_INTEGER
+ := NULL,
+ match_rownum_in IN BOOLEAN := FALSE ,
+ null_ok_in IN BOOLEAN := TRUE ,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ dynblock VARCHAR2 (32767);
+ v_matchrow CHAR (1) := 'N';
+ badc PLS_INTEGER;
+ bada PLS_INTEGER;
+ badtext VARCHAR2 (32767);
+ valid_interim BOOLEAN;
+ invalid_interim_msg VARCHAR2 (4000);
+ null_and_valid BOOLEAN := FALSE ;
+ &start_lt_8_1
+ fdbk PLS_INTEGER;
+ cur PLS_INTEGER
+ := DBMS_SQL.open_cursor;
+ &end_lt_8_1
+
+ BEGIN
+ validatecoll (
+ msg_in,
+ check_this_pkg_in,
+ against_this_pkg_in,
+ valid_interim,
+ invalid_interim_msg,
+ countfunc_in,
+ firstrowfunc_in,
+ lastrowfunc_in,
+ check_startrow_in,
+ check_endrow_in,
+ against_startrow_in,
+ against_endrow_in,
+ match_rownum_in,
+ null_ok_in,
+ raise_exc_in,
+ null_and_valid
+ );
+
+ IF null_and_valid
+ THEN
+ GOTO normal_termination;
+ END IF;
+
+ IF match_rownum_in
+ THEN
+ v_matchrow := 'Y';
+ END IF;
+
+ dynblock := dyncollstr (
+ check_this_pkg_in,
+ against_this_pkg_in,
+ eqfunc_in,
+ countfunc_in,
+ firstrowfunc_in,
+ lastrowfunc_in,
+ nextrowfunc_in,
+ getvalfunc_in
+ );
+ &start_ge_8_1
+ EXECUTE IMMEDIATE dynblock
+ USING IN check_endrow_in,
+ IN against_endrow_in,
+ IN OUT badc,
+ IN OUT bada,
+ IN OUT badtext,
+ IN check_startrow_in,
+ IN against_startrow_in,
+ IN v_matchrow;
+ &start_ge_8_1
+ &start_lt_8_1
+ DBMS_SQL.parse (
+ cur,
+ dynblock,
+ DBMS_SQL.native
+ );
+ DBMS_SQL.bind_variable (
+ cur,
+ 'cendit',
+ check_endrow_in
+ );
+ DBMS_SQL.bind_variable (
+ cur,
+ 'cendit',
+ against_endrow_in
+ );
+ DBMS_SQL.bind_variable (
+ cur,
+ 'cendit',
+ check_startrow_in
+ );
+ DBMS_SQL.bind_variable (
+ cur,
+ 'cendit',
+ against_startrow_in
+ );
+ DBMS_SQL.bind_variable (
+ cur,
+ 'cendit',
+ v_matchrow
+ );
+ fdbk := DBMS_SQL.EXECUTE (cur);
+ DBMS_SQL.variable_value (
+ cur,
+ 'badcindx',
+ badc
+ );
+ DBMS_SQL.variable_value (
+ cur,
+ 'badaindx',
+ bada
+ );
+ DBMS_SQL.variable_value (
+ cur,
+ 'badreason',
+ badtext
+ );
+ DBMS_SQL.close_cursor (cur);
+
+ &end_lt_8_1
+
+ <>
+ this (
+ outcome_in,
+ collection_message (
+ TRUE ,
+ msg_in,
+ check_this_pkg_in,
+ badc,
+ against_this_pkg_in,
+ bada,
+ badc IS NULL
+ AND bada IS NULL
+ ),
+ bada IS NULL
+ AND badc IS NULL,
+ FALSE ,
+ raise_exc_in,
+ TRUE
+ );
+ EXCEPTION
+ WHEN OTHERS
+ THEN --p.l (sqlerrm);
+ &start_lt_8_1
+ DBMS_SQL.close_cursor (cur);
+ &end_lt_8_1
+
+ this (
+ outcome_in,
+ collection_message (
+ TRUE ,
+ msg_in
+ || ' SQLERROR: '
+ || SQLERRM,
+ check_this_pkg_in,
+ badc,
+ against_this_pkg_in,
+ bada,
+ badc IS NULL
+ AND bada IS NULL
+ ),
+ SQLCODE = 0,
+ FALSE ,
+ raise_exc_in,
+ TRUE
+ );
+ END;
+
+ PROCEDURE isnotnull (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ BEGIN
+ this (
+ outcome_in,
+ message_expected (
+ 'ISNOTNULL',
+ msg_in,
+ check_this_in,
+ 'NOT NULL'
+ ),
+ check_this_in IS NOT NULL,
+ FALSE ,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE isnull (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ BEGIN
+ this (
+ outcome_in,
+ message_expected (
+ 'ISNULL',
+ msg_in,
+ check_this_in,
+ ''
+ ),
+ check_this_in IS NULL,
+ TRUE ,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE isnotnull (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ BEGIN
+ this (
+ outcome_in,
+ message_expected (
+ 'ISNOTNULL',
+ msg_in,
+ utplsql.bool2vc (check_this_in),
+ 'NOT NULL'
+ ),
+ check_this_in IS NOT NULL,
+ FALSE ,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE isnull (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ BEGIN
+ this (
+ outcome_in,
+ message_expected (
+ 'ISNULL',
+ msg_in,
+ utplsql.bool2vc (check_this_in),
+ ''
+ ),
+ check_this_in IS NULL,
+ TRUE ,
+ raise_exc_in
+ );
+ END;
+
+ --Check a given call throws a named exception
+ PROCEDURE raises (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in VARCHAR2,
+ check_call_in IN VARCHAR2,
+ against_exc_in IN VARCHAR2
+ )
+ IS
+ expected_indicator PLS_INTEGER := 1000;
+ l_indicator PLS_INTEGER;
+ v_block VARCHAR2 (32767)
+ := 'BEGIN '
+ || RTRIM (RTRIM (check_call_in), ';')
+ || ';
+ :indicator := 0;
+ EXCEPTION
+ WHEN '
+ || against_exc_in
+ || ' THEN
+ :indicator := '
+ || expected_indicator
+ || ';
+ WHEN OTHERS THEN :indicator := SQLCODE;
+ END;';
+ &start_lt_8_1
+ cur PLS_INTEGER
+ := DBMS_SQL.open_cursor;
+ ret_val PLS_INTEGER;
+ &end_lt_8_1
+ BEGIN
+ --Fire off the dynamic PL/SQL
+ &start_ge_8_1
+ EXECUTE IMMEDIATE v_block USING OUT l_indicator;
+ &start_ge_8_1
+ &start_lt_8_1
+ DBMS_SQL.parse (
+ cur,
+ v_block,
+ DBMS_SQL.native
+ );
+ DBMS_SQL.bind_variable (cur, 'indicator', 1);
+ ret_val := DBMS_SQL.EXECUTE (cur);
+ DBMS_SQL.variable_value (
+ cur,
+ 'indicator',
+ l_indicator
+ );
+ DBMS_SQL.close_cursor (cur);
+ &end_lt_8_1
+
+ this (
+ outcome_in,
+ message (
+ 'RAISES',
+ msg_in,
+ 'Block "'
+ || check_call_in
+ || '"'
+ || utplsql.ifelse (
+ NOT (NVL (
+ l_indicator =
+ expected_indicator,
+ FALSE
+ )
+ ),
+ ' does not raise',
+ ' raises '
+ )
+ || ' Exception "'
+ || against_exc_in
+ || utplsql.ifelse (
+ l_indicator =
+ expected_indicator,
+ NULL,
+ '. Instead it raises SQLCODE = '
+ || l_indicator
+ || '.'
+ )
+ ),
+ l_indicator = expected_indicator
+ );
+ END;
+
+ --Check a given call throws an exception with a given SQLCODE
+ PROCEDURE raises (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in VARCHAR2,
+ check_call_in IN VARCHAR2,
+ against_exc_in IN NUMBER
+ )
+ IS
+ expected_indicator PLS_INTEGER := 1000;
+ l_indicator PLS_INTEGER;
+ v_block VARCHAR2 (32767)
+ := 'BEGIN '
+ || RTRIM (RTRIM (check_call_in), ';')
+ || ';
+ :indicator := 0;
+ EXCEPTION
+ WHEN OTHERS
+ THEN IF SQLCODE = '
+ || against_exc_in
+ || ' THEN :indicator := '
+ || expected_indicator
+ || ';'
+ || ' ELSE :indicator := SQLCODE; END IF;
+ END;';
+ &start_lt_8_1
+ cur PLS_INTEGER
+ := DBMS_SQL.open_cursor;
+ ret_val PLS_INTEGER;
+ &end_lt_8_1
+ BEGIN
+ --Fire off the dynamic PL/SQL
+ &start_ge_8_1
+ EXECUTE IMMEDIATE v_block USING OUT l_indicator;
+ &start_ge_8_1
+ &start_lt_8_1
+ DBMS_SQL.parse (
+ cur,
+ v_block,
+ DBMS_SQL.native
+ );
+ DBMS_SQL.bind_variable (cur, 'indicator', 1);
+ ret_val := DBMS_SQL.EXECUTE (cur);
+ DBMS_SQL.variable_value (
+ cur,
+ 'indicator',
+ l_indicator
+ );
+ DBMS_SQL.close_cursor (cur);
+ &end_lt_8_1
+
+ this (
+ outcome_in,
+ message (
+ 'THROWS',
+ msg_in,
+ 'Block "'
+ || check_call_in
+ || '"'
+ || utplsql.ifelse (
+ NOT (NVL (
+ l_indicator =
+ expected_indicator,
+ FALSE
+ )
+ ),
+ ' does not raise',
+ ' raises '
+ )
+ || ' Exception "'
+ || against_exc_in
+ || utplsql.ifelse (
+ l_indicator =
+ expected_indicator,
+ NULL,
+ '. Instead it raises SQLCODE = '
+ || l_indicator
+ || '.'
+ )
+ ),
+ l_indicator = expected_indicator
+ );
+ END;
+
+ PROCEDURE throws (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in VARCHAR2,
+ check_call_in IN VARCHAR2,
+ against_exc_in IN VARCHAR2
+ )
+ IS
+ BEGIN
+ raises (
+ outcome_in,
+ msg_in,
+ check_call_in,
+ against_exc_in
+ );
+ END;
+
+ PROCEDURE throws (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in VARCHAR2,
+ check_call_in IN VARCHAR2,
+ against_exc_in IN NUMBER
+ )
+ IS
+ BEGIN
+ raises (
+ outcome_in,
+ msg_in,
+ check_call_in,
+ against_exc_in
+ );
+ END;
+
+ -- Same assertions, but using NAME not ID to identify the test case.
+
+ PROCEDURE this (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE ,
+ raise_exc_in IN BOOLEAN := FALSE ,
+ register_in IN BOOLEAN := TRUE
+ )
+ IS
+ l_id ut_outcome.id%TYPE;
+ BEGIN
+ get_id (outcome_in, l_id);
+ this (
+ l_id,
+ msg_in,
+ check_this_in,
+ null_ok_in,
+ raise_exc_in,
+ register_in
+ );
+ END;
+
+ PROCEDURE eq (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE ,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_id ut_outcome.id%TYPE;
+ BEGIN
+ get_id (outcome_in, l_id);
+ eq (
+ l_id,
+ msg_in,
+ check_this_in,
+ against_this_in,
+ null_ok_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eq (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ against_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE ,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_id ut_outcome.id%TYPE;
+ BEGIN
+ get_id (outcome_in, l_id);
+ eq (
+ l_id,
+ msg_in,
+ check_this_in,
+ against_this_in,
+ null_ok_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eq (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN DATE,
+ against_this_in IN DATE,
+ null_ok_in IN BOOLEAN := FALSE ,
+ raise_exc_in IN BOOLEAN := FALSE ,
+ truncate_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_id ut_outcome.id%TYPE;
+ BEGIN
+ get_id (outcome_in, l_id);
+ eq (
+ l_id,
+ msg_in,
+ check_this_in,
+ against_this_in,
+ null_ok_in,
+ raise_exc_in,
+ truncate_in
+ );
+ END;
+
+ PROCEDURE eqtable (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ check_where_in IN VARCHAR2 := NULL,
+ against_where_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_id ut_outcome.id%TYPE;
+ BEGIN
+ get_id (outcome_in, l_id);
+ eqtable (
+ l_id,
+ msg_in,
+ check_this_in,
+ against_this_in,
+ check_where_in,
+ against_where_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eqtabcount (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ check_where_in IN VARCHAR2 := NULL,
+ against_where_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_id ut_outcome.id%TYPE;
+ BEGIN
+ get_id (outcome_in, l_id);
+ eqtabcount (
+ l_id,
+ msg_in,
+ check_this_in,
+ against_this_in,
+ check_where_in,
+ against_where_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eqquery (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_id ut_outcome.id%TYPE;
+ BEGIN
+ get_id (outcome_in, l_id);
+ eqquery (
+ l_id,
+ msg_in,
+ check_this_in,
+ against_this_in,
+ raise_exc_in
+ );
+ END;
+
+ --Check a query against a single VARCHAR2 value
+ PROCEDURE eqqueryvalue (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ msg_in IN VARCHAR2,
+ check_query_in IN VARCHAR2,
+ against_value_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_id ut_outcome.id%TYPE;
+ BEGIN
+ get_id (outcome_in, l_id);
+ eqqueryvalue (
+ l_id,
+ msg_in,
+ check_query_in,
+ against_value_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eqqueryvalue (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ msg_in IN VARCHAR2,
+ check_query_in IN VARCHAR2,
+ against_value_in IN DATE,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_id ut_outcome.id%TYPE;
+ BEGIN
+ get_id (outcome_in, l_id);
+ eqqueryvalue (
+ l_id,
+ msg_in,
+ check_query_in,
+ against_value_in,
+ raise_exc_in
+ );
+ END;
+
+ --Check a query against a single VARCHAR2 value
+ PROCEDURE eqqueryvalue (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ msg_in IN VARCHAR2,
+ check_query_in IN VARCHAR2,
+ against_value_in IN NUMBER,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_id ut_outcome.id%TYPE;
+ BEGIN
+ get_id (outcome_in, l_id);
+ eqqueryvalue (
+ l_id,
+ msg_in,
+ check_query_in,
+ against_value_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eqcursor (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ -- User passes in names of two packaged cursors.
+ -- Have to loop through each row and compare!
+ -- How do I compare the contents of two records
+ -- which have been defined dynamically?
+ IS
+ BEGIN
+ utreport.pl (
+ 'utAssert.eqCursor is not yet implemented!'
+ );
+ END;
+
+ PROCEDURE eqfile (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ check_this_dir_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ against_this_dir_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_id ut_outcome.id%TYPE;
+ BEGIN
+ get_id (outcome_in, l_id);
+ eqfile (
+ l_id,
+ msg_in,
+ check_this_in,
+ check_this_dir_in,
+ against_this_in,
+ against_this_dir_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eqpipe (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_id ut_outcome.id%TYPE;
+ BEGIN
+ get_id (outcome_in, l_id);
+ eqpipe (
+ l_id,
+ msg_in,
+ check_this_in,
+ against_this_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eqcoll (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ eqfunc_in IN VARCHAR2 := NULL,
+ check_startrow_in IN PLS_INTEGER
+ := NULL,
+ check_endrow_in IN PLS_INTEGER
+ := NULL,
+ against_startrow_in IN PLS_INTEGER
+ := NULL,
+ against_endrow_in IN PLS_INTEGER
+ := NULL,
+ match_rownum_in IN BOOLEAN := FALSE ,
+ null_ok_in IN BOOLEAN := TRUE ,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_id ut_outcome.id%TYPE;
+ BEGIN
+ get_id (outcome_in, l_id);
+ eqcoll (
+ l_id,
+ msg_in,
+ check_this_in,
+ against_this_in,
+ eqfunc_in,
+ check_startrow_in,
+ check_endrow_in,
+ against_startrow_in,
+ against_endrow_in,
+ match_rownum_in,
+ null_ok_in,
+ raise_exc_in
+ );
+ END;
+
+ /* API based access to collections */
+ PROCEDURE eqcollapi (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_pkg_in IN VARCHAR2,
+ against_this_pkg_in IN VARCHAR2,
+ eqfunc_in IN VARCHAR2 := NULL,
+ countfunc_in IN VARCHAR2 := 'COUNT',
+ firstrowfunc_in IN VARCHAR2 := 'FIRST',
+ lastrowfunc_in IN VARCHAR2 := 'LAST',
+ nextrowfunc_in IN VARCHAR2 := 'NEXT',
+ getvalfunc_in IN VARCHAR2
+ := 'NTHVAL',
+ check_startrow_in IN PLS_INTEGER
+ := NULL,
+ check_endrow_in IN PLS_INTEGER
+ := NULL,
+ against_startrow_in IN PLS_INTEGER
+ := NULL,
+ against_endrow_in IN PLS_INTEGER
+ := NULL,
+ match_rownum_in IN BOOLEAN := FALSE ,
+ null_ok_in IN BOOLEAN := TRUE ,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_id ut_outcome.id%TYPE;
+ BEGIN
+ get_id (outcome_in, l_id);
+ eqcollapi (
+ l_id,
+ msg_in,
+ check_this_pkg_in,
+ against_this_pkg_in,
+ eqfunc_in,
+ countfunc_in,
+ firstrowfunc_in,
+ lastrowfunc_in,
+ nextrowfunc_in,
+ getvalfunc_in,
+ check_startrow_in,
+ check_endrow_in,
+ against_startrow_in,
+ against_endrow_in,
+ match_rownum_in,
+ null_ok_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE isnotnull (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_id ut_outcome.id%TYPE;
+ BEGIN
+ get_id (outcome_in, l_id);
+ isnotnull (
+ l_id,
+ msg_in,
+ check_this_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE isnull (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_id ut_outcome.id%TYPE;
+ BEGIN
+ get_id (outcome_in, l_id);
+ isnull (
+ l_id,
+ msg_in,
+ check_this_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE isnotnull (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_id ut_outcome.id%TYPE;
+ BEGIN
+ get_id (outcome_in, l_id);
+ isnotnull (
+ l_id,
+ msg_in,
+ check_this_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE isnull (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_id ut_outcome.id%TYPE;
+ BEGIN
+ get_id (outcome_in, l_id);
+ isnull (
+ l_id,
+ msg_in,
+ check_this_in,
+ raise_exc_in
+ );
+ END;
+
+ --Check a given call throws a named exception
+ PROCEDURE raises (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ msg_in VARCHAR2,
+ check_call_in IN VARCHAR2,
+ against_exc_in IN VARCHAR2
+ )
+ IS
+ l_id ut_outcome.id%TYPE;
+ BEGIN
+ get_id (outcome_in, l_id);
+ raises (
+ l_id,
+ msg_in,
+ check_call_in,
+ against_exc_in
+ );
+ END;
+
+ --Check a given call throws an exception with a given SQLCODE
+ PROCEDURE raises (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ msg_in VARCHAR2,
+ check_call_in IN VARCHAR2,
+ against_exc_in IN NUMBER
+ )
+ IS
+ l_id ut_outcome.id%TYPE;
+ BEGIN
+ get_id (outcome_in, l_id);
+ raises (
+ l_id,
+ msg_in,
+ check_call_in,
+ against_exc_in
+ );
+ END;
+
+ PROCEDURE throws (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ msg_in VARCHAR2,
+ check_call_in IN VARCHAR2,
+ against_exc_in IN VARCHAR2
+ )
+ IS
+ BEGIN
+ raises (
+ outcome_in,
+ msg_in,
+ check_call_in,
+ against_exc_in
+ );
+ END;
+
+ PROCEDURE throws (
+ outcome_in IN ut_outcome.NAME%TYPE,
+ msg_in VARCHAR2,
+ check_call_in IN VARCHAR2,
+ against_exc_in IN NUMBER
+ )
+ IS
+ BEGIN
+ raises (
+ outcome_in,
+ msg_in,
+ check_call_in,
+ against_exc_in
+ );
+ END;
+
+ -- 2.0.7
+ PROCEDURE fileexists (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ dir_in IN VARCHAR2,
+ file_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE ,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ checkid UTL_FILE.file_type;
+
+ PROCEDURE cleanup (
+ val IN BOOLEAN,
+ msg_in IN VARCHAR2
+ )
+ IS
+ BEGIN
+ UTL_FILE.fclose (checkid);
+ this (
+ outcome_in,
+ message (
+ 'FILEEXISTS',
+ msg_in,
+ 'File "'
+ || file_descrip (file_in, dir_in)
+ || '" could '
+ || utplsql.ifelse (
+ val,
+ NULL,
+ ' not '
+ )
+ || 'be opened for reading."'
+ ),
+ val,
+ FALSE ,
+ raise_exc_in,
+ TRUE
+ );
+ END;
+ BEGIN
+ checkid :=
+ UTL_FILE.fopen (
+ dir_in,
+ file_in,
+ 'R' &start_ge_8_1, max_linesize => 32767 &start_ge_8_1
+ );
+ cleanup (TRUE , msg_in);
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ cleanup (FALSE , msg_in);
+ END;
+
+ PROCEDURE showresults
+ IS
+ BEGIN
+ g_showresults := TRUE ;
+ END;
+
+ PROCEDURE noshowresults
+ IS
+ BEGIN
+ g_showresults := FALSE ;
+ END;
+
+ FUNCTION showing_results
+ RETURN BOOLEAN
+ IS
+ BEGIN
+ RETURN g_showresults;
+ END;
+
+ /* START username:studious Date:01/11/2002 Task_id:42690
+ Description: Checking whether object exists */
+
+ FUNCTION find_obj (check_this_in IN VARCHAR2)
+ RETURN BOOLEAN
+ IS
+ v_st VARCHAR2 (20);
+ v_err VARCHAR2 (100);
+ v_schema VARCHAR2 (100);
+ v_obj_name VARCHAR2 (100);
+ v_point NUMBER
+ := INSTR (check_this_in, '.');
+ v_state BOOLEAN := FALSE ;
+ v_val VARCHAR2 (30);
+
+ CURSOR c_obj
+ IS
+ SELECT object_name
+ FROM all_objects
+ WHERE object_name = UPPER (v_obj_name)
+ AND owner = UPPER (v_schema);
+ BEGIN
+ IF v_point = 0
+ THEN
+ v_schema := USER;
+ v_obj_name := check_this_in;
+ ELSE
+ v_schema := SUBSTR (
+ check_this_in,
+ 0,
+ ( v_point
+ - 1
+ )
+ );
+ v_obj_name := SUBSTR (
+ check_this_in,
+ ( v_point
+ + 1
+ )
+ );
+ END IF;
+
+ OPEN c_obj;
+ FETCH c_obj INTO v_val;
+
+ IF c_obj%FOUND
+ THEN
+ v_state := TRUE ;
+ ELSE
+ v_state := FALSE ;
+ END IF;
+
+ CLOSE c_obj;
+ RETURN v_state;
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ RETURN FALSE ;
+ END;
+
+ PROCEDURE objexists (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE ,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ BEGIN
+ IF utplsql2.tracing
+ THEN
+ -- Optional trace of assertion call.
+ utreport.pl (
+ 'verfying that the object "'
+ || check_this_in
+ || '"exists'
+ );
+ END IF;
+
+ this (
+ outcome_in,
+ message (
+ msg_in,
+ check_this_in,
+ 'This object Exists'
+ ),
+ message (
+ msg_in,
+ check_this_in,
+ 'This object does not Exist'
+ ),
+ find_obj (check_this_in),
+ null_ok_in,
+ raise_exc_in,
+ TRUE
+ );
+ END;
+
+ PROCEDURE objnotexists (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE ,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ BEGIN
+ IF utplsql2.tracing
+ THEN
+ -- Optional trace of assertion call.
+ utreport.pl (
+ 'verifying that the object "'
+ || check_this_in
+ || '"does not exist'
+ );
+ END IF;
+
+ this (
+ outcome_in,
+ message (
+ msg_in,
+ check_this_in,
+ 'This object does not Exist'
+ ),
+ message (
+ msg_in,
+ check_this_in,
+ 'This object Exists'
+ ),
+ NOT (find_obj (check_this_in)),
+ null_ok_in,
+ raise_exc_in,
+ TRUE
+ );
+ END;
+/* END username:studious Task_id:42690*/
+
+ /* START chrisrimmer 42694 */
+ FUNCTION previous_passed
+ RETURN BOOLEAN
+ IS
+ BEGIN
+ RETURN g_previous_pass;
+ END;
+
+ FUNCTION previous_failed
+ RETURN BOOLEAN
+ IS
+ BEGIN
+ RETURN NOT g_previous_pass;
+ END;
+/* END chrisrimmer 42694 */
+
+ /* START chrisrimmer 42696 */
+ PROCEDURE eqoutput (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN DBMS_OUTPUT.CHARARR,
+ against_this_in IN DBMS_OUTPUT.CHARARR,
+ ignore_case_in IN BOOLEAN := FALSE,
+ ignore_whitespace_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ v_check_index BINARY_INTEGER;
+ v_against_index BINARY_INTEGER;
+ v_message VARCHAR2(1000);
+ v_line1 VARCHAR2(1000);
+ v_line2 VARCHAR2(1000);
+ WHITESPACE CONSTANT CHAR(5) := '!' || CHR(9) || CHR(10) || CHR(13) || CHR(32) ;
+ NOWHITESPACE CONSTANT CHAR(1) := '!';
+
+ FUNCTION Preview_Line(line_in VARCHAR2)
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ IF LENGTH(line_in) <= 100 THEN
+ RETURN line_in;
+ ELSE
+ RETURN SUBSTR(line_in, 1, 97) || '...';
+ END IF;
+ END;
+
+ BEGIN
+ v_check_index := check_this_in.FIRST;
+ v_against_index := against_this_in.FIRST;
+
+ WHILE v_check_index IS NOT NULL
+ AND v_against_index IS NOT NULL
+ AND v_message IS NULL
+ LOOP
+
+ v_line1 := check_this_in(v_check_index);
+ v_line2 := against_this_in(v_against_index);
+
+ IF ignore_case_in THEN
+ v_line1 := UPPER(v_line1);
+ v_line2 := UPPER(v_line2);
+ END IF;
+
+ IF ignore_whitespace_in THEN
+ v_line1 := TRANSLATE(v_line1, WHITESPACE, NOWHITESPACE);
+ v_line2 := TRANSLATE(v_line2, WHITESPACE, NOWHITESPACE);
+ END IF;
+
+ IF (NVL (v_line1 <> v_line2, NOT null_ok_in)) THEN
+ v_message := message_expected (
+ 'EQOUTPUT',
+ msg_in,
+ Preview_Line(check_this_in(v_check_index)),
+ Preview_Line(against_this_in(v_against_index))) ||
+ ' (Comparing line ' || v_check_index ||
+ ' of tested collection against line ' || v_against_index ||
+ ' of reference collection)';
+ END IF;
+
+ v_check_index := check_this_in.NEXT(v_check_index);
+ v_against_index := against_this_in.NEXT(v_against_index);
+ END LOOP;
+
+ IF v_message IS NULL THEN
+ IF v_check_index IS NULL AND v_against_index IS NOT NULL THEN
+ v_message := message (
+ 'EQOUTPUT',
+ msg_in ,
+ 'Extra line found at end of reference collection: ' ||
+ Preview_Line(against_this_in(v_against_index)));
+ ELSIF v_check_index IS NOT NULL AND v_against_index IS NULL THEN
+ v_message := message (
+ 'EQOUTPUT',
+ msg_in ,
+ 'Extra line found at end of tested collection: ' ||
+ Preview_Line(check_this_in(v_check_index)));
+ END IF;
+ END IF;
+
+ this(outcome_in,
+ NVL(v_message, message('EQOUTPUT', msg_in, 'Collections Match')),
+ v_message IS NULL,
+ FALSE,
+ raise_exc_in,
+ TRUE);
+
+ END;
+
+ PROCEDURE eqoutput (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN DBMS_OUTPUT.CHARARR,
+ against_this_in IN DBMS_OUTPUT.CHARARR,
+ ignore_case_in IN BOOLEAN := FALSE,
+ ignore_whitespace_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_id ut_outcome.id%TYPE;
+ BEGIN
+ get_id (outcome_in, l_id);
+ eqoutput(
+ l_id,
+ msg_in,
+ check_this_in,
+ against_this_in,
+ ignore_case_in,
+ ignore_whitespace_in,
+ null_ok_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eqoutput (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN DBMS_OUTPUT.CHARARR,
+ against_this_in IN VARCHAR2,
+ line_delimiter_in IN CHAR := NULL,
+ ignore_case_in IN BOOLEAN := FALSE,
+ ignore_whitespace_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_buffer DBMS_OUTPUT.CHARARR;
+ l_against_this VARCHAR2(2000) := against_this_in;
+ l_delimiter_pos BINARY_INTEGER;
+ BEGIN
+
+ IF line_delimiter_in IS NULL THEN
+ l_against_this := REPLACE(l_against_this, CHR(13) || CHR(10), CHR(10));
+ END IF;
+
+ WHILE l_against_this IS NOT NULL LOOP
+ l_delimiter_pos := INSTR(l_against_this, NVL(line_delimiter_in, CHR(10)));
+ IF l_delimiter_pos = 0 THEN
+ l_buffer(l_buffer.COUNT) := l_against_this;
+ l_against_this := NULL;
+ ELSE
+ l_buffer(l_buffer.COUNT) := SUBSTR(l_against_this, 1, l_delimiter_pos - 1);
+ l_against_this := SUBSTR(l_against_this, l_delimiter_pos + 1);
+ --Handle Case of delimiter at end
+ IF l_against_this IS NULL THEN
+ l_buffer(l_buffer.COUNT) := NULL;
+ END IF;
+ END IF;
+ END LOOP;
+
+ eqoutput(
+ outcome_in,
+ msg_in,
+ check_this_in,
+ l_buffer,
+ ignore_case_in,
+ ignore_whitespace_in,
+ null_ok_in,
+ raise_exc_in
+ );
+ END;
+
+ PROCEDURE eqoutput (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN DBMS_OUTPUT.CHARARR,
+ against_this_in IN VARCHAR2,
+ line_delimiter_in IN CHAR := NULL,
+ ignore_case_in IN BOOLEAN := FALSE,
+ ignore_whitespace_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+ )
+ IS
+ l_id ut_outcome.id%TYPE;
+ BEGIN
+ get_id (outcome_in, l_id);
+ eqoutput(
+ l_id,
+ msg_in,
+ check_this_in,
+ against_this_in,
+ line_delimiter_in,
+ ignore_case_in,
+ ignore_whitespace_in,
+ null_ok_in,
+ raise_exc_in
+ );
+ END;
+
+ /* END chrisrimmer 42696 */
+
+ /* START VENKY11 12345 */
+
+ PROCEDURE eq_refc_table(
+ outcome_in IN ut_outcome.id%TYPE,
+ p_msg_nm IN VARCHAR2,
+ proc_name IN VARCHAR2,
+ params IN utplsql_util.utplsql_params,
+ cursor_position IN PLS_INTEGER,
+ table_name IN VARCHAR2 )
+ IS
+ refc_table_name VARCHAR2(50);
+ BEGIN
+ refc_table_name := utplsql_util.prepare_and_fetch_rc(proc_name,params,cursor_position,1,table_name);
+ IF (refc_table_name IS NOT NULL) THEN
+ IF (utplsql.tracing) THEN
+ dbms_output.put_line('Doing eqtable ');
+ END IF;
+ --utassert2.eqtable(outcome_in,p_msg_nm,'UTPLSQL.'||refc_table_name,table_name);
+ utassert2.eqtable(outcome_in,p_msg_nm,refc_table_name,table_name);
+ END IF;
+ IF (utplsql.tracing) THEN
+ dbms_output.put_line('Table dropped '||refc_table_name);
+ END IF;
+ utplsql_util.execute_ddl('DROP TABLE '||refc_table_name);
+ END;
+
+ PROCEDURE eq_refc_query(
+ outcome_in IN ut_outcome.id%TYPE,
+ p_msg_nm IN VARCHAR2,
+ proc_name IN VARCHAR2,
+ params IN utplsql_util.utplsql_params,
+ cursor_position IN PLS_INTEGER,
+ qry IN VARCHAR2 )
+ IS
+ refc_table_name VARCHAR2(50);
+ BEGIN
+ refc_table_name := utplsql_util.prepare_and_fetch_rc(proc_name,params,cursor_position,2,qry);
+ IF (refc_table_name IS NOT NULL) THEN
+ --utassert2.eqquery(outcome_in,p_msg_nm,'select * from '||'UTPLSQL.'||refc_table_name,qry);
+ utassert2.eqquery(outcome_in,p_msg_nm,'select * from '||refc_table_name,qry);
+ END IF;
+ IF (utplsql.tracing) THEN
+ dbms_output.put_line('Table dropped '||refc_table_name);
+ END IF;
+ utplsql_util.execute_ddl('DROP TABLE '||refc_table_name);
+ END;
+
+/* START VENKY11 12345 */
+
+
+
+END utassert2;
+/
+
diff --git a/source/ut_assert2.pks b/source/ut_assert2.pks
new file mode 100644
index 000000000..096422a5a
--- /dev/null
+++ b/source/ut_assert2.pks
@@ -0,0 +1,621 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE utassert2
+&start_ge_8_1 AUTHID CURRENT_USER &end_ge_8_1
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:46 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ test_failure EXCEPTION;
+ /* On Error behaviors */
+ c_continue CONSTANT CHAR (1) := 'c';
+ c_stop CONSTANT CHAR (1) := 's';
+
+ TYPE value_name_rt IS RECORD (
+ value VARCHAR2(32767),
+ name VARCHAR2(100));
+
+ TYPE value_name_tt IS TABLE OF value_name_rt INDEX BY BINARY_INTEGER;
+
+ function id (name_in in ut_assertion.name%type) return ut_assertion.id%type;
+ function name (id_in in ut_assertion.id%type) return ut_assertion.name%type;
+
+ PROCEDURE this (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE,
+ register_in IN BOOLEAN := TRUE
+ );
+
+ /*
+ 2.0.8 General evaluation program.
+ */
+ PROCEDURE eval (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ using_in IN VARCHAR2, -- The expression
+ value_name_in IN value_name_tt,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eval (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ using_in IN VARCHAR2, -- The expression
+ value_name_in IN value_name_tt,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eq (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eq (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN DATE,
+ against_this_in IN DATE,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE,
+ truncate_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eq (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ against_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eqtable (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ check_where_in IN VARCHAR2 := NULL,
+ against_where_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eqtabcount (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ check_where_in IN VARCHAR2 := NULL,
+ against_where_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eqquery (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ --Check a query against a single VARCHAR2 value
+ PROCEDURE eqqueryvalue (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_query_in IN VARCHAR2,
+ against_value_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ -- Check a query against a single DATE value
+ PROCEDURE eqqueryvalue (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_query_in IN VARCHAR2,
+ against_value_in IN DATE,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eqqueryvalue (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_query_in IN VARCHAR2,
+ against_value_in IN NUMBER,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ -- Not currently implemented
+ PROCEDURE eqcursor (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eqfile (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ check_this_dir_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ against_this_dir_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eqpipe (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ /* Direct access to collections */
+ PROCEDURE eqcoll (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2, /* pkg1.coll */
+ against_this_in IN VARCHAR2, /* pkg2.coll */
+ eqfunc_in IN VARCHAR2 := NULL,
+ check_startrow_in IN PLS_INTEGER := NULL,
+ check_endrow_in IN PLS_INTEGER := NULL,
+ against_startrow_in IN PLS_INTEGER := NULL,
+ against_endrow_in IN PLS_INTEGER := NULL,
+ match_rownum_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ /* API based access to collections */
+ PROCEDURE eqcollapi (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_pkg_in IN VARCHAR2,
+ against_this_pkg_in IN VARCHAR2,
+ eqfunc_in IN VARCHAR2 := NULL,
+ countfunc_in IN VARCHAR2 := 'COUNT',
+ firstrowfunc_in IN VARCHAR2 := 'FIRST',
+ lastrowfunc_in IN VARCHAR2 := 'LAST',
+ nextrowfunc_in IN VARCHAR2 := 'NEXT',
+ getvalfunc_in IN VARCHAR2 := 'NTHVAL',
+ check_startrow_in IN PLS_INTEGER := NULL,
+ check_endrow_in IN PLS_INTEGER := NULL,
+ against_startrow_in IN PLS_INTEGER := NULL,
+ against_endrow_in IN PLS_INTEGER := NULL,
+ match_rownum_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE isnotnull (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE isnull (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ -- 1.5.2
+ PROCEDURE isnotnull (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE isnull (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ --Check a given call throws a named exception
+ PROCEDURE throws (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_call_in IN VARCHAR2,
+ against_exc_in IN VARCHAR2
+ );
+
+ --Check a given call throws an exception with a given SQLCODE
+ PROCEDURE throws (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in VARCHAR2,
+ check_call_in IN VARCHAR2,
+ against_exc_in IN NUMBER
+ );
+
+ --Check a given call throws a named exception
+ PROCEDURE raises (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_call_in IN VARCHAR2,
+ against_exc_in IN VARCHAR2
+ );
+
+ --Check a given call throws an exception with a given SQLCODE
+ PROCEDURE raises (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in VARCHAR2,
+ check_call_in IN VARCHAR2,
+ against_exc_in IN NUMBER
+ );
+
+ -- Same assertions, but providing the assertion name, not ID.
+ PROCEDURE this (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE,
+ register_in IN BOOLEAN := TRUE
+ );
+
+
+ PROCEDURE eq (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eq (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN DATE,
+ against_this_in IN DATE,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE,
+ truncate_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eq (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ against_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eqtable (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ check_where_in IN VARCHAR2 := NULL,
+ against_where_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eqtabcount (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ check_where_in IN VARCHAR2 := NULL,
+ against_where_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eqquery (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ --Check a query against a single VARCHAR2 value
+ PROCEDURE eqqueryvalue (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_query_in IN VARCHAR2,
+ against_value_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ -- Check a query against a single DATE value
+ PROCEDURE eqqueryvalue (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_query_in IN VARCHAR2,
+ against_value_in IN DATE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eqqueryvalue (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_query_in IN VARCHAR2,
+ against_value_in IN NUMBER,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ -- Not currently implemented
+ PROCEDURE eqcursor (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eqfile (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ check_this_dir_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ against_this_dir_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eqpipe (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ /* Direct access to collections */
+ PROCEDURE eqcoll (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2, /* pkg1.coll */
+ against_this_in IN VARCHAR2, /* pkg2.coll */
+ eqfunc_in IN VARCHAR2 := NULL,
+ check_startrow_in IN PLS_INTEGER := NULL,
+ check_endrow_in IN PLS_INTEGER := NULL,
+ against_startrow_in IN PLS_INTEGER := NULL,
+ against_endrow_in IN PLS_INTEGER := NULL,
+ match_rownum_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ /* API based access to collections */
+ PROCEDURE eqcollapi (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_pkg_in IN VARCHAR2,
+ against_this_pkg_in IN VARCHAR2,
+ eqfunc_in IN VARCHAR2 := NULL,
+ countfunc_in IN VARCHAR2 := 'COUNT',
+ firstrowfunc_in IN VARCHAR2 := 'FIRST',
+ lastrowfunc_in IN VARCHAR2 := 'LAST',
+ nextrowfunc_in IN VARCHAR2 := 'NEXT',
+ getvalfunc_in IN VARCHAR2 := 'NTHVAL',
+ check_startrow_in IN PLS_INTEGER := NULL,
+ check_endrow_in IN PLS_INTEGER := NULL,
+ against_startrow_in IN PLS_INTEGER := NULL,
+ against_endrow_in IN PLS_INTEGER := NULL,
+ match_rownum_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE isnotnull (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE isnull (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ -- 1.5.2
+ PROCEDURE isnotnull (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE isnull (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ --Check a given call throws a named exception
+ PROCEDURE throws (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_call_in IN VARCHAR2,
+ against_exc_in IN VARCHAR2
+ );
+
+ --Check a given call throws an exception with a given SQLCODE
+ PROCEDURE throws (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in VARCHAR2,
+ check_call_in IN VARCHAR2,
+ against_exc_in IN NUMBER
+ );
+
+ --Check a given call throws a named exception
+ PROCEDURE raises (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_call_in IN VARCHAR2,
+ against_exc_in IN VARCHAR2
+ );
+
+ --Check a given call throws an exception with a given SQLCODE
+ PROCEDURE raises (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in VARCHAR2,
+ check_call_in IN VARCHAR2,
+ against_exc_in IN NUMBER
+ );
+
+ PROCEDURE showresults;
+
+ PROCEDURE noshowresults;
+
+ FUNCTION showing_results
+ RETURN BOOLEAN;
+
+ -- 2.0.7
+ PROCEDURE fileExists(
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ dir_in in varchar2,
+ file_in in varchar2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ /* START username:studious Date:01/11/2002 Task_id:42690
+ Description: Checking object exist */
+
+ PROCEDURE objExists (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE objnotExists (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+/* END username:studious Task_id:42690*/
+
+ /* START chrisrimmer 42694 */
+ FUNCTION previous_passed
+ RETURN BOOLEAN;
+
+ FUNCTION previous_failed
+ RETURN BOOLEAN;
+ /* END chrisrimmer 42694 */
+
+ /* START chrisrimmer 42696 */
+ PROCEDURE eqoutput (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN DBMS_OUTPUT.CHARARR,
+ against_this_in IN DBMS_OUTPUT.CHARARR,
+ ignore_case_in IN BOOLEAN := FALSE,
+ ignore_whitespace_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eqoutput (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN DBMS_OUTPUT.CHARARR,
+ against_this_in IN DBMS_OUTPUT.CHARARR,
+ ignore_case_in IN BOOLEAN := FALSE,
+ ignore_whitespace_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eqoutput (
+ outcome_in IN ut_outcome.id%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN DBMS_OUTPUT.CHARARR,
+ against_this_in IN VARCHAR2,
+ line_delimiter_in IN CHAR := NULL,
+ ignore_case_in IN BOOLEAN := FALSE,
+ ignore_whitespace_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE eqoutput (
+ outcome_in IN ut_outcome.name%TYPE,
+ msg_in IN VARCHAR2,
+ check_this_in IN DBMS_OUTPUT.CHARARR,
+ against_this_in IN VARCHAR2,
+ line_delimiter_in IN CHAR := NULL,
+ ignore_case_in IN BOOLEAN := FALSE,
+ ignore_whitespace_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+ /* END chrisrimmer 42696 */
+
+ /* START VENKY11 12345 */
+
+ PROCEDURE eq_refc_table(
+ outcome_in IN ut_outcome.id%TYPE,
+ p_msg_nm IN VARCHAR2,
+ proc_name IN VARCHAR2,
+ params IN utplsql_util.utplsql_params,
+ cursor_position IN PLS_INTEGER,
+ table_name IN VARCHAR2 );
+
+ PROCEDURE eq_refc_query(
+ outcome_in IN ut_outcome.id%TYPE,
+ p_msg_nm IN VARCHAR2,
+ proc_name IN VARCHAR2,
+ params IN utplsql_util.utplsql_params,
+ cursor_position IN PLS_INTEGER,
+ qry IN VARCHAR2 );
+
+
+/* END VENKY11 12345 */
+
+
+END utassert2;
+/
diff --git a/source/ut_assertion.tab b/source/ut_assertion.tab
new file mode 100644
index 000000000..146e9cefd
--- /dev/null
+++ b/source/ut_assertion.tab
@@ -0,0 +1,147 @@
+-- Modification History:
+-- studious:01/20/2002:Assertion for object existance
+
+CREATE TABLE ut_assertion (
+ id INTEGER ,
+ NAME VARCHAR2(100), -- MUST corresponds to utAssert2 program name
+ description VARCHAR2(1000),
+ /* Rest of columns, V1 compatibility; too generic to be useful. */
+ use_msg CHAR(1) DEFAULT 'Y',
+ use_null_ok CHAR(1) DEFAULT 'Y',
+ use_raise_exc CHAR(1) DEFAULT 'Y',
+ use_check_this CHAR(1) DEFAULT 'Y',
+ check_this_label VARCHAR2(100)
+ DEFAULT 'Check this',
+ use_check_this_where CHAR(1) DEFAULT 'N',
+ check_this_where_label VARCHAR2(100)
+ DEFAULT 'Check this WHERE clause',
+ use_against_this CHAR(1) DEFAULT 'Y',
+ against_this_label VARCHAR2(100)
+ DEFAULT 'Against this',
+ use_against_this_where CHAR(1) DEFAULT 'N',
+ against_this_where_label VARCHAR2(100)
+ DEFAULT 'Against this WHERE clause',
+ use_check_this_dir CHAR(1) DEFAULT 'N',
+ check_this_dir_label VARCHAR2(100)
+ DEFAULT 'Location of "check this" file',
+ use_against_this_dir CHAR(1) DEFAULT 'N',
+ against_this_dir_label VARCHAR2(100)
+ DEFAULT 'Location of "against this" file',
+ CONSTRAINT ut_assertion_pk PRIMARY KEY (id)
+);
+
+CREATE UNIQUE INDEX ut_assertion_idx1 ON
+ ut_assertion (NAME);
+
+BEGIN
+ INSERT INTO ut_assertion
+ (id, NAME,
+ description)
+ VALUES (1, 'THIS',
+ 'General Boolean expression evaluation');
+
+ INSERT INTO ut_assertion
+ (id, NAME,
+ description)
+ VALUES (2, 'EQ',
+ 'Scalar equality');
+
+ INSERT INTO ut_assertion
+ (id, NAME,
+ description)
+ VALUES (3, 'EQTABLE',
+ 'Database table/view equality');
+
+ INSERT INTO ut_assertion
+ (id, NAME,
+ description)
+ VALUES (4, 'EQTABCOUNT',
+ 'Database table/view row count comparison');
+
+ INSERT INTO ut_assertion
+ (id, NAME,
+ description)
+ VALUES (5, 'EQQUERY',
+ 'Query result set equality');
+
+ INSERT INTO ut_assertion
+ (id, NAME,
+ description)
+ VALUES (6, 'EQQUERYVALUE',
+ 'Query return value comparison');
+
+ INSERT INTO ut_assertion
+ (id, NAME,
+ description)
+ VALUES (7, 'EQFILE',
+ 'Operating system file equality');
+
+ INSERT INTO ut_assertion
+ (id, NAME,
+ description)
+ VALUES (8, 'EQPIPE',
+ 'Database pipe equality');
+
+ INSERT INTO ut_assertion
+ (id, NAME,
+ description)
+ VALUES (9, 'EQCOLL',
+ 'Collection equality - direct access');
+
+ INSERT INTO ut_assertion
+ (id, NAME,
+ description)
+ VALUES (10, 'EQCOLLAPI',
+ 'Collection equality - API access');
+
+ INSERT INTO ut_assertion
+ (id, NAME,
+ description)
+ VALUES (11, 'ISNOTNULL',
+ 'NOTNULL validation');
+
+ INSERT INTO ut_assertion
+ (id, NAME,
+ description)
+ VALUES (12, 'ISNULL',
+ 'NULL validation');
+
+ INSERT INTO ut_assertion
+ (id, NAME,
+ description)
+ VALUES (13, 'RAISES',
+ 'Raised exception validation');
+
+ INSERT INTO ut_assertion
+ (id, NAME,
+ description)
+ VALUES (14, 'FILEEXISTS',
+ 'Confirm that specified file exists');
+
+ INSERT INTO ut_assertion
+ (id, NAME,
+ description)
+ VALUES (15, 'EVALUATE',
+ 'General evaluation of specified expression');
+
+-- START username:STUDIOUS Date:01/11/2002 Task_id:42690
+-- Description: Checking whether object exists
+
+ INSERT INTO ut_assertion
+ (id, NAME,
+ description)
+ VALUES (16, 'OBJEXISTS',
+ 'Confirm that specified Object exists');
+
+ INSERT INTO ut_assertion
+ (id, NAME,
+ description)
+ VALUES (17, 'OBJNOTEXISTS',
+ 'Confirm that specified Object does not exist');
+
+-- END username:STUDIOUS Task_id:42690
+
+ COMMIT;
+END;
+/
+
diff --git a/source/ut_assertion_seq.seq b/source/ut_assertion_seq.seq
new file mode 100644
index 000000000..11a8ce337
--- /dev/null
+++ b/source/ut_assertion_seq.seq
@@ -0,0 +1 @@
+CREATE sequence ut_assertion_seq INCREMENT BY 1 START WITH 1 ORDER NOCACHE;
diff --git a/source/ut_config.pkb b/source/ut_config.pkb
new file mode 100644
index 000000000..a4d7af0c8
--- /dev/null
+++ b/source/ut_config.pkb
@@ -0,0 +1,763 @@
+CREATE OR REPLACE PACKAGE BODY utconfig
+IS
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.5 2004/11/23 14:56:47 chrisrimmer
+Moved dbms_pipe code into its own package. Also changed some preprocessor flags
+
+Revision 1.4 2004/11/16 09:46:48 chrisrimmer
+Changed to new version detection system.
+
+Revision 1.3 2004/07/14 17:01:57 chrisrimmer
+Added first version of pluggable reporter packages
+
+Revision 1.2 2003/07/01 19:36:46 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+-------------------------------------------------------------------------------
+--Description
+-------------------------------------------------------------------------------
+--This package manages the ut_config table, which holds the configuration
+--settings for different users. The configuration data to be used by utPLSQL
+--by default is set by calling settester. Wherever a username is passed as NULL,
+--it is assumed to be that user. This defaults initially to the current user.
+-------------------------------------------------------------------------------
+
+----------------------------------------------------------------------------
+--This record holds the default configuration
+----------------------------------------------------------------------------
+ g_config ut_config%ROWTYPE := NULL;
+
+----------------------------------------------------------------------------
+-- Get the configuration record for a user from the table
+----------------------------------------------------------------------------
+ FUNCTION config (username_in IN VARCHAR2 := USER)
+ RETURN ut_config%ROWTYPE
+ IS
+ rec ut_config%ROWTYPE;
+ BEGIN
+ --Short cut for current user
+ IF username_in = tester
+ THEN
+ RETURN g_config;
+ END IF;
+
+ BEGIN
+ --Try to pull in the record from the table
+ SELECT *
+ INTO rec
+ FROM ut_config
+ WHERE username = UPPER (username_in);
+ EXCEPTION
+ --If we failed to find the record
+ WHEN OTHERS
+ THEN
+ --Set the record to NULL
+ rec := NULL;
+ END;
+
+ RETURN rec;
+ END;
+
+----------------------------------------------------------------------------
+--This sets the configuration record for a user in the table
+----------------------------------------------------------------------------
+ PROCEDURE setconfig (
+ field_in IN VARCHAR2
+ ,value_in VARCHAR2
+ ,username_in IN VARCHAR2 := NULL
+ )
+ IS
+ &start_ge_8_1 PRAGMA AUTONOMOUS_TRANSACTION; &end_ge_8_1
+
+ --Local procedure to do dynamic SQL
+ PROCEDURE do_dml (statement_in IN VARCHAR2)
+ IS
+ &start_lt_8_1 cursor_handle INTEGER; &end_lt_8_1
+ &start_lt_8_1 rows INTEGER; &end_lt_8_1
+ BEGIN
+ --In 8i, just do it
+ &start_ge_8_1 EXECUTE IMMEDIATE statement_in; COMMIT; &end_ge_8_1
+
+ --Otherwise use DBMS_SQL
+ &start_lt_8_1
+ --Open the cursor
+ cursor_handle := DBMS_SQL.open_cursor;
+ -- Parse the Statement
+ DBMS_SQL.parse (cursor_handle, statement_in, DBMS_SQL.native);
+ -- Execute the Statement
+ ROWS := DBMS_SQL.EXECUTE (cursor_handle);
+ -- Close the cursor
+ DBMS_SQL.close_cursor (cursor_handle);
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ DBMS_SQL.close_cursor (cursor_handle);
+ RAISE;
+ &end_lt_8_1
+ END;
+ BEGIN
+ BEGIN
+ --Try to insert the record
+ do_dml ( 'INSERT INTO ut_config(username, '
+ || field_in
+ || ')'
+ || 'VALUES ('''
+ || username_in
+ || ''', '''
+ || value_in
+ || ''')'
+ );
+ EXCEPTION
+ WHEN DUP_VAL_ON_INDEX
+ THEN
+ --Since it already exists, we'll update instead
+ do_dml ( 'UPDATE ut_config '
+ || 'SET '
+ || field_in
+ || ' = '''
+ || value_in
+ || ''' '
+ || 'WHERE username = '''
+ || username_in
+ || ''' '
+ );
+ WHEN OTHERS
+ THEN
+ --Something else went wrong
+ UtOutputreporter.pl (SQLERRM);
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ RETURN;
+ END;
+
+ &start_ge_8_1 COMMIT; &end_ge_8_1
+
+ --If it's the current user, force update of package record
+ IF username_in = tester
+ THEN
+ g_config := NULL;
+ settester (username_in);
+ END IF;
+ END;
+
+----------------------------------------------------------------------------
+--This loads the default configuration from the table
+----------------------------------------------------------------------------
+ PROCEDURE settester (username_in IN VARCHAR2 := USER)
+ IS
+ BEGIN
+ --Load the record
+ g_config := config (username_in);
+ --But set the username record if null
+ g_config.username := NVL (g_config.username, UPPER (username_in));
+ END;
+
+----------------------------------------------------------------------------
+-- Get the user we use by default
+----------------------------------------------------------------------------
+ FUNCTION tester
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ RETURN g_config.username;
+ END;
+
+----------------------------------------------------------------------------
+-- Show the config for a user
+----------------------------------------------------------------------------
+ PROCEDURE showconfig (username_in IN VARCHAR2 := NULL)
+ IS
+ --The schema to show
+ v_user VARCHAR2 (32) := NVL (username_in, tester);
+ --This holds the configuration
+ rec ut_config%ROWTYPE;
+ BEGIN
+ --Get the configuration
+ rec := config (v_user);
+ --Now show it
+ utOutputReporter.pl ('=============================================================');
+ utOutputReporter.pl ('utPLSQL Configuration for ' || v_user);
+ utOutputReporter.pl (' Directory: ' || rec.DIRECTORY);
+ utOutputReporter.pl (' Autcompile? ' || rec.autocompile);
+ utOutputReporter.pl (' Manual test registration? ' || rec.registertest);
+ utOutputReporter.pl (' Prefix = ' || rec.prefix);
+ utOutputReporter.pl (' Default reporter = ' || rec.reporter);
+ utOutputReporter.pl (' ----- File Output settings:');
+ utOutputReporter.pl (' Output directory: ' || rec.filedir);
+ utOutputReporter.pl (' User prefix = ' || rec.fileuserprefix);
+ utOutputReporter.pl (' Include progname? ' || rec.fileincprogname);
+ utOutputReporter.pl (' Date format = ' || rec.filedateformat);
+ utOutputReporter.pl (' File extension = ' || rec.fileextension);
+ utOutputReporter.pl (' ----- End File Output settings');
+ utOutputReporter.pl ('=============================================================');
+ END;
+
+----------------------------------------------------------------------------
+-- Set the prefix for a user
+----------------------------------------------------------------------------
+ PROCEDURE setprefix (prefix_in IN VARCHAR2, username_in IN VARCHAR2 := NULL)
+ IS
+ --The user to set
+ v_user VARCHAR2 (100) := NVL (UPPER (username_in), tester);
+ BEGIN
+ --Set the configuration
+ setconfig ('prefix', prefix_in, v_user);
+ END;
+
+----------------------------------------------------------------------------
+-- Get the prefix for a user
+----------------------------------------------------------------------------
+ FUNCTION prefix (username_in IN VARCHAR2 := NULL)
+ RETURN VARCHAR2
+ IS
+ --Holds the user's config record
+ rec ut_config%ROWTYPE;
+ --Holds the username in question
+ v_user VARCHAR2 (100) := NVL (UPPER (username_in), tester);
+ BEGIN
+ --Pull in the configuration
+ rec := config (v_user);
+ --Return prefix
+ RETURN NVL (rec.prefix, c_prefix);
+ END;
+
+----------------------------------------------------------------------------
+-- Set the delimiter for a user
+----------------------------------------------------------------------------
+ PROCEDURE setdelimiter (
+ delimiter_in IN VARCHAR2
+ ,username_in IN VARCHAR2 := NULL
+ )
+ IS
+ --The user to set
+ v_user VARCHAR2 (100) := NVL (UPPER (username_in), tester);
+ BEGIN
+ --Set the configuration
+ setconfig ('delimiter', delimiter_in, v_user);
+ END;
+
+----------------------------------------------------------------------------
+-- Get the delimiter for a user
+----------------------------------------------------------------------------
+ FUNCTION delimiter (username_in IN VARCHAR2 := NULL)
+ RETURN VARCHAR2
+ IS
+ --Holds the user's config record
+ rec ut_config%ROWTYPE;
+ --Holds the username in question
+ v_user VARCHAR2 (100) := NVL (UPPER (username_in), tester);
+ BEGIN
+ --Pull in the configuration
+ rec := config (v_user);
+ --Return prefix
+ RETURN NVL (rec.delimiter, c_delimiter);
+ END;
+
+----------------------------------------------------------------------------
+-- Set the source directory for a user
+----------------------------------------------------------------------------
+ PROCEDURE setdir (dir_in IN VARCHAR2, username_in IN VARCHAR2 := NULL)
+ IS
+ --The user to set
+ v_user VARCHAR2 (100) := NVL (UPPER (username_in), tester);
+ BEGIN
+ --Set the configuration
+ setconfig ('directory', dir_in, v_user);
+ END;
+
+----------------------------------------------------------------------------
+-- Get the source directory for a user
+----------------------------------------------------------------------------
+ FUNCTION dir (username_in IN VARCHAR2 := NULL)
+ RETURN VARCHAR2
+ IS
+ --Holds the user's config record
+ rec ut_config%ROWTYPE;
+ --Holds the username in question
+ v_user VARCHAR2 (100) := NVL (UPPER (username_in), tester);
+ BEGIN
+ --Pull in the configuration
+ rec := config (v_user);
+ --Return directory
+ RETURN rec.DIRECTORY;
+ END;
+
+----------------------------------------------------------------------------
+-- Set the autocompile flag for a user
+----------------------------------------------------------------------------
+ PROCEDURE autocompile (onoff_in IN BOOLEAN, username_in IN VARCHAR2 := NULL)
+ IS
+ --Holds the flag as 'Y'/'N'
+ v_autocompile CHAR (1) := utplsql.bool2vc (onoff_in);
+ --Holds the user to set
+ v_user VARCHAR2 (100) := NVL (UPPER (username_in), tester);
+ BEGIN
+ --Set the configuration
+ setconfig ('autocompile', v_autocompile, v_user);
+ END;
+
+----------------------------------------------------------------------------
+-- Get the autocompile flag for a user
+----------------------------------------------------------------------------
+ FUNCTION autocompiling (username_in IN VARCHAR2 := NULL)
+ RETURN BOOLEAN
+ IS
+ --Holds the user's config record
+ rec ut_config%ROWTYPE;
+ --Holds the username in question
+ v_user VARCHAR2 (100) := NVL (UPPER (username_in), tester);
+ BEGIN
+ --Pull in the configuration
+ rec := config (v_user);
+ --Return autocompile, defaulting to TRUE if NULL
+ RETURN NVL (utplsql.vc2bool (rec.autocompile), TRUE);
+ END;
+
+----------------------------------------------------------------------------
+-- Set the manual registration flag for a user
+----------------------------------------------------------------------------
+ PROCEDURE registertest (onoff_in IN BOOLEAN, username_in IN VARCHAR2
+ := NULL)
+ IS
+ --Holds the flag as 'Y'/'N'
+ v_registertest CHAR (1) := utplsql.bool2vc (onoff_in);
+ --Holds the username in question
+ v_user VARCHAR2 (100) := NVL (UPPER (username_in), tester);
+ BEGIN
+ --Set the configuration
+ setconfig ('registertest', v_registertest, v_user);
+ END;
+
+----------------------------------------------------------------------------
+-- Get the manual registration flag for a user
+----------------------------------------------------------------------------
+ FUNCTION registeringtest (username_in IN VARCHAR2 := NULL)
+ RETURN BOOLEAN
+ IS
+ --Holds the user's config record
+ rec ut_config%ROWTYPE;
+ --Holds the username in question
+ v_user VARCHAR2 (100) := NVL (UPPER (username_in), tester);
+ BEGIN
+ --Pull in the configuration
+ rec := config (v_user);
+ --Return registertest, defaulting to FALSE if NULL
+ RETURN NVL (utplsql.vc2bool (rec.registertest), FALSE);
+ END;
+
+ -- Show failures only?
+ PROCEDURE showfailuresonly (
+ onoff_in IN BOOLEAN
+ ,username_in IN VARCHAR2 := NULL
+ )
+ IS
+ --Holds the flag as 'Y'/'N'
+ v_showfailuresonly CHAR (1) := utplsql.bool2vc (onoff_in);
+ --Holds the username in question
+ v_user VARCHAR2 (100)
+ := NVL (UPPER (username_in), tester);
+ BEGIN
+ --Set the configuration
+ setconfig ('show_failures_only', v_showfailuresonly, v_user);
+ END;
+
+ FUNCTION showingfailuresonly (username_in IN VARCHAR2 := NULL)
+ RETURN BOOLEAN
+ IS
+ --Holds the user's config record
+ rec ut_config%ROWTYPE;
+ --Holds the username in question
+ v_user VARCHAR2 (100) := NVL (UPPER (username_in), tester);
+ BEGIN
+ --Pull in the configuration
+ rec := config (v_user);
+ --Return show_failures_only, defaulting to FALSE if NULL
+ RETURN NVL (utplsql.vc2bool (rec.show_failures_only), FALSE);
+ END;
+
+-- RMM start
+----------------------------------------------------------------------------
+-- Set the file directory for a user
+----------------------------------------------------------------------------
+ PROCEDURE setfiledir (
+ dir_in IN VARCHAR2 := NULL
+ ,username_in IN VARCHAR2 := NULL
+ )
+ IS
+ --The user to set
+ v_user VARCHAR2 (100) := NVL (UPPER (username_in), tester);
+ BEGIN
+ --Set the configuration
+ setconfig ('filedir', dir_in, v_user);
+ END;
+
+----------------------------------------------------------------------------
+-- Get the file output directory for a user
+----------------------------------------------------------------------------
+ FUNCTION filedir (username_in IN VARCHAR2 := NULL)
+ RETURN VARCHAR2
+ IS
+ --Holds the user's config record
+ rec ut_config%ROWTYPE;
+ --Holds the username in question
+ v_user VARCHAR2 (100) := NVL (UPPER (username_in), tester);
+ BEGIN
+ --Pull in the configuration
+ rec := config (v_user);
+ --Return directory
+ RETURN rec.filedir;
+ END;
+
+----------------------------------------------------------------------------
+-- Set the default reporter for a user
+----------------------------------------------------------------------------
+ PROCEDURE setreporter (
+ reporter_in IN VARCHAR2
+ ,username_in IN VARCHAR2 := NULL
+ )
+ IS
+ --Holds the user to set
+ v_user VARCHAR2 (100) := NVL (UPPER (username_in), tester);
+ BEGIN
+ --Set the configuration
+ setconfig ('reporter', reporter_in, v_user);
+ Utreport.USE(reporter_in);
+ END;
+
+----------------------------------------------------------------------------
+-- Get the default reporter for a user
+----------------------------------------------------------------------------
+ FUNCTION getreporter (username_in IN VARCHAR2 := NULL)
+ RETURN VARCHAR2
+ IS
+ --Holds the user's config record
+ rec ut_config%ROWTYPE;
+ --Holds the username in question
+ v_user VARCHAR2 (100) := NVL (UPPER (username_in), tester);
+ BEGIN
+ --Pull in the configuration
+ rec := config (v_user);
+ --Return autocompile, defaulting to TRUE if NULL
+ RETURN rec.reporter;
+ END;
+
+----------------------------------------------------------------------------
+-- Set the file prefix for a user
+----------------------------------------------------------------------------
+ PROCEDURE setuserprefix (
+ userprefix_in IN VARCHAR2 := NULL
+ ,username_in IN VARCHAR2 := NULL
+ )
+ IS
+ --The user to set
+ v_user VARCHAR2 (100) := NVL (UPPER (username_in), tester);
+ BEGIN
+ --Set the configuration
+ setconfig ('fileuserprefix', userprefix_in, v_user);
+ END;
+
+----------------------------------------------------------------------------
+-- Get the file prefix for a user
+----------------------------------------------------------------------------
+ FUNCTION userprefix (username_in IN VARCHAR2 := NULL)
+ RETURN VARCHAR2
+ IS
+ --Holds the user's config record
+ rec ut_config%ROWTYPE;
+ --Holds the username in question
+ v_user VARCHAR2 (100) := NVL (UPPER (username_in), tester);
+ BEGIN
+ --Pull in the configuration
+ rec := config (v_user);
+ --Return directory
+ RETURN rec.fileuserprefix;
+ END;
+
+----------------------------------------------------------------------------
+-- Set the include program name flag for a user
+----------------------------------------------------------------------------
+ PROCEDURE setincludeprogname (
+ incname_in IN BOOLEAN := FALSE
+ ,username_in IN VARCHAR2 := NULL
+ )
+ IS
+ --Holds the flag as 'Y'/'N'
+ v_incname CHAR (1) := utplsql.bool2vc (incname_in);
+ --Holds the user to set
+ v_user VARCHAR2 (100) := NVL (UPPER (username_in), tester);
+ BEGIN
+ --Set the configuration
+ setconfig ('fileincprogname', v_incname, v_user);
+ END;
+
+----------------------------------------------------------------------------
+-- Get the include program name flag for a user
+----------------------------------------------------------------------------
+ FUNCTION includeprogname (username_in IN VARCHAR2 := NULL)
+ RETURN BOOLEAN
+ IS
+ --Holds the user's config record
+ rec ut_config%ROWTYPE;
+ --Holds the username in question
+ v_user VARCHAR2 (100) := NVL (UPPER (username_in), tester);
+ BEGIN
+ --Pull in the configuration
+ rec := config (v_user);
+ --Return autocompile, defaulting to TRUE if NULL
+ RETURN NVL (utplsql.vc2bool (rec.fileincprogname), FALSE);
+ END;
+
+----------------------------------------------------------------------------
+-- Set the date format for a user
+----------------------------------------------------------------------------
+ PROCEDURE setdateformat (
+ dateformat_in IN VARCHAR2 := 'yyyyddmmhh24miss'
+ ,username_in IN VARCHAR2 := NULL
+ )
+ IS
+ --The user to set
+ v_user VARCHAR2 (100) := NVL (UPPER (username_in), tester);
+ BEGIN
+ --Set the configuration
+ setconfig ('filedateformat', dateformat_in, v_user);
+ END;
+
+----------------------------------------------------------------------------
+-- Get the date format for a user
+----------------------------------------------------------------------------
+ FUNCTION DATEFORMAT (username_in IN VARCHAR2 := NULL)
+ RETURN VARCHAR2
+ IS
+ --Holds the user's config record
+ rec ut_config%ROWTYPE;
+ --Holds the username in question
+ v_user VARCHAR2 (100) := NVL (UPPER (username_in), tester);
+ BEGIN
+ --Pull in the configuration
+ rec := config (v_user);
+ --Return directory
+ RETURN rec.filedateformat;
+ END;
+
+----------------------------------------------------------------------------
+-- Set the file extension for a user
+----------------------------------------------------------------------------
+ PROCEDURE setfileextension (
+ fileextension_in IN VARCHAR2 := '.UTF'
+ ,username_in IN VARCHAR2 := NULL
+ )
+ IS
+ --The user to set
+ v_user VARCHAR2 (100) := NVL (UPPER (username_in), tester);
+ BEGIN
+ --Set the configuration
+ setconfig ('fileextension', fileextension_in, v_user);
+ END;
+
+----------------------------------------------------------------------------
+-- Get the file extension for a user
+----------------------------------------------------------------------------
+ FUNCTION fileextension (username_in IN VARCHAR2 := NULL)
+ RETURN VARCHAR2
+ IS
+ --Holds the user's config record
+ rec ut_config%ROWTYPE;
+ --Holds the username in question
+ v_user VARCHAR2 (100) := NVL (UPPER (username_in), tester);
+ BEGIN
+ --Pull in the configuration
+ rec := config (v_user);
+ --Return directory
+ RETURN rec.fileextension;
+ END;
+
+----------------------------------------------------------------------------
+-- Set all of the file output columns for a user
+----------------------------------------------------------------------------
+ PROCEDURE setfileinfo (
+ dir_in IN VARCHAR2 := NULL
+ ,userprefix_in IN VARCHAR2 := NULL
+ ,incname_in IN BOOLEAN := FALSE
+ ,dateformat_in IN VARCHAR2 := 'yyyyddmmhh24miss'
+ ,fileextension_in IN VARCHAR2 := '.UTF'
+ ,username_in IN VARCHAR2 := NULL
+ )
+ IS
+ BEGIN
+ setfiledir (dir_in, username_in);
+ setuserprefix (userprefix_in, username_in);
+ setincludeprogname (incname_in, username_in);
+ setdateformat (dateformat_in, username_in);
+ setfileextension (fileextension_in, username_in);
+ END setfileinfo;
+
+----------------------------------------------------------------------------
+-- Get all of the file output columns for a user
+----------------------------------------------------------------------------
+ FUNCTION fileinfo (username_in IN VARCHAR2 := NULL)
+ RETURN rec_fileinfo
+ IS
+ --Holds the user's config record
+ rec ut_config%ROWTYPE;
+ --Holds the username in question
+ v_user VARCHAR2 (100) := NVL (UPPER (username_in), tester);
+ -- Holds the return value
+ fileinfo_rec rec_fileinfo;
+ BEGIN
+ --Pull in the configuration
+ rec := config (v_user);
+ --populate the record
+ fileinfo_rec.filedir := rec.filedir;
+ fileinfo_rec.fileuserprefix := rec.fileuserprefix;
+ fileinfo_rec.fileincprogname := rec.fileincprogname;
+ fileinfo_rec.filedateformat := rec.filedateformat;
+ fileinfo_rec.fileextension := rec.fileextension;
+ --Return the record
+ RETURN fileinfo_rec;
+ END fileinfo;
+
+-- RMM end
+
+ PROCEDURE upd (
+ username_in IN ut_config.username%TYPE
+ ,autocompile_in IN ut_config.autocompile%TYPE
+ ,prefix_in IN ut_config.prefix%TYPE
+ ,show_failures_only_in IN ut_config.show_failures_only%TYPE
+ ,directory_in IN ut_config.DIRECTORY%TYPE
+ ,filedir_in IN ut_config.filedir%TYPE
+ ,show_config_info_in IN ut_config.show_config_info%TYPE
+ ,editor_in IN ut_config.editor%TYPE
+ )
+ IS
+ &start_ge_8_1 PRAGMA AUTONOMOUS_TRANSACTION; &end_ge_8_1
+ BEGIN
+ INSERT INTO ut_config
+ (username, autocompile, prefix
+ ,show_failures_only, DIRECTORY, filedir
+ ,show_config_info, editor
+ )
+ VALUES (username_in, autocompile_in, prefix_in
+ ,show_failures_only_in, directory_in, filedir_in
+ ,show_config_info_in, editor_in
+ );
+ &start_ge_8_1 COMMIT; &end_ge_8_1
+ EXCEPTION
+ WHEN DUP_VAL_ON_INDEX
+ THEN
+ -- Perform an update instead.
+ UPDATE ut_config
+ SET autocompile = autocompile_in
+ ,prefix = prefix_in
+ ,show_failures_only = show_failures_only_in
+ ,DIRECTORY = directory_in
+ ,filedir = filedir_in
+ ,show_config_info = show_config_info_in
+ WHERE username = username_in;
+ -- SF 20050922: Should have a commit; in the dup val exc header.
+ -- Otherwise, Oracle raises exception and rollsback.
+ &start_ge_8_1 COMMIT; & start_ge_8_1
+ WHEN OTHERS
+ THEN
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ NULL; -- Present to assist in formatting
+ END;
+
+ FUNCTION browser_contents (
+ schema_in IN VARCHAR2
+ ,name_like_in IN VARCHAR2 := '%'
+ ,type_like_in IN VARCHAR2 := '%'
+ )
+ RETURN refcur_t
+ IS
+ retval refcur_t;
+ BEGIN
+ OPEN retval FOR
+ SELECT ao.owner, ao.object_name, ao.object_type, ao.created
+ ,ao.last_ddl_time, Utrutp.last_run_status (
+ ao.owner, ao.object_name) status
+ FROM all_objects ao
+ WHERE ao.owner = UPPER (schema_in)
+ AND ao.owner NOT IN ('SYS', 'SYSTEM', 'PUBLIC')
+ AND object_name LIKE UPPER (name_like_in)
+ AND object_type LIKE UPPER (type_like_in)
+ AND object_type IN ('PACKAGE', 'FUNCTION', 'PROCEDURE', 'OBJECT TYPE');
+ RETURN retval;
+ END browser_contents;
+
+ FUNCTION source_for_program (schema_in IN VARCHAR2, NAME_IN IN VARCHAR2)
+ RETURN refcur_t
+ IS
+ retval refcur_t;
+ BEGIN
+ OPEN retval FOR
+ SELECT line, text
+ FROM all_source
+ WHERE owner = UPPER (schema_in) AND NAME = UPPER (NAME_IN);
+ RETURN retval;
+ END source_for_program;
+
+ FUNCTION onerow (schema_in IN VARCHAR2)
+ RETURN refcur_t
+ IS
+ retval refcur_t;
+ BEGIN
+ OPEN retval FOR
+ SELECT autocompile, DIRECTORY, filedir, prefix, show_failures_only
+ ,show_config_info, editor
+ FROM ut_config
+ WHERE username = UPPER (schema_in);
+ END onerow;
+
+ PROCEDURE get_onerow (
+ schema_in IN VARCHAR2
+ ,username_out OUT VARCHAR2
+ ,autocompile_out OUT ut_config.autocompile%TYPE
+ ,prefix_out OUT ut_config.prefix%TYPE
+ ,show_failures_only_out OUT ut_config.show_failures_only%TYPE
+ ,directory_out OUT ut_config.DIRECTORY%TYPE
+ ,filedir_out OUT ut_config.filedir%TYPE
+ ,show_config_info_out OUT ut_config.show_config_info%TYPE
+ ,editor_out OUT ut_config.editor%TYPE
+ )
+ IS
+ BEGIN
+ SELECT username, autocompile, DIRECTORY, filedir
+ ,prefix, show_failures_only, show_config_info
+ ,editor
+ INTO username_out, autocompile_out, directory_out, filedir_out
+ ,prefix_out, show_failures_only_out, show_config_info_out
+ ,editor_out
+ FROM ut_config
+ WHERE username = UPPER (schema_in);
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ username_out := NULL;
+ END get_onerow;
+BEGIN
+ --Initially, set the user as default tester
+ settester;
+END;
+/
diff --git a/source/ut_config.pks b/source/ut_config.pks
new file mode 100644
index 000000000..346523bf7
--- /dev/null
+++ b/source/ut_config.pks
@@ -0,0 +1,276 @@
+CREATE OR REPLACE PACKAGE utconfig &start_ge_8_1 AUTHID CURRENT_USER &end_ge_8_1
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.4 2004/07/14 17:01:57 chrisrimmer
+Added first version of pluggable reporter packages
+
+Revision 1.3 2003/07/01 19:36:46 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+-------------------------------------------------------------------------------
+--Description
+-------------------------------------------------------------------------------
+--This package manages the ut_config table, which holds the configuration
+--settings for different users. The configuration data to be used by utPLSQL
+--by default is set by calling settester. Wherever a username is passed as NULL,
+--it is assumed to be that user. This defaults initially to the current user.
+-------------------------------------------------------------------------------
+
+ --The default prefix
+ c_prefix CONSTANT CHAR (3) := 'ut_';
+ --The default delimiter
+ c_delimiter CONSTANT CHAR (2) := '##';
+
+ -- RMM start
+ -- Record definition used by fileinfo function
+ TYPE rec_fileinfo IS RECORD (
+ filedir UT_CONFIG.filedir%TYPE
+ ,fileuserprefix UT_CONFIG.fileuserprefix%TYPE
+ ,fileincprogname UT_CONFIG.fileincprogname%TYPE
+ ,filedateformat UT_CONFIG.filedateformat%TYPE
+ ,fileextension UT_CONFIG.filedateformat%TYPE
+ );
+
+ -- RMM end
+
+ TYPE refcur_t IS REF CURSOR;
+
+ CURSOR browser_cur
+ IS
+ SELECT owner, object_name, object_type, created, last_ddl_time, status
+ FROM all_objects;
+
+ cursor source_cur
+ IS
+ SELECT line, text FROM all_source;
+
+ -- Set the user whose configuration we use by default
+ PROCEDURE settester (username_in IN VARCHAR2 := USER);
+
+ -- Get the user we use by default
+ FUNCTION tester
+ RETURN VARCHAR2;
+
+ -- Display the current configuration settings
+ PROCEDURE showconfig (username_in IN VARCHAR2 := NULL);
+
+ -- Set the default prefix
+ PROCEDURE setprefix (prefix_in IN VARCHAR2, username_in IN VARCHAR2 := NULL);
+
+ -- Get the default prefix
+ FUNCTION prefix (username_in IN VARCHAR2 := NULL)
+ RETURN VARCHAR2;
+
+ -- 2.0.7 Switch to delimiter for V2
+ -- Set the default delimiter
+ PROCEDURE setdelimiter (
+ delimiter_in IN VARCHAR2
+ ,username_in IN VARCHAR2 := NULL
+ );
+
+ -- Get the default delimiter
+ FUNCTION delimiter (username_in IN VARCHAR2 := NULL)
+ RETURN VARCHAR2;
+
+ -- Set location of source code
+ PROCEDURE setdir (dir_in IN VARCHAR2, username_in IN VARCHAR2 := NULL);
+
+ -- Get location of source code
+ FUNCTION dir (username_in IN VARCHAR2 := NULL)
+ RETURN VARCHAR2;
+
+ -- Set autocompile flag
+ PROCEDURE autocompile (onoff_in IN BOOLEAN, username_in IN VARCHAR2 := NULL);
+
+ -- Get autocompile flag
+ FUNCTION autocompiling (username_in IN VARCHAR2 := NULL)
+ RETURN BOOLEAN;
+
+ -- Set manual registration flag
+ PROCEDURE registertest (onoff_in IN BOOLEAN, username_in IN VARCHAR2
+ := NULL);
+
+ -- Get manual registration flag
+ FUNCTION registeringtest (username_in IN VARCHAR2 := NULL)
+ RETURN BOOLEAN;
+
+ /* start 2.0.10.1 additions */
+ -- Show failures only?
+ PROCEDURE showfailuresonly (
+ onoff_in IN BOOLEAN
+ ,username_in IN VARCHAR2 := NULL
+ );
+
+ FUNCTION showingfailuresonly (username_in IN VARCHAR2 := NULL)
+ RETURN BOOLEAN;
+
+ /* end 2.0.10.1 additions */
+
+ -- Set the directory for file output
+ PROCEDURE setfiledir (
+ dir_in IN VARCHAR2 := NULL
+ ,username_in IN VARCHAR2 := NULL
+ );
+
+ -- Get the directory for file output
+ FUNCTION filedir (username_in IN VARCHAR2 := NULL)
+ RETURN VARCHAR2;
+
+ -- Set the default reporter
+ PROCEDURE setreporter (
+ reporter_in IN VARCHAR2
+ ,username_in IN VARCHAR2 := NULL
+ );
+
+ -- Get the default reporter for a user
+ FUNCTION getreporter (username_in IN VARCHAR2 := NULL)
+ RETURN VARCHAR2;
+
+ -- Set the file prefix for a user
+ PROCEDURE setuserprefix (
+ userprefix_in IN VARCHAR2 := NULL
+ ,username_in IN VARCHAR2 := NULL
+ );
+
+ -- Get the file prefix for a user
+ FUNCTION userprefix (username_in IN VARCHAR2 := NULL)
+ RETURN VARCHAR2;
+
+ -- Set the include program name flag for a user
+ PROCEDURE setincludeprogname (
+ incname_in IN BOOLEAN := FALSE
+ ,username_in IN VARCHAR2 := NULL
+ );
+
+ -- Get the include program name flag for a user
+ FUNCTION includeprogname (username_in IN VARCHAR2 := NULL)
+ RETURN BOOLEAN;
+
+ -- Set the date format for a user
+ PROCEDURE setdateformat (
+ dateformat_in IN VARCHAR2 := 'yyyyddmmhh24miss'
+ ,username_in IN VARCHAR2 := NULL
+ );
+
+ -- Get the date format for a user
+ FUNCTION DATEFORMAT (username_in IN VARCHAR2 := NULL)
+ RETURN VARCHAR2;
+
+ -- Set the file extension for a user
+ PROCEDURE setfileextension (
+ fileextension_in IN VARCHAR2 := '.UTF'
+ ,username_in IN VARCHAR2 := NULL
+ );
+
+ -- Get the file extension for a user
+ FUNCTION fileextension (username_in IN VARCHAR2 := NULL)
+ RETURN VARCHAR2;
+
+ -- Set all of the file output columns for a user
+ PROCEDURE setfileinfo (
+ dir_in IN VARCHAR2 := NULL
+ ,userprefix_in IN VARCHAR2 := NULL
+ ,incname_in IN BOOLEAN := FALSE
+ ,dateformat_in IN VARCHAR2 := 'yyyyddmmhh24miss'
+ ,fileextension_in IN VARCHAR2 := '.UTF'
+ ,username_in IN VARCHAR2 := NULL
+ );
+
+ -- Get all of the file output columns for a user
+ FUNCTION fileinfo (username_in IN VARCHAR2 := NULL)
+ RETURN rec_fileinfo;
+
+ -- RMM end
+
+ -- 2.1.1: Single update and insert procedure
+ PROCEDURE upd (
+ username_in IN ut_config.username%TYPE
+ ,autocompile_in IN ut_config.autocompile%TYPE
+ ,prefix_in IN ut_config.prefix%TYPE
+ ,show_failures_only_in IN ut_config.show_failures_only%TYPE
+ ,directory_in IN ut_config.DIRECTORY%TYPE
+ ,filedir_in IN ut_config.filedir%TYPE
+ ,show_config_info_in IN ut_config.show_config_info%TYPE
+ ,editor_in IN ut_config.editor%TYPE
+ );
+
+ /* The upd procedure does an insert if no row exists.
+ PROCEDURE add (
+ username_in IN ut_config.username%TYPE,
+ AUTOCOMPILE_in IN ut_config.AUTOCOMPILE%TYPE := 'N',
+ prefix_in in ut_config.prefix%TYPE := c_prefix,
+ SHOW_FAILURES_ONLY_in in ut_config.SHOW_FAILURES_ONLY%TYPE := 'N',
+ directory_in IN ut_config.directory%TYPE := NULL,
+ FILEDIR_in in ut_config.FILEDIR%TYPE := NULL,
+ show_config_info_in in ut_config.show_config_info%TYPE := 'Y') ;
+ */
+ FUNCTION browser_contents (
+ schema_in IN VARCHAR2
+ ,name_like_in IN VARCHAR2 := '%'
+ ,type_like_in IN VARCHAR2 := '%'
+ )
+ RETURN refcur_t;
+
+ /*
+ Sample usage:
+
+ DECLARE
+ rc utconfig.refcur_t;
+ rec utconfig.browser_cur%ROWTYPE;
+ BEGIN
+ rc := utconfig.browser_contents (USER);
+
+ LOOP
+ FETCH rc INTO rec;
+ EXIT WHEN rc%NOTFOUND;
+ p.l (rec.object_name);
+ END LOOP;
+ END;
+ */
+
+ FUNCTION source_for_program (
+ schema_in IN VARCHAR2
+ ,name_in IN VARCHAR2
+ )
+ RETURN refcur_t;
+
+ FUNCTION onerow (schema_in IN VARCHAR2)
+ RETURN refcur_t;
+
+ PROCEDURE get_onerow (
+ schema_in IN VARCHAR2
+ ,username_out OUT VARCHAR2
+ ,autocompile_out OUT ut_config.autocompile%TYPE
+ ,prefix_out OUT ut_config.prefix%TYPE
+ ,show_failures_only_out OUT ut_config.show_failures_only%TYPE
+ ,directory_out OUT ut_config.DIRECTORY%TYPE
+ ,filedir_out OUT ut_config.filedir%TYPE
+ ,show_config_info_out OUT ut_config.show_config_info%TYPE
+ ,editor_out OUT ut_config.editor%TYPE
+ );
+END;
+/
diff --git a/source/ut_config.tab b/source/ut_config.tab
new file mode 100644
index 000000000..e235d1291
--- /dev/null
+++ b/source/ut_config.tab
@@ -0,0 +1,30 @@
+CREATE TABLE UT_CONFIG (
+ username VARCHAR2(100),
+ autocompile CHAR(1) DEFAULT 'Y', /* V1 compatibility */
+ registertest CHAR(1) DEFAULT 'N', /* V1 compatibility */
+ DIRECTORY VARCHAR2(2000), /* V1 compatibility */
+ naming_mode CHAR(2), /* either V1 or V2 */
+ prefix VARCHAR2(100) /* V1 name construction */ ,
+ CONSTRAINT ut_config_pk PRIMARY KEY (username)
+);
+
+REM /* V2 name construction */
+ALTER TABLE UT_CONFIG ADD delimiter VARCHAR2(10) DEFAULT '##';
+
+REM 2.0.10.1 Add show only failure results
+ALTER TABLE UT_CONFIG ADD show_failures_only CHAR(1) DEFAULT 'N';
+
+REM RMM start columns required for file output
+ALTER TABLE UT_CONFIG ADD filedir VARCHAR2 (2000);
+ALTER TABLE UT_CONFIG ADD fileuserprefix VARCHAR2 (100);
+ALTER TABLE UT_CONFIG ADD fileincprogname VARCHAR2 (1) DEFAULT 'N';
+ALTER TABLE UT_CONFIG ADD filedateformat VARCHAR2 (100) DEFAULT 'yyyyddmmhh24miss';
+ALTER TABLE UT_CONFIG ADD fileextension VARCHAR2 (200) DEFAULT '.UTF';
+REM RMM columns required for file output
+
+REM 2.1.1
+ALTER TABLE UT_CONFIG ADD show_config_info VARCHAR2 (1) DEFAULT 'Y';
+ALTER TABLE UT_CONFIG ADD editor VARCHAR2 (1000);
+
+ALTER TABLE UT_CONFIG ADD reporter VARCHAR2(100);
+
diff --git a/source/ut_deterministic.tab b/source/ut_deterministic.tab
new file mode 100644
index 000000000..094dfd7f7
--- /dev/null
+++ b/source/ut_deterministic.tab
@@ -0,0 +1,12 @@
+create table ut_deterministic (
+ package varchar2(100),
+ overload integer,
+ name varchar2(100),
+ tcname varchar2(100),
+ message varchar2(2000),
+ arglist varchar2(2000),
+ result varchar2(2000),
+ assertion_type varchar2(20));
+
+ALTER table ut_deterministic add CONSTRAINT ut_deterministic_pk
+ primary key (package, overload, name, tcname);
diff --git a/source/ut_deterministic_arg.tab b/source/ut_deterministic_arg.tab
new file mode 100644
index 000000000..603cfb0a0
--- /dev/null
+++ b/source/ut_deterministic_arg.tab
@@ -0,0 +1,10 @@
+create table ut_deterministic_arg (
+ package varchar2(100),
+ overload integer,
+ name varchar2(100),
+ tcname varchar2(100),
+ seq integer,
+ arg_value varchar2(2000));
+
+ALTER table ut_deterministic_arg add CONSTRAINT ut_deterministic_fk
+ FOREIGN KEY (package, overload, name, tcname) REFERENCES ut_deterministic;
diff --git a/source/ut_eq.tab b/source/ut_eq.tab
new file mode 100644
index 000000000..e8fd252aa
--- /dev/null
+++ b/source/ut_eq.tab
@@ -0,0 +1,15 @@
+create table ut_eq (
+id integer ,
+outcome_id integer,
+data_type integer,
+check_v varchar2(2000),
+against_v varchar2(2000),
+check_d date ,
+against_d date ,
+check_n number ,
+against_n number ,
+check_b char(1) ,
+against_b char(1),
+ CONSTRAINT ut_eq_pk PRIMARY KEY (id)
+);
+
diff --git a/source/ut_filereporter.pkb b/source/ut_filereporter.pkb
new file mode 100644
index 000000000..c810dc65e
--- /dev/null
+++ b/source/ut_filereporter.pkb
@@ -0,0 +1,241 @@
+CREATE OR REPLACE PACKAGE BODY Utfilereporter
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2004/11/16 09:46:48 chrisrimmer
+Changed to new version detection system.
+
+Revision 1.1 2004/07/14 17:01:57 chrisrimmer
+Added first version of pluggable reporter packages
+
+
+************************************************************************/
+
+ g_fid UTL_FILE.FILE_TYPE := NULL;
+
+ PROCEDURE record_error (str IN VARCHAR2)
+ IS
+ BEGIN
+ UtOutputReporter.pl('UTL_FILE error: ' || str);
+ Utfilereporter.CLOSE(bool_abort => TRUE);
+ END;
+
+ PROCEDURE open_file(dir VARCHAR2, filename VARCHAR2, filemode VARCHAR2 := 'A')
+ IS
+ BEGIN
+
+ IF g_fid.ID IS NOT NULL THEN
+ close_file;
+ END IF;
+
+ g_fid := UTL_FILE.FOPEN (dir, filename, filemode);
+
+ EXCEPTION
+ WHEN UTL_FILE.INVALID_PATH
+ THEN record_error ('invalid_path');
+ RAISE;
+ WHEN UTL_FILE.INVALID_MODE
+ THEN record_error ('invalid_mode');
+ RAISE;
+ WHEN UTL_FILE.INVALID_FILEHANDLE
+ THEN record_error ('invalid_filehandle');
+ RAISE;
+ WHEN UTL_FILE.INVALID_OPERATION
+ THEN record_error ('invalid_operation');
+ RAISE;
+ WHEN UTL_FILE.READ_ERROR
+ THEN record_error ('read_error');
+ RAISE;
+ WHEN UTL_FILE.WRITE_ERROR
+ THEN record_error ('write_error');
+ RAISE;
+ WHEN UTL_FILE.INTERNAL_ERROR
+ THEN record_error ('internal_error');
+ RAISE;
+ END;
+
+ PROCEDURE close_file
+ IS
+ BEGIN
+
+ UTL_FILE.FCLOSE (g_fid);
+ g_fid.ID := NULL;
+
+ EXCEPTION
+ WHEN UTL_FILE.INVALID_PATH
+ THEN record_error ('invalid_path');
+ RAISE;
+ WHEN UTL_FILE.INVALID_MODE
+ THEN record_error ('invalid_mode');
+ RAISE;
+ WHEN UTL_FILE.INVALID_FILEHANDLE
+ THEN record_error ('invalid_filehandle');
+ RAISE;
+ WHEN UTL_FILE.INVALID_OPERATION
+ THEN record_error ('invalid_operation');
+ RAISE;
+ WHEN UTL_FILE.READ_ERROR
+ THEN record_error ('read_error');
+ RAISE;
+ WHEN UTL_FILE.WRITE_ERROR
+ THEN record_error ('write_error');
+ RAISE;
+ WHEN UTL_FILE.INTERNAL_ERROR
+ THEN record_error ('internal_error');
+ RAISE;
+ END;
+
+ PROCEDURE OPEN
+ IS
+
+ file_dir UT_CONFIG.filedir%TYPE;
+ userprefix UT_CONFIG.fileuserprefix%TYPE;
+ incprog UT_CONFIG.fileincprogname%TYPE;
+ extension UT_CONFIG.fileextension%TYPE;
+
+ no_dir EXCEPTION;
+
+ BEGIN
+
+ -- Get the output file directory
+ file_dir := Utconfig.filedir ();
+ -- check if NULL
+ IF file_dir IS NULL THEN
+ -- try directory
+ file_dir := Utconfig.dir ();
+ -- check if NULL
+ IF file_dir IS NULL THEN
+ record_error('No directory specified for file output');
+ RAISE no_dir;
+ END IF;
+ END IF;
+
+ -- Get the userprefix from config
+ userprefix := Utconfig.userprefix();
+ IF userprefix IS NULL THEN
+ -- use the current user if userprefix IS NULL
+ userprefix := USER;
+ END IF;
+ userprefix := userprefix ||'_';
+
+ -- get the file extension
+ extension := Utconfig.fileextension();
+
+ open_file (file_dir, userprefix || TO_CHAR(SYSDATE,Utconfig.dateformat)||extension);
+
+ pl('-- '||TO_CHAR(SYSDATE,Utconfig.dateformat));
+
+ END;
+
+ PROCEDURE before_results(run_id IN utr_outcome.run_id%TYPE)
+ IS
+ BEGIN
+ utOutputReporter.before_results(run_id);
+ END;
+
+ PROCEDURE show_failure
+ IS
+ BEGIN
+ utOutputReporter.show_failure;
+ END;
+
+ PROCEDURE show_result
+ IS
+ BEGIN
+ utOutputReporter.show_result;
+ END;
+
+ PROCEDURE after_results(run_id IN utr_outcome.run_id%TYPE)
+ IS
+ BEGIN
+ utOutputReporter.after_results(run_id);
+ END;
+
+ PROCEDURE before_errors(run_id IN utr_error.run_id%TYPE)
+ IS
+ BEGIN
+ utOutputReporter.before_errors(run_id);
+ END;
+
+ PROCEDURE show_error
+ IS
+ BEGIN
+ utOutputReporter.show_error;
+ END;
+
+ PROCEDURE after_errors(run_id IN utr_error.run_id%TYPE)
+ IS
+ BEGIN
+ utOutputReporter.after_errors(run_id);
+ END;
+
+ PROCEDURE CLOSE(bool_abort BOOLEAN := FALSE)
+ IS
+ BEGIN
+ IF NOT bool_abort AND g_fid.ID IS NOT NULL THEN
+ pl('-- '||TO_CHAR(SYSDATE,Utconfig.dateformat));
+ END IF;
+
+ close_file;
+ END;
+
+ PROCEDURE pl (str IN VARCHAR2)
+ IS
+ BEGIN
+
+ IF g_fid.ID IS NULL THEN
+ utfilereporter.open;
+ END IF;
+
+ -- write input to file
+ UTL_FILE.PUT_LINE (g_fid, str);
+
+ EXCEPTION
+ WHEN UTL_FILE.INVALID_PATH
+ THEN record_error ('invalid_path');
+ RAISE;
+ WHEN UTL_FILE.INVALID_MODE
+ THEN record_error ('invalid_mode');
+ RAISE;
+ WHEN UTL_FILE.INVALID_FILEHANDLE
+ THEN record_error ('invalid_filehandle');
+ RAISE;
+ WHEN UTL_FILE.INVALID_OPERATION
+ THEN record_error ('invalid_operation');
+ RAISE;
+ WHEN UTL_FILE.READ_ERROR
+ THEN record_error ('read_error');
+ RAISE;
+ WHEN UTL_FILE.WRITE_ERROR
+ THEN record_error ('write_error');
+ RAISE;
+ WHEN UTL_FILE.INTERNAL_ERROR
+ THEN record_error ('internal_error');
+ RAISE;
+ END pl;
+
+BEGIN
+ g_fid.ID := NULL;
+END;
+/
diff --git a/source/ut_filereporter.pks b/source/ut_filereporter.pks
new file mode 100644
index 000000000..2ecc30a4a
--- /dev/null
+++ b/source/ut_filereporter.pks
@@ -0,0 +1,39 @@
+CREATE OR REPLACE PACKAGE utfilereporter &start_ge_8_1 AUTHID CURRENT_USER &end_ge_8_1
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log
+
+************************************************************************/
+
+ --The procedures to use this as a reporter
+ PROCEDURE open;
+ PROCEDURE pl (str IN VARCHAR2);
+ PROCEDURE close(bool_abort BOOLEAN := FALSE);
+
+ --Simpler versions to be used by other reporters
+ PROCEDURE open_file(dir VARCHAR2, filename VARCHAR2, filemode VARCHAR2 := 'A');
+ PROCEDURE close_file;
+
+END;
+/
diff --git a/source/ut_gen.pkb b/source/ut_gen.pkb
new file mode 100644
index 000000000..efd30bd4e
--- /dev/null
+++ b/source/ut_gen.pkb
@@ -0,0 +1,1454 @@
+CREATE OR REPLACE PACKAGE BODY utgen
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2005
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.6 2004/11/16 09:46:49 chrisrimmer
+Changed to new version detection system.
+
+Revision 1.5 2004/07/14 17:01:57 chrisrimmer
+Added first version of pluggable reporter packages
+
+Revision 1.4 2004/05/11 15:36:58 chrisrimmer
+Added tweak to cursor from Steven F
+
+Revision 1.3 2004/05/11 15:33:56 chrisrimmer
+Added 9.2 specific code from Mark Vilrokx
+
+Revision 1.2 2003/07/01 19:36:46 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ g_pkgstring VARCHAR2 (32767);
+ g_currrow PLS_INTEGER := NULL;
+ g_firstbodyrow PLS_INTEGER := NULL;
+
+ TYPE code_tt IS TABLE OF codeline_t
+ INDEX BY BINARY_INTEGER;
+
+ pkgarray code_tt;
+
+ -- 1.5.6 Generic string parser
+ TYPE item_tt IS TABLE OF VARCHAR2 (2000)
+ INDEX BY BINARY_INTEGER;
+
+ PROCEDURE parse_string (
+ string_in IN VARCHAR2
+ , items_out IN OUT item_tt
+ , delim_in IN VARCHAR2 := ','
+ )
+ IS
+ v_item VARCHAR2 (32767);
+ v_loc PLS_INTEGER;
+ v_startloc PLS_INTEGER := 1;
+
+ PROCEDURE add_item (item_in IN VARCHAR2)
+ IS
+ BEGIN
+ IF (item_in != delim_in OR item_in IS NULL)
+ THEN
+ items_out (NVL (items_out.LAST, 0) + 1) := item_in;
+ END IF;
+ END;
+ BEGIN
+ items_out.DELETE;
+
+ LOOP
+ -- Find next delimiter
+ v_loc := INSTR (string_in, delim_in, v_startloc);
+
+ IF v_loc = v_startloc -- Previous item is NULL
+ THEN
+ v_item := NULL;
+ ELSIF v_loc = 0 -- Rest of string is last item
+ THEN
+ v_item := SUBSTR (string_in, v_startloc);
+ ELSE
+ v_item := SUBSTR (string_in, v_startloc, v_loc - v_startloc);
+ END IF;
+
+ add_item (v_item);
+
+ IF v_loc = 0
+ THEN
+ EXIT;
+ ELSE
+ add_item (delim_in);
+ v_startloc := v_loc + 1;
+ END IF;
+ END LOOP;
+ END parse_string;
+
+ PROCEDURE get_nextline (
+ file_in IN UTL_FILE.file_type
+ , line_out OUT VARCHAR2
+ , eof_out OUT BOOLEAN
+ )
+ IS
+ BEGIN
+ UTL_FILE.get_line (file_in, line_out);
+ eof_out := FALSE;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ line_out := NULL;
+ eof_out := TRUE;
+ END;
+
+ -- 1.5.6: add this and rewrite isfunction
+ FUNCTION return_type (
+ schema_in IN VARCHAR2
+ , package_in IN VARCHAR2
+ , program_in IN VARCHAR2
+ , overload_in IN PLS_INTEGER := NULL
+ )
+ RETURN VARCHAR2
+ IS
+ retval all_arguments.data_type%TYPE;
+ BEGIN
+ SELECT data_type
+ INTO retval
+ FROM all_arguments
+ WHERE owner = NVL (UPPER (schema_in), USER)
+ AND ( package_name = UPPER (package_in)
+ OR (package_name IS NULL AND package_in IS NULL)
+ )
+ AND object_name = UPPER (program_in)
+ AND ( overload = overload_in
+ OR (overload IS NULL AND overload_in IS NULL)
+ )
+ AND argument_name IS NULL
+ AND POSITION = 0;
+
+ IF retval LIKE 'PL/SQL%'
+ THEN
+ -- Change "PL/SQL BOOLEAN" to "BOOLEAN" and so on...
+ retval := SUBSTR (retval, 8);
+ ELSIF retval IN ('VARCHAR2', 'VARCHAR', 'CHAR')
+ THEN
+ -- Make it a legal string declaration.
+ retval := retval || '(2000)';
+ END IF;
+
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ WHEN OTHERS
+ THEN
+ RETURN NULL;
+ END;
+
+ FUNCTION isfunction (
+ schema_in IN VARCHAR2
+ , package_in IN VARCHAR2
+ , program_in IN VARCHAR2
+ , overload_in IN PLS_INTEGER := NULL
+ )
+ RETURN BOOLEAN
+ IS
+ BEGIN
+ RETURN (return_type (schema_in, package_in, program_in, overload_in) IS NOT NULL
+ );
+ END;
+
+ PROCEDURE testpkg (
+ package_in IN VARCHAR2
+ , grid_in IN grid_tt
+ , program_in IN VARCHAR2 := '%'
+ , samepackage_in IN BOOLEAN := FALSE
+ , prefix_in IN VARCHAR2 := NULL
+ , schema_in IN VARCHAR2 := NULL
+ , output_type_in IN PLS_INTEGER := c_screen
+ , dir_in IN VARCHAR2 := NULL
+ , delim_in IN VARCHAR2 := c_delim
+ , date_format_in IN VARCHAR2 := 'MM/DD/YYYY'
+ , only_if_in_grid_in IN BOOLEAN := FALSE
+ , override_file_in IN VARCHAR2 := NULL
+ )
+ IS
+ fid UTL_FILE.file_type;
+ v_ispkg BOOLEAN := utplsql.ispackage (package_in, schema_in);
+ v_dir VARCHAR2 (2000) := NVL (dir_in, utconfig.dir);
+ v_pkg VARCHAR2 (100);
+ v_progprefix VARCHAR2 (100);
+ -- Used in queries against ALL_ARGUMENTS
+ v_objpackage VARCHAR2 (100);
+ v_objprogram VARCHAR2 (100);
+ l_grid grid_tt;
+
+ CURSOR prog_cur (package_in IN VARCHAR2, program_in IN VARCHAR2)
+ IS &start_lt_9
+ SELECT DISTINCT owner, package_name, object_name, overload,
+ object_name || overload
+ full_name
+ FROM all_arguments
+ WHERE owner = NVL (UPPER (schema_in), USER)
+ AND ( package_name = UPPER (package_in)
+ AND object_name LIKE
+ NVL (UPPER (program_in), '%')
+ )
+ OR ( ( package_name IS NULL
+ -- 2.0.9.1 9i changes way package_name is set.
+ OR package_name = UPPER (program_in)
+ )
+ AND package_in IS NULL
+ AND object_name = UPPER (program_in)
+ );
+ &end_lt_9
+ &start_ge_9
+ SELECT owner, object_name package_name, procedure_name object_name,
+ DECODE (
+ ROW_NUMBER () OVER (PARTITION BY procedure_name ORDER BY object_name),
+ 1, NULL,
+ ROW_NUMBER () OVER (PARTITION BY procedure_name ORDER BY object_name)
+ ) overload,
+ procedure_name
+ || DECODE (
+ ROW_NUMBER () OVER (PARTITION BY procedure_name ORDER BY object_name),
+ 1, NULL,
+ ROW_NUMBER () OVER (PARTITION BY procedure_name ORDER BY object_name)
+ ) full_name
+ FROM all_procedures
+ WHERE owner = NVL (UPPER (schema_in), USER)
+ AND ( object_name = UPPER (package_in)
+ AND procedure_name LIKE
+ NVL (UPPER (program_in), '%')
+ )
+ OR ( ( object_name IS NULL
+ -- 2.0.9.1 9i changes way package_name is set.
+ OR object_name = UPPER (program_in)
+ )
+ AND package_in IS NULL
+ AND procedure_name = UPPER (program_in)
+ );
+ &end_ge_9
+
+ CURSOR arg_cur (
+ schema_in IN VARCHAR2
+ , package_in IN VARCHAR2
+ , program_in IN VARCHAR2
+ , overload_in IN PLS_INTEGER
+ )
+ IS
+ SELECT argument_name, data_type
+ FROM all_arguments
+ WHERE owner = schema_in
+ AND ( package_name = package_in
+ OR (package_name IS NULL AND package_in IS NULL)
+ )
+ AND object_name = program_in
+ AND argument_name IS NOT NULL
+ AND ( overload = overload_in
+ OR (overload IS NULL AND overload_in IS NULL)
+ )
+ ORDER BY POSITION;
+
+ arg arg_cur%ROWTYPE;
+ noargs BOOLEAN;
+
+ PROCEDURE setup (ext IN VARCHAR2 := NULL)
+ IS
+ BEGIN
+ IF output_type_in = c_screen
+ THEN
+ NULL;
+ ELSIF output_type_in = c_string
+ THEN
+ g_pkgstring := NULL;
+ ELSIF output_type_in = c_array
+ THEN
+ pkgarray.DELETE;
+ g_currrow := NULL;
+ g_firstbodyrow := NULL;
+ ELSIF output_type_in = c_file
+ THEN
+ utassert.this
+ ('Compile error: you must specify a directory with utConfig.setdir!'
+ , v_dir IS NOT NULL
+ , register_in => FALSE
+ );
+
+ IF utplsql.tracing
+ THEN
+ utreport.pl (v_dir || '-' || package_in || '.' || ext);
+ END IF;
+
+ fid :=
+ UTL_FILE.fopen (v_dir
+ , NVL (override_file_in
+ , NVL (prefix_in
+ , utconfig.prefix (schema_in)
+ )
+ || package_in
+ || '.'
+ || ext
+ )
+ , 'W'
+ , max_linesize => 32767
+ );
+ END IF;
+ END;
+
+ PROCEDURE putline (str IN VARCHAR2)
+ IS
+ BEGIN
+ IF output_type_in = c_screen
+ THEN
+ utOutputReporter.pl(str);
+ ELSIF output_type_in = c_string
+ THEN
+ g_pkgstring := g_pkgstring || '|' || str;
+ ELSIF output_type_in = c_array
+ THEN
+ pkgarray (NVL (pkgarray.LAST, 0) + 1) := str;
+ ELSIF output_type_in = c_file
+ THEN
+ UTL_FILE.put_line (fid, str);
+ END IF;
+ END;
+
+ PROCEDURE cleanup
+ IS
+ BEGIN
+ IF output_type_in = c_screen
+ THEN
+ NULL;
+ ELSIF output_type_in = c_string
+ THEN
+ g_pkgstring := LTRIM (g_pkgstring, '|');
+ ELSIF output_type_in = c_file
+ THEN
+ UTL_FILE.fclose (fid);
+ END IF;
+ END;
+
+ FUNCTION program_call ( -- 2.0.9.1 switch to whole record
+ rec IN prog_cur%ROWTYPE
+ , is_package IN BOOLEAN /*
+ package_in IN VARCHAR2,
+ program_in IN VARCHAR2 */
+ )
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ IF rec.package_name IS NOT NULL AND is_package
+ THEN
+ RETURN rec.package_name || '.' || rec.object_name;
+ ELSE
+ RETURN rec.object_name;
+ END IF;
+ END;
+
+ PROCEDURE iputline (
+ string_in IN VARCHAR2
+ , indentby_in IN PLS_INTEGER := 3
+ )
+ IS
+ BEGIN
+ putline (LPAD (' ', indentby_in, ' ') || string_in);
+ END;
+
+ PROCEDURE i6putline (string_in IN VARCHAR2)
+ IS
+ BEGIN
+ putline (LPAD (' ', 6, ' ') || string_in);
+ END;
+
+ FUNCTION include_program (
+ NAME_IN IN VARCHAR2
+ , overload_in IN PLS_INTEGER
+ , curr_name_in IN VARCHAR2
+ , curr_overload_in IN PLS_INTEGER
+ )
+ RETURN BOOLEAN
+ IS
+ BEGIN
+ RETURN ( UPPER (NAME_IN) = curr_name_in
+ AND ( overload_in = curr_overload_in
+ OR (overload_in = 1 AND curr_overload_in IS NULL)
+ OR (overload_in IS NULL AND curr_overload_in IS NULL)
+ )
+ );
+ -- OR v_objprogram = '%';
+ END;
+
+ FUNCTION include_program (rec IN prog_cur%ROWTYPE, grid_in IN grid_tt)
+ RETURN BOOLEAN
+ IS
+ retval BOOLEAN := NOT only_if_in_grid_in;
+ grid_index PLS_INTEGER := grid_in.FIRST;
+ BEGIN
+ -- Does the program in rec appear at all in grid_in?
+ IF only_if_in_grid_in
+ THEN
+ LOOP
+ EXIT WHEN grid_index IS NULL;
+
+ IF include_program (grid_in (grid_index).progname
+ , grid_in (grid_index).overload
+ , rec.object_name
+ , rec.overload
+ )
+ THEN
+ retval := TRUE;
+ EXIT;
+ ELSE
+ grid_index := grid_in.NEXT (grid_index);
+ END IF;
+ END LOOP;
+ END IF;
+
+ RETURN retval;
+ END;
+
+ PROCEDURE generate_setup (
+ prefix_in IN VARCHAR2
+ , schema_in IN VARCHAR2
+ , objpackage_in IN VARCHAR2
+ , objprogram_in IN VARCHAR2
+ )
+ IS
+ BEGIN
+ iputline ('PROCEDURE ' || prefix_in || 'setup');
+ iputline ('IS');
+ iputline ('BEGIN');
+
+ IF utconfig.registeringtest (schema_in)
+ THEN
+ iputline (' -- For each program to test...');
+
+ FOR rec IN prog_cur (objpackage_in, objprogram_in)
+ LOOP
+ IF include_program (rec, grid_in)
+ THEN
+ iputline (' utPLSQL.addtest (''' || rec.full_name
+ || ''');'
+ );
+ END IF;
+ END LOOP;
+ ELSE
+ iputline (' NULL;');
+ END IF;
+
+ iputline ('END;');
+ iputline ('');
+ END;
+
+ PROCEDURE generate_teardown (prefix_in IN VARCHAR2)
+ IS
+ BEGIN
+ iputline ('PROCEDURE ' || prefix_in || 'teardown');
+ iputline ('IS');
+ iputline ('BEGIN');
+ iputline (' NULL;');
+ iputline ('END;');
+ END;
+
+ FUNCTION is_expression (string_in IN VARCHAR2)
+ RETURN BOOLEAN
+ IS
+ BEGIN
+ RETURN SUBSTR (string_in, 1, 1) = c_asis;
+ END;
+
+ -- NOK0205: manage null ok argument inclusion
+ PROCEDURE add_null_ok (grid_in IN grid_rt)
+ IS
+ BEGIN
+ IF grid_in.null_ok = 'Y'
+ THEN
+ i6putline (' ,null_ok_in => TRUE');
+ ELSIF grid_in.null_ok = 'N'
+ THEN
+ i6putline (' ,null_ok_in => FALSE');
+ END IF;
+ END add_null_ok;
+
+ PROCEDURE generate_ut_procedure (
+ prefix_in IN VARCHAR2
+ , rec IN prog_cur%ROWTYPE
+ ,
+ /*schema_in IN VARCHAR2,
+ objpackage_in IN VARCHAR2,
+ objprogram_in IN VARCHAR2,*/
+ grid_in IN grid_tt
+ )
+ IS
+ v_isfunction BOOLEAN;
+ v_datatype VARCHAR2 (100);
+
+ FUNCTION data_value (value_in IN VARCHAR2, type_in IN VARCHAR2)
+ RETURN VARCHAR2
+ IS
+ retval VARCHAR2 (2000) := value_in;
+ BEGIN
+ IF is_expression (value_in)
+ THEN
+ retval := SUBSTR (value_in, 2);
+ ELSIF value_in IS NULL OR UPPER (value_in) = 'NULL'
+ THEN
+ retval := 'NULL';
+ ELSIF type_in LIKE '%CHAR%'
+ THEN
+ retval := '''' || value_in || '''';
+ ELSIF type_in IN ('NUMBER', 'FLOAT') OR type_in LIKE '%INT%'
+ THEN
+ retval := value_in;
+ ELSIF type_in IN ('BOOLEAN', 'PL/SQL BOOLEAN')
+ THEN
+ retval := value_in;
+ ELSIF type_in LIKE '%DATE%'
+ THEN
+ retval :=
+ 'TO_DATE ('''
+ || value_in
+ || ''', '''
+ || date_format_in
+ || ''')';
+ END IF;
+
+ RETURN retval;
+ END;
+
+ PROCEDURE generate_testcase (
+ rec IN prog_cur%ROWTYPE
+ , isfunction_in IN BOOLEAN
+ , datatype_in IN VARCHAR2
+ , grid_in IN grid_rt
+ )
+ IS
+ l_entries item_tt;
+
+ PROCEDURE putarg (
+ arg_in IN arg_cur%ROWTYPE
+ , ntharg_in IN PLS_INTEGER
+ )
+ IS
+ BEGIN
+ IF l_entries.COUNT > 0
+ THEN
+ i6putline ( ' '
+ || arg_in.argument_name
+ || ' => '
+ || data_value (l_entries (ntharg_in)
+ , arg_in.data_type
+ )
+ );
+ ELSE
+ i6putline (' ' || arg_in.argument_name || ' => ''''');
+ END IF;
+ END;
+
+ FUNCTION testname
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ IF grid_in.progname IS NOT NULL
+ THEN
+ RETURN ' for "' || grid_in.tcname || '"';
+ ELSE
+ RETURN NULL;
+ END IF;
+ END;
+ BEGIN
+ i6putline ('');
+ i6putline ('-- Define "control" operation' || testname);
+ i6putline (' ');
+
+ IF isfunction_in
+ THEN
+ i6putline ( 'against_this := '
+ || data_value (grid_in.return_value, datatype_in)
+ || ';'
+ );
+ END IF;
+
+ i6putline (' ');
+ i6putline ('-- Execute test code' || testname);
+ i6putline (' ');
+
+ OPEN arg_cur (rec.owner
+ , rec.package_name
+ , rec.object_name
+ , rec.overload
+ );
+
+ FETCH arg_cur
+ INTO arg;
+
+ noargs := arg_cur%NOTFOUND;
+
+ IF isfunction_in
+ THEN
+ i6putline ('check_this := ');
+ END IF;
+
+ IF noargs
+ THEN
+ i6putline ( -- 2.0.9.1: use procedure, not explicit concat.
+ program_call (rec, v_ispkg) || ';');
+ ELSE
+ i6putline (program_call (rec, v_ispkg) || ' (');
+
+ IF grid_in.arglist IS NOT NULL
+ THEN
+ parse_string (grid_in.arglist, l_entries, delim_in);
+ END IF;
+
+ WHILE arg_cur%FOUND
+ LOOP
+ putarg (arg, arg_cur%ROWCOUNT);
+
+ FETCH arg_cur
+ INTO arg;
+
+ IF arg_cur%FOUND
+ THEN
+ i6putline (' ,');
+ END IF;
+ END LOOP;
+
+ iputline (' );');
+ END IF;
+
+ CLOSE arg_cur;
+
+ i6putline (' ');
+ i6putline ('-- Assert success' || testname);
+ i6putline (' ');
+
+ -- Here I should access information in ut_assertion table to dynamically
+ -- build the call to the utAssert procedure. For now, I will hard code
+ -- for EQ and ISNULL to demonstrate the possibilities.
+ IF v_isfunction
+ THEN
+ IF grid_in.assertion_type = 'EQ'
+ OR grid_in.assertion_type IS NULL
+ THEN
+ i6putline ('-- Compare the two values.');
+ i6putline ('utAssert.eq (');
+ i6putline ( ' '''
+ || NVL (grid_in.MESSAGE
+ , 'Test of ' || rec.object_name
+ )
+ || ''','
+ );
+ i6putline (' check_this,');
+ i6putline (' against_this');
+ add_null_ok (grid_in);
+ i6putline (' );');
+ ELSIF grid_in.assertion_type = 'ISNULL'
+ THEN
+ i6putline ('-- Check for NULL return value.');
+ i6putline ('utAssert.isNULL (');
+ i6putline ( ' '''
+ || NVL (grid_in.MESSAGE
+ , 'NULL Test for ' || rec.object_name
+ )
+ || ''','
+ );
+ i6putline (' check_this');
+ i6putline (' );');
+ END IF;
+ ELSE
+ i6putline ('utAssert.this (');
+ i6putline ( ' '''
+ || NVL (grid_in.MESSAGE
+ , 'Test of ' || rec.object_name
+ )
+ || ''','
+ );
+ i6putline (' ''''');
+ add_null_ok (grid_in);
+ i6putline (' );');
+ END IF;
+
+ i6putline ('');
+ i6putline ('-- End of test' || testname);
+ END;
+
+ PROCEDURE generate_testcase (
+ rec IN prog_cur%ROWTYPE
+ , isfunction_in IN BOOLEAN
+ , datatype_in IN VARCHAR2
+ )
+ IS
+ l_empty grid_rt;
+ BEGIN
+ generate_testcase (rec, isfunction_in, datatype_in, l_empty);
+ END;
+ BEGIN
+ v_isfunction :=
+ isfunction (rec.owner
+ , rec.package_name
+ , rec.object_name
+ , rec.overload
+ );
+
+ IF v_isfunction
+ THEN
+ v_datatype :=
+ return_type (rec.owner
+ , rec.package_name
+ , rec.object_name
+ , rec.overload
+ );
+ END IF;
+
+ iputline ('PROCEDURE ' || prefix_in || rec.full_name);
+ iputline ('IS');
+
+ IF v_isfunction
+ THEN
+ i6putline ('-- Verify and complete data types.');
+ i6putline ('against_this ' || v_datatype || ';');
+ i6putline ('check_this ' || v_datatype || ';');
+ END IF;
+
+ iputline ('BEGIN');
+
+ IF grid_in.COUNT = 0
+ THEN
+ generate_testcase (rec, v_isfunction, v_datatype);
+ ELSE
+ FOR indx IN grid_in.FIRST .. grid_in.LAST
+ LOOP
+ generate_testcase (rec
+ , v_isfunction
+ , v_datatype
+ , grid_in (indx)
+ );
+ END LOOP;
+ END IF;
+
+ iputline ('END ' || v_progprefix || rec.full_name || ';');
+ putline ('');
+ END;
+
+ BEGIN /* MAIN TESTPKG */
+ utassert.this ('Invalid target to generate a package: '
+ || output_type_in
+ , output_type_in IN (c_string, c_screen, c_file, c_array)
+ , register_in => FALSE
+ );
+ v_pkg :=
+ utplsql.pkgname (package_in
+ , samepackage_in
+ , NVL (prefix_in, utconfig.prefix (schema_in))
+ , v_ispkg
+ );
+ v_progprefix :=
+ utplsql.progname (NULL
+ , samepackage_in
+ , NVL (prefix_in, utconfig.prefix (schema_in))
+ , v_ispkg
+ );
+
+ IF v_ispkg
+ THEN
+ v_objpackage := UPPER (package_in);
+ v_objprogram := UPPER (program_in);
+ ELSE
+ v_objpackage := NULL;
+ v_objprogram := UPPER (package_in);
+ END IF;
+
+ setup ('pks');
+
+ -- Spit out the package spec
+ IF samepackage_in
+ THEN
+ putline ('-- START: place in specification of source package');
+ ELSE
+ putline ('CREATE OR REPLACE PACKAGE ' || v_pkg);
+ putline ('IS');
+ END IF;
+
+ putline (' PROCEDURE ' || v_progprefix || 'setup;');
+ putline (' PROCEDURE ' || v_progprefix || 'teardown;');
+ putline (' ');
+ putline (' -- For each program to test...');
+
+ FOR rec IN prog_cur (v_objpackage, v_objprogram)
+ LOOP
+ IF include_program (rec, grid_in)
+ THEN
+ putline (' PROCEDURE ' || v_progprefix || rec.full_name || ';');
+ END IF;
+ END LOOP;
+
+ IF samepackage_in
+ THEN
+ putline ('-- END: place in specification of source package');
+ ELSE
+ putline ('END ' || v_pkg || ';');
+ putline ('/');
+ END IF;
+
+ -- Spit out the package body into a separate file
+ IF output_type_in = c_file
+ THEN
+ cleanup;
+ setup ('pkb');
+ ELSIF output_type_in = c_array
+ THEN
+ g_firstbodyrow := pkgarray.LAST + 1;
+ END IF;
+
+ IF samepackage_in
+ THEN
+ putline ('-- START: place in body of source package');
+ ELSE
+ putline ('CREATE OR REPLACE PACKAGE BODY ' || v_pkg);
+ putline ('IS');
+ END IF;
+
+ generate_setup (v_progprefix, schema_in, v_objpackage, v_objprogram);
+ generate_teardown (v_progprefix);
+ putline (' -- For each program to test...');
+
+ FOR rec IN prog_cur (v_objpackage, v_objprogram)
+ LOOP
+ l_grid.DELETE;
+
+ IF grid_in.COUNT > 0
+ THEN
+ /*
+ Go through the grid, pulling out only those test case rows
+ for the current program and then populate the test case procedure
+ accordingly.
+ */
+ FOR indx IN grid_in.FIRST .. grid_in.LAST
+ LOOP
+ -- should switch to passing in records.
+ IF include_program (grid_in (indx).progname
+ , grid_in (indx).overload
+ , rec.object_name
+ , rec.overload
+ )
+ THEN
+ -- NOK0205g - assign to sequential rows, not same indx value
+ l_grid (l_grid.COUNT + 1) := grid_in (indx);
+ END IF;
+ END LOOP;
+ END IF;
+
+ IF l_grid.COUNT > 0 OR NOT NVL (only_if_in_grid_in, FALSE)
+-- IF l_grid.COUNT > 0
+ THEN
+ generate_ut_procedure (v_progprefix, rec, /*schema_in,
+ rec.package_name,
+ rec.object_name,*/
+ l_grid);
+ END IF;
+ END LOOP;
+
+ IF samepackage_in
+ THEN
+ putline ('-- END: place in body of source package');
+ ELSE
+ putline ('END ' || v_pkg || ';');
+ putline ('/');
+ END IF;
+
+ cleanup;
+ END testpkg;
+
+ PROCEDURE clean_up_file_io (
+ prog_in IN VARCHAR2
+ , file_in IN OUT UTL_FILE.file_type
+ , err_in IN VARCHAR2 := NULL
+ )
+ IS
+ BEGIN
+ UTL_FILE.fclose (file_in);
+
+ IF err_in IS NOT NULL
+ THEN
+ utreport.pl (prog_in || ' File IO failure: ' || err_in);
+ END IF;
+ END;
+
+ PROCEDURE testpkg (
+ package_in IN VARCHAR2
+ , program_in IN VARCHAR2 := '%'
+ , samepackage_in IN BOOLEAN := FALSE
+ , prefix_in IN VARCHAR2 := NULL
+ , schema_in IN VARCHAR2 := NULL
+ , output_type_in IN PLS_INTEGER := c_screen
+ , dir_in IN VARCHAR2 := NULL
+ , override_file_in IN VARCHAR2 := NULL
+ )
+ IS
+ l_grid grid_tt;
+ BEGIN
+ -- pass an empty grid to the engine.
+ testpkg (package_in
+ , l_grid
+ , program_in
+ , samepackage_in
+ , prefix_in
+ , schema_in
+ , output_type_in
+ , dir_in
+ , only_if_in_grid_in => FALSE
+ , override_file_in => override_file_in
+ );
+ END;
+
+ FUNCTION valid_entry (string_in IN VARCHAR2)
+ RETURN BOOLEAN
+ IS
+ BEGIN
+ RETURN string_in IS NOT NULL AND string_in NOT LIKE '#%';
+ END;
+
+ PROCEDURE testpkg_from_file (
+ package_in IN VARCHAR2
+ , gridfile_loc_in IN VARCHAR2
+ , gridfile_in IN VARCHAR2
+ , program_in IN VARCHAR2 := '%'
+ , samepackage_in IN BOOLEAN := FALSE
+ , prefix_in IN VARCHAR2 := NULL
+ , schema_in IN VARCHAR2 := NULL
+ , output_type_in IN PLS_INTEGER := c_screen
+ , dir_in IN VARCHAR2 := NULL
+ , field_delim_in IN VARCHAR2 := '|'
+ , arg_delim_in IN VARCHAR2 := c_delim
+ , date_format_in IN VARCHAR2 := 'MM/DD/YYYY'
+ , only_if_in_grid_in IN BOOLEAN := FALSE
+ , override_file_in IN VARCHAR2 := NULL
+ )
+ IS
+ c_progname VARCHAR2 (30) := 'testpkg_from_file';
+ fid UTL_FILE.file_type;
+ l_line VARCHAR2 (1000);
+ l_eof BOOLEAN;
+ l_entries item_tt;
+ l_grid grid_tt;
+ l_indx PLS_INTEGER;
+ BEGIN
+ fid := UTL_FILE.fopen (gridfile_loc_in, gridfile_in, 'R');
+
+ LOOP
+ get_nextline (fid, l_line, l_eof);
+ l_line := LTRIM (l_line);
+ EXIT WHEN l_eof;
+
+ IF valid_entry (l_line)
+ THEN
+ parse_string (l_line, l_entries, field_delim_in);
+ l_indx := NVL (l_grid.LAST, 0) + 1;
+ l_grid (l_indx).progname := UPPER (l_entries (1));
+ l_grid (l_indx).overload := l_entries (2);
+ l_grid (l_indx).tcname := l_entries (3);
+ l_grid (l_indx).MESSAGE := l_entries (4);
+ l_grid (l_indx).arglist := l_entries (5);
+ l_grid (l_indx).return_value := l_entries (6);
+ l_grid (l_indx).assertion_type := UPPER (l_entries (7));
+ END IF;
+ END LOOP;
+
+ clean_up_file_io (c_progname, fid);
+ testpkg (package_in
+ , l_grid
+ , program_in
+ , samepackage_in
+ , prefix_in
+ , schema_in
+ , output_type_in
+ , dir_in
+ , arg_delim_in
+ , date_format_in
+ , only_if_in_grid_in
+ , override_file_in => override_file_in
+ );
+ EXCEPTION
+ WHEN UTL_FILE.invalid_path
+ THEN
+ clean_up_file_io (c_progname, fid, 'invalid_path');
+ WHEN UTL_FILE.invalid_mode
+ THEN
+ clean_up_file_io (c_progname, fid, 'invalid_mode');
+ WHEN UTL_FILE.invalid_filehandle
+ THEN
+ clean_up_file_io (c_progname, fid, 'invalid_filehandle');
+ WHEN UTL_FILE.invalid_operation
+ THEN
+ clean_up_file_io (c_progname, fid, 'invalid_operation');
+ WHEN UTL_FILE.read_error
+ THEN
+ clean_up_file_io (c_progname, fid, 'read_error');
+ WHEN UTL_FILE.write_error
+ THEN
+ clean_up_file_io (c_progname, fid, 'write_error');
+ WHEN UTL_FILE.internal_error
+ THEN
+ clean_up_file_io (c_progname, fid, 'internal_error');
+ WHEN OTHERS
+ THEN
+ clean_up_file_io (c_progname, fid, SQLERRM);
+ END testpkg_from_file;
+
+ PROCEDURE testpkg_from_string (
+ package_in IN VARCHAR2
+ , grid_in IN VARCHAR2
+ , program_in IN VARCHAR2 := '%'
+ , samepackage_in IN BOOLEAN := FALSE
+ , prefix_in IN VARCHAR2 := NULL
+ , schema_in IN VARCHAR2 := NULL
+ , output_type_in IN PLS_INTEGER := c_screen
+ , dir_in IN VARCHAR2 := NULL
+ , line_delim_in IN VARCHAR := CHR (10)
+ , field_delim_in IN VARCHAR2 := '|'
+ , arg_delim_in IN VARCHAR2 := c_delim
+ , date_format_in IN VARCHAR2 := 'MM/DD/YYYY'
+ , only_if_in_grid_in IN BOOLEAN := FALSE
+ , override_file_in IN VARCHAR2 := NULL
+ )
+ IS
+ c_progname VARCHAR2 (30) := 'testpkg_from_string';
+ l_line VARCHAR2 (1000);
+ l_lines item_tt;
+ l_entries item_tt;
+ l_grid grid_tt;
+ l_indx PLS_INTEGER;
+ BEGIN
+ IF grid_in IS NOT NULL
+ THEN
+ parse_string (grid_in, l_lines, line_delim_in);
+
+ FOR l_linenum IN l_lines.FIRST .. l_lines.LAST
+ LOOP
+ IF valid_entry (l_lines (l_linenum))
+ THEN
+ parse_string (l_lines (l_linenum), l_entries, field_delim_in);
+ l_indx := NVL (l_grid.LAST, 0) + 1;
+ l_grid (l_indx).progname := UPPER (l_entries (1));
+ l_grid (l_indx).overload := l_entries (2);
+ l_grid (l_indx).tcname := l_entries (3);
+ l_grid (l_indx).MESSAGE := l_entries (4);
+ l_grid (l_indx).arglist := l_entries (5);
+ l_grid (l_indx).return_value := l_entries (6);
+ l_grid (l_indx).assertion_type := UPPER (l_entries (7));
+ -- NOK0205: grab value for last entry as well.
+ l_grid (l_indx).null_ok := UPPER (l_entries (8));
+ END IF;
+ END LOOP;
+
+ testpkg (package_in
+ , l_grid
+ , program_in
+ , samepackage_in
+ , prefix_in
+ , schema_in
+ , output_type_in
+ , dir_in
+ , arg_delim_in
+ , date_format_in
+ , only_if_in_grid_in
+ , override_file_in => override_file_in
+ );
+ END IF;
+ END;
+
+ PROCEDURE testpkg_from_string_od (
+ package_in IN VARCHAR2
+ , grid_in IN VARCHAR2
+ , dir_in IN VARCHAR2 := NULL
+ , override_file_in IN VARCHAR2 := NULL
+ )
+ IS
+ BEGIN
+ testpkg_from_string (package_in
+ , grid_in
+ , output_type_in => c_file
+ , dir_in => dir_in
+ , only_if_in_grid_in => TRUE
+ , override_file_in => override_file_in
+ );
+ END;
+
+ PROCEDURE clear_grid (
+ owner_in IN ut_grid.owner%TYPE
+ , package_in IN ut_grid.PACKAGE%TYPE
+ )
+ IS
+ BEGIN
+ DELETE FROM ut_grid
+ WHERE ut_grid.owner = UPPER (owner_in)
+ AND ut_grid.PACKAGE = UPPER (package_in);
+ END;
+
+ PROCEDURE add_to_grid (
+ owner_in IN ut_grid.owner%TYPE
+ , package_in IN ut_grid.PACKAGE%TYPE
+ , progname_in IN ut_grid.progname%TYPE
+ , overload_in IN ut_grid.overload%TYPE
+ , tcname_in IN ut_grid.tcname%TYPE
+ , message_in IN ut_grid.MESSAGE%TYPE
+ , arglist_in IN ut_grid.arglist%TYPE
+ , return_value_in IN ut_grid.return_value%TYPE
+ , assertion_type_in IN ut_grid.assertion_type%TYPE
+ )
+ IS
+ BEGIN
+ INSERT INTO ut_grid
+ (owner, PACKAGE, progname, overload
+ , tcname, MESSAGE, arglist, return_value
+ , assertion_type
+ )
+ VALUES (owner_in, package_in, progname_in, overload_in
+ , tcname_in, message_in, arglist_in, return_value_in
+ , assertion_type_in
+ );
+ END add_to_grid;
+
+ -- 2.0.10.1 From Patrick Barel
+/* START Patch72 607131 */
+ PROCEDURE testpkg_from_table (
+ package_in IN VARCHAR2
+ , program_in IN VARCHAR2 := '%'
+ , samepackage_in IN BOOLEAN := FALSE
+ , prefix_in IN VARCHAR2 := NULL
+ , schema_in IN VARCHAR2 := NULL
+ , output_type_in IN PLS_INTEGER := c_screen
+ , dir_in IN VARCHAR2 := NULL
+ , date_format_in IN VARCHAR2 := 'MM/DD/YYYY'
+ , override_file_in IN VARCHAR2 := NULL
+ )
+ IS
+ CURSOR c_ut_grid (p_package VARCHAR2, p_owner VARCHAR2)
+ IS
+ SELECT ut_grid.owner, ut_grid.progname, ut_grid.overload
+ , ut_grid.tcname, ut_grid.MESSAGE, ut_grid.arglist
+ , ut_grid.return_value, ut_grid.assertion_type
+ FROM ut_grid
+ WHERE ut_grid.owner = UPPER (p_owner)
+ AND ut_grid.PACKAGE = UPPER (p_package)
+ ORDER BY ut_grid.progname;
+
+ lv_grid utgen.grid_tt;
+ rc_ut_grid c_ut_grid%ROWTYPE;
+ lv_index NUMBER := -1;
+ BEGIN
+ IF c_ut_grid%ISOPEN
+ THEN
+ CLOSE c_ut_grid;
+ END IF; -- c_ut_grid%IsOpen
+
+ OPEN c_ut_grid (p_package => package_in
+ , p_owner => NVL (schema_in, USER)
+ );
+
+ FETCH c_ut_grid
+ INTO rc_ut_grid;
+
+ WHILE c_ut_grid%FOUND
+ LOOP
+ lv_index := lv_index + 1;
+ lv_grid (lv_index).progname := rc_ut_grid.progname;
+ lv_grid (lv_index).overload := rc_ut_grid.overload;
+ lv_grid (lv_index).tcname := rc_ut_grid.tcname;
+ lv_grid (lv_index).MESSAGE := rc_ut_grid.MESSAGE;
+ lv_grid (lv_index).arglist := rc_ut_grid.arglist;
+ lv_grid (lv_index).return_value := rc_ut_grid.return_value;
+ lv_grid (lv_index).assertion_type := rc_ut_grid.assertion_type;
+
+ FETCH c_ut_grid
+ INTO rc_ut_grid;
+ END LOOP;
+
+ IF c_ut_grid%ISOPEN
+ THEN
+ CLOSE c_ut_grid;
+ END IF; -- c_ut_grid%IsOpen
+
+ IF lv_index > -1
+ THEN
+/* utgen.testpkg (
+ package_in => package_in,
+ grid_in => lv_grid,
+ date_format_in => date_format_in
+ );
+*/
+-- We have access to all parameters (either sent in or default). Why not use them?
+ utgen.testpkg
+ (package_in => package_in
+ /* SEF fix 10/9/2 lv_package*/
+ , grid_in => lv_grid
+ , program_in => program_in
+ , samepackage_in => samepackage_in
+ , prefix_in => prefix_in
+ , schema_in => schema_in
+ , output_type_in => output_type_in
+ , dir_in => dir_in
+ , date_format_in => date_format_in
+ , override_file_in => override_file_in
+ );
+ END IF; -- lv_index > -1
+ END;
+
+/* END Patch72 607131 */
+ FUNCTION pkgstring
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ RETURN g_pkgstring;
+ END;
+
+ /* Returns data in order retrieved (ie, Nth row). */
+ FUNCTION nthrow (nth IN PLS_INTEGER, direction IN SIGNTYPE := 1)
+ RETURN codeline_t
+ IS
+ v_nth PLS_INTEGER := 1;
+ v_row PLS_INTEGER;
+ retval codeline_t;
+ BEGIN
+ IF direction = 1
+ THEN
+ v_row := pkgarray.FIRST;
+ ELSE
+ v_row := pkgarray.LAST;
+ END IF;
+
+ /* Since no prep work was done, do a scan through table. */
+ LOOP
+ EXIT WHEN v_row IS NULL;
+
+ IF v_nth = nth
+ THEN
+ retval := pkgarray (v_row);
+ EXIT;
+ ELSE
+ v_nth := v_nth + 1;
+
+ IF direction = 1
+ THEN
+ v_row := pkgarray.NEXT (v_row);
+ ELSE
+ v_row := pkgarray.PRIOR (v_row);
+ END IF;
+ END IF;
+ END LOOP;
+
+ RETURN retval;
+ END;
+
+ FUNCTION firstrow
+ RETURN PLS_INTEGER
+ IS
+ BEGIN
+ RETURN pkgarray.FIRST;
+ END;
+
+ FUNCTION lastrow
+ RETURN PLS_INTEGER
+ IS
+ BEGIN
+ RETURN pkgarray.LAST;
+ END;
+
+ FUNCTION atfirstrow
+ RETURN BOOLEAN
+ IS
+ BEGIN
+ RETURN g_currrow = pkgarray.FIRST;
+ END;
+
+ FUNCTION atlastrow
+ RETURN BOOLEAN
+ IS
+ BEGIN
+ RETURN g_currrow = pkgarray.LAST;
+ END;
+
+ FUNCTION firstbodyrow
+ RETURN PLS_INTEGER
+ IS
+ BEGIN
+ RETURN g_firstbodyrow;
+ END;
+
+ FUNCTION countrows
+ RETURN PLS_INTEGER
+ IS
+ BEGIN
+ RETURN pkgarray.COUNT;
+ END;
+
+ PROCEDURE init_currrow
+ IS
+ BEGIN
+ IF g_currrow IS NULL
+ THEN
+ g_currrow := pkgarray.FIRST;
+ END IF;
+ END;
+
+ PROCEDURE setrow (nth IN PLS_INTEGER)
+ IS
+ BEGIN
+ g_currrow := nth;
+ END;
+
+ FUNCTION getrow
+ RETURN codeline_t
+ IS
+ BEGIN
+ init_currrow;
+ RETURN pkgarray (g_currrow);
+ END;
+
+ PROCEDURE nextrow
+ IS
+ BEGIN
+ init_currrow;
+ g_currrow := pkgarray.NEXT (g_currrow);
+ END;
+
+ PROCEDURE prevrow
+ IS
+ BEGIN
+ init_currrow;
+ g_currrow := pkgarray.PRIOR (g_currrow);
+ END;
+
+ PROCEDURE showrows (
+ startrow IN PLS_INTEGER := NULL
+ , endrow IN PLS_INTEGER := NULL
+ )
+ IS
+ v_start PLS_INTEGER := NVL (startrow, 1);
+ v_end PLS_INTEGER := NVL (endrow, countrows);
+ BEGIN
+ FOR indx IN 1 .. countrows
+ LOOP
+ setrow (indx);
+ utreport.pl (getrow);
+ END LOOP;
+ END;
+
+ -- TO COMPLETE: apply same output type flexibility
+ -- from testpkg to receq_compare.
+ PROCEDURE putline (str IN VARCHAR2)
+ IS
+ BEGIN
+ DBMS_OUTPUT.put_line (str);
+ END;
+
+-- 2.0.8 Implementation provided by Dan Spencer!
+ PROCEDURE receq_package (
+ table_in IN VARCHAR2
+ , pkg_in IN VARCHAR2 := NULL
+ , owner_in IN VARCHAR2 := NULL
+ )
+ IS
+ v_pkg VARCHAR2 (30)
+ := NVL (pkg_in, SUBSTR ('receq_' || table_in, 1, 30));
+ v_owner VARCHAR2 (30) := UPPER (NVL (owner_in, USER));
+ v_table VARCHAR2 (30) := UPPER (table_in);
+ BEGIN
+ putline ('CREATE OR REPLACE PACKAGE ' || v_pkg || ' IS');
+
+ FOR tabs_rec IN (SELECT *
+ FROM all_tables
+ WHERE owner = v_owner AND table_name = v_table)
+ LOOP
+ putline ( 'FUNCTION eq(a '
+ || tabs_rec.table_name
+ || '%ROWTYPE , b '
+ || tabs_rec.table_name
+ || '%ROWTYPE ) RETURN BOOLEAN; '
+ );
+ END LOOP;
+
+ putline (' END ' || v_pkg || ';');
+ putline ('/');
+ putline (' ');
+ putline ('CREATE OR REPLACE PACKAGE BODY ' || v_pkg || ' IS');
+
+ FOR tabs_rec IN (SELECT *
+ FROM all_tables
+ WHERE owner = v_owner AND table_name = v_table)
+ LOOP
+ putline ( 'FUNCTION eq( a '
+ || tabs_rec.table_name
+ || '%ROWTYPE , '
+ || 'b '
+ || tabs_rec.table_name
+ || '%ROWTYPE ) '
+ || 'RETURN BOOLEAN '
+ );
+ putline ('IS BEGIN ');
+ putline (' RETURN (');
+
+ FOR user_tab_columns_rec IN (SELECT *
+ FROM user_tab_columns
+ WHERE table_name =
+ tabs_rec.table_name
+ ORDER BY column_id)
+ LOOP
+ IF user_tab_columns_rec.column_id > 1
+ THEN
+ putline (' AND ');
+ END IF;
+
+ IF user_tab_columns_rec.data_type = 'CLOB'
+ THEN
+ putline ( '( ( a.'
+ || user_tab_columns_rec.column_name
+ || ' IS NULL AND b.'
+ || user_tab_columns_rec.column_name
+ || ' IS NULL ) OR DBMS_LOB.COMPARE( a.'
+ || user_tab_columns_rec.column_name
+ || ' , b.'
+ || user_tab_columns_rec.column_name
+ || ') = 0 )'
+ );
+ ELSE
+ putline ( '( ( a.'
+ || user_tab_columns_rec.column_name
+ || ' IS NULL AND b.'
+ || user_tab_columns_rec.column_name
+ || ' IS NULL ) OR a.'
+ || user_tab_columns_rec.column_name
+ || ' = b.'
+ || user_tab_columns_rec.column_name
+ || ')'
+ );
+ END IF;
+ END LOOP;
+
+ putline ('); END eq;');
+ END LOOP;
+
+ putline (' END ' || v_pkg || ';');
+ putline ('/');
+ putline (' ');
+ END;
+END;
+/
diff --git a/source/ut_gen.pks b/source/ut_gen.pks
new file mode 100644
index 000000000..9fd4a2fde
--- /dev/null
+++ b/source/ut_gen.pks
@@ -0,0 +1,226 @@
+CREATE OR REPLACE PACKAGE utgen
+&start_ge_8_1 AUTHID CURRENT_USER &end_ge_8_1
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.4 2004/11/23 14:56:47 chrisrimmer
+Moved dbms_pipe code into its own package. Also changed some preprocessor flags
+
+Revision 1.3 2004/11/16 09:46:49 chrisrimmer
+Changed to new version detection system.
+
+Revision 1.2 2003/07/01 19:36:46 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ c_screen CONSTANT PLS_INTEGER := 1;
+ c_string CONSTANT PLS_INTEGER := 2;
+ c_file CONSTANT PLS_INTEGER := 3;
+ c_array CONSTANT PLS_INTEGER := 4;
+ c_delim CONSTANT CHAR (1) := ';';
+ c_comment CONSTANT CHAR (1) := '#';
+ c_asis CONSTANT CHAR (1) := '!';
+
+ &start_ge_8_1 SUBTYPE codeline_t IS VARCHAR2(200); &end_ge_8_1
+
+ &start_lt_8_1
+ v_codeline VARCHAR2 (200);
+ SUBTYPE codeline_t IS v_codeline%TYPE;
+ &end_lt_8_1
+
+ -- Each line in the grid represents a test case
+ --
+
+ TYPE grid_rt IS RECORD (
+ progname VARCHAR2 (100)
+ , overload PLS_INTEGER
+ , tcname VARCHAR2 (100)
+ , MESSAGE VARCHAR2 (2000)
+ , arglist VARCHAR2 (2000)
+ , return_value VARCHAR2 (2000)
+ , assertion_type VARCHAR2 (100)
+ , null_ok VARCHAR2 (1) -- NOK0205: Y or N
+ );
+
+ TYPE grid_tt IS TABLE OF grid_rt
+ INDEX BY BINARY_INTEGER;
+
+ PROCEDURE testpkg (
+ package_in IN VARCHAR2
+ , program_in IN VARCHAR2 := '%'
+ , samepackage_in IN BOOLEAN := FALSE
+ , prefix_in IN VARCHAR2 := NULL
+ , schema_in IN VARCHAR2 := NULL
+ , output_type_in IN PLS_INTEGER := c_screen
+ , dir_in IN VARCHAR2 := NULL
+ , override_file_in IN VARCHAR2 := NULL
+ );
+
+ PROCEDURE testpkg (
+ package_in IN VARCHAR2
+ , grid_in IN grid_tt
+ , program_in IN VARCHAR2 := '%'
+ , samepackage_in IN BOOLEAN := FALSE
+ , prefix_in IN VARCHAR2 := NULL
+ , schema_in IN VARCHAR2 := NULL
+ , output_type_in IN PLS_INTEGER := c_screen
+ , dir_in IN VARCHAR2 := NULL
+ , delim_in IN VARCHAR2 := c_delim
+ , date_format_in IN VARCHAR2 := 'MM/DD/YYYY'
+ , only_if_in_grid_in IN BOOLEAN := FALSE
+ , override_file_in IN VARCHAR2 := NULL
+ );
+
+ PROCEDURE testpkg_from_file (
+ package_in IN VARCHAR2
+ , gridfile_loc_in IN VARCHAR2
+ , gridfile_in IN VARCHAR2
+ , program_in IN VARCHAR2 := '%'
+ , samepackage_in IN BOOLEAN := FALSE
+ , prefix_in IN VARCHAR2 := NULL
+ , schema_in IN VARCHAR2 := NULL
+ , output_type_in IN PLS_INTEGER := c_screen
+ , dir_in IN VARCHAR2 := NULL
+ , field_delim_in IN VARCHAR2 := '|'
+ , arg_delim_in IN VARCHAR2 := c_delim
+ , date_format_in IN VARCHAR2 := 'MM/DD/YYYY'
+ , only_if_in_grid_in IN BOOLEAN := FALSE
+ , override_file_in IN VARCHAR2 := NULL
+ );
+
+ PROCEDURE testpkg_from_string (
+ package_in IN VARCHAR2
+ , grid_in IN VARCHAR2
+ , program_in IN VARCHAR2 := '%'
+ , samepackage_in IN BOOLEAN := FALSE
+ , prefix_in IN VARCHAR2 := NULL
+ , schema_in IN VARCHAR2 := NULL
+ , output_type_in IN PLS_INTEGER := c_screen
+ , dir_in IN VARCHAR2 := NULL
+ , line_delim_in IN VARCHAR := CHR (10)
+ , field_delim_in IN VARCHAR2 := '|'
+ , arg_delim_in IN VARCHAR2 := c_delim
+ , date_format_in IN VARCHAR2 := 'MM/DD/YYYY'
+ , only_if_in_grid_in IN BOOLEAN := FALSE
+ , override_file_in IN VARCHAR2 := NULL
+ );
+
+ PROCEDURE testpkg_from_string_od (
+ package_in IN VARCHAR2
+ , grid_in IN VARCHAR2
+ , dir_in IN VARCHAR2 := NULL
+ , override_file_in IN VARCHAR2 := NULL
+ );
+
+ -- Retrieve single string with generated package.
+ FUNCTION pkgstring
+ RETURN VARCHAR2;
+
+ -- Retrieve individual lines of code in generated package
+
+ FUNCTION nthrow (nth IN PLS_INTEGER, direction IN SIGNTYPE := 1)
+ RETURN codeline_t;
+
+ FUNCTION countrows
+ RETURN PLS_INTEGER;
+
+ FUNCTION firstrow
+ RETURN PLS_INTEGER;
+
+ FUNCTION firstbodyrow
+ RETURN PLS_INTEGER;
+
+ FUNCTION atfirstrow
+ RETURN BOOLEAN;
+
+ FUNCTION lastrow
+ RETURN PLS_INTEGER;
+
+ FUNCTION atlastrow
+ RETURN BOOLEAN;
+
+ PROCEDURE setrow (nth IN PLS_INTEGER);
+
+ FUNCTION getrow
+ RETURN codeline_t;
+
+ PROCEDURE nextrow;
+
+ PROCEDURE prevrow;
+
+ PROCEDURE showrows (
+ startrow IN PLS_INTEGER := NULL
+ , endrow IN PLS_INTEGER := NULL
+ );
+
+ FUNCTION isfunction (
+ schema_in IN VARCHAR2
+ , package_in IN VARCHAR2
+ , program_in IN VARCHAR2
+ , overload_in IN PLS_INTEGER := NULL
+ )
+ RETURN BOOLEAN;
+
+ -- 2.0.10.1 From Patrick Barel
+ PROCEDURE add_to_grid (
+ owner_in IN ut_grid.owner%TYPE
+ , package_in IN ut_grid.PACKAGE%TYPE
+ , progname_in IN ut_grid.progname%TYPE
+ , overload_in IN ut_grid.overload%TYPE
+ , tcname_in IN ut_grid.tcname%TYPE
+ , message_in IN ut_grid.MESSAGE%TYPE
+ , arglist_in IN ut_grid.arglist%TYPE
+ , return_value_in IN ut_grid.return_value%TYPE
+ , assertion_type_in IN ut_grid.assertion_type%TYPE
+ );
+
+ PROCEDURE clear_grid (
+ owner_in IN ut_grid.owner%TYPE
+ , package_in IN ut_grid.PACKAGE%TYPE
+ );
+
+ /* START Patch72 607131 */
+ PROCEDURE testpkg_from_table (
+ package_in IN VARCHAR2
+ , program_in IN VARCHAR2 := '%'
+ , samepackage_in IN BOOLEAN := FALSE
+ , prefix_in IN VARCHAR2 := NULL
+ , schema_in IN VARCHAR2 := NULL
+ , output_type_in IN PLS_INTEGER := c_screen
+ , dir_in IN VARCHAR2 := NULL
+ , date_format_in IN VARCHAR2 := 'MM/DD/YYYY'
+ , override_file_in IN VARCHAR2 := NULL
+ );
+/* END Patch72 607131 */
+
+/* -- 2.0.8 Implementation provided by Dan Spencer!
+ PROCEDURE receq_package (
+ table_in IN VARCHAR2,
+ pkg_in IN VARCHAR2 := NULL,
+ owner_in IN VARCHAR2 := NULL
+ );
+*/
+END;
+/
diff --git a/source/ut_grid.tab b/source/ut_grid.tab
new file mode 100644
index 000000000..fa44ee2ed
--- /dev/null
+++ b/source/ut_grid.tab
@@ -0,0 +1,39 @@
+-- 09/2002 PBA initial version
+
+-- Patch72 607131
+-- Create table
+create table UT_GRID
+(
+ PACKAGE VARCHAR2(100),
+ PROGNAME VARCHAR2(100),
+ OVERLOAD NUMBER,
+ TCNAME VARCHAR2(100),
+ MESSAGE VARCHAR2(2000) not null,
+ ARGLIST VARCHAR2(2000),
+ RETURN_VALUE VARCHAR2(2000),
+ ASSERTION_TYPE VARCHAR2(100)
+);
+-- Add comments to the columns
+comment on column UT_GRID.PACKAGE
+ is 'This is the name of the package to be tested.';
+comment on column UT_GRID.PROGNAME
+ is 'This is the name of the subprogram to be tested.';
+comment on column UT_GRID.OVERLOAD
+ is 'This is the version of the subprogram where overloaded versions exist. (You may have to look in the data dictionary to work this out).';
+comment on column UT_GRID.TCNAME
+ is 'The name of the test case.';
+comment on column UT_GRID.MESSAGE
+ is 'The message to be used in the assertion code.';
+comment on column UT_GRID.ARGLIST
+ is 'The list of arguments to be passed to the subprogram.';
+comment on column UT_GRID.RETURN_VALUE
+ is 'The return value to be checked against.';
+comment on column UT_GRID.ASSERTION_TYPE
+ is 'The type of assertion to be used. Currently this is ignored unless it contains ''EQ'' of ''ISNULL''.';
+
+-- Create/Recreate primary, unique and foreign key constraints
+alter table UT_GRID
+ add constraint UK_MESSAGE unique (MESSAGE);
+
+REM 2.1
+alter table ut_grid add owner varchar2(30);
diff --git a/source/ut_htmlreporter.pkb b/source/ut_htmlreporter.pkb
new file mode 100644
index 000000000..7f62071bb
--- /dev/null
+++ b/source/ut_htmlreporter.pkb
@@ -0,0 +1,168 @@
+CREATE OR REPLACE PACKAGE BODY uthtmlreporter
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.1 2004/07/14 17:01:57 chrisrimmer
+Added first version of pluggable reporter packages
+
+
+************************************************************************/
+
+
+ PROCEDURE open
+ IS
+
+ file_dir UT_CONFIG.filedir%TYPE;
+ no_dir EXCEPTION;
+
+ BEGIN
+
+ -- Get the output file directory
+ file_dir := Utconfig.filedir ();
+ -- check if NULL
+ IF file_dir IS NULL THEN
+ Utoutputreporter.pl('UTL_FILE error: No directory specified for file output');
+ Utfilereporter.CLOSE(bool_abort => TRUE);
+ RAISE no_dir;
+ END IF;
+
+ utfilereporter.open_file (file_dir, TO_CHAR(SYSDATE, 'YYYYMMDDHH24MISS') || '.html', 'W');
+
+ pl('Test Results');
+
+ END;
+
+ PROCEDURE close
+ IS
+ BEGIN
+ pl('');
+ utfilereporter.close_file;
+ END;
+
+ PROCEDURE pl (str VARCHAR2)
+ IS
+ BEGIN
+ utfilereporter.pl(str);
+ END;
+
+ PROCEDURE pl_success
+ IS
+ BEGIN
+ pl('Success');
+ END;
+
+ PROCEDURE pl_failure
+ IS
+ BEGIN
+ pl('FAILURE');
+ END;
+
+ PROCEDURE before_results(run_id IN utr_outcome.run_id%TYPE)
+ IS
+ BEGIN
+ pl('
'|| utplsql.currpkg || ': ');
+ IF utresult.success (run_id) THEN
+ pl_success;
+ ELSE
+ pl_failure;
+ END IF;
+
+ pl('
Results:
');
+ pl('
Status
Description
');
+
+ END;
+
+ PROCEDURE show_failure
+ IS
+ BEGIN
+ pl('
');
+ pl_failure;
+ pl('
' || utreport.outcome.description || '
');
+ END;
+
+ PROCEDURE show_result
+ IS
+ BEGIN
+ pl ('
');
+
+ IF utreport.outcome.status = 'SUCCESS' THEN
+ pl_success;
+ ELSE
+ pl_failure;
+ END IF;
+
+ pl('
' || utreport.outcome.description || '
');
+ END;
+
+ PROCEDURE after_results(run_id IN utr_outcome.run_id%TYPE)
+ IS
+ BEGIN
+ pl('
');
+ END;
+
+ PROCEDURE before_errors(run_id IN utr_error.run_id%TYPE)
+ IS
+ BEGIN
+ pl('Errors:
');
+ pl('
Error Level
Error Code
Description
');
+ END;
+
+ PROCEDURE show_error
+ IS
+ BEGIN
+ utreport.pl ('
' || utreport.error.errlevel ||
+ '
' || utreport.error.errcode ||
+ '
' || utreport.error.errtext || '
');
+ END;
+
+ PROCEDURE after_errors(run_id IN utr_error.run_id%TYPE)
+ IS
+ BEGIN
+ pl('
');
+ END;
+
+
+ PROCEDURE before_suite_results(
+ suite_id ut_suite.id%TYPE
+ )
+ IS
+ PROCEDURE showsuitebanner(
+ suite_id ut_suite.id%TYPE
+ )
+ IS
+ BEGIN
+ pl('
SUITE "'|| utsuite.name_from_id(id_in => suite_id) || '": ');
+ IF utresult.suite_success(suite_id => suite_id) THEN
+ pl_success;
+ ELSE
+ pl_failure;
+ END IF;
+ pl('
');
+ END showsuitebanner;
+ BEGIN
+
+ showsuitebanner(suite_id => suite_id);
+ END before_suite_results;
+END uthtmlreporter;
+/
diff --git a/source/ut_htmlreporter.pks b/source/ut_htmlreporter.pks
new file mode 100644
index 000000000..6fea03ad4
--- /dev/null
+++ b/source/ut_htmlreporter.pks
@@ -0,0 +1,47 @@
+CREATE OR REPLACE PACKAGE uthtmlreporter
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log
+
+************************************************************************/
+
+ PROCEDURE open;
+ PROCEDURE pl (str IN VARCHAR2);
+
+ PROCEDURE before_results(run_id IN utr_outcome.run_id%TYPE);
+ PROCEDURE show_failure;
+ PROCEDURE show_result;
+ PROCEDURE after_results(run_id IN utr_outcome.run_id%TYPE);
+
+ PROCEDURE before_errors(run_id IN utr_error.run_id%TYPE);
+ PROCEDURE show_error;
+ PROCEDURE after_errors(run_id IN utr_error.run_id%TYPE);
+
+ PROCEDURE close;
+ PROCEDURE before_suite_results(
+ suite_id ut_suite.id%TYPE
+ );
+
+END uthtmlreporter;
+/
diff --git a/source/ut_i_do.sql b/source/ut_i_do.sql
new file mode 100644
index 000000000..a7ebd5cf3
--- /dev/null
+++ b/source/ut_i_do.sql
@@ -0,0 +1,75 @@
+CLEAR SCREEN
+SET TERMOUT OFF
+SET ECHO OFF
+SET VERIFY OFF
+SET FEEDBACK OFF
+SET TTITLE OFF
+SET SERVEROUTPUT ON SIZE 1000000 FORMAT WRAPPED
+SET DEFINE ON
+
+----------------------------------------------------
+-- ou installator
+--
+-- parameter 1 values:
+--
+-- install - UT full installation
+-- recompile - Recompile UT code base
+-- synonyms - Create public synonyms for UT
+-- uninstall - Deinstall UT
+----------------------------------------------------
+
+DEFINE line1='-------------------------------------------------------------'
+DEFINE line2='============================================================='
+DEFINE finished='. Finished'
+DEFINE UT='utPLSQL'
+
+COLUMN col NOPRINT NEW_VALUE ut_owner
+select USER col from dual;
+
+
+COLUMN col NOPRINT NEW_VALUE next_script
+select decode(LOWER('&1'),'install','ut_i_install',
+ 'recompile','ut_i_recompile',
+ 'compile','ut_i_recompile',
+ 'synonyms','ut_i_synonyms',
+ 'synonym','ut_i_synonyms',
+ 'uninstall','ut_i_uninstall',
+ 'deinstall','ut_i_uninstall',
+ 'ERROR') col from dual;
+
+COLUMN col NOPRINT NEW_VALUE txt_prompt
+select decode('&next_script','ut_i_install','I N S T A L L A T I O N',
+ 'ut_i_recompile','R E C O M P I L A T I O N',
+ 'ut_i_synonyms','S Y N O N Y M S',
+ 'ut_i_uninstall','D E I N S T A L L A T I O N',
+ 'ERROR') col from dual;
+------------------------------------------------------
+
+SET TERMOUT ON
+
+PROMPT &line2
+PROMPT GNU General Public License for utPLSQL
+PROMPT
+PROMPT Copyright (C) 2000-2003
+PROMPT Steven Feuerstein and the utPLSQL Project
+PROMPT (steven@stevenfeuerstein.com)
+PROMPT
+PROMPT This program is free software; you can redistribute it and/or modify
+PROMPT it under the terms of the GNU General Public License as published by
+PROMPT the Free Software Foundation; either version 2 of the License, or
+PROMPT (at your option) any later version.
+PROMPT
+PROMPT This program is distributed in the hope that it will be useful,
+PROMPT but WITHOUT ANY WARRANTY; without even the implied warranty of
+PROMPT MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+PROMPT GNU General Public License for more details.
+PROMPT
+PROMPT You should have received a copy of the GNU General Public License
+PROMPT along with this program (see license.txt); if not, write to the Free Software
+PROMPT Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+PROMPT &line2
+PROMPT
+
+PROMPT [ &txt_prompt ]
+@@ut_i_preprocess
+@@&next_script
diff --git a/source/ut_i_grants.sql b/source/ut_i_grants.sql
new file mode 100644
index 000000000..296c7e9dc
--- /dev/null
+++ b/source/ut_i_grants.sql
@@ -0,0 +1,40 @@
+SET TERMOUT OFF
+SET VERIFY OFF
+SET PAGESIZE 0
+SET FEEDBACK OFF
+SET TRIMSPOOL ON
+
+SET DEFINE ON
+TTITLE OFF
+SET SERVEROUTPUT ON SIZE 1000000 FORMAT WRAPPED
+
+DEFINE uscript='ut_i_spool_temp.sql'
+
+SET TERMOUT ON
+PROMPT &line1
+PROMPT GRANTS FOR &UT OBJECTS
+PROMPT &line1
+SET TERMOUT OFF
+
+SPOOL &uscript
+
+select 'PROMPT Granting all on every object...' from dual;
+select 'grant all on '||object_name||' to public;'
+from all_objects
+where owner='&ut_owner' and object_name like 'UT%' and
+ object_type in('TABLE','SEQUENCE','PACKAGE', 'VIEW');
+select 'PROMPT &finished' from dual;
+
+select 'PROMPT Granting execute on packages...' from dual;
+select 'grant execute on '||object_name||' to public;'
+from all_objects
+where owner='&ut_owner' and object_name like 'UT%' and
+ object_type ='PACKAGE';
+
+select 'PROMPT &finished' from dual;
+
+SPOOL OFF
+SET TERMOUT ON
+
+@@&uscript
+
diff --git a/source/ut_i_install.sql b/source/ut_i_install.sql
new file mode 100644
index 000000000..94830dd7b
--- /dev/null
+++ b/source/ut_i_install.sql
@@ -0,0 +1,68 @@
+SET TERMOUT OFF
+SET ECHO OFF
+SET VERIFY OFF
+SET FEEDBACK OFF
+SET TTITLE OFF
+
+SET SERVEROUTPUT ON SIZE 1000000 FORMAT WRAPPED
+SET DEFINE ON
+SPOOL ut_i_install.log
+
+----------------------------------------------------TABLES
+SET TERMOUT ON
+PROMPT &line1
+PROMPT CREATING &UT TABLES
+PROMPT &line1
+
+DEFINE prompt_text='Creating &UT tables '
+
+@@ut_i_tables
+
+----------------------------------------------------SEQUENCES
+SET TERMOUT ON
+PROMPT &line1
+PROMPT CREATING &UT SEQUENCES
+PROMPT &line1
+
+DEFINE prompt_text='Creating &UT sequence '
+
+@@ut_i_sequences
+
+----------------------------------------------------VIEWS
+SET TERMOUT ON
+PROMPT &line1
+PROMPT CREATING &UT VIEWS
+PROMPT &line1
+
+DEFINE prompt_text='Creating &UT view '
+
+@@ut_i_views
+
+----------------------------------------------------PACKAGE HEADERS
+SET TERMOUT ON
+PROMPT &line1
+PROMPT CREATING &UT PACKAGE HEADERS
+PROMPT &line1
+
+DEFINE prompt_text='Creating &UT package specification '
+
+@@ut_i_packages
+
+----------------------------------------------------PACKAGE BODIES
+SET TERMOUT ON
+PROMPT &line1
+PROMPT CREATING &UT PACKAGE BODIES
+PROMPT &line1
+
+DEFINE prompt_text='Creating &UT package body '
+
+@@ut_i_packages_b
+
+SET TERMOUT OFF
+SPOOL OFF
+
+----------------------------------------------------GENERIC SCRIPTS
+
+@@ut_i_synonyms
+
+@@ut_i_grants
diff --git a/source/ut_i_packages.sql b/source/ut_i_packages.sql
new file mode 100644
index 000000000..697ff74ed
--- /dev/null
+++ b/source/ut_i_packages.sql
@@ -0,0 +1,38 @@
+@@ut_i_run ut_config.pks
+@@ut_i_run ut_plsql.pks
+@@ut_i_run ut_report.pks
+@@ut_i_run ut_outputreporter.pks
+@@ut_i_run ut_filereporter.pks
+@@ut_i_run ut_htmlreporter.pks
+@@ut_i_run ut_result.pks
+@@ut_i_run ut_plsql_util.pks
+@@ut_i_run ut_assert2.pks
+@@ut_i_run ut_assert.pks
+@@ut_i_run ut_plsql2.pks
+@@ut_i_run ut_result2.pks
+@@ut_i_run ut_utp.pks
+@@ut_i_run ut_testprep.pks
+@@ut_i_run ut_unittest.pks
+@@ut_i_run ut_testcase.pks
+@@ut_i_run ut_outcome.pks
+@@ut_i_run ut_suiteutp.pks
+@@ut_i_run ut_suite.pks
+@@ut_i_run ut_package.pks
+@@ut_i_run ut_test.pks
+@@ut_i_run ut_gen.pks
+@@ut_i_run ut_rsuite.pks
+@@ut_i_run ut_rutp.pks
+@@ut_i_run ut_runittest.pks
+@@ut_i_run ut_rtestcase.pks
+@@ut_i_run ut_routcome.pks
+@@ut_i_run ut_rerror.pks
+@@ut_i_run ut_receq.pks
+@@ut_i_run ut_output.pks
+@@ut_i_run ut_filereporter.pks
+@@ut_i_run ut_htmlreporter.pks
+@@ut_i_run ut_outputreporter.pks
+@@ut_i_run ut_report.pks
+@@ut_i_run ut_pipe.pks
+
+@@ut_i_run ut_utoutput.pks
+@@ut_i_run ut_utreport.pks
diff --git a/source/ut_i_packages_b.sql b/source/ut_i_packages_b.sql
new file mode 100644
index 000000000..86fb36d8e
--- /dev/null
+++ b/source/ut_i_packages_b.sql
@@ -0,0 +1,38 @@
+@@ut_i_run ut_config.pkb
+@@ut_i_run ut_plsql.pkb
+@@ut_i_run ut_report.pkb
+@@ut_i_run ut_outputreporter.pkb
+@@ut_i_run ut_filereporter.pkb
+@@ut_i_run ut_htmlreporter.pkb
+@@ut_i_run ut_result.pkb
+@@ut_i_run ut_plsql_util.pkb
+@@ut_i_run ut_assert2.pkb
+@@ut_i_run ut_assert.pkb
+@@ut_i_run ut_plsql2.pkb
+@@ut_i_run ut_result2.pkb
+@@ut_i_run ut_utp.pkb
+@@ut_i_run ut_testprep.pkb
+@@ut_i_run ut_unittest.pkb
+@@ut_i_run ut_testcase.pkb
+@@ut_i_run ut_outcome.pkb
+@@ut_i_run ut_suiteutp.pkb
+@@ut_i_run ut_suite.pkb
+@@ut_i_run ut_package.pkb
+@@ut_i_run ut_test.pkb
+@@ut_i_run ut_gen.pkb
+@@ut_i_run ut_rsuite.pkb
+@@ut_i_run ut_rutp.pkb
+@@ut_i_run ut_runittest.pkb
+@@ut_i_run ut_rtestcase.pkb
+@@ut_i_run ut_routcome.pkb
+@@ut_i_run ut_rerror.pkb
+@@ut_i_run ut_receq.pkb
+@@ut_i_run ut_output.pkb
+@@ut_i_run ut_filereporter.pkb
+@@ut_i_run ut_htmlreporter.pkb
+@@ut_i_run ut_outputreporter.pkb
+@@ut_i_run ut_report.pkb
+@@ut_i_run ut_pipe.pkb
+
+@@ut_i_run ut_utoutput.pkb
+@@ut_i_run ut_utreport.pkb
diff --git a/source/ut_i_preprocess.sql b/source/ut_i_preprocess.sql
new file mode 100644
index 000000000..f58778994
--- /dev/null
+++ b/source/ut_i_preprocess.sql
@@ -0,0 +1,63 @@
+COLUMN major NOPRINT NEW_VALUE major_v
+COLUMN minor NOPRINT NEW_VALUE minor_v
+
+--Get the major and minor versions
+
+select major, SUBSTR(minor_version,1,instr(minor_version, '.')-1) minor
+from
+(
+ select major, substr(version, length(major)+2) minor_version
+ from
+ (
+ SELECT SUBSTR(version,1,instr(version, '.')-1) major, version
+ FROM product_component_version p
+ WHERE UPPER(PRODUCT) LIKE 'ORACLE%'
+ OR UPPER(PRODUCT) LIKE 'PERSONAL ORACLE%'
+ )
+);
+
+--Flags for 9.x code
+
+COLUMN col NOPRINT NEW_VALUE start_ge_9
+
+SELECT decode(greatest(8, &major_v), 8, '/* < v9 ', '/* >= v9 */') col
+FROM dual;
+
+COLUMN col NOPRINT NEW_VALUE end_ge_9
+
+SELECT decode(greatest(8, &major_v), 8, '< v9 */', '/* >= v9 */') col
+FROM dual;
+
+COLUMN col NOPRINT NEW_VALUE start_lt_9
+
+SELECT decode(greatest(8, &major_v), 8, '/* < v9 */', '/* >= v9 ') col
+FROM dual;
+
+COLUMN col NOPRINT NEW_VALUE end_lt_9
+
+SELECT decode(greatest(8, &major_v), 8, '/* < v9 */', ' >= v9 */') col
+FROM dual;
+
+--Flags for 8.1 code
+
+COLUMN col NOPRINT NEW_VALUE start_ge_8_1
+
+SELECT decode(greatest(8, &major_v+(&minor_v/10)), 8, '/* < v8.1 ', '/* >= v8.1 */') col
+FROM dual;
+
+COLUMN col NOPRINT NEW_VALUE end_ge_8_1
+
+SELECT decode(greatest(8, &major_v+(&minor_v/10)), 8, ' < v8.1 */', '/* >= v8.1 */') col
+FROM dual;
+
+COLUMN col NOPRINT NEW_VALUE start_lt_8_1
+
+SELECT decode(greatest(8, &major_v+(&minor_v/10)), 8, '/* < v8.1 */', '/* >= v8.1 ') col
+FROM dual;
+
+COLUMN col NOPRINT NEW_VALUE end_lt_8_1
+
+SELECT decode(greatest(8, &major_v+(&minor_v/10)), 8, '/* < v8.1 */', ' >= v8.1 */') col
+FROM dual;
+
+
diff --git a/source/ut_i_recompile.sql b/source/ut_i_recompile.sql
new file mode 100644
index 000000000..2a8d63b19
--- /dev/null
+++ b/source/ut_i_recompile.sql
@@ -0,0 +1,31 @@
+SET TERMOUT OFF
+SET VERIFY OFF
+SET PAGESIZE 0
+SET FEEDBACK OFF
+SET TRIMSPOOL ON
+
+SET DEFINE ON
+TTITLE OFF
+SET SERVEROUTPUT ON SIZE 1000000 FORMAT WRAPPED
+
+DEFINE uscript='ut_i_spool_temp.sql'
+
+SET TERMOUT ON
+PROMPT &line1
+PROMPT RECOMPILING &UT OBJECTS
+PROMPT &line1
+SET TERMOUT OFF
+
+SPOOL &uscript
+select 'PROMPT Recompiling...' from dual;
+select 'alter package '||object_name||' compile package;'
+from all_objects
+where owner='&ut_owner' and object_name like 'UT%' and
+ object_type=('PACKAGE')
+order by created;
+select 'PROMPT &finished' from dual;
+SPOOL OFF
+SET TERMOUT ON
+
+@@&uscript
+
diff --git a/source/ut_i_run.sql b/source/ut_i_run.sql
new file mode 100644
index 000000000..b64c5696a
--- /dev/null
+++ b/source/ut_i_run.sql
@@ -0,0 +1,12 @@
+SET TERMOUT OFF
+
+COLUMN col NOPRINT NEW_VALUE run_object
+SELECT substr('&1',1,instr('&1','.')-1) col FROM dual;
+
+SET TERMOUT ON
+
+PROMPT &prompt_text &run_object
+@@&1
+REM PROMPT &line1
+
+SET TERMOUT OFF
diff --git a/source/ut_i_sequences.sql b/source/ut_i_sequences.sql
new file mode 100644
index 000000000..e8bafc906
--- /dev/null
+++ b/source/ut_i_sequences.sql
@@ -0,0 +1,12 @@
+@@ut_i_run ut_suite_seq.seq
+@@ut_i_run ut_package_seq.seq
+@@ut_i_run ut_utp_seq.seq
+@@ut_i_run ut_test_seq.seq
+@@ut_i_run ut_unittest_seq.seq
+@@ut_i_run ut_testcase_seq.seq
+@@ut_i_run ut_plsql_runnum_seq.seq
+@@ut_i_run ut_assertion_seq.seq
+@@ut_i_run ut_receq_seq.seq
+@@ut_i_run ut_refcursor_results_seq.seq
+
+
diff --git a/source/ut_i_synonyms.sql b/source/ut_i_synonyms.sql
new file mode 100644
index 000000000..b6fb906c5
--- /dev/null
+++ b/source/ut_i_synonyms.sql
@@ -0,0 +1,37 @@
+SET TERMOUT OFF
+SET VERIFY OFF
+SET PAGESIZE 0
+SET FEEDBACK OFF
+SET TRIMSPOOL ON
+
+spool off
+SET DEFINE ON
+TTITLE OFF
+SET SERVEROUTPUT ON SIZE 1000000 FORMAT WRAPPED
+
+DEFINE uscript='ut_i_spool_temp.sql'
+
+SET TERMOUT ON
+PROMPT &line1
+PROMPT CREATING SYNONYMS FOR &UT OBJECTS
+PROMPT &line1
+SET TERMOUT OFF
+
+COLUMN col NOPRINT NEW_VALUE fine
+select count(privilege) col from session_privs where privilege='CREATE PUBLIC SYNONYM';
+
+SPOOL &uscript
+select decode(&fine,0,'','PROMPT Creating synonyms ...') from dual;
+select decode(&fine,0,'','create public synonym '||object_name||' for '||object_name||';')
+from all_objects
+where owner='&ut_owner'
+and object_name like 'UT%'
+and object_name not in ('UT_UTOUTPUT', 'UT_UTREPORT')
+and object_type IN ('PACKAGE', 'TABLE', 'VIEW', 'SEQUENCE');
+select decode(&fine,0,'','PROMPT &finished') from dual;
+
+select decode(&fine,1,'','PROMPT Skipped - user has no rights to create public synonyms') from dual;
+SPOOL OFF
+SET TERMOUT ON
+
+@@&uscript
diff --git a/source/ut_i_tables.sql b/source/ut_i_tables.sql
new file mode 100644
index 000000000..f79a804af
--- /dev/null
+++ b/source/ut_i_tables.sql
@@ -0,0 +1,23 @@
+@@ut_i_run ut_config.tab
+@@ut_i_run ut_assertion.tab
+@@ut_i_run ut_suite.tab
+@@ut_i_run ut_utp.tab
+@@ut_i_run ut_package.tab
+@@ut_i_run ut_test.tab
+@@ut_i_run ut_unittest.tab
+@@ut_i_run ut_testcase.tab
+@@ut_i_run ut_testprep.tab
+@@ut_i_run ut_outcome.tab
+@@ut_i_run ut_eq.tab
+@@ut_i_run ut_suite_utp.tab
+@@ut_i_run ut_argument.tab
+@@ut_i_run utr_suite.tab
+@@ut_i_run utr_utp.tab
+@@ut_i_run utr_unittest.tab
+@@ut_i_run utr_testcase.tab
+@@ut_i_run utr_outcome.tab
+@@ut_i_run utr_error.tab
+@@ut_i_run ut_deterministic.tab
+@@ut_i_run ut_deterministic_arg.tab
+@@ut_i_run ut_receq.tab
+@@ut_i_run ut_grid.tab
diff --git a/source/ut_i_uninstall.sql b/source/ut_i_uninstall.sql
new file mode 100644
index 000000000..a3ac5bb00
--- /dev/null
+++ b/source/ut_i_uninstall.sql
@@ -0,0 +1,179 @@
+SET TERMOUT OFF
+SET VERIFY OFF
+SET PAGESIZE 0
+SET FEEDBACK OFF
+SET TRIMSPOOL ON
+
+SET DEFINE ON
+TTITLE OFF
+SET SERVEROUTPUT ON SIZE 1000000 FORMAT WRAPPED
+
+SET TERMOUT ON
+PROMPT &line1
+PROMPT DROPPING &UT PACKAGES
+PROMPT &line1
+
+drop package UTASSERT2;
+drop package UTASSERT;
+drop package UTCONFIG;
+drop package UTGEN;
+drop package UTOUTCOME;
+drop package UTOUTPUT;
+drop package UTPACKAGE;
+drop package UTPLSQL2;
+drop package UTPLSQL;
+drop package UTPLSQL_UTIL;
+drop package UTRECEQ;
+drop package UTRERROR;
+drop package UTRESULT2;
+drop package UTRESULT;
+drop package UTROUTCOME;
+drop package UTRSUITE;
+drop package UTRTESTCASE;
+drop package UTRUNITTEST;
+drop package UTRUTP;
+drop package UTSUITE;
+drop package UTSUITEUTP;
+drop package UTTEST;
+drop package UTTESTCASE;
+drop package UTTESTPREP;
+drop package UTUNITTEST;
+drop package UTUTP;
+drop package UTFILEREPORTER;
+drop package UTHTMLREPORTER;
+drop package UTOUTPUTREPORTER;
+drop package UTREPORT;
+drop package UTPIPE;
+
+drop package UT_UTOUTPUT;
+drop package UT_UTREPORT;
+
+
+SET TERMOUT ON
+PROMPT &line1
+PROMPT DROPPING &UT PUBLIC SYNONYMS
+PROMPT &line1
+
+drop public synonym UTASSERT2;
+drop public synonym UTASSERT;
+drop public synonym UTCONFIG;
+drop public synonym UTGEN;
+drop public synonym UTOUTCOME;
+drop public synonym UTOUTPUT;
+drop public synonym UTPACKAGE;
+drop public synonym UTPLSQL2;
+drop public synonym UTPLSQL;
+drop public synonym UTPLSQL_UTIL;
+drop public synonym UTRECEQ;
+drop public synonym UTRERROR;
+drop public synonym UTRESULT2;
+drop public synonym UTRESULT;
+drop public synonym UTROUTCOME;
+drop public synonym UTRSUITE;
+drop public synonym UTRTESTCASE;
+drop public synonym UTRUNITTEST;
+drop public synonym UTRUTP;
+drop public synonym UTR_ERROR;
+drop public synonym UTR_OUTCOME;
+drop public synonym UTR_SUITE;
+drop public synonym UTR_TESTCASE;
+drop public synonym UTR_UNITTEST;
+drop public synonym UTR_UTP;
+drop public synonym UTSUITE;
+drop public synonym UTSUITEUTP;
+drop public synonym UTTEST;
+drop public synonym UTTESTCASE;
+drop public synonym UTTESTPREP;
+drop public synonym UTUNITTEST;
+drop public synonym UTUTP;
+drop public synonym UTFILEREPORTER;
+drop public synonym UTHTMLREPORTER;
+drop public synonym UTOUTPUTREPORTER;
+drop public synonym UTREPORT;
+drop public synonym UTPIPE;
+drop public synonym UT_ARGUMENT;
+drop public synonym UT_ASSERTION;
+drop public synonym UT_CONFIG;
+drop public synonym UT_DETERMINISTIC;
+drop public synonym UT_DETERMINISTIC_ARG;
+drop public synonym UT_EQ;
+drop public synonym UT_GRID;
+drop public synonym UT_OUTCOME;
+drop public synonym UT_PACKAGE;
+drop public synonym UT_RECEQ;
+drop public synonym UT_RECEQ_PKG;
+drop public synonym UT_SUITE;
+drop public synonym UT_SUITE_UTP;
+drop public synonym UT_TEST;
+drop public synonym UT_TESTCASE;
+drop public synonym UT_TESTPREP;
+drop public synonym UT_UNITTEST;
+drop public synonym UT_UTP;
+drop public synonym UTPLSQL_RUNNUM_SEQ;
+drop public synonym UT_ASSERTION_SEQ;
+drop public synonym UT_PACKAGE_SEQ;
+drop public synonym UT_RECEQ_SEQ;
+drop public synonym UT_REFCURSOR_RESULTS_SEQ;
+drop public synonym UT_SUITE_SEQ;
+drop public synonym UT_TESTCASE_SEQ;
+drop public synonym UT_TEST_SEQ;
+drop public synonym UT_UNITTEST_SEQ;
+drop public synonym UT_UTP_SEQ;
+drop public synonym UTV_LAST_RUN;
+drop public synonym UTV_RESULT_FULL;
+
+SET TERMOUT ON
+PROMPT &line1
+PROMPT DROPPING &UT SEQUENCES
+PROMPT &line1
+
+drop sequence UTPLSQL_RUNNUM_SEQ;
+drop sequence UT_ASSERTION_SEQ;
+drop sequence UT_PACKAGE_SEQ;
+drop sequence UT_RECEQ_SEQ;
+drop sequence UT_REFCURSOR_RESULTS_SEQ;
+drop sequence UT_SUITE_SEQ;
+drop sequence UT_TESTCASE_SEQ;
+drop sequence UT_TEST_SEQ;
+drop sequence UT_UNITTEST_SEQ;
+drop sequence UT_UTP_SEQ;
+
+SET TERMOUT ON
+PROMPT &line1
+PROMPT DROPPING &UT TABLES
+PROMPT &line1
+
+drop table UTR_ERROR cascade constraints;
+drop table UTR_OUTCOME cascade constraints;
+drop table UTR_SUITE cascade constraints;
+drop table UTR_TESTCASE cascade constraints;
+drop table UTR_UNITTEST cascade constraints;
+drop table UTR_UTP cascade constraints;
+drop table UT_ARGUMENT cascade constraints;
+drop table UT_ASSERTION cascade constraints;
+drop table UT_CONFIG cascade constraints;
+drop table UT_DETERMINISTIC cascade constraints;
+drop table UT_DETERMINISTIC_ARG cascade constraints;
+drop table UT_EQ cascade constraints;
+drop table UT_GRID cascade constraints;
+drop table UT_OUTCOME cascade constraints;
+drop table UT_PACKAGE cascade constraints;
+drop table UT_RECEQ cascade constraints;
+drop table UT_RECEQ_PKG cascade constraints;
+drop table UT_SUITE cascade constraints;
+drop table UT_SUITE_UTP cascade constraints;
+drop table UT_TEST cascade constraints;
+drop table UT_TESTCASE cascade constraints;
+drop table UT_TESTPREP cascade constraints;
+drop table UT_UNITTEST cascade constraints;
+drop table UT_UTP cascade constraints;
+
+
+SET TERMOUT ON
+PROMPT &line1
+PROMPT DROPPING &UT VIEWS
+PROMPT &line1
+
+drop view UTV_RESULT_FULL;
+drop view UTV_LAST_RUN;
+
diff --git a/source/ut_i_views.sql b/source/ut_i_views.sql
new file mode 100644
index 000000000..594f0d3f5
--- /dev/null
+++ b/source/ut_i_views.sql
@@ -0,0 +1,2 @@
+@@ut_i_run utv_result_full.sql
+@@ut_i_run utv_last_run.sql
\ No newline at end of file
diff --git a/source/ut_outcome.pkb b/source/ut_outcome.pkb
new file mode 100644
index 000000000..0d66b278d
--- /dev/null
+++ b/source/ut_outcome.pkb
@@ -0,0 +1,135 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE BODY utoutcome
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:46 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+IS
+ FUNCTION name (outcome_id_in IN ut_outcome.id%TYPE)
+ RETURN ut_outcome.name%TYPE
+ IS
+ retval ut_outcome.name%TYPE;
+ BEGIN
+ SELECT name
+ INTO retval
+ FROM ut_outcome
+ WHERE id = outcome_id_in;
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END;
+
+ FUNCTION id (name_in IN ut_outcome.name%TYPE)
+ RETURN ut_outcome.id%TYPE
+ IS
+ retval ut_outcome.id%TYPE;
+ BEGIN
+ SELECT id
+ INTO retval
+ FROM ut_outcome
+ WHERE name = name_in;
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END;
+
+ FUNCTION onerow (name_in IN ut_outcome.name%TYPE)
+ RETURN ut_outcome%ROWTYPE
+ IS
+ retval ut_outcome%ROWTYPE;
+ empty_rec ut_outcome%ROWTYPE;
+ BEGIN
+ SELECT *
+ INTO retval
+ FROM ut_outcome
+ WHERE name = name_in;
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN empty_rec;
+ END;
+
+ FUNCTION onerow (outcome_id_in IN ut_outcome.id%TYPE)
+ RETURN ut_outcome%ROWTYPE
+ IS
+ retval ut_outcome%ROWTYPE;
+ empty_rec ut_outcome%ROWTYPE;
+ BEGIN
+ SELECT *
+ INTO retval
+ FROM ut_outcome
+ WHERE id = outcome_id_in;
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN empty_rec;
+ END;
+
+ FUNCTION utp (outcome_id_in IN ut_outcome.id%TYPE)
+ RETURN ut_utp.id%TYPE
+ IS
+ CURSOR utp_cur
+ IS
+ SELECT ut.utp_id
+ FROM ut_outcome oc, ut_testcase tc, ut_unittest ut
+ WHERE tc.id = oc.testcase_id
+ AND tc.unittest_id = ut.id
+ AND oc.id = outcome_id_in;
+
+ utp_rec utp_cur%ROWTYPE;
+ BEGIN
+ OPEN utp_cur;
+ FETCH utp_cur INTO utp_rec;
+ CLOSE utp_cur;
+ RETURN utp_rec.utp_id;
+ END;
+
+ FUNCTION unittest (outcome_id_in IN ut_outcome.id%TYPE)
+ RETURN ut_unittest.id%TYPE
+ IS
+ CURSOR unittest_cur
+ IS
+ SELECT tc.unittest_id
+ FROM ut_outcome oc, ut_testcase tc
+ WHERE tc.id = oc.testcase_id
+ AND oc.id = outcome_id_in;
+
+ unittest_rec unittest_cur%ROWTYPE;
+ BEGIN
+ OPEN unittest_cur;
+ FETCH unittest_cur INTO unittest_rec;
+ CLOSE unittest_cur;
+ RETURN unittest_rec.unittest_id;
+ END;
+END utoutcome;
+/
diff --git a/source/ut_outcome.pks b/source/ut_outcome.pks
new file mode 100644
index 000000000..9fdbb0c93
--- /dev/null
+++ b/source/ut_outcome.pks
@@ -0,0 +1,57 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE utoutcome
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:46 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ c_name CONSTANT CHAR (7) := 'OUTCOME';
+ c_abbrev CONSTANT CHAR (2) := 'OC';
+
+ FUNCTION name (outcome_id_in IN ut_outcome.id%TYPE)
+ RETURN ut_outcome.name%TYPE;
+
+ FUNCTION id (name_in IN ut_outcome.name%TYPE)
+ RETURN ut_outcome.id%TYPE;
+
+ FUNCTION onerow (name_in IN ut_outcome.name%TYPE)
+ RETURN ut_outcome%ROWTYPE;
+
+ FUNCTION onerow (outcome_id_in IN ut_outcome.id%TYPE)
+ RETURN ut_outcome%ROWTYPE;
+
+ FUNCTION utp (outcome_id_in IN ut_outcome.id%TYPE)
+ RETURN ut_utp.id%TYPE;
+
+ PRAGMA restrict_references (utp, WNDS, WNPS);
+
+ FUNCTION unittest (outcome_id_in IN ut_outcome.id%TYPE)
+ RETURN ut_unittest.id%TYPE;
+
+ PRAGMA restrict_references (unittest, WNDS, WNPS);
+END utoutcome;
+/
diff --git a/source/ut_outcome.tab b/source/ut_outcome.tab
new file mode 100644
index 000000000..866c926a7
--- /dev/null
+++ b/source/ut_outcome.tab
@@ -0,0 +1,26 @@
+CREATE TABLE ut_outcome (
+id integer,
+testcase_id integer,
+seq integer,
+name varchar2(200),
+assertion_type varchar2(100),
+action_level varchar2(10), -- V1 only; not used
+null_ok char(1) default 'N',
+raise_exception char(1) default 'N',
+declarations varchar2 (2000),
+setup varchar2 (2000),
+teardown varchar2 (2000),
+exceptions varchar2 (2000),
+ CONSTRAINT ut_outcome_pk PRIMARY KEY (id)
+);
+
+REM 2.0.10.1 Add control and test fields to help specify testing characteristics
+
+ALTER TABLE ut_outcome ADD control_info VARCHAR2(2000);
+ALTER TABLE ut_outcome ADD test_info VARCHAR2(2000);
+
+CREATE unique index ut_outcome_idx1 ON
+ ut_outcome (testcase_id, name);
+
+ALTER table ut_outcome add CONSTRAINT ut_outcome_testcase_fk
+ FOREIGN KEY (testcase_id) REFERENCES ut_testcase;
\ No newline at end of file
diff --git a/source/ut_output.pkb b/source/ut_output.pkb
new file mode 100644
index 000000000..78b5de98c
--- /dev/null
+++ b/source/ut_output.pkb
@@ -0,0 +1,173 @@
+CREATE OR REPLACE PACKAGE BODY utoutput
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+************************************************************************/
+
+ g_temp_buffer DBMS_OUTPUT.CHARARR;
+ g_save_buffer DBMS_OUTPUT.CHARARR;
+ g_save BOOLEAN := FALSE;
+ c_all_lines CONSTANT INTEGER := 1000000;
+
+ FUNCTION saving RETURN BOOLEAN
+ IS
+ BEGIN
+ RETURN g_save;
+ END;
+
+ PROCEDURE save
+ IS
+ BEGIN
+ g_save := TRUE;
+ END;
+
+ PROCEDURE nosave
+ IS
+ BEGIN
+ g_save := FALSE;
+ END;
+
+ --Pull lines into given buffer and optionally
+ --into the save buffer too.
+ FUNCTION extract (
+ buffer_out OUT DBMS_OUTPUT.CHARARR,
+ max_lines_in IN INTEGER := NULL,
+ save_in IN BOOLEAN := saving
+ ) RETURN INTEGER
+ IS
+ l_lines INTEGER := NVL(max_lines_in, c_all_lines);
+ l_index BINARY_INTEGER;
+ BEGIN
+ buffer_out.DELETE;
+
+ DBMS_OUTPUT.Get_Lines(buffer_out, l_lines);
+
+ --Remove the extra empty lines
+ WHILE l_lines < buffer_out.COUNT LOOP
+ buffer_out.DELETE(buffer_out.LAST);
+ END LOOP;
+
+ --Append to save buffer
+ IF save_in THEN
+ l_index := buffer_out.FIRST;
+ WHILE l_index IS NOT NULL LOOP
+ g_save_buffer(NVL(g_save_buffer.LAST,0) + 1) := buffer_out(l_index);
+ l_index := buffer_out.NEXT(l_index);
+ END LOOP;
+ END IF;
+
+ RETURN l_lines;
+ END;
+
+ --Get the output ignoring number of lines returned.
+ PROCEDURE extract (
+ buffer_out OUT DBMS_OUTPUT.CHARARR,
+ max_lines_in IN INTEGER := NULL,
+ save_in IN BOOLEAN := saving
+ )
+ IS
+ l_lines INTEGER;
+ BEGIN
+ l_lines := extract(buffer_out, max_lines_in, save_in);
+ END;
+
+ --Get the output ignoring the data itself
+ FUNCTION extract (
+ max_lines_in IN INTEGER := NULL,
+ save_in IN BOOLEAN := saving
+ ) RETURN INTEGER
+ IS
+ BEGIN
+ RETURN extract(g_temp_buffer, max_lines_in, save_in);
+ END;
+
+ --Get the output ignoring number of lines returned
+ --and ignoring the data itself
+ PROCEDURE extract (
+ max_lines_in IN INTEGER := NULL,
+ save_in IN BOOLEAN := saving
+ )
+ IS
+ BEGIN
+ extract(g_temp_buffer, max_lines_in, save_in);
+ END;
+
+ --Put a buffer back into DBMS_OUTPUT buffer.
+ PROCEDURE replace(buffer_inout IN OUT DBMS_OUTPUT.CHARARR)
+ IS
+ l_index BINARY_INTEGER;
+ BEGIN
+ l_index := buffer_inout.FIRST;
+ WHILE l_index IS NOT NULL LOOP
+ DBMS_OUTPUT.Put_Line(buffer_inout(l_index));
+ l_index := buffer_inout.NEXT(l_index);
+ END LOOP;
+ buffer_inout.DELETE;
+ END;
+
+ --Put the save buffer back into the DBMS_OUTPUT buffer
+ PROCEDURE replace
+ IS
+ BEGIN
+ replace(g_save_buffer);
+ END;
+
+ --Pull out the next line from the DBMS_OUTPUT buffer
+ FUNCTION nextLine(raise_exc_in BOOLEAN := TRUE, save_in BOOLEAN := saving) RETURN VARCHAR2
+ IS
+ l_lines INTEGER;
+ BEGIN
+
+ l_lines := extract(buffer_out => g_temp_buffer,
+ max_lines_in => 1,
+ save_in => save_in);
+
+ IF l_lines <> 1 THEN
+
+ IF raise_exc_in THEN
+ RAISE EMPTY_OUTPUT_BUFFER;
+ ELSE
+ RETURN NULL;
+ END IF;
+ ELSE
+ RETURN g_temp_buffer(g_temp_buffer.FIRST);
+ END IF;
+
+ END;
+
+ --Simply count the number of lines in the DBMS_OUTPUT buffer
+ --but don't remove anything
+ FUNCTION count RETURN INTEGER
+ IS
+ l_lines INTEGER;
+ BEGIN
+ l_lines := extract(buffer_out => g_temp_buffer,
+ max_lines_in => c_all_lines,
+ save_in => FALSE);
+ replace(g_temp_buffer);
+ RETURN l_lines;
+ END;
+
+END utoutput;
+/
diff --git a/source/ut_output.pks b/source/ut_output.pks
new file mode 100644
index 000000000..e0245bacf
--- /dev/null
+++ b/source/ut_output.pks
@@ -0,0 +1,69 @@
+CREATE OR REPLACE PACKAGE utoutput
+&start_ge_8_1 AUTHID CURRENT_USER &end_ge_8_1
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:46 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ EMPTY_OUTPUT_BUFFER EXCEPTION;
+
+ FUNCTION saving RETURN BOOLEAN;
+
+ PROCEDURE save;
+
+ PROCEDURE nosave;
+
+ PROCEDURE replace;
+
+ FUNCTION extract (
+ buffer_out OUT DBMS_OUTPUT.CHARARR,
+ max_lines_in IN INTEGER := NULL,
+ save_in IN BOOLEAN := saving
+ ) RETURN INTEGER;
+
+ PROCEDURE extract (
+ buffer_out OUT DBMS_OUTPUT.CHARARR,
+ max_lines_in IN INTEGER := NULL,
+ save_in IN BOOLEAN := saving
+ );
+
+ FUNCTION extract(
+ max_lines_in IN INTEGER := NULL,
+ save_in IN BOOLEAN := saving
+ ) RETURN INTEGER;
+
+ PROCEDURE extract(
+ max_lines_in IN INTEGER := NULL,
+ save_in IN BOOLEAN := saving
+ );
+
+ FUNCTION nextLine(raise_exc_in BOOLEAN := TRUE, save_in BOOLEAN := saving) RETURN VARCHAR2;
+
+ FUNCTION count RETURN INTEGER;
+
+END utoutput;
+/
diff --git a/source/ut_outputreporter.pkb b/source/ut_outputreporter.pkb
new file mode 100644
index 000000000..e9d57b413
--- /dev/null
+++ b/source/ut_outputreporter.pkb
@@ -0,0 +1,352 @@
+CREATE OR REPLACE PACKAGE BODY utoutputreporter
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.1 2004/07/14 17:01:57 chrisrimmer
+Added first version of pluggable reporter packages
+
+
+************************************************************************/
+
+ norows BOOLEAN;
+
+ PROCEDURE open
+ IS
+ BEGIN
+ NULL;
+ END;
+
+ PROCEDURE close
+ IS
+ BEGIN
+ NULL;
+ END;
+
+ -- This is an interface to dbms_output.put_line that tries to
+ -- sensibly split long lines (which is useful if you want to
+ -- print large dynamic sql statements). From Alistair Bayley
+ PROCEDURE show (
+ s VARCHAR2,
+ maxlinelenparm NUMBER := 255,
+ expand BOOLEAN := TRUE
+ )
+ IS
+ output_buffer_overflow EXCEPTION;
+ PRAGMA EXCEPTION_INIT (output_buffer_overflow, -20000);
+ i NUMBER;
+ maxlinelen NUMBER
+ := GREATEST (1, LEAST (255, maxlinelenparm));
+
+ FUNCTION locatenewline (str VARCHAR2)
+ RETURN NUMBER
+ IS
+ i10 NUMBER;
+ i13 NUMBER;
+ BEGIN
+ i13 := NVL (INSTR (SUBSTR (str, 1, maxlinelen), CHR (13)), 0);
+ i10 := NVL (INSTR (SUBSTR (str, 1, maxlinelen), CHR (10)), 0);
+
+ IF i13 = 0
+ THEN
+ RETURN i10;
+ ELSIF i10 = 0
+ THEN
+ RETURN i13;
+ ELSE
+ RETURN LEAST (i13, i10);
+ END IF;
+ END;
+ BEGIN
+ -- 2.1.2 if NULL, abort.
+ IF s IS NULL
+ THEN
+ DBMS_OUTPUT.put_line (s);
+ -- 2.1.2 PBA we should return here...
+ RETURN;
+ -- Simple case: s is short.
+ ELSIF LENGTH (s) <= maxlinelen
+ THEN
+ DBMS_OUTPUT.put_line (s);
+ RETURN;
+ END IF;
+
+ -- OK, so it's long. Look for newline chars as a good place to split.
+ i := locatenewline (s);
+
+ IF i > 0
+ THEN -- cool, we can split at a newline
+ DBMS_OUTPUT.put_line (SUBSTR (s, 1, i - 1));
+ show (SUBSTR (s, i + 1), maxlinelen, expand);
+ ELSE
+ -- No newlines. Look for a convenient space prior to the 255-char limit.
+ -- Search backwards from maxLineLen.
+ i := NVL (INSTR (SUBSTR (s, 1, maxlinelen), ' ', -1), 0);
+
+ IF i > 0
+ THEN
+ DBMS_OUTPUT.put_line (SUBSTR (s, 1, i - 1));
+ show (SUBSTR (s, i + 1), maxlinelen, expand);
+ ELSE
+ -- No whitespace - split at max line length.
+ i := maxlinelen;
+ DBMS_OUTPUT.put_line (SUBSTR (s, 1, i));
+ show (SUBSTR (s, i + 1), maxlinelen, expand);
+ END IF;
+ END IF;
+ EXCEPTION
+ WHEN output_buffer_overflow
+ THEN
+ IF NOT expand
+ THEN
+ RAISE;
+ ELSE
+ DBMS_OUTPUT.ENABLE (1000000);
+ -- set false so won't expand again
+ show (s, maxlinelen, FALSE);
+ END IF;
+ END;
+
+ PROCEDURE showbanner (
+ success_in IN BOOLEAN,
+ program_in IN VARCHAR2,
+ run_id_in IN utr_outcome.run_id%TYPE := NULL
+ )
+ IS
+ program_name_and_run_id VARCHAR2(2000);
+ BEGIN
+ IF success_in
+ THEN
+ utreport.pl ('. ');
+ utreport.pl (
+ '> SSSS U U CCC CCC EEEEEEE SSSS SSSS '
+ );
+ utreport.pl (
+ '> S S U U C C C C E S S S S '
+ );
+ utreport.pl (
+ '> S U U C C C C E S S '
+ );
+ utreport.pl (
+ '> S U U C C E S S '
+ );
+ utreport.pl (
+ '> SSSS U U C C EEEE SSSS SSSS '
+ );
+ utreport.pl (
+ '> S U U C C E S S '
+ );
+ utreport.pl (
+ '> S U U C C C C E S S '
+ );
+ utreport.pl (
+ '> S S U U C C C C E S S S S '
+ );
+ utreport.pl (
+ '> SSSS UUU CCC CCC EEEEEEE SSSS SSSS '
+ );
+ ELSE
+ utreport.pl ('. ');
+ utreport.pl (
+ '> FFFFFFF AA III L U U RRRRR EEEEEEE '
+ );
+ utreport.pl (
+ '> F A A I L U U R R E '
+ );
+ utreport.pl (
+ '> F A A I L U U R R E '
+ );
+ utreport.pl (
+ '> F A A I L U U R R E '
+ );
+ utreport.pl (
+ '> FFFF A A I L U U RRRRRR EEEE '
+ );
+ utreport.pl (
+ '> F AAAAAAAA I L U U R R E '
+ );
+ utreport.pl (
+ '> F A A I L U U R R E '
+ );
+ utreport.pl (
+ '> F A A I L U U R R E '
+ );
+ utreport.pl (
+ '> F A A III LLLLLLL UUU R R EEEEEEE '
+ );
+ END IF;
+
+ utreport.pl ('. ');
+ program_name_and_run_id := '"'||NVL (program_in, 'Unnamed Test')||'"';
+ IF run_id_in IS NOT NULL THEN
+ program_name_and_run_id := program_name_and_run_id ||' Run ID: ' || run_id_in;
+ END IF;
+ IF success_in
+ THEN
+ utreport.pl (' SUCCESS: ' || program_name_and_run_id);
+ ELSE
+ utreport.pl (' FAILURE: ' || program_name_and_run_id);
+ END IF;
+ utreport.pl ('. ');
+ END;
+
+ PROCEDURE pl (str VARCHAR2)
+ IS
+ BEGIN
+ show(str);
+ END;
+
+ PROCEDURE before_results(run_id IN utr_outcome.run_id%TYPE)
+ IS
+ v_packagename ut_package.name%TYPE;
+ v_owner ut_package.owner%TYPE;
+ BEGIN
+ IF run_id IS NULL THEN
+ v_packagename := utplsql.currpkg;
+ v_owner := utplsql.currpkgowner;
+ ELSE
+ v_packagename := utpackage.name_from_last_run_id(last_run_id_in => run_id);
+ v_owner := utpackage.owner_from_last_run_id(last_run_id_in => run_id);
+ END IF;
+ showbanner (utresult.success (run_id), v_owner||'.'||v_packagename, run_id);
+ utreport.pl ('> Individual Test Case Results:');
+ utreport.pl ('>');
+ norows := TRUE;
+ END;
+
+ PROCEDURE show_failure
+ IS
+ BEGIN
+ utreport.pl (utreport.outcome.description);
+ utreport.pl ('>');
+ norows := FALSE;
+ END;
+
+ PROCEDURE show_result
+ IS
+ BEGIN
+ utreport.pl (utreport.outcome.status || ' - ' || utreport.outcome.description);
+ utreport.pl ('>');
+ norows := FALSE;
+ END;
+
+ PROCEDURE after_results(run_id IN utr_outcome.run_id%TYPE)
+ IS
+ BEGIN
+ IF norows AND utconfig.showingfailuresonly
+ THEN
+ utreport.pl ('> NO FAILURES FOUND');
+ ELSIF norows
+ THEN
+ utreport.pl ('> NONE FOUND');
+ END IF;
+ END;
+
+ PROCEDURE before_errors(run_id IN utr_error.run_id%TYPE)
+ IS
+ BEGIN
+ utreport.pl ('>');
+ utreport.pl ('> Errors recorded in utPLSQL Error Log:');
+ utreport.pl ('>');
+ norows := TRUE ;
+ END;
+
+ PROCEDURE show_error
+ IS
+ BEGIN
+ norows := FALSE ;
+ utreport.pl (utreport.error.errlevel || ' - ' || utreport.error.errcode || ': ' || utreport.error.errtext);
+ END;
+
+ PROCEDURE after_errors(run_id IN utr_error.run_id%TYPE)
+ IS
+ BEGIN
+ IF norows
+ THEN
+ utreport.pl ('> NONE FOUND');
+ END IF;
+ END;
+
+ /*
+ proc: before_suite_results
+ Show suite overall result banner and suite run stats
+
+ parameters:
+ suite_id - suite id
+ */
+ PROCEDURE before_suite_results(
+ suite_id ut_suite.id%TYPE
+ )
+ IS
+ PROCEDURE show_suite_stats(
+ suite_id ut_suite.id%TYPE
+ )
+ IS
+ SuiteStats utresult.TSuiteStats;
+ BEGIN
+ SuiteStats := utresult.get_suite_stats(suite_id => suite_id);
+ utreport.pl('SUITE STATS: '||to_char(SuiteStats.succeededpackages)||' of '||to_char(SuiteStats.totalpackages)||' packages succeeded.');
+ utreport.pl('SUITE STATS: '||to_char(SuiteStats.succeededasserts)||' of '||to_char(SuiteStats.totalasserts)||' individual test cases succeeded.');
+ utreport.pl('.');
+ END show_suite_stats;
+
+ PROCEDURE showsuitebanner(
+ suite_id ut_suite.id%TYPE
+ )
+ IS
+ BEGIN
+ IF utresult.suite_success(suite_id => suite_id) THEN
+ utreport.pl('.');
+ utreport.pl('> SSSS U U III TTTTTTT EEEEEEE SSSS U U CCC CCC EEEEEEE SSSS SSSS ');
+ utreport.pl('> S S U U I T E S S U U C C C C E S S S S ');
+ utreport.pl('> S U U I T E S U U C C C C E S S ');
+ utreport.pl('> S U U I T E S U U C C E S S ');
+ utreport.pl('> SSSS U U I T EEEE SSSS U U C C EEEE SSSS SSSS ');
+ utreport.pl('> S U U I T E S U U C C E S S ');
+ utreport.pl('> S U U I T E S U U C C C C E S S ');
+ utreport.pl('> S S U U I T E S S U U C C C C E S S S S ');
+ utreport.pl('> SSSS UUU III T EEEEEEE SSSS UUU CCC CCC EEEEEEE SSSS SSSS ');
+ utreport.pl('.');
+ utreport.pl('SUITE SUCCESS: "'||utsuite.name_from_id(id_in => suite_id)||'"');
+ ELSE
+ utreport.pl('.');
+ utreport.pl('> SSSS U U III TTTTTTT EEEEEEE FFFFFFF AA III L U U RRRRR EEEEEEE ');
+ utreport.pl('> S S U U I T E F A A I L U U R R E ');
+ utreport.pl('> S U U I T E F A A I L U U R R E ');
+ utreport.pl('> S U U I T E F A A I L U U R R E ');
+ utreport.pl('> SSSS U U I T EEEE FFFF A A I L U U RRRRRR EEEE ');
+ utreport.pl('> S U U I T E F AAAAAAAA I L U U R R E ');
+ utreport.pl('> S U U I T E F A A I L U U R R E ');
+ utreport.pl('> S S U U I T E F A A I L U U R R E ');
+ utreport.pl('> SSSS UUU III T EEEEEEE F A A III LLLLLLL UUU R R EEEEEEE ');
+ utreport.pl('.');
+ utreport.pl('SUITE FAILURE: "'||utsuite.name_from_id(id_in => suite_id)||'"');
+ END IF;
+ END showsuitebanner;
+
+ BEGIN
+ showsuitebanner(suite_id => suite_id);
+ show_suite_stats(suite_id => suite_id);
+ END before_suite_results;
+END;
+/
diff --git a/source/ut_outputreporter.pks b/source/ut_outputreporter.pks
new file mode 100644
index 000000000..d34ae10dd
--- /dev/null
+++ b/source/ut_outputreporter.pks
@@ -0,0 +1,45 @@
+CREATE OR REPLACE PACKAGE utoutputreporter &start_ge_8_1 AUTHID CURRENT_USER &end_ge_8_1
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log
+
+************************************************************************/
+
+ PROCEDURE open;
+ PROCEDURE pl (str IN VARCHAR2);
+
+ PROCEDURE before_results(run_id IN utr_outcome.run_id%TYPE);
+ PROCEDURE show_failure;
+ PROCEDURE show_result;
+ PROCEDURE after_results(run_id IN utr_outcome.run_id%TYPE);
+
+ PROCEDURE before_errors(run_id IN utr_error.run_id%TYPE);
+ PROCEDURE show_error;
+ PROCEDURE after_errors(run_id IN utr_error.run_id%TYPE);
+
+ PROCEDURE close;
+ PROCEDURE before_suite_results(suite_id ut_suite.id%TYPE);
+
+END;
+/
diff --git a/source/ut_package.pkb b/source/ut_package.pkb
new file mode 100644
index 000000000..8451c17d7
--- /dev/null
+++ b/source/ut_package.pkb
@@ -0,0 +1,432 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE BODY utpackage
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.5 2004/11/23 14:56:47 chrisrimmer
+Moved dbms_pipe code into its own package. Also changed some preprocessor flags
+
+Revision 1.4 2004/11/16 09:46:49 chrisrimmer
+Changed to new version detection system.
+
+Revision 1.3 2004/07/14 17:01:57 chrisrimmer
+Added first version of pluggable reporter packages
+
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ FUNCTION name_from_id (id_in IN ut_package.id%TYPE)
+ RETURN ut_package.name%TYPE
+ IS
+ retval ut_package.name%TYPE;
+ BEGIN
+ SELECT name
+ INTO retval
+ FROM ut_package
+ WHERE id = id_in;
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END;
+
+ -- Need to add owner to param list and query
+ FUNCTION id_from_name (name_in IN ut_package.name%TYPE,
+ owner_in IN ut_package.owner%TYPE := NULL)
+ RETURN ut_package.id%TYPE
+ IS
+ retval ut_package.id%TYPE;
+ v_owner ut_package.owner%type := nvl(owner_in,USER);
+ BEGIN
+ SELECT id
+ INTO retval
+ FROM ut_package
+ WHERE name = UPPER (name_in)
+ AND owner=v_owner
+ AND SUITE_ID is null;
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END;
+ /*
+ func: name_from_last_run_id
+ Return name of package using last run id.
+ Return null if there is no package with given last run id.
+ params:
+ last_run_id_in - last run id of package
+ */
+ FUNCTION name_from_last_run_id (last_run_id_in IN ut_package.last_run_id%TYPE)
+ RETURN ut_package.name%TYPE
+ IS
+ retval ut_package.name%TYPE;
+ BEGIN
+ SELECT name
+ INTO retval
+ FROM ut_package
+ WHERE last_run_id = last_run_id_in;
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END name_from_last_run_id;
+ /*
+ func:owner_from_last_run_id
+ Return owner of package using last run id.
+ Return null if there is no package with given last run id.
+ params:
+ last_run_id_in - last run id of package
+ */
+ FUNCTION owner_from_last_run_id (last_run_id_in IN ut_package.last_run_id%TYPE)
+ RETURN ut_package.owner%TYPE
+ IS
+ retval ut_package.owner%TYPE;
+ BEGIN
+ SELECT owner
+ INTO retval
+ FROM ut_package
+ WHERE last_run_id = last_run_id_in;
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END owner_from_last_run_id;
+
+ PROCEDURE ADD (
+ suite_in IN INTEGER,
+ package_in IN VARCHAR2,
+ samepackage_in IN BOOLEAN := FALSE,
+ prefix_in IN VARCHAR2 := NULL,
+ dir_in IN VARCHAR2 := NULL,
+ seq_in IN PLS_INTEGER := NULL,
+ owner_in IN VARCHAR2 := NULL,
+ add_tests_in IN BOOLEAN := FALSE,
+ test_overloads_in IN BOOLEAN := FALSE
+ )
+ IS
+ &start_ge_8_1 PRAGMA AUTONOMOUS_TRANSACTION; &end_ge_8_1
+ v_owner VARCHAR2 (30) := NVL (owner_in, USER);
+ v_id ut_package.id%TYPE;
+ v_same ut_package.samepackage%TYPE := utplsql.c_yes;
+ v_prefix ut_config.prefix%TYPE
+ := NVL (prefix_in, utconfig.prefix (owner_in));
+ BEGIN
+ IF NOT (NVL (samepackage_in, FALSE))
+ THEN
+ v_same := utplsql.c_no;
+ END IF;
+
+ &start_ge_8_1 v_id := utplsql.seqval ('ut_package'); &end_ge_8_1
+ &start_lt_8_1 SELECT ut_package_seq.NEXTVAL INTO v_id FROM dual; &end_lt_8_1
+
+ INSERT INTO ut_package
+ (id, suite_id, name,
+ owner, samepackage, prefix, dir, seq,
+ executions, failures)
+ VALUES (v_id, suite_in, UPPER (package_in),
+ UPPER (v_owner), v_same, v_prefix, dir_in, NVL (seq_in, 1),
+ 0, 0);
+ IF id_from_name( UPPER (package_in),owner_in) IS NULL
+ THEN
+ &start_ge_8_1 v_id := utplsql.seqval ('ut_package'); &end_ge_8_1
+ &start_lt_8_1 SELECT ut_package_seq.NEXTVAL INTO v_id FROM dual; &end_lt_8_1
+
+ INSERT INTO ut_package
+ (id, suite_id, name,
+ owner, samepackage, prefix, dir, seq,
+ executions, failures)
+ VALUES (v_id, NULL, UPPER (package_in),
+ UPPER (v_owner), v_same, v_prefix, dir_in, NVL (seq_in, 1),
+ 0, 0);
+
+
+ &start_ge_8_1 COMMIT; &end_ge_8_1
+ END IF;
+ IF add_tests_in
+ THEN
+ -- For each program in ALL_ARGUMENTS, add a test.
+
+ &start_ge_8_1
+ -- 8i NDS implementation
+ DECLARE
+ TYPE cv_t IS REF CURSOR;
+
+ cv cv_t;
+ v_name VARCHAR2 (100);
+ v_query VARCHAR2 (32767);
+ v_suffix VARCHAR2 (100) := NULL;
+ BEGIN
+ IF test_overloads_in
+ THEN
+ v_suffix := ' || TO_CHAR(overload)';
+ END IF;
+
+ v_query :=
+ 'SELECT DISTINCT object_name '
+ || v_suffix
+ || ' name '
+ || ' from all_arguments
+ where owner = :owner and package_name = :package';
+ OPEN cv FOR v_query
+ USING NVL (UPPER (owner_in), USER), UPPER (package_in);
+
+ LOOP
+ FETCH cv INTO v_name;
+ EXIT WHEN cv%NOTFOUND;
+
+ IF utplsql.tracing
+ THEN
+ utreport.pl ( 'Adding test '
+ || package_in
+ || '.'
+ || v_name);
+ END IF;
+
+ uttest.ADD (v_id, v_name, 'Test '
+ || v_name);
+ END LOOP;
+
+ CLOSE cv;
+ END;
+
+ &end_ge_8_1
+ &start_lt_8_1
+ -- 7.3 DBMS_SQL Implementation
+ DECLARE
+ cur PLS_INTEGER := DBMS_SQL.open_cursor;
+ fdbk PLS_INTEGER;
+ v_name VARCHAR2 (100);
+ v_query VARCHAR2 (32767);
+ v_suffix VARCHAR2 (100) := NULL;
+ BEGIN
+ IF test_overloads_in
+ THEN
+ v_suffix := ' || TO_CHAR(overload)';
+ END IF;
+
+ v_query :=
+ 'SELECT DISTINCT object_name '
+ || v_suffix
+ || ' name '
+ || ' from all_arguments
+ where owner = :owner and package_name = :package';
+ DBMS_SQL.parse (cur, v_query, DBMS_SQL.native);
+ DBMS_SQL.bind_variable (cur, 'owner', NVL (UPPER (owner_in), USER));
+ DBMS_SQL.bind_variable (cur, 'package', UPPER (package_in));
+ fdbk := DBMS_SQL.EXECUTE (cur);
+
+ LOOP
+ EXIT WHEN DBMS_SQL.fetch_rows (cur) = 0;
+ DBMS_SQL.column_value (cur, 1, v_name);
+
+ IF utplsql.tracing
+ THEN
+ utreport.pl ( 'Adding test '
+ || package_in
+ || '.'
+ || v_name);
+ END IF;
+
+ uttest.ADD (v_id, v_name, 'Test '
+ || v_name);
+ END LOOP;
+
+ DBMS_SQL.close_cursor (cur);
+ END;
+ &end_lt_8_1
+ END IF;
+ &start_ge_8_1 COMMIT; &end_ge_8_1
+ EXCEPTION
+ WHEN DUP_VAL_ON_INDEX
+ THEN
+ -- Update changeable columns.
+ UPDATE ut_package
+ SET samepackage = v_same,
+ prefix = v_prefix,
+ dir = dir_in
+ WHERE owner = UPPER (v_owner)
+ AND name = UPPER (package_in)
+ AND suite_id = suite_in;
+ &start_ge_8_1 COMMIT; &end_ge_8_1
+
+ WHEN OTHERS
+ THEN
+ utreport.pl ( 'Add package error: '
+ || SQLERRM);
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ RAISE;
+ END;
+
+ PROCEDURE ADD (
+ suite_in IN VARCHAR2,
+ package_in IN VARCHAR2,
+ samepackage_in IN BOOLEAN := FALSE,
+ prefix_in IN VARCHAR2 := NULL,
+ dir_in IN VARCHAR2 := NULL,
+ seq_in IN PLS_INTEGER := NULL,
+ owner_in IN VARCHAR2 := NULL,
+ add_tests_in IN BOOLEAN := FALSE,
+ test_overloads_in IN BOOLEAN := FALSE
+ )
+ IS
+ BEGIN
+ ADD (
+ utsuite.id_from_name (suite_in),
+ package_in,
+ samepackage_in,
+ prefix_in,
+ dir_in,
+ seq_in,
+ owner_in,
+ add_tests_in,
+ test_overloads_in
+ );
+ END;
+
+ PROCEDURE rem (
+ suite_in IN INTEGER,
+ package_in IN VARCHAR2,
+ owner_in IN VARCHAR2 := NULL
+ )
+ IS
+ &start_ge_8_1 PRAGMA AUTONOMOUS_TRANSACTION; &end_ge_8_1
+ BEGIN
+ DELETE FROM ut_package
+ WHERE ( suite_id = UPPER (suite_in)
+ OR ( suite_id IS NULL
+ AND suite_in IS NULL
+ )
+ )
+ AND name = UPPER (package_in)
+ AND owner = NVL (UPPER (owner_in), USER);
+ &start_ge_8_1 COMMIT; &end_ge_8_1
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ utreport.pl ( 'Remove package error: '
+ || SQLERRM);
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ RAISE;
+ END;
+
+ PROCEDURE rem (
+ suite_in IN VARCHAR2,
+ package_in IN VARCHAR2,
+ owner_in IN VARCHAR2 := NULL
+ )
+ IS
+ BEGIN
+ rem (utsuite.id_from_name (suite_in), package_in, owner_in);
+ END;
+
+ PROCEDURE upd (
+ suite_id_in IN INTEGER,
+ package_in IN VARCHAR2,
+ start_in DATE,
+ end_in DATE,
+ successful_in BOOLEAN,
+ owner_in IN VARCHAR2 := NULL
+ )
+ IS
+ l_status VARCHAR2 (100) := utplsql.c_success;
+ &start_ge_8_1 PRAGMA AUTONOMOUS_TRANSACTION; &end_ge_8_1
+ v_failure PLS_INTEGER := 0;
+
+ PROCEDURE do_upd
+ IS
+ BEGIN
+ UPDATE ut_package
+ SET last_status = l_status,
+ last_start = start_in,
+ last_end = end_in,
+ executions = NVL (executions, 0)
+ + 1,
+ failures = NVL (failures, 0)
+ + v_failure
+ ,last_run_id = utplsql2.runnum -- 2.0.9.1
+ WHERE nvl(suite_id,0) = nvl(suite_id_in,0)
+ AND name = UPPER (package_in)
+ AND owner = NVL (UPPER (owner_in), USER);
+ END;
+ BEGIN
+ IF NOT successful_in
+ THEN
+ v_failure := 1;
+ l_status := utplsql.c_failure;
+ END IF;
+
+ do_upd;
+
+ IF SQL%ROWCOUNT = 0
+ THEN
+ ADD (
+ suite_id_in,
+ package_in,
+ samepackage_in=> FALSE,
+ prefix_in=> utconfig.prefix (owner_in),
+ dir_in=> NULL,
+ seq_in=> NULL,
+ owner_in=> owner_in,
+ add_tests_in=> FALSE,
+ test_overloads_in=> FALSE
+ );
+ do_upd;
+ END IF;
+ &start_ge_8_1 COMMIT; &end_ge_8_1
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ utreport.pl ( 'Update package error: '
+ || SQLERRM);
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ RAISE;
+ END;
+
+ PROCEDURE upd (
+ suite_in IN VARCHAR2,
+ package_in IN VARCHAR2,
+ start_in DATE,
+ end_in DATE,
+ successful_in BOOLEAN,
+ owner_in IN VARCHAR2 := NULL
+ )
+ IS
+ BEGIN
+ upd (
+ utsuite.id_from_name (suite_in),
+ package_in,
+ start_in,
+ end_in,
+ successful_in,
+ owner_in
+ );
+ END;
+END utpackage;
+/
diff --git a/source/ut_package.pks b/source/ut_package.pks
new file mode 100644
index 000000000..e374394e5
--- /dev/null
+++ b/source/ut_package.pks
@@ -0,0 +1,103 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE utpackage -- &start_ge_8_1 AUTHID CURRENT_USER &end_ge_8_1
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ c_success CONSTANT VARCHAR2 (7) := 'SUCCESS';
+ c_failure CONSTANT VARCHAR2 (7) := 'FAILURE';
+
+ FUNCTION name_from_id (id_in IN ut_package.id%TYPE)
+ RETURN ut_package.name%TYPE;
+
+ FUNCTION id_from_name (name_in IN ut_package.name%TYPE,
+ owner_in IN ut_package.owner%TYPE := NULL)
+ RETURN ut_package.id%TYPE;
+ FUNCTION name_from_last_run_id(
+ last_run_id_in IN ut_package.last_run_id%TYPE
+ )
+ RETURN ut_package.name%TYPE;
+
+ FUNCTION owner_from_last_run_id (last_run_id_in IN ut_package.last_run_id%TYPE)
+ RETURN ut_package.owner%TYPE;
+
+ PROCEDURE ADD (
+ suite_in IN VARCHAR2,
+ package_in IN VARCHAR2,
+ samepackage_in IN BOOLEAN := FALSE,
+ prefix_in IN VARCHAR2 := NULL,
+ dir_in IN VARCHAR2 := NULL,
+ seq_in IN PLS_INTEGER := NULL,
+ owner_in IN VARCHAR2 := NULL,
+ add_tests_in IN BOOLEAN := FALSE,
+ test_overloads_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE rem (
+ suite_in IN VARCHAR2,
+ package_in IN VARCHAR2,
+ owner_in IN VARCHAR2 := NULL
+ );
+
+ PROCEDURE upd (
+ suite_in IN VARCHAR2,
+ package_in IN VARCHAR2,
+ start_in DATE,
+ end_in DATE,
+ successful_in BOOLEAN,
+ owner_in IN VARCHAR2 := NULL
+ );
+
+ PROCEDURE ADD (
+ suite_in IN INTEGER,
+ package_in IN VARCHAR2,
+ samepackage_in IN BOOLEAN := FALSE,
+ prefix_in IN VARCHAR2 := NULL,
+ dir_in IN VARCHAR2 := NULL,
+ seq_in IN PLS_INTEGER := NULL,
+ owner_in IN VARCHAR2 := NULL,
+ add_tests_in IN BOOLEAN := FALSE,
+ test_overloads_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE rem (
+ suite_in IN INTEGER,
+ package_in IN VARCHAR2,
+ owner_in IN VARCHAR2 := NULL
+ );
+
+ PROCEDURE upd (
+ suite_id_in IN INTEGER,
+ package_in IN VARCHAR2,
+ start_in DATE,
+ end_in DATE,
+ successful_in BOOLEAN,
+ owner_in IN VARCHAR2 := NULL
+ );
+END utpackage;
+/
diff --git a/source/ut_package.tab b/source/ut_package.tab
new file mode 100644
index 000000000..55e788bff
--- /dev/null
+++ b/source/ut_package.tab
@@ -0,0 +1,31 @@
+CREATE TABLE ut_package (
+ id INTEGER ,
+ suite_id INTEGER,
+ owner VARCHAR2(30),
+ name VARCHAR2(200),
+ description VARCHAR2(2000),
+ samepackage CHAR(1) DEFAULT 'N',
+ prefix VARCHAR2(100),
+ dir VARCHAR2(2000),
+ seq INTEGER,
+ executions INTEGER,
+ failures INTEGER,
+ last_status VARCHAR2(20), /* either SUCCESS or FAILURE */
+ last_start DATE,
+ last_end DATE,
+ CONSTRAINT ut_package_pk PRIMARY KEY (id)
+);
+
+REM 2.0.9.1 support cross ref to run, recommended by Dan Spencer
+
+alter table ut_package add (last_run_id number);
+
+CREATE unique index ut_package_idx1 ON
+ ut_package (suite_id, owner, name);
+
+--CREATE unique index ut_package_idx2 ON
+-- ut_package (owner, name);
+
+ALTER table ut_package add CONSTRAINT ut_package_suite_fk
+ FOREIGN KEY (suite_id) REFERENCES ut_suite;
+
diff --git a/source/ut_package_seq.seq b/source/ut_package_seq.seq
new file mode 100644
index 000000000..ff8c4d3b4
--- /dev/null
+++ b/source/ut_package_seq.seq
@@ -0,0 +1 @@
+CREATE sequence ut_package_seq INCREMENT BY 1 START WITH 1 ORDER NOCACHE;
diff --git a/source/ut_pipe.pkb b/source/ut_pipe.pkb
new file mode 100644
index 000000000..ea79ce522
--- /dev/null
+++ b/source/ut_pipe.pkb
@@ -0,0 +1,103 @@
+CREATE OR REPLACE PACKAGE BODY UTPIPE
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2004
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2004/11/23 15:02:18 chrisrimmer
+Added missing preprocessor flags
+
+Revision 1.1 2004/11/23 14:56:47 chrisrimmer
+Moved dbms_pipe code into its own package. Also changed some preprocessor flags
+
+
+************************************************************************/
+
+ PROCEDURE receive_and_unpack (
+ pipe_in IN VARCHAR2,
+ msg_tbl_out OUT msg_tbltype,
+ pipe_status_out IN OUT PLS_INTEGER
+ )
+ IS
+ invalid_item_type EXCEPTION;
+ null_msg_tbl msg_tbltype;
+ next_item INTEGER;
+ item_count INTEGER := 0;
+ BEGIN
+ pipe_status_out :=
+ DBMS_PIPE.receive_message (
+ pipe_in,
+ TIMEOUT=> 0
+ );
+
+ IF pipe_status_out != 0
+ THEN
+ RAISE invalid_item_type;
+ END IF;
+
+ LOOP
+ next_item := DBMS_PIPE.next_item_type;
+ EXIT WHEN next_item = 0;
+ item_count := item_count
+ + 1;
+ msg_tbl_out (item_count).item_type :=
+ next_item;
+
+ IF next_item = 9
+ THEN
+ DBMS_PIPE.unpack_message (
+ msg_tbl_out (item_count).mvc2
+ );
+ ELSIF next_item = 6
+ THEN
+ DBMS_PIPE.unpack_message (
+ msg_tbl_out (item_count).mnum
+ );
+ ELSIF next_item = 11
+ THEN
+ DBMS_PIPE.unpack_message_rowid (
+ msg_tbl_out (item_count).mrid
+ );
+ ELSIF next_item = 12
+ THEN
+ DBMS_PIPE.unpack_message (
+ msg_tbl_out (item_count).mdt
+ );
+ ELSIF next_item = 23
+ THEN
+ DBMS_PIPE.unpack_message_raw (
+ msg_tbl_out (item_count).mraw
+ );
+ ELSE
+ RAISE invalid_item_type;
+ END IF;
+
+ next_item := DBMS_PIPE.next_item_type;
+ END LOOP;
+ EXCEPTION
+ WHEN invalid_item_type
+ THEN
+ msg_tbl_out := null_msg_tbl;
+ END receive_and_unpack;
+
+END UTPIPE;
+/
diff --git a/source/ut_pipe.pks b/source/ut_pipe.pks
new file mode 100644
index 000000000..3c1cc340d
--- /dev/null
+++ b/source/ut_pipe.pks
@@ -0,0 +1,56 @@
+CREATE OR REPLACE PACKAGE UTPIPE &start_ge_8_1 AUTHID CURRENT_USER &end_ge_8_1
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2004
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.1 2004/11/23 14:56:48 chrisrimmer
+Moved dbms_pipe code into its own package. Also changed some preprocessor flags
+
+
+************************************************************************/
+
+ -- DBMS_PIPE functionality based on code provided by John Beresniewicz,
+ -- Savant Corp, in ORACLE BUILT-IN PACKAGES
+
+ -- For pipe equality checking
+ TYPE msg_rectype IS RECORD (
+ item_type INTEGER,
+ mvc2 VARCHAR2 (4093),
+ mdt DATE,
+ mnum NUMBER,
+ mrid ROWID,
+ mraw RAW (4093));
+
+ /*
+ || msg_tbltype tables can hold an ordered list of
+ || message items, thus any message can be captured
+ */
+ TYPE msg_tbltype IS TABLE OF msg_rectype
+ INDEX BY BINARY_INTEGER;
+
+ PROCEDURE receive_and_unpack(pipe_in IN VARCHAR2,
+ msg_tbl_out OUT msg_tbltype,
+ pipe_status_out IN OUT PLS_INTEGER);
+
+END UTPIPE;
+/
diff --git a/source/ut_plsql.pkb b/source/ut_plsql.pkb
new file mode 100644
index 000000000..196f0b641
--- /dev/null
+++ b/source/ut_plsql.pkb
@@ -0,0 +1,1412 @@
+/* Formatted on 2002/03/31 23:53 (Formatter Plus v4.5.2) */
+CREATE OR REPLACE PACKAGE BODY utplsql
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.7 2004/11/28 20:48:55 chrisrimmer
+Incremented version number
+
+Revision 1.6 2004/11/23 14:56:48 chrisrimmer
+Moved dbms_pipe code into its own package. Also changed some preprocessor flags
+
+Revision 1.5 2004/11/16 09:46:49 chrisrimmer
+Changed to new version detection system.
+
+Revision 1.4 2004/07/14 17:01:57 chrisrimmer
+Added first version of pluggable reporter packages
+
+Revision 1.3 2004/05/11 15:33:57 chrisrimmer
+Added 9.2 specific code from Mark Vilrokx
+
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ g_trc BOOLEAN := FALSE;
+ g_version VARCHAR2 (100) := '2.3.1';
+
+ tests test_tt;
+ testpkg test_rt;
+
+ FUNCTION vc2bool (vc IN VARCHAR2)
+ RETURN BOOLEAN
+ IS
+ BEGIN
+ IF vc = c_yes
+ THEN
+ RETURN TRUE;
+ ELSIF vc = c_no
+ THEN
+ RETURN FALSE;
+ ELSE
+ RETURN NULL;
+ END IF;
+ END;
+
+ FUNCTION bool2vc (bool IN BOOLEAN)
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ IF bool
+ THEN
+ RETURN c_yes;
+ ELSIF NOT bool
+ THEN
+ RETURN c_no;
+ ELSE
+ RETURN 'NULL';
+ END IF;
+ END;
+
+ FUNCTION progexists (
+ prog_in IN VARCHAR2,
+ sch_in IN VARCHAR2
+ )
+ RETURN BOOLEAN
+ IS
+ v_prog VARCHAR2 (1000) := prog_in;
+ /* variables to hold components of the name */
+ sch VARCHAR2 (100);
+ part1 VARCHAR2 (100);
+ part2 VARCHAR2 (100);
+ dblink VARCHAR2 (100);
+ part1_type NUMBER;
+ object_number NUMBER;
+ BEGIN
+ IF sch_in IS NOT NULL
+ THEN
+ v_prog := sch_in
+ || '.'
+ || prog_in;
+ END IF;
+
+ /* Break down the name into its components */
+ DBMS_UTILITY.name_resolve (
+ v_prog,
+ 1,
+ sch,
+ part1,
+ part2,
+ dblink,
+ part1_type,
+ object_number
+ );
+ RETURN TRUE;
+ EXCEPTION
+ -- Josh Goldie: 2.0.10.3 handle failure for objects.
+ WHEN OTHERS
+ THEN
+ IF sch_in IS NOT NULL
+ THEN
+ RETURN progexists (prog_in, NULL);
+ ELSE
+ /* Begin changes to check if v_prog is an object */
+ DECLARE
+ block VARCHAR2(100) :=
+ 'DECLARE obj ' || v_prog || '; BEGIN NULL; END;';
+ &start_lt_8_1
+ cur PLS_INTEGER := DBMS_SQL.open_cursor;
+ fdbk PLS_INTEGER;
+ &end_lt_8_1
+ BEGIN
+ &start_ge_8_1
+ EXECUTE IMMEDIATE block;
+ &start_ge_8_1
+
+ &start_lt_8_1
+ DBMS_SQL.parse (
+ cur,
+ block,
+ DBMS_SQL.native
+ );
+
+ fdbk := DBMS_SQL.EXECUTE(cur);
+
+ DBMS_SQL.close_cursor(cur);
+ &end_lt_8_1
+
+ RETURN TRUE;
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ &start_lt_8_1
+ DBMS_SQL.close_cursor(cur);
+ &end_lt_8_1
+ RETURN FALSE;
+ END;
+ /* End changes to check if v_prog is an object */
+ END IF;
+ END;
+
+
+ FUNCTION ispackage (
+ prog_in IN VARCHAR2,
+ sch_in IN VARCHAR2
+ )
+ RETURN BOOLEAN
+ IS
+ v_prog VARCHAR2 (1000) := prog_in;
+ /* variables to hold components of the name */
+ sch VARCHAR2 (100);
+ part1 VARCHAR2 (100);
+ part2 VARCHAR2 (100);
+ dblink VARCHAR2 (100);
+ part1_type NUMBER;
+ object_number NUMBER;
+ BEGIN
+ IF sch_in IS NOT NULL
+ THEN
+ v_prog := sch_in
+ || '.'
+ || prog_in;
+ END IF;
+
+ /* Break down the name into its components */
+ DBMS_UTILITY.name_resolve (
+ v_prog,
+ 1,
+ sch,
+ part1,
+ part2,
+ dblink,
+ part1_type,
+ object_number
+ );
+ RETURN part1_type = 9;
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ IF sch_in IS NOT NULL
+ THEN
+ RETURN ispackage (prog_in, NULL);
+ ELSE
+ RETURN FALSE;
+ END IF;
+ END;
+
+ -- End utility definitions
+
+ PROCEDURE setcurrcase (indx_in IN PLS_INTEGER)
+ IS
+ BEGIN
+ currcase.pkg := testpkg.pkg;
+ currcase.prefix := testpkg.prefix;
+ currcase.NAME := tests (indx_in).NAME;
+ currcase.indx := indx_in;
+ END;
+
+ FUNCTION pkgname (
+ package_in IN VARCHAR2,
+ samepackage_in IN BOOLEAN,
+ prefix_in IN VARCHAR2,
+ ispkg_in IN BOOLEAN,
+ owner_in IN VARCHAR2 := NULL
+ )
+ RETURN VARCHAR2
+ IS
+ retval VARCHAR2 (1000);
+ BEGIN
+ -- 2.0.9.1: revamp for owner/remote schema exec.
+ IF NOT ispkg_in
+ AND NOT samepackage_in -- 2.0.9.2 add second clause
+ THEN
+ retval := prefix_in
+ || package_in;
+ ELSIF samepackage_in
+ THEN
+ retval := package_in;
+ ELSE
+ retval := prefix_in
+ || package_in;
+ END IF;
+
+ IF owner_in IS NOT NULL
+ THEN
+ -- 2.0.10.2: embed owner_in in double quotes to support
+ -- OS authentication
+ retval := '"' || owner_in || '"'
+ --retval := owner_in
+ || '.'
+ || retval;
+ END IF;
+
+ RETURN retval;
+ END;
+
+ /* 1.5.3 No longer in use
+ FUNCTION do_register
+ RETURN BOOLEAN
+ IS
+ BEGIN
+ RETURN (NVL (g_config.registertest, c_yes) != c_no);
+ END;
+ */
+
+ FUNCTION progname (
+ program_in IN VARCHAR2,
+ samepackage_in IN BOOLEAN,
+ prefix_in IN VARCHAR2,
+ ispkg_in IN BOOLEAN
+ )
+ RETURN VARCHAR2
+ IS
+ -- The default setting...
+ retval VARCHAR2 (1000)
+ := prefix_in
+ || program_in;
+ BEGIN
+ -- 1.3.5 If not using setup to register then prefix
+ -- is already a part of the name; no construction necessary.
+ IF NOT utconfig.registeringtest
+ THEN
+ IF UPPER (program_in) NOT IN
+ (c_setup, c_teardown)
+ THEN
+ retval := program_in;
+ END IF;
+ ELSIF NOT ispkg_in
+ THEN
+ retval := prefix_in
+ || program_in;
+ ELSIF samepackage_in
+ THEN
+ retval := prefix_in
+ || program_in;
+ ELSE
+ -- Ignore prefix only for separate test packages of packaged
+ -- functionality.
+ retval := program_in;
+ END IF;
+
+ RETURN retval;
+ END;
+
+ FUNCTION pkgname (
+ package_in IN VARCHAR2,
+ samepackage_in IN BOOLEAN,
+ prefix_in IN VARCHAR2,
+ owner_in IN VARCHAR2 := NULL
+ )
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ utassert.this (
+ 'Pkgname: the package record has not been set!',
+ testpkg.pkg IS NOT NULL,
+ register_in=> FALSE
+ );
+ RETURN pkgname (
+ package_in,
+ samepackage_in,
+ prefix_in,
+ testpkg.ispkg,
+ owner_in
+ );
+ END;
+
+ FUNCTION progname (
+ program_in IN VARCHAR2,
+ samepackage_in IN BOOLEAN,
+ prefix_in IN VARCHAR2
+ )
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ utassert.this (
+ 'Progname: the package record has not been set!',
+ testpkg.pkg IS NOT NULL,
+ register_in=> FALSE
+ );
+ RETURN progname (
+ program_in,
+ samepackage_in,
+ prefix_in,
+ testpkg.ispkg
+ );
+ END;
+
+ PROCEDURE runprog (
+ name_in IN VARCHAR2,
+ propagate_in IN BOOLEAN := FALSE
+ )
+ IS
+ v_pkg VARCHAR2 (100)
+ := pkgname (
+ testpkg.pkg,
+ testpkg.samepkg,
+ testpkg.prefix,
+ testpkg.owner
+ );
+ v_name VARCHAR2 (100) := name_in;
+ /*
+ 1.5.3 No longer needed; name is always already prefixed.
+ := progname (NAME_IN, testpkg.samepkg, testpkg.prefix);
+ */
+ v_str VARCHAR2 (32767);
+ &start_lt_8_1
+ fdbk PLS_INTEGER;
+ cur PLS_INTEGER
+ := DBMS_SQL.open_cursor;
+ &end_lt_8_1
+ BEGIN
+ IF tracing
+ THEN
+ utreport.pl ( 'Runprog of '
+ || name_in);
+ utreport.pl (
+ ' Package and program = '
+ || v_pkg
+ || '.'
+ || v_name
+ );
+ utreport.pl (
+ ' Same package? '
+ || bool2vc (testpkg.samepkg)
+ );
+ utreport.pl (
+ ' Is package? '
+ || bool2vc (testpkg.ispkg)
+ );
+ utreport.pl ( ' Prefix = '
+ || testpkg.prefix);
+ END IF;
+
+ v_str := 'BEGIN '
+ || v_pkg
+ || '.'
+ || v_name
+ || '; END;';
+ &start_ge_8_1
+ EXECUTE IMMEDIATE v_str;
+ &start_ge_8_1
+ &start_lt_8_1
+ DBMS_SQL.parse (cur, v_str, DBMS_SQL.native);
+ fdbk := DBMS_SQL.EXECUTE (cur);
+ DBMS_SQL.close_cursor (cur);
+ &end_lt_8_1
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ &start_lt_8_1
+ DBMS_SQL.close_cursor (cur);
+
+ &end_lt_8_1
+
+ IF tracing
+ THEN
+ utreport.pl (
+ 'Compile Error "'
+ || SQLERRM
+ || '" on: '
+ );
+ utreport.pl (v_str);
+ END IF;
+
+ utassert.this (
+ 'Unable to run '
+ || v_pkg
+ || '.'
+ || v_name
+ || ': '
+ || SQLERRM,
+ FALSE,
+ null_ok_in=> NULL,
+ raise_exc_in=> propagate_in,
+ register_in=> TRUE
+ );
+ END;
+
+ PROCEDURE runit (
+ indx_in IN PLS_INTEGER,
+ per_method_setup_in IN BOOLEAN,
+ prefix_in IN VARCHAR2
+ )
+ IS
+ BEGIN
+ setcurrcase (indx_in);
+
+ IF per_method_setup_in
+ THEN
+ runprog ( prefix_in
+ || c_setup, TRUE);
+ END IF;
+
+ runprog (tests (indx_in).NAME, FALSE);
+
+ IF per_method_setup_in
+ THEN
+ runprog (
+ prefix_in
+ || c_teardown,
+ TRUE
+ );
+ END IF;
+ END;
+
+ PROCEDURE init_tests
+ IS
+ nulltest test_rt;
+ nullcase testcase_rt;
+ BEGIN
+ tests.DELETE;
+ currcase := nullcase;
+ testpkg := nulltest;
+ END;
+
+ PROCEDURE init (
+ prefix_in IN VARCHAR2 := NULL,
+ dir_in IN VARCHAR2 := NULL,
+ from_suite_in IN BOOLEAN := FALSE
+ )
+ IS
+ BEGIN
+ init_tests;
+
+ --Removed test for null as utConfig.prefix never returns null
+ IF prefix_in IS NOT NULL
+ AND prefix_in != utconfig.prefix
+ THEN
+ utconfig.setprefix (prefix_in);
+ END IF;
+
+ IF dir_in IS NOT NULL
+ AND ( dir_in != utconfig.dir
+ OR utconfig.dir IS NULL
+ )
+ /* 1.5.3 Check for null config directory as well */
+ THEN
+ utconfig.setdir (dir_in);
+ END IF;
+
+ utresult.init (from_suite_in);
+
+ -- 2.0.1 compatibilty with utPLSQL2
+ utplsql2.set_runnum;
+
+ IF tracing
+ THEN
+ utreport.pl ('Initialized utPLSQL session...');
+ END IF;
+ END;
+
+ PROCEDURE COMPILE (
+ file_in IN VARCHAR2,
+ dir_in IN VARCHAR2
+ )
+ IS
+ fid UTL_FILE.file_type;
+ v_dir VARCHAR2 (2000)
+ := NVL (dir_in, utconfig.dir);
+ lines DBMS_SQL.varchar2s;
+ cur PLS_INTEGER := DBMS_SQL.open_cursor;
+
+ PROCEDURE recngo (str IN VARCHAR2)
+ IS
+ BEGIN
+ UTL_FILE.fclose (fid);
+ utreport.pl (
+ 'Error compiling '
+ || file_in
+ || ' located in "'
+ || v_dir
+ || '": '
+ || str
+ );
+ utreport.pl (
+ ' Please make sure the directory for utPLSQL is set by calling '
+ || 'utConfig.setdir.'
+ );
+ utreport.pl (
+ ' Your test package must reside in this directory.'
+ );
+
+ IF DBMS_SQL.is_open (cur)
+ THEN
+ DBMS_SQL.close_cursor (cur);
+ END IF;
+ END;
+ BEGIN
+ utrerror.assert (
+ v_dir IS NOT NULL,
+ 'Compile error: you must specify a directory with utConfig.setdir!'
+ );
+ fid :=
+ UTL_FILE.fopen (
+ v_dir,
+ file_in,
+ 'R' &start_ge_8_1
+ ,
+ max_linesize=> 32767 &end_ge_8_1
+ );
+
+ LOOP
+ BEGIN
+ UTL_FILE.get_line (
+ fid,
+ lines ( NVL (lines.LAST, 0)
+ + 1)
+ );
+ -- 2.0.7: helps with compiling in Linux.
+ lines (lines.LAST) :=
+ RTRIM (
+ lines (lines.LAST),
+ ' '
+ || CHR (13)
+ );
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ EXIT;
+ END;
+ END LOOP;
+
+ /* Clean up termination character. */
+ LOOP
+ IF lines (lines.LAST) = '/'
+ OR RTRIM (lines (lines.LAST)) IS NULL
+ THEN
+ lines.DELETE (lines.LAST);
+ ELSE
+ EXIT;
+ END IF;
+ END LOOP;
+
+ UTL_FILE.fclose (fid);
+
+ if tracing then
+ utreport.pl ('Compiling ' || lines (lines.first));
+ end if;
+
+ DBMS_SQL.parse (
+ cur,
+ lines,
+ lines.FIRST,
+ lines.LAST,
+ TRUE,
+ DBMS_SQL.native
+ );
+ DBMS_SQL.close_cursor (cur);
+ EXCEPTION
+ WHEN UTL_FILE.invalid_path
+ THEN
+ recngo ('invalid_path');
+ WHEN UTL_FILE.invalid_mode
+ THEN
+ recngo ('invalid_mode');
+ WHEN UTL_FILE.invalid_filehandle
+ THEN
+ recngo ('invalid_filehandle');
+ WHEN UTL_FILE.invalid_operation
+ THEN
+ recngo ('invalid_operation');
+ WHEN UTL_FILE.read_error
+ THEN
+ recngo ('read_error');
+ WHEN UTL_FILE.write_error
+ THEN
+ recngo ('write_error');
+ WHEN UTL_FILE.internal_error
+ THEN
+ recngo ('internal_error');
+ WHEN OTHERS
+ THEN
+ recngo (SQLERRM);
+ END;
+
+ /* Programs used in ut_PKG.setup */
+
+ PROCEDURE setpkg (
+ package_in IN VARCHAR2,
+ samepackage_in IN BOOLEAN := FALSE,
+ prefix_in IN VARCHAR2 := NULL,
+ owner_in IN VARCHAR2 := NULL,
+ subprogram_in IN VARCHAR2 := '%',
+ override_package_in IN VARCHAR2
+ := NULL -- 2.0.9.2
+ )
+ IS
+ v_pkg VARCHAR2 (1000);
+ BEGIN
+ --testpkg.pkg := package_in;
+ -- 2.0.9.2
+ testpkg.pkg :=
+ NVL (override_package_in, package_in);
+ testpkg.owner := owner_in; -- 2.0.9.1 remote schema
+ testpkg.ispkg :=
+ ispackage (package_in, owner_in);
+
+ -- 2.0.9.2 If there is an override package, treat like samepackage
+ -- No addition of prefix, essentially
+
+ IF override_package_in IS NOT NULL
+ THEN
+ testpkg.samepkg := TRUE;
+ ELSE
+ testpkg.samepkg := samepackage_in;
+ END IF;
+
+ testpkg.prefix :=
+ NVL (
+ prefix_in,
+ utconfig.prefix (owner_in)
+ );
+ v_pkg := pkgname (
+ testpkg.pkg,
+ testpkg.samepkg,
+ testpkg.prefix,
+ testpkg.owner
+ );
+
+ -- 2.1.1 Initialize a ut_utp row/id
+ DECLARE
+ rec ut_utp%ROWTYPE;
+ BEGIN
+ IF ututp.EXISTS (testpkg.owner, testpkg.pkg)
+ THEN
+ rec := ututp.onerow (testpkg.owner, testpkg.pkg);
+ ELSE
+ ututp.ADD (testpkg.pkg, testpkg.owner, id_out => rec.ID);
+ END IF;
+
+ utplsql2.set_current_utp (rec.ID);
+ utrutp.initiate(utplsql2.runnum,rec.id);
+ END;
+
+
+ IF tracing
+ THEN
+ utreport.pl ( 'Setpkg to '
+ || testpkg.pkg);
+ utreport.pl (
+ ' Package and program = '
+ || v_pkg
+ );
+ utreport.pl (
+ ' Same package? '
+ || bool2vc (testpkg.samepkg)
+ );
+ utreport.pl (
+ ' Is package? '
+ || bool2vc (testpkg.ispkg)
+ );
+ utreport.pl ( ' Prefix = '
+ || testpkg.prefix);
+ END IF;
+ END;
+
+ -- 2.0.8.2 Separate out population of test array
+ PROCEDURE populate_test_array (
+ testpkg_in IN test_rt,
+ package_in IN VARCHAR2,
+ samepackage_in IN BOOLEAN := FALSE,
+ prefix_in IN VARCHAR2 := NULL,
+ owner_in IN VARCHAR2 := NULL,
+ subprogram_in IN VARCHAR2 := '%'
+ )
+ IS
+ v_pkg VARCHAR2 (1000)
+ := -- 2.0.9.1 No owner prefix.
+ pkgname (
+ testpkg_in.pkg,
+ testpkg_in.samepkg,
+ testpkg_in.prefix
+ );
+ BEGIN
+ -- 1.3.5
+ IF NOT utconfig.registeringtest (
+ NVL (UPPER (owner_in), USER)
+ )
+ THEN
+ -- Populate test information from ALL_ARGUMENTS
+ FOR rec IN
+ &start_lt_9
+ (SELECT DISTINCT object_name procedure_name
+ FROM all_arguments
+ WHERE owner =
+ NVL (
+ UPPER (
+ owner_in
+ ),
+ USER
+ )
+ AND package_name =
+ UPPER (v_pkg)
+ AND object_name LIKE
+ UPPER (
+ prefix_in
+ )
+ || '%'
+ AND object_name LIKE
+ UPPER (
+ prefix_in
+ || subprogram_in
+ )
+ AND object_name NOT IN
+ (UPPER (
+ prefix_in
+ || c_setup
+ ),
+ UPPER (
+ prefix_in
+ || c_teardown
+ )
+ ) ORDER BY procedure_name)
+ &end_lt_9
+ &start_ge_9
+ (SELECT procedure_name
+ FROM all_procedures
+ WHERE owner = NVL (UPPER (owner_in), USER)
+ AND object_name = UPPER (v_pkg)
+ AND procedure_name LIKE UPPER (prefix_in)
+ || '%'
+ AND procedure_name LIKE
+ UPPER ( prefix_in
+ || subprogram_in)
+ AND procedure_name NOT IN (UPPER (
+ prefix_in
+ || c_setup
+ ),
+ UPPER (
+ prefix_in
+ || c_teardown
+ )
+ ) ORDER BY procedure_name)
+ &end_ge_9
+ LOOP
+ addtest (
+ testpkg_in.pkg,
+ rec.procedure_name,
+ prefix_in,
+ iterations_in=> 1,
+ override_in=> TRUE
+ );
+ END LOOP;
+ END IF;
+ END;
+
+ FUNCTION currpkg
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ RETURN testpkg.pkg;
+ END;
+
+ /*
+ func: currpkgowner
+ Return Owner of current package.
+ */
+ FUNCTION currpkgowner
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ RETURN testpkg.owner;
+ END;
+
+
+ PROCEDURE addtest (
+ package_in IN VARCHAR2,
+ name_in IN VARCHAR2,
+ prefix_in IN VARCHAR2,
+ iterations_in IN PLS_INTEGER,
+ override_in IN BOOLEAN
+ )
+ IS
+ indx PLS_INTEGER
+ := NVL (tests.LAST, 0)
+ + 1;
+ BEGIN
+ -- 1.3.5 Disable calls to addtest from setup.
+ IF utconfig.registeringtest
+ OR ( NOT utconfig.registeringtest
+ AND override_in
+ )
+ THEN
+ IF tracing
+ THEN
+ utreport.pl ('Addtest');
+ utreport.pl (
+ ' Package and program = '
+ || package_in
+ || '.'
+ || name_in
+ );
+ utreport.pl (
+ ' Same package? '
+ || bool2vc (testpkg.samepkg)
+ );
+ utreport.pl (
+ ' Override? '
+ || bool2vc (override_in)
+ );
+ utreport.pl ( ' Prefix = '
+ || prefix_in);
+ END IF;
+
+ -- 1.5.3: program name always already has prefix!
+ tests (indx).pkg := package_in;
+ tests (indx).prefix := prefix_in;
+ tests (indx).NAME := name_in;
+ tests (indx).iterations := iterations_in;
+ END IF;
+ END;
+
+ PROCEDURE addtest (
+ name_in IN VARCHAR2,
+ prefix_in IN VARCHAR2 := NULL,
+ iterations_in IN PLS_INTEGER := 1,
+ override_in IN BOOLEAN := FALSE
+ )
+ IS
+ indx PLS_INTEGER
+ := NVL (tests.LAST, 0)
+ + 1;
+ BEGIN
+ addtest (
+ testpkg.pkg,
+ name_in,
+ prefix_in,
+ iterations_in,
+ override_in
+ );
+ END;
+
+ /* Test engine */
+
+ /* 1.5.3. autocompiling used instead
+ FUNCTION do_recompile (recomp IN BOOLEAN)
+ RETURN BOOLEAN
+ IS
+ BEGIN
+ RETURN ( recomp
+ AND (NVL (g_config.autocompile, c_yes) != c_no));
+ END;
+ */
+
+ PROCEDURE test (
+ package_in IN VARCHAR2,
+ samepackage_in IN BOOLEAN := FALSE,
+ prefix_in IN VARCHAR2 := NULL,
+ recompile_in IN BOOLEAN := TRUE,
+ dir_in IN VARCHAR2 := NULL,
+ suite_in IN VARCHAR2 := NULL,
+ owner_in IN VARCHAR2 := NULL,
+ reset_results_in IN BOOLEAN := TRUE,
+ from_suite_in IN BOOLEAN := FALSE,
+ subprogram_in IN VARCHAR2 := '%',
+ per_method_setup_in IN BOOLEAN := FALSE, -- 2.0.8
+ override_package_in IN VARCHAR2
+ := NULL -- 2.0.9.2
+ )
+ IS
+ indx PLS_INTEGER;
+ v_pkg VARCHAR2 (100);
+ -- 2.0.10.1: use dir in config
+ v_dir maxvc2_t := NVL (dir_in, utconfig.dir);
+ v_start DATE := SYSDATE;
+ v_prefix ut_config.prefix%TYPE
+ := NVL (prefix_in, utconfig.prefix (owner_in));
+ v_per_method_setup BOOLEAN
+ := NVL (per_method_setup_in, FALSE);
+
+ PROCEDURE cleanup (
+ per_method_setup_in IN BOOLEAN
+ )
+ IS
+ BEGIN
+ IF suite_in IS NULL THEN
+ utreport.open;
+ utresult.show;
+ END IF;
+ BEGIN
+ IF NOT per_method_setup_in
+ THEN
+ runprog (
+ v_prefix
+ || c_teardown,
+ TRUE
+ );
+ END IF;
+ EXCEPTION
+ WHEN OTHERS THEN
+ utassert.this (
+ 'Unable to run '
+ || v_prefix || c_teardown
+ || ': '
+ || SQLERRM,
+ FALSE,
+ --same as in "runprog" call
+ null_ok_in=> NULL,
+ raise_exc_in=> TRUE,
+ register_in=> TRUE
+ );
+ END;
+
+
+ utpackage.upd (
+ suite_in,
+ package_in,
+ v_start,
+ SYSDATE,
+ utresult.success,
+ owner_in
+ );
+
+ -- 2.1.1 add recording of test in tables.
+ utrutp.terminate(utplsql2.runnum, utplsql2.current_utp);
+
+ IF reset_results_in
+ THEN
+ init_tests;
+ END IF;
+
+ IF suite_in IS NULL THEN
+ utreport.close;
+ END IF;
+
+ END;
+ BEGIN
+ init (v_prefix, v_dir, from_suite_in);
+
+ IF NOT progexists (package_in, owner_in)
+ THEN
+ utreport.pl (
+ 'Program named "'
+ || package_in
+ || '" does not exist.'
+ );
+ ELSE
+ setpkg (
+ package_in,
+ samepackage_in,
+ v_prefix,
+ owner_in,
+ subprogram_in,
+ override_package_in
+ );
+ --v_pkg := pkgname (package_in, samepackage_in, v_prefix, owner_in);
+ -- 2.0.9.2 Make sure record is used.
+ v_pkg := pkgname (
+ testpkg.pkg,
+ testpkg.samepkg,
+ testpkg.prefix,
+ testpkg.owner
+ );
+
+ IF recompile_in
+ AND utconfig.autocompiling (
+ owner_in
+ )
+ THEN
+ IF tracing
+ THEN
+ utreport.pl (
+ 'Recompiling '
+ || v_pkg
+ || ' in '
+ || v_dir
+ );
+ END IF;
+
+ utreceq.COMPILE (package_in);
+
+ COMPILE (
+ -- 2.0.9.1 Package name without OWNER
+ -- 2.0.9.2 Switch to use of record based info.
+ --pkgname (package_in, samepackage_in, v_prefix)
+ -- || '.pks', dir_in);
+ pkgname (
+ testpkg.pkg,
+ testpkg.samepkg,
+ testpkg.prefix
+ )
+ || '.pks',
+ v_dir
+ );
+ COMPILE (
+ -- 2.0.9.1 Package name without OWNER
+ -- 2.0.9.2 Switch to use of record based info.
+ --pkgname (package_in, samepackage_in, v_prefix)
+ -- || '.pks', dir_in);
+ pkgname (
+ testpkg.pkg,
+ testpkg.samepkg,
+ testpkg.prefix
+ )
+ || '.pkb',
+ v_dir
+ );
+ END IF;
+
+ IF NOT v_per_method_setup
+ THEN
+ runprog (
+ v_prefix
+ || c_setup,
+ TRUE
+ );
+ END IF;
+
+ populate_test_array (
+ testpkg,
+ package_in,
+ samepackage_in,
+ v_prefix,
+ owner_in,
+ subprogram_in
+ );
+ indx := tests.FIRST;
+
+ IF indx IS NULL
+ THEN
+ utreport.pl ('Warning!');
+ utreport.pl (
+ 'Warning...no tests were identified for execution!'
+ );
+ utreport.pl ('Warning!');
+ ELSE
+ LOOP
+ EXIT WHEN indx IS NULL;
+ runit (
+ indx,
+ v_per_method_setup,
+ v_prefix
+ );
+ indx := tests.NEXT (indx);
+ END LOOP;
+ END IF;
+
+ cleanup (v_per_method_setup);
+ END IF;
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ utassert.this (
+ 'utPLSQL.test failure: '
+ || SQLERRM,
+ FALSE
+ );
+ cleanup (FALSE);
+ END;
+
+ PROCEDURE testsuite (
+ suite_in IN VARCHAR2,
+ recompile_in IN BOOLEAN := TRUE,
+ reset_results_in IN BOOLEAN := TRUE,
+ per_method_setup_in IN BOOLEAN := FALSE, -- 2.0.8
+ override_package_in IN BOOLEAN := FALSE
+ )
+ IS
+ v_suite ut_suite.id%TYPE
+ := utsuite.id_from_name (suite_in);
+ v_success BOOLEAN := TRUE;
+ v_suite_start DATE := SYSDATE;
+ v_pkg_start DATE;
+ v_override VARCHAR2 (1000);
+ BEGIN
+ utreport.open;
+ BEGIN
+ IF v_suite IS NULL
+ THEN
+ utassert.this (
+ 'Test suite with name "'
+ || suite_in
+ || '" does not exist.',
+ FALSE
+ );
+ utresult.show;
+ ELSE
+ FOR rec IN (SELECT *
+ FROM ut_package
+ WHERE suite_id = v_suite
+ ORDER BY seq)
+ LOOP
+ v_pkg_start := SYSDATE;
+
+ -- 2.0.9.2 Pass override request to individual test.
+ IF override_package_in
+ THEN
+ v_override := rec.NAME;
+ ELSE
+ v_override := NULL;
+ END IF;
+-- 2.0.9.2 allow for continuation of tests if a single package fails
+begin
+ test (
+ rec.NAME,
+ vc2bool (rec.samepackage),
+ rec.prefix,
+ recompile_in,
+ rec.dir,
+
+-- v_suite,
+ suite_in,
+ rec.owner,
+ reset_results_in=> FALSE,
+ from_suite_in=> TRUE,
+ per_method_setup_in=> per_method_setup_in,
+ override_package_in=> v_override
+ );
+ -- 3/4/02 trap exceptions and continue with next package.
+ EXCEPTION
+ WHEN OTHERS THEN
+ v_success := FALSE;
+ END;
+ IF utresult.failure
+ THEN
+ v_success := FALSE;
+ END IF;
+ END LOOP;
+
+ utsuite.upd (
+ v_suite,
+ v_suite_start,
+ SYSDATE,
+ v_success
+ );
+
+ utresult.showsuite(suite_id => v_suite);
+
+ END IF;
+
+ IF reset_results_in
+ THEN
+ init;
+ END IF;
+ utreport.close;
+ EXCEPTION
+ WHEN OTHERS THEN
+ utassert.this (
+ 'utPLSQL.testsuite failure: '
+ || SQLERRM,
+ FALSE
+ );
+ utreport.close;
+ END;
+ END;
+
+ /* Programs used in individual unit test programs. */
+
+ PROCEDURE setcase (case_in IN VARCHAR2)
+ IS
+ BEGIN
+ NULL;
+ END;
+
+ PROCEDURE setdata (
+ dir_in IN VARCHAR2,
+ file_in IN VARCHAR2,
+ delim_in IN VARCHAR2 := ','
+ )
+ IS
+ BEGIN
+ NULL;
+ END;
+
+ PROCEDURE passdata (
+ data_in IN VARCHAR2,
+ delim_in IN VARCHAR2 := ','
+ )
+ IS
+ BEGIN
+ NULL;
+ END;
+
+ PROCEDURE trc
+ IS
+ BEGIN
+ g_trc := TRUE;
+ END;
+
+ PROCEDURE notrc
+ IS
+ BEGIN
+ g_trc := FALSE;
+ END;
+
+ FUNCTION tracing
+ RETURN BOOLEAN
+ IS
+ BEGIN
+ RETURN g_trc;
+ END;
+
+ FUNCTION version
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ RETURN g_version;
+ END;
+
+ FUNCTION seqval (tab_in IN VARCHAR2)
+ RETURN PLS_INTEGER
+ IS
+ sqlstr VARCHAR2 (200)
+ := 'SELECT '
+ || tab_in
+ || '_seq.NEXTVAL FROM dual';
+ fdbk PLS_INTEGER;
+ retval PLS_INTEGER;
+ BEGIN
+ &start_ge_8_1
+ EXECUTE IMMEDIATE sqlstr
+ INTO retval;
+
+ &start_ge_8_1
+ &start_lt_8_1
+ DECLARE
+ fdbk PLS_INTEGER;
+ cur PLS_INTEGER
+ := DBMS_SQL.open_cursor;
+ BEGIN
+ DBMS_SQL.parse (
+ cur,
+ sqlstr,
+ DBMS_SQL.native
+ );
+ DBMS_SQL.define_column (cur, 1, retval);
+ fdbk := DBMS_SQL.execute_and_fetch (cur);
+ DBMS_SQL.column_value (cur, 1, retval);
+ DBMS_SQL.close_cursor (cur);
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ DBMS_SQL.close_cursor (cur);
+ RAISE;
+ END;
+
+ &end_lt_8_1
+ RETURN retval;
+ END;
+
+ FUNCTION ifelse (
+ bool_in IN BOOLEAN,
+ tval_in IN BOOLEAN,
+ fval_in IN BOOLEAN
+ )
+ RETURN BOOLEAN
+ IS
+ BEGIN
+ IF bool_in
+ THEN
+ RETURN tval_in;
+ ELSE
+ RETURN fval_in;
+ END IF;
+ END;
+
+ FUNCTION ifelse (
+ bool_in IN BOOLEAN,
+ tval_in IN DATE,
+ fval_in IN DATE
+ )
+ RETURN DATE
+ IS
+ BEGIN
+ IF bool_in
+ THEN
+ RETURN tval_in;
+ ELSE
+ RETURN fval_in;
+ END IF;
+ END;
+
+ FUNCTION ifelse (
+ bool_in IN BOOLEAN,
+ tval_in IN NUMBER,
+ fval_in IN NUMBER
+ )
+ RETURN NUMBER
+ IS
+ BEGIN
+ IF bool_in
+ THEN
+ RETURN tval_in;
+ ELSE
+ RETURN fval_in;
+ END IF;
+ END;
+
+ FUNCTION ifelse (
+ bool_in IN BOOLEAN,
+ tval_in IN VARCHAR2,
+ fval_in IN VARCHAR2
+ )
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ IF bool_in
+ THEN
+ RETURN tval_in;
+ ELSE
+ RETURN fval_in;
+ END IF;
+ END;
+
+ -- 2.0.9.2: run a test package directly
+ PROCEDURE run (
+ testpackage_in IN VARCHAR2,
+ prefix_in IN VARCHAR2 := NULL,
+ suite_in IN VARCHAR2 := NULL,
+ owner_in IN VARCHAR2 := NULL,
+ reset_results_in IN BOOLEAN := TRUE,
+ from_suite_in IN BOOLEAN := FALSE,
+ subprogram_in IN VARCHAR2 := '%',
+ per_method_setup_in IN BOOLEAN := FALSE
+ )
+ IS
+ BEGIN
+ test (
+ package_in=> testpackage_in,
+ samepackage_in=> FALSE,
+ prefix_in=> prefix_in,
+ recompile_in=> FALSE,
+ dir_in=> NULL,
+ suite_in=> suite_in,
+ owner_in=> owner_in,
+ reset_results_in=> reset_results_in,
+ from_suite_in=> from_suite_in,
+ subprogram_in=> subprogram_in,
+ per_method_setup_in=> per_method_setup_in, -- 2.0.8
+ override_package_in=> testpackage_in
+ );
+ END;
+
+ PROCEDURE runsuite (
+ suite_in IN VARCHAR2,
+ reset_results_in IN BOOLEAN := TRUE,
+ per_method_setup_in IN BOOLEAN := FALSE
+ )
+ IS
+ BEGIN
+ testsuite (
+ suite_in=> suite_in,
+ recompile_in=> FALSE,
+ reset_results_in=> reset_results_in,
+ per_method_setup_in=> per_method_setup_in, -- 2.0.8
+ override_package_in=> TRUE
+ );
+ END;
+END;
+/
diff --git a/source/ut_plsql.pks b/source/ut_plsql.pks
new file mode 100644
index 000000000..8a9af28e4
--- /dev/null
+++ b/source/ut_plsql.pks
@@ -0,0 +1,250 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE utplsql &start_ge_8_1 AUTHID CURRENT_USER &end_ge_8_1
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.4 2004/11/16 09:46:49 chrisrimmer
+Changed to new version detection system.
+
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ c_success CONSTANT VARCHAR2 (7) := 'SUCCESS';
+ c_failure CONSTANT VARCHAR2 (7) := 'FAILURE';
+ c_yes CONSTANT CHAR (1) := 'Y';
+ c_no CONSTANT CHAR (1) := 'N';
+ c_setup CONSTANT CHAR (5) := 'SETUP';
+ c_teardown CONSTANT CHAR (8) := 'TEARDOWN';
+ c_enabled CONSTANT CHAR (7) := 'ENABLED';
+ c_disabled CONSTANT CHAR (8) := 'DISABLED';
+ &start_lt_8_1
+ dbmaxvc2 VARCHAR2 (2000);
+ &end_lt_8_1
+ &start_ge_8_1
+ dbmaxvc2 VARCHAR2 (4000);
+
+ &end_ge_8_1
+ SUBTYPE dbmaxvc2_t IS dbmaxvc2%TYPE;
+
+ maxvc2 VARCHAR2 (32767);
+
+ SUBTYPE maxvc2_t IS maxvc2%TYPE;
+
+ namevc2 VARCHAR2 (100);
+
+ SUBTYPE name_t IS namevc2%TYPE;
+
+ TYPE test_rt IS RECORD (
+ pkg VARCHAR2 (100),
+ owner VARCHAR2(100), -- 2.0.9.1 support remote schema execution
+ ispkg BOOLEAN,
+ samepkg BOOLEAN,
+ prefix VARCHAR2 (100),
+ iterations PLS_INTEGER);
+
+ TYPE testcase_rt IS RECORD (
+ pkg VARCHAR2 (100),
+ prefix VARCHAR2 (100),
+ name VARCHAR2 (100),
+ indx PLS_INTEGER,
+ iterations PLS_INTEGER);
+
+ TYPE test_tt IS TABLE OF testcase_rt
+ INDEX BY BINARY_INTEGER;
+
+ currcase testcase_rt;
+
+ /* Utility programs */
+ FUNCTION vc2bool (vc IN VARCHAR2)
+ RETURN BOOLEAN;
+
+ FUNCTION bool2vc (bool IN BOOLEAN)
+ RETURN VARCHAR2;
+
+ FUNCTION ispackage (prog_in IN VARCHAR2, sch_in IN VARCHAR2)
+ RETURN BOOLEAN;
+
+ /* Single package test engine. */
+
+ PROCEDURE test (
+ package_in IN VARCHAR2,
+ samepackage_in IN BOOLEAN := FALSE,
+ prefix_in IN VARCHAR2 := NULL,
+ recompile_in IN BOOLEAN := TRUE,
+ dir_in IN VARCHAR2 := NULL,
+ suite_in IN VARCHAR2 := NULL,
+ owner_in IN VARCHAR2 := NULL,
+ reset_results_in IN BOOLEAN := TRUE,
+ from_suite_in IN BOOLEAN := FALSE,
+ subprogram_in in varchar2 := '%',
+ per_method_setup_in in boolean := FALSE, -- 2.0.8
+ override_package_in IN varchar2 := NULL -- 2.0.9.2
+ -- If recompiling, then always looks for
+ -- .pks and .pkb files
+ );
+
+ PROCEDURE testsuite (
+ suite_in IN VARCHAR2,
+ recompile_in IN BOOLEAN := TRUE,
+ reset_results_in IN BOOLEAN := TRUE,
+ per_method_setup_in in boolean := FALSE, -- 2.0.8
+ override_package_in IN BOOLEAN := FALSE
+ -- If recompiling, then always looks for
+ -- .pks and .pkb files
+ );
+
+ /* Single package test engine. */
+ -- 2.0.9.2: run a test package directly
+ PROCEDURE run (
+ testpackage_in IN VARCHAR2,
+ prefix_in IN VARCHAR2 := NULL,
+ suite_in IN VARCHAR2 := NULL,
+ owner_in IN VARCHAR2 := NULL,
+ reset_results_in IN BOOLEAN := TRUE,
+ from_suite_in IN BOOLEAN := FALSE,
+ subprogram_in in varchar2 := '%',
+ per_method_setup_in in boolean := FALSE
+ );
+
+ PROCEDURE runsuite (
+ suite_in IN VARCHAR2,
+ reset_results_in IN BOOLEAN := TRUE,
+ per_method_setup_in in boolean := FALSE
+ );
+
+ /* Programs used in ut_PKG.setup */
+
+ /* 1.3.2: Hide setpkg. Modifies global package state
+ and is no longer needed by customer.
+
+ PROCEDURE setpkg (
+ package_in IN VARCHAR2,
+ samepackage_in IN BOOLEAN := FALSE,
+ prefix_in IN VARCHAR2 := NULL
+ );
+ */
+
+ FUNCTION currpkg
+ RETURN VARCHAR2;
+
+ FUNCTION currpkgowner
+ RETURN VARCHAR2;
+
+ PROCEDURE addtest (
+ package_in IN VARCHAR2,
+ name_in IN VARCHAR2,
+ prefix_in IN VARCHAR2,
+ iterations_in IN PLS_INTEGER,
+ override_in IN BOOLEAN
+ );
+
+ PROCEDURE addtest (
+ name_in IN VARCHAR2,
+ prefix_in IN VARCHAR2 := NULL,
+ iterations_in IN PLS_INTEGER := 1,
+ override_in IN BOOLEAN := FALSE
+ );
+
+ -- Not currently used.
+ PROCEDURE setcase (case_in IN VARCHAR2);
+
+ -- Not currently used.
+ PROCEDURE setdata (
+ dir_in IN VARCHAR2,
+ file_in IN VARCHAR2,
+ delim_in IN VARCHAR2 := ','
+ );
+
+ -- Not currently used.
+ PROCEDURE passdata (data_in IN VARCHAR2, delim_in IN VARCHAR2 := ',');
+
+ -- Utility programs
+
+ PROCEDURE trc;
+
+ PROCEDURE notrc;
+
+ FUNCTION tracing
+ RETURN BOOLEAN;
+
+ FUNCTION version
+ RETURN VARCHAR2;
+
+ FUNCTION seqval (tab_in IN VARCHAR2)
+ RETURN PLS_INTEGER;
+
+ -- Constructs name of package and program based on factors
+ -- such as same package or test package, prefix, etc.
+ FUNCTION pkgname (
+ package_in IN VARCHAR2,
+ samepackage_in IN BOOLEAN,
+ prefix_in IN VARCHAR2,
+ ispkg_in IN BOOLEAN,
+ owner_in IN VARCHAR2 := NULL
+ )
+ RETURN VARCHAR2;
+
+ FUNCTION progname (
+ program_in IN VARCHAR2,
+ samepackage_in IN BOOLEAN,
+ prefix_in IN VARCHAR2,
+ ispkg_in IN BOOLEAN
+ )
+ RETURN VARCHAR2;
+
+ FUNCTION pkgname (
+ package_in IN VARCHAR2,
+ samepackage_in IN BOOLEAN,
+ prefix_in IN VARCHAR2,
+ owner_in IN VARCHAR2 := NULL
+ )
+ RETURN VARCHAR2;
+
+ FUNCTION progname (
+ program_in IN VARCHAR2,
+ samepackage_in IN BOOLEAN,
+ prefix_in IN VARCHAR2
+ )
+ RETURN VARCHAR2;
+
+ FUNCTION ifelse (bool_in IN BOOLEAN, tval_in IN BOOLEAN, fval_in IN BOOLEAN)
+ RETURN BOOLEAN;
+
+ FUNCTION ifelse (bool_in IN BOOLEAN, tval_in IN DATE, fval_in IN DATE)
+ RETURN DATE;
+
+ FUNCTION ifelse (bool_in IN BOOLEAN, tval_in IN NUMBER, fval_in IN NUMBER)
+ RETURN NUMBER;
+
+ FUNCTION ifelse (
+ bool_in IN BOOLEAN,
+ tval_in IN VARCHAR2,
+ fval_in IN VARCHAR2
+ )
+ RETURN VARCHAR2;
+END;
+/
+
diff --git a/source/ut_plsql2.pkb b/source/ut_plsql2.pkb
new file mode 100644
index 000000000..b894bd1e6
--- /dev/null
+++ b/source/ut_plsql2.pkb
@@ -0,0 +1,478 @@
+/* Formatted on 2001/10/15 08:45 (Formatter Plus v4.5.2) */
+CREATE OR REPLACE PACKAGE BODY utplsql2
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.5 2004/11/23 14:56:48 chrisrimmer
+Moved dbms_pipe code into its own package. Also changed some preprocessor flags
+
+Revision 1.4 2004/11/16 09:46:49 chrisrimmer
+Changed to new version detection system.
+
+Revision 1.3 2004/07/14 17:01:57 chrisrimmer
+Added first version of pluggable reporter packages
+
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ g_trc BOOLEAN := FALSE;
+ g_current current_test_rt;
+
+ -- Global state information
+ FUNCTION runnum
+ RETURN utr_outcome.run_id%TYPE
+ IS
+ BEGIN
+ RETURN g_current.run_id;
+ END;
+
+
+ -- 2.0.9.1: tc_run_id logic
+ PROCEDURE set_runnum
+ IS
+ BEGIN
+ SELECT utplsql_runnum_seq.NEXTVAL
+ INTO g_current.run_id
+ FROM DUAL;
+ g_current.tc_run_id := 1;
+ END;
+
+ FUNCTION tc_runnum
+ RETURN PLS_INTEGER
+ IS
+ BEGIN
+ RETURN g_current.tc_run_id;
+ END;
+
+ PROCEDURE move_ahead_tc_runnum
+ IS
+ BEGIN
+ g_current.tc_run_id := g_current.tc_run_id + 1;
+ END;
+
+ FUNCTION current_suite
+ RETURN ut_suite.id%TYPE
+ IS
+ BEGIN
+ RETURN g_current.suite_id;
+ END;
+
+ PROCEDURE set_current_suite (suite_in IN ut_suite.id%TYPE)
+ IS
+ BEGIN
+ g_current.suite_id := suite_in;
+ END;
+
+ FUNCTION current_utp
+ RETURN ut_utp.id%TYPE
+ IS
+ BEGIN
+ RETURN g_current.utp_id;
+ END;
+
+ PROCEDURE set_current_utp (utp_in IN ut_utp.id%TYPE)
+ IS
+ BEGIN
+ g_current.utp_id := utp_in;
+ END;
+
+ FUNCTION current_unittest
+ RETURN ut_unittest.id%TYPE
+ IS
+ BEGIN
+ RETURN g_current.unittest_id;
+ END;
+
+ PROCEDURE set_current_unittest (
+ unittest_in IN ut_unittest.id%TYPE
+ )
+ IS
+ BEGIN
+ g_current.unittest_id := unittest_in;
+ END;
+
+ FUNCTION current_testcase
+ RETURN ut_testcase.id%TYPE
+ IS
+ BEGIN
+ RETURN g_current.testcase_id;
+ END;
+
+ PROCEDURE set_current_testcase (
+ testcase_in IN ut_testcase.id%TYPE
+ )
+ IS
+ BEGIN
+ g_current.testcase_id := testcase_in;
+ END;
+
+ FUNCTION current_outcome
+ RETURN ut_outcome.id%TYPE
+ IS
+ BEGIN
+ RETURN g_current.outcome_id;
+ END;
+
+ PROCEDURE set_current_outcome (
+ outcome_in IN ut_outcome.id%TYPE
+ )
+ IS
+ BEGIN
+ g_current.outcome_id := outcome_in;
+ END;
+
+ PROCEDURE runprog (
+ procedure_in IN VARCHAR2,
+ utp_id_in IN ut_utp.id%TYPE := NULL,
+ unittest_id_in IN ut_unittest.id%TYPE := NULL,
+ propagate_in IN BOOLEAN := FALSE,
+ exceptions_in IN VARCHAR2 := NULL
+ )
+ IS
+ v_name VARCHAR2 (100) := procedure_in;
+ v_str VARCHAR2 (32767);
+ &start_lt_8_1
+ fdbk PLS_INTEGER;
+ cur PLS_INTEGER := DBMS_SQL.open_cursor;
+ &end_lt_8_1
+ BEGIN
+ IF tracing
+ THEN
+ utreport.pl ( 'Runprog of '
+ || procedure_in);
+ END IF;
+
+ v_str := 'BEGIN '
+ || procedure_in
+ || ';'
+ || utplsql.ifelse (
+ exceptions_in IS NULL,
+ NULL,
+ RTRIM (
+ 'EXCEPTION '
+ || exceptions_in,
+ ';'
+ )
+ || ';'
+ )
+ || ' END;';
+ &start_ge_8_1
+ EXECUTE IMMEDIATE v_str;
+ &start_ge_8_1
+ &start_lt_8_1
+ DBMS_SQL.parse (cur, v_str, DBMS_SQL.native);
+ fdbk := DBMS_SQL.EXECUTE (cur);
+ DBMS_SQL.close_cursor (cur);
+ &end_lt_8_1
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ &start_lt_8_1
+ DBMS_SQL.close_cursor (cur);
+
+ &end_lt_8_1
+
+ IF tracing
+ THEN
+ utreport.pl (
+ 'Procedure execution Error "'
+ || SQLERRM
+ || '" on: '
+ );
+ utreport.pl (v_str);
+ END IF;
+
+ IF unittest_id_in IS NOT NULL
+ THEN
+ utrerror.ut_report (
+ utplsql2.runnum,
+ unittest_id_in,
+ utrerror.cannot_run_program,
+ 'Procedure named "'
+ || procedure_in
+ || '" could not be executed.',
+ SQLERRM
+ );
+ ELSE
+ utrerror.utp_report (
+ utplsql2.runnum,
+ utp_id_in,
+ utrerror.cannot_run_program,
+ 'Procedure named "'
+ || procedure_in
+ || '" could not be executed.',
+ SQLERRM
+ );
+ END IF;
+ /*
+ utassert.this (
+ 'Unable to run '
+ || procedure_in
+ || ': '
+ || SQLERRM,
+ FALSE,
+ null_ok_in=> NULL,
+ raise_exc_in=> propagate_in,
+ register_in=> TRUE
+ );
+ */
+ END;
+
+ PROCEDURE run_utp_setup (utp_in IN ut_utp%ROWTYPE,
+ package_level_in in boolean := TRUE)
+ IS
+ l_program VARCHAR2 (100)
+ := ututp.setup_procedure (utp_in);
+ -- V1 uttestprep.setup_program (utp_in)
+ BEGIN
+ IF l_program IS NOT NULL and
+ (package_level_in OR utp_in.per_method_setup = utplsql.c_yes)
+ THEN
+ runprog (
+ l_program,
+ utp_in.id,
+ exceptions_in=> utp_in.EXCEPTIONS
+ );
+ END IF;
+ END;
+
+ PROCEDURE run_utp_teardown (utp_in IN ut_utp%ROWTYPE,
+ package_level_in in boolean := TRUE)
+ IS
+ l_program VARCHAR2 (100)
+ := ututp.teardown_procedure (utp_in);
+ -- V1 uttestprep.teardown_program (utp_in);
+ BEGIN
+ IF l_program IS NOT NULL and
+ (package_level_in OR utp_in.per_method_setup = utplsql.c_yes)
+ THEN
+ runprog (
+ l_program,
+ utp_in.id,
+ exceptions_in=> utp_in.EXCEPTIONS
+ );
+ END IF;
+ END;
+
+ PROCEDURE run_unittest (
+ utp_in IN ut_utp%ROWTYPE,
+ ut_in IN ut_unittest%ROWTYPE
+ )
+ IS
+ BEGIN
+ utrunittest.initiate (utplsql2.runnum, ut_in.id);
+
+ -- 2.0.8.1: Add support for unit test level setup/teardown
+
+ run_utp_setup (utp_in, package_level_in => FALSE);
+
+ runprog (
+ utunittest.full_name (utp_in, ut_in),
+ utp_in.id,
+ ut_in.id,
+ exceptions_in=> utp_in.EXCEPTIONS
+ );
+
+ run_utp_teardown (utp_in, package_level_in => FALSE);
+
+ utrunittest.terminate (utplsql2.runnum, ut_in.id);
+ END;
+
+ PROCEDURE test (
+ utp_rec IN ut_utp%ROWTYPE,
+ show_results_in IN BOOLEAN := TRUE,
+ program_in IN VARCHAR2 := NULL,
+ naming_mode_in IN VARCHAR2 := v2_naming_mode
+ )
+ IS
+ CURSOR unit_tests_cur (id_in IN ut_utp.id%TYPE)
+ IS
+ SELECT *
+ FROM ut_unittest
+ WHERE utp_id = id_in
+ AND status = utplsql.c_enabled
+ ORDER BY seq;
+
+ PROCEDURE cleanup (utp_in IN ut_utp%ROWTYPE)
+ IS
+ BEGIN
+ IF utp_in.id IS NOT NULL
+ THEN
+ run_utp_teardown (utp_in);
+ utrutp.terminate (utplsql2.runnum, utp_in.id);
+ END IF;
+
+ IF show_results_in
+ THEN
+ utresult.show (utplsql2.runnum);
+ END IF;
+
+ COMMIT;
+ END;
+ BEGIN
+ IF utp_rec.id IS NULL
+ THEN
+ utrerror.utp_report (
+ utplsql2.runnum,
+ NULL,
+ utrerror.no_utp_for_program,
+ 'Program named "'
+ || program_in
+ || '" does not have a UTP defined for it.'
+ );
+ ELSE
+ utrutp.initiate (utplsql2.runnum, utp_rec.id);
+ run_utp_setup (utp_rec);
+
+ -- Get the information on this program from the ut_utp table.
+ FOR ut_rec IN unit_tests_cur (utp_rec.id)
+ LOOP
+ IF tracing
+ THEN
+ utreport.pl (
+ 'Unit testing: '
+ || ut_rec.program_name
+ );
+ END IF;
+
+ run_unittest (utp_rec, ut_rec);
+
+ END LOOP;
+ END IF;
+
+ cleanup (utp_rec);
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ utrerror.utp_report (
+ utplsql2.runnum,
+ utp_rec.id,
+ SQLCODE,
+ SQLERRM,
+ raiseexc=> FALSE
+ );
+ cleanup (utp_rec);
+ END;
+
+ PROCEDURE test (
+ program_in IN VARCHAR2,
+ owner_in IN VARCHAR2 := NULL,
+ show_results_in IN BOOLEAN := TRUE,
+ naming_mode_in IN VARCHAR2 := v2_naming_mode
+ )
+ IS
+ utp_rec ut_utp%ROWTYPE;
+ BEGIN
+ set_runnum;
+ utp_rec := ututp.onerow (owner_in, program_in);
+ test (
+ utp_rec,
+ show_results_in,
+ program_in,
+ naming_mode_in
+ );
+ END;
+
+ PROCEDURE testsuite (
+ suite_in IN VARCHAR2,
+ show_results_in IN BOOLEAN := TRUE,
+ naming_mode_in IN VARCHAR2 := v2_naming_mode
+ )
+ IS
+ v_suite ut_suite.id%TYPE;
+ v_success BOOLEAN := TRUE;
+ v_suite_start DATE := SYSDATE;
+ v_pkg_start DATE;
+ suite_rec ut_suite%ROWTYPE;
+
+ CURSOR utps_cur (suite_in IN ut_suite.id%TYPE)
+ IS
+ SELECT ut_utp.*
+ FROM ut_utp, ut_suite_utp
+ WHERE suite_id = suite_in
+ AND ut_utp.id = ut_suite_utp.utp_id;
+ BEGIN
+ set_runnum;
+ suite_rec := utsuite.onerow (suite_in);
+
+ IF suite_rec.id IS NULL
+ THEN
+ utrerror.suite_report (
+ utplsql2.runnum,
+ NULL,
+ utrerror.undefined_suite,
+ 'Suite named "'
+ || suite_in
+ || '" is not defined.'
+ );
+ ELSE
+ utrsuite.initiate (utplsql2.runnum, suite_rec.id);
+
+ -- Get the information on this program from the ut_utp table.
+ FOR utp_rec IN utps_cur (suite_rec.id)
+ LOOP
+ test (
+ utp_rec,
+ show_results_in=> show_results_in,
+ naming_mode_in=> naming_mode_in
+ );
+ END LOOP;
+
+ utrsuite.terminate (utplsql2.runnum, suite_rec.id);
+ END IF;
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ utrerror.suite_report (
+ utplsql2.runnum,
+ suite_rec.id,
+ SQLCODE,
+ SQLERRM,
+ raiseexc=> FALSE
+ );
+ END;
+
+ PROCEDURE trc
+ IS
+ BEGIN
+ g_trc := TRUE;
+ END;
+
+ PROCEDURE notrc
+ IS
+ BEGIN
+ g_trc := FALSE;
+ END;
+
+ FUNCTION tracing
+ RETURN BOOLEAN
+ IS
+ BEGIN
+ RETURN g_trc;
+ END;
+END utplsql2;
+/
+
diff --git a/source/ut_plsql2.pks b/source/ut_plsql2.pks
new file mode 100644
index 000000000..3d7d11ab8
--- /dev/null
+++ b/source/ut_plsql2.pks
@@ -0,0 +1,105 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE utplsql2 &start_ge_8_1 AUTHID CURRENT_USER &end_ge_8_1
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+V2_naming_mode constant char(2) := 'V1';
+V1_naming_mode constant char(2) := 'V2';
+
+ -- Define and access "current test state" information
+
+ TYPE current_test_rt IS RECORD (
+ run_id utr_outcome.run_id%TYPE,
+ tc_run_id PLS_INTEGER, -- 2.0.9.1
+ suite_id ut_suite.id%TYPE,
+ utp_id ut_utp.id%TYPE,
+ unittest_id ut_unittest.id%TYPE,
+ testcase_id ut_testcase.id%TYPE,
+ outcome_id ut_outcome.id%TYPE);
+
+ FUNCTION runnum
+ RETURN utr_outcome.run_id%TYPE;
+ --2.0.9.2
+ PRAGMA RESTRICT_REFERENCES (runnum, WNDS);
+
+ PROCEDURE set_runnum;
+
+ FUNCTION tc_runnum
+ RETURN PLS_INTEGER;
+
+ PROCEDURE move_ahead_tc_runnum;
+
+ FUNCTION current_suite
+ RETURN ut_suite.id%TYPE;
+
+ PROCEDURE set_current_suite (suite_in IN ut_suite.id%TYPE);
+
+ FUNCTION current_utp
+ RETURN ut_utp.id%TYPE;
+
+ PROCEDURE set_current_utp (utp_in IN ut_utp.id%TYPE);
+
+ FUNCTION current_unittest
+ RETURN ut_unittest.id%TYPE;
+
+ PROCEDURE set_current_unittest (unittest_in IN ut_unittest.id%TYPE);
+
+ FUNCTION current_testcase
+ RETURN ut_testcase.id%TYPE;
+
+ PROCEDURE set_current_testcase (testcase_in IN ut_testcase.id%TYPE);
+
+ FUNCTION current_outcome
+ RETURN ut_outcome.id%TYPE;
+
+ PROCEDURE set_current_outcome (outcome_in IN ut_outcome.id%TYPE);
+
+ PROCEDURE test (
+ program_in IN VARCHAR2,
+ owner_in IN VARCHAR2 := NULL,
+ show_results_in IN BOOLEAN := TRUE,
+ naming_mode_in IN VARCHAR2 := V2_naming_mode
+ );
+
+ PROCEDURE testsuite (
+ suite_in IN VARCHAR2,
+ show_results_in IN BOOLEAN := TRUE,
+ naming_mode_in IN VARCHAR2 := V2_naming_mode
+ );
+
+ -- Utility programs
+
+ PROCEDURE trc;
+
+ PROCEDURE notrc;
+
+ FUNCTION tracing
+ RETURN BOOLEAN;
+END utplsql2;
+/
diff --git a/source/ut_plsql_runnum_seq.seq b/source/ut_plsql_runnum_seq.seq
new file mode 100644
index 000000000..5dd2cf485
--- /dev/null
+++ b/source/ut_plsql_runnum_seq.seq
@@ -0,0 +1 @@
+CREATE sequence utplsql_runnum_seq INCREMENT BY 1 START WITH 1 ORDER NOCACHE;
diff --git a/source/ut_plsql_util.pkb b/source/ut_plsql_util.pkb
new file mode 100644
index 000000000..dd6d95186
--- /dev/null
+++ b/source/ut_plsql_util.pkb
@@ -0,0 +1,1624 @@
+CREATE OR REPLACE PACKAGE BODY utplsql_util
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.4 2004/11/16 09:46:49 chrisrimmer
+Changed to new version detection system.
+
+Revision 1.3 2003/11/21 16:28:44 chrisrimmer
+Fixed the commented out preprocessor flags, pointed out by Frank Puechl
+in bug 846639
+
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+AS
+ ver_no VARCHAR2 (10) := '1.0.0';
+
+ TYPE param_rec IS RECORD (
+ col_name VARCHAR2 (50),
+ col_type PLS_INTEGER,
+ col_len PLS_INTEGER,
+ col_mode PLS_INTEGER
+ );
+
+ TYPE params_tab IS TABLE OF param_rec
+ INDEX BY BINARY_INTEGER;
+
+ par_in PLS_INTEGER := 1;
+ par_inout PLS_INTEGER := 2;
+ par_out PLS_INTEGER := 3;
+ param_prefix VARCHAR2 (10) := 'ut_';
+
+ FUNCTION get_version
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ RETURN (ver_no);
+ END;
+
+ FUNCTION get_par_alias (par_type VARCHAR)
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ IF (par_type = 'VARCHAR')
+ THEN
+ RETURN ('vchar');
+ ELSIF (par_type = 'NUMBER')
+ THEN
+ RETURN ('num');
+ ELSIF (par_type = 'DATE')
+ THEN
+ RETURN ('date');
+ ELSIF (par_type = 'REF CURSOR')
+ THEN
+ RETURN ('refc');
+ ELSIF (par_type = 'CHAR')
+ THEN
+ RETURN ('chr');
+ ELSE
+ RETURN ('oth');
+ END IF;
+ END;
+
+ PROCEDURE add_params (
+ params IN OUT utplsql_params,
+ par_pos PLS_INTEGER,
+ par_type VARCHAR2,
+ par_sql_type VARCHAR2,
+ par_inout PLS_INTEGER,
+ par_val VARCHAR2
+ )
+ IS
+ idx PLS_INTEGER;
+ BEGIN
+ idx := params.COUNT + 1;
+ params (idx).par_name := param_prefix
+ || get_par_alias (par_type)
+ || '_'
+ || TO_CHAR (par_pos);
+ params (idx).par_pos := par_pos;
+ params (idx).par_type := par_type;
+ params (idx).par_sql_type := par_sql_type;
+ params (idx).par_inout := par_inout;
+ params (idx).par_val := par_val;
+ END;
+
+ PROCEDURE reg_in_param (
+ par_pos PLS_INTEGER,
+ par_val VARCHAR2,
+ params IN OUT utplsql_params
+ )
+ IS
+ BEGIN
+ add_params (params, par_pos, 'VARCHAR2', 'VARCHAR2', par_in, par_val);
+ END;
+
+ PROCEDURE reg_in_param (
+ par_pos PLS_INTEGER,
+ par_val NUMBER,
+ params IN OUT utplsql_params
+ )
+ IS
+ BEGIN
+ add_params (
+ params,
+ par_pos,
+ 'NUMBER',
+ 'NUMBER',
+ par_in,
+ TO_CHAR (par_val)
+ );
+ END;
+
+ PROCEDURE reg_in_array (
+ par_pos IN PLS_INTEGER,
+ array_name IN VARCHAR2,
+ array_vals IN varchar_array,
+ params IN OUT utplsql_params
+ )
+ IS
+ idx PLS_INTEGER;
+ BEGIN
+ add_params (params, par_pos, 'ARRAY', array_name, par_in, NULL);
+ idx := array_holder.COUNT + 1;
+
+ FOR i IN 1 .. array_vals.COUNT
+ LOOP
+ array_holder (idx).array_pos := par_pos;
+ array_holder (idx).array_val := array_vals (i);
+ idx := idx + 1;
+ END LOOP;
+ END;
+
+ PROCEDURE reg_in_param (
+ par_pos PLS_INTEGER,
+ par_val DATE,
+ params IN OUT utplsql_params
+ )
+ IS
+ BEGIN
+ add_params (
+ params,
+ par_pos,
+ 'DATE',
+ 'DATE',
+ par_in,
+ TO_CHAR (par_val, 'DD-MON-YYYY:HH24:MI:SS')
+ );
+ END;
+
+ PROCEDURE reg_inout_param (
+ par_pos PLS_INTEGER,
+ par_val VARCHAR2,
+ params IN OUT utplsql_params
+ )
+ IS
+ BEGIN
+ add_params (params, par_pos, 'VARCHAR2', 'VARCHAR2', par_inout, par_val);
+ END;
+
+ PROCEDURE reg_inout_param (
+ par_pos PLS_INTEGER,
+ par_val NUMBER,
+ params IN OUT utplsql_params
+ )
+ IS
+ BEGIN
+ add_params (
+ params,
+ par_pos,
+ 'NUMBER',
+ 'NUMBER',
+ par_inout,
+ TO_CHAR (par_val)
+ );
+ END;
+
+ PROCEDURE reg_inout_param (
+ par_pos PLS_INTEGER,
+ par_val DATE,
+ params IN OUT utplsql_params
+ )
+ IS
+ BEGIN
+ add_params (
+ params,
+ par_pos,
+ 'DATE',
+ 'DATE',
+ par_inout,
+ TO_CHAR (par_val, 'DD-MON-YYYY:HH24:MI:SS')
+ );
+ END;
+
+ PROCEDURE reg_out_param (
+ par_pos PLS_INTEGER,
+ par_type VARCHAR2,
+ params IN OUT utplsql_params
+ )
+ IS
+ int_par_type VARCHAR2 (10);
+ BEGIN
+ IF (par_type = 'NUMBER')
+ THEN
+ int_par_type := 'NUMBER';
+ ELSIF (par_type = 'VARCHAR')
+ THEN
+ int_par_type := 'VARCHAR2';
+ ELSIF (par_type = 'CHAR')
+ THEN
+ int_par_type := 'VARCHAR2';
+ ELSIF (par_type = 'REFCURSOR')
+ THEN
+ int_par_type := 'REFC';
+ ELSE
+ int_par_type := par_type;
+ END IF;
+
+ add_params (params, par_pos, int_par_type, int_par_type, par_out, NULL);
+ END;
+
+ FUNCTION strtoken (s_str IN OUT VARCHAR2, token VARCHAR2)
+ RETURN VARCHAR2
+ IS
+ pos PLS_INTEGER;
+ tmpstr VARCHAR2 (4000);
+ BEGIN
+ pos := NVL (INSTR (s_str, token), 0);
+
+ IF (pos = 0)
+ THEN
+ pos := LENGTH (s_str);
+ END IF;
+
+ tmpstr := SUBSTR (s_str, 1, pos);
+ s_str := SUBSTR (s_str, pos);
+ RETURN (tmpstr);
+ END;
+
+ PROCEDURE get_table_for_str (
+ p_arr OUT v30_table,
+ p_string VARCHAR2,
+ delim VARCHAR2 := ',',
+ enclose_str VARCHAR2 DEFAULT NULL
+ )
+ IS
+ pos INTEGER := 1;
+ v_idx INTEGER := 1;
+ tmp_str VARCHAR2 (4000);
+ BEGIN
+ IF p_string IS NULL
+ THEN
+ RETURN;
+ END IF;
+
+ tmp_str := p_string;
+
+ LOOP
+ EXIT WHEN (pos = 0);
+ pos := INSTR (tmp_str, delim);
+
+ IF (pos = 0)
+ THEN
+ p_arr (v_idx) := enclose_str || tmp_str || enclose_str;
+ ELSE
+ p_arr (v_idx) := enclose_str
+ || SUBSTR (tmp_str, 1, pos - 1)
+ || enclose_str;
+ v_idx := v_idx + 1;
+ tmp_str := SUBSTR (tmp_str, pos + 1);
+ END IF;
+ END LOOP;
+ END;
+
+ FUNCTION describe_proc (vproc_name VARCHAR2, params OUT params_tab)
+ RETURN VARCHAR2
+ IS
+ outstr VARCHAR2 (3000) := NULL;
+ seperator VARCHAR2 (10) := NULL;
+ v_overload DBMS_DESCRIBE.number_table;
+ v_position DBMS_DESCRIBE.number_table;
+ v_level DBMS_DESCRIBE.number_table;
+ v_argumentname DBMS_DESCRIBE.varchar2_table;
+ v_datatype DBMS_DESCRIBE.number_table;
+ v_defaultvalue DBMS_DESCRIBE.number_table;
+ v_inout DBMS_DESCRIBE.number_table;
+ v_length DBMS_DESCRIBE.number_table;
+ v_precision DBMS_DESCRIBE.number_table;
+ v_scale DBMS_DESCRIBE.number_table;
+ v_radix DBMS_DESCRIBE.number_table;
+ v_spare DBMS_DESCRIBE.number_table;
+ v_argcounter PLS_INTEGER := 1;
+ curr_level PLS_INTEGER := 1;
+ prev_level PLS_INTEGER := 1;
+ tab_open BOOLEAN := FALSE ;
+ rec_open BOOLEAN := FALSE ;
+ pos PLS_INTEGER;
+
+ PROCEDURE add_param (str VARCHAR2)
+ IS
+ vtable v30_table;
+ BEGIN
+ get_table_for_str (vtable, str, ':');
+
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line (
+ 'Parsed='
+ || vtable (1)
+ || ','
+ || vtable (2)
+ || ','
+ || vtable (3)
+ || ','
+ || vtable (4)
+ );
+ END IF;
+
+ params (pos).col_name := vtable (1);
+ params (pos).col_type := vtable (2);
+ params (pos).col_len := vtable (3);
+ params (pos).col_mode := vtable (4);
+ pos := pos + 1;
+ END;
+ BEGIN
+ DBMS_DESCRIBE.describe_procedure (
+ vproc_name,
+ NULL,
+ NULL,
+ v_overload,
+ v_position,
+ v_level,
+ v_argumentname,
+ v_datatype,
+ v_defaultvalue,
+ v_inout,
+ v_length,
+ v_precision,
+ v_scale,
+ v_radix,
+ v_spare
+ );
+ v_argcounter := 1;
+
+ IF (v_position (1) = 0)
+ THEN
+ outstr := 'FUNCTION';
+ ELSE
+ outstr := 'PROCEDURE';
+ END IF;
+
+ pos := 1;
+
+ LOOP
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line (
+ 'Desc()='
+ || v_argumentname (v_argcounter)
+ || ','
+ || TO_CHAR (v_datatype (v_argcounter))
+ );
+ END IF;
+
+ curr_level := v_level (v_argcounter);
+
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line (
+ 'Currlevel='
+ || TO_CHAR (curr_level)
+ || ',Prevlevel='
+ || TO_CHAR (prev_level)
+ );
+ END IF;
+
+ IF (curr_level <= prev_level)
+ THEN
+ IF (rec_open)
+ THEN
+ add_param ('RECORDEND:0:0:0');
+ rec_open := FALSE ;
+ ELSIF (tab_open)
+ THEN
+ add_param ('TABLEEND:0:0:0');
+ tab_open := FALSE ;
+ END IF;
+ END IF;
+
+ IF (v_datatype (v_argcounter) = 250)
+ THEN /* Record */
+ rec_open := TRUE ;
+ add_param (
+ 'RECORDBEGIN:'
+ || TO_CHAR (v_datatype (v_argcounter))
+ || ':'
+ || TO_CHAR (v_length (v_argcounter))
+ || ':'
+ || TO_CHAR (v_inout (v_argcounter))
+ );
+ seperator := ',';
+ ELSIF (v_datatype (v_argcounter) = 251)
+ THEN /* PLSQL Table */
+ tab_open := TRUE ;
+ add_param (
+ 'TABLEOPEN:'
+ || TO_CHAR (v_datatype (v_argcounter))
+ || ':'
+ || TO_CHAR (v_length (v_argcounter))
+ || ':'
+ || TO_CHAR (v_inout (v_argcounter))
+ );
+ ELSIF (v_datatype (v_argcounter) = 102)
+ THEN /* REF CURSOR */
+ add_param (
+ 'CURSOR:'
+ || TO_CHAR (v_datatype (v_argcounter))
+ || ':'
+ || TO_CHAR (v_length (v_argcounter))
+ || ':'
+ || TO_CHAR (v_inout (v_argcounter))
+ );
+ ELSE
+ add_param (
+ NVL (v_argumentname (v_argcounter), 'UNKNOWN')
+ || ':'
+ || TO_CHAR (v_datatype (v_argcounter))
+ || ':'
+ || TO_CHAR (v_length (v_argcounter))
+ || ':'
+ || TO_CHAR (v_inout (v_argcounter))
+ );
+ END IF;
+
+ v_argcounter := v_argcounter + 1;
+ seperator := ',';
+ END LOOP;
+
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('Done DBMS_DESCRIBE');
+ END IF;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ IF (rec_open)
+ THEN
+ add_param ('RECORDEND:0:0:0');
+ rec_open := FALSE ;
+ ELSIF (tab_open)
+ THEN
+ add_param ('TABLEEND:0:0:0');
+ tab_open := FALSE ;
+ END IF;
+
+ RETURN (outstr);
+ WHEN OTHERS
+ THEN
+ RAISE;
+ END;
+
+ PROCEDURE print_metadata (metadata sqldata_tab)
+ IS
+ BEGIN
+ FOR i IN 1 .. NVL (metadata.COUNT, 0)
+ LOOP
+ DBMS_OUTPUT.put_line (
+ 'Name='
+ || metadata (i).col_name
+ || ',Type='
+ || TO_CHAR (metadata (i).col_type)
+ || ',Len='
+ || TO_CHAR (metadata (i).col_len)
+ );
+ END LOOP;
+ END;
+
+ PROCEDURE get_metadata_for_cursor (
+ proc_name VARCHAR2,
+ metadata OUT sqldata_tab
+ )
+ IS
+ params params_tab;
+ proc_type VARCHAR2 (10);
+ idx PLS_INTEGER := 1;
+ pos PLS_INTEGER := 1;
+ BEGIN
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('Start Describe Proc');
+ END IF;
+
+ proc_type := describe_proc (proc_name, params);
+
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('End Describe Proc');
+ END IF;
+
+ --print_metadata(params);
+ LOOP
+ EXIT WHEN (params (pos).col_name = 'CURSOR');
+ pos := pos + 1;
+ END LOOP;
+
+ pos := pos + 2;
+
+ LOOP
+ EXIT WHEN (params (pos).col_name = 'RECORDEND');
+ metadata (idx).col_name := params (pos).col_name;
+ metadata (idx).col_type := params (pos).col_type;
+ metadata (idx).col_len := params (pos).col_len;
+ idx := idx + 1;
+ pos := pos + 1;
+ END LOOP;
+ END;
+
+ PROCEDURE get_metadata_for_query (
+ query_txt VARCHAR2,
+ metadata OUT sqldata_tab
+ )
+ IS
+ cols DBMS_SQL.desc_tab;
+ ncols PLS_INTEGER;
+ cur INTEGER := DBMS_SQL.open_cursor;
+ BEGIN
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('Query=' || query_txt);
+ END IF;
+
+ DBMS_SQL.parse (cur, query_txt, DBMS_SQL.native);
+ DBMS_SQL.describe_columns (cur, ncols, cols);
+
+ FOR i IN 1 .. cols.COUNT
+ LOOP
+ metadata (i).col_name := cols (i).col_name;
+ metadata (i).col_type := cols (i).col_type;
+ metadata (i).col_len := cols (i).col_max_len;
+ END LOOP;
+
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('Done get_metadata_for_query');
+ END IF;
+ END;
+
+ PROCEDURE get_metadata_for_table (
+ table_name VARCHAR2,
+ metadata OUT sqldata_tab
+ )
+ IS
+ BEGIN
+ get_metadata_for_query ('select * from ' || table_name, metadata);
+ END;
+
+ PROCEDURE get_metadata_for_proc (
+ proc_name VARCHAR2,
+ POSITION INTEGER,
+ data_type OUT VARCHAR2,
+ metadata OUT sqldata_tab
+ )
+ IS
+ outstr VARCHAR2 (3000) := NULL;
+ seperator VARCHAR2 (10) := NULL;
+ v_overload DBMS_DESCRIBE.number_table;
+ v_position DBMS_DESCRIBE.number_table;
+ v_level DBMS_DESCRIBE.number_table;
+ v_argumentname DBMS_DESCRIBE.varchar2_table;
+ v_datatype DBMS_DESCRIBE.number_table;
+ v_defaultvalue DBMS_DESCRIBE.number_table;
+ v_inout DBMS_DESCRIBE.number_table;
+ v_length DBMS_DESCRIBE.number_table;
+ v_precision DBMS_DESCRIBE.number_table;
+ v_scale DBMS_DESCRIBE.number_table;
+ v_radix DBMS_DESCRIBE.number_table;
+ v_spare DBMS_DESCRIBE.number_table;
+ v_argcounter PLS_INTEGER := 1;
+ curr_level PLS_INTEGER := 1;
+ prev_level PLS_INTEGER := 1;
+ tab_open BOOLEAN := FALSE ;
+ rec_open BOOLEAN := FALSE ;
+ pos PLS_INTEGER;
+ idx PLS_INTEGER := 1;
+ recs_copied PLS_INTEGER;
+
+ FUNCTION get_datatype (l_type INTEGER)
+ RETURN VARCHAR2
+ IS
+ r_type VARCHAR2 (20);
+ BEGIN
+ -- Need to add more data types
+ SELECT DECODE (
+ l_type,
+ 1, 'VARCHAR2',
+ 2, 'NUMBER',
+ 12, 'DATE',
+ 96, 'CHAR',
+ 102, 'REF CURSOR',
+ 250, 'RECORD',
+ 251, 'PLSQL TABLE',
+ 'UNKNOWN'
+ )
+ INTO r_type
+ FROM DUAL;
+
+ RETURN (r_type);
+ END;
+
+ PROCEDURE copy_metadata (l_idx INTEGER)
+ IS
+ m_idx INTEGER;
+ BEGIN
+ m_idx := metadata.COUNT + 1;
+ metadata (m_idx).col_name := v_argumentname (l_idx);
+ metadata (m_idx).col_type := v_datatype (l_idx);
+ metadata (m_idx).col_len := v_length (l_idx);
+ END;
+
+ FUNCTION copy_level (l_idx INTEGER)
+ RETURN INTEGER
+ IS
+ l_counter PLS_INTEGER := 1;
+ l_level PLS_INTEGER;
+ BEGIN
+ l_level := v_level (l_idx);
+ l_counter := l_idx;
+
+ LOOP
+ EXIT WHEN ( (l_counter > v_argumentname.COUNT)
+ OR l_level <> v_level (l_counter)
+ );
+ copy_metadata (l_counter);
+ l_counter := l_counter + 1;
+ END LOOP;
+
+ RETURN (l_counter - l_idx);
+ END;
+ BEGIN
+ DBMS_DESCRIBE.describe_procedure (
+ proc_name,
+ NULL,
+ NULL,
+ v_overload,
+ v_position,
+ v_level,
+ v_argumentname,
+ v_datatype,
+ v_defaultvalue,
+ v_inout,
+ v_length,
+ v_precision,
+ v_scale,
+ v_radix,
+ v_spare
+ );
+
+ IF (v_position.COUNT = 0)
+ THEN
+ data_type := 'NOTFOUND';
+ RETURN;
+ END IF;
+
+ idx := 1;
+
+ LOOP
+ EXIT WHEN ( ((v_level (idx) = 0) AND (POSITION = v_position (idx)))
+ OR (idx = v_position.COUNT)
+ );
+ idx := idx + 1;
+ END LOOP;
+
+ IF (idx = v_position.COUNT)
+ THEN
+ IF (POSITION = v_position (idx))
+ THEN
+ data_type := get_datatype (v_datatype (idx));
+
+ IF (data_type <> 'REF CURSOR')
+ THEN -- Weak ref cursor
+ copy_metadata (idx);
+ END IF;
+ ELSE
+ data_type := 'NOTFOUND';
+ END IF;
+
+ RETURN;
+ END IF;
+
+ data_type := get_datatype (v_datatype (idx));
+
+ --dbms_output.put_line('data_type = '||data_type||','||'Pos='||TO_CHAR(idx));
+
+ IF (data_type = 'REF CURSOR')
+ THEN
+ IF (v_level (idx + 1) > v_level (idx))
+ THEN -- Strong ref cursor
+ idx := idx + 2;
+ recs_copied := copy_level (idx);
+ idx := idx + recs_copied;
+ END IF;
+ ELSIF (data_type = 'PLSQL TABLE')
+ THEN
+ IF (v_level (idx + 1) > v_level (idx))
+ THEN
+ IF (v_datatype (idx + 1) = 250)
+ THEN -- RECORD
+ idx := idx + 2; -- PLSQL TABLE OF RECORD (user defined)
+ ELSE
+ idx := idx + 1; -- PLSQL TABLE OF SINGLE COLUMN
+ END IF;
+
+ recs_copied := copy_level (idx);
+ idx := idx + recs_copied;
+ ELSE
+ copy_metadata (idx);
+ END IF;
+ ELSIF (data_type = 'RECORD')
+ THEN
+ IF (v_level (idx + 1) > v_level (idx))
+ THEN -- I think always true.
+ idx := idx + 1;
+ recs_copied := copy_level (idx);
+ idx := idx + recs_copied;
+ ELSE -- I guess it should never come here
+ copy_metadata (idx);
+ END IF;
+ ELSE
+ data_type := get_datatype (v_datatype (idx));
+ copy_metadata (idx);
+ END IF;
+ END;
+
+ PROCEDURE test_get_metadata_for_cursor (proc_name VARCHAR2)
+ IS
+ metadata sqldata_tab;
+ BEGIN
+ get_metadata_for_cursor (proc_name, metadata);
+
+ IF (utplsql.tracing)
+ THEN
+ print_metadata (metadata);
+ END IF;
+ END;
+
+ FUNCTION get_colnamesstr (metadata sqldata_tab)
+ RETURN VARCHAR2
+ IS
+ cnt PLS_INTEGER;
+ str VARCHAR2 (32000);
+ BEGIN
+ cnt := metadata.COUNT;
+
+ FOR i IN 1 .. cnt
+ LOOP
+ str := str || metadata (i).col_name || ',';
+ END LOOP;
+
+ RETURN (SUBSTR (str, 1, LENGTH (str) - 1));
+ END;
+
+ FUNCTION get_coltypesstr (metadata sqldata_tab)
+ RETURN VARCHAR2
+ IS
+ cnt PLS_INTEGER;
+ str VARCHAR2 (2000);
+ BEGIN
+ cnt := metadata.COUNT;
+
+ FOR i IN 1 .. cnt
+ LOOP
+ str := str || TO_CHAR (metadata (i).col_type) || ',';
+ END LOOP;
+
+ RETURN (SUBSTR (str, 1, LENGTH (str) - 1));
+ END;
+
+ FUNCTION get_coltype_syntax (col_type PLS_INTEGER, col_len PLS_INTEGER)
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ IF (col_type = 1)
+ THEN
+ RETURN ('VARCHAR2(' || TO_CHAR (col_len) || ')');
+ ELSIF (col_type = 2)
+ THEN
+ RETURN ('NUMBER');
+ ELSIF (col_type = 12)
+ THEN
+ RETURN ('DATE');
+ ELSIF (col_type = 96)
+ THEN
+ RETURN ('CHAR(' || TO_CHAR (col_len) || ')');
+ END IF;
+ END;
+
+ FUNCTION get_coltype_syntax (col_type VARCHAR2, col_len PLS_INTEGER)
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ IF (col_type = 'VARCHAR2')
+ THEN
+ RETURN ('VARCHAR2(' || TO_CHAR (col_len) || ')');
+ ELSIF (col_type = 'NUMBER')
+ THEN
+ RETURN ('NUMBER');
+ ELSIF (col_type = 'DATE')
+ THEN
+ RETURN ('DATE');
+ ELSIF (col_type = 'CHAR')
+ THEN
+ RETURN ('CHAR(' || TO_CHAR (col_len) || ')');
+ ELSIF (col_type = 'REFC')
+ THEN
+ RETURN ('REFC');
+ ELSE
+ RETURN (col_type);
+ END IF;
+ END;
+
+ PROCEDURE PRINT (str VARCHAR2)
+ IS
+ len PLS_INTEGER;
+ BEGIN
+ len := LENGTH (str);
+
+ FOR i IN 1 .. len
+ LOOP
+ DBMS_OUTPUT.put_line (SUBSTR (str, (i - 1) * 255, 255));
+ END LOOP;
+
+ IF ((len * 255) > LENGTH (str))
+ THEN
+ DBMS_OUTPUT.put_line (SUBSTR (str, len * 255));
+ END IF;
+ END;
+
+ FUNCTION get_proc_name (p_proc_nm VARCHAR2)
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ RETURN (SUBSTR (p_proc_nm, 1, INSTR (p_proc_nm, '(') - 1));
+ END;
+
+ FUNCTION get_val_for_table (
+ table_name VARCHAR2,
+ col_name VARCHAR2,
+ col_val OUT VARCHAR2,
+ col_type OUT NUMBER
+ )
+ RETURN NUMBER
+ IS
+ cur PLS_INTEGER := DBMS_SQL.open_cursor;
+ cols DBMS_SQL.desc_tab;
+ ncols PLS_INTEGER;
+ idx PLS_INTEGER := 0;
+ tvarchar VARCHAR2 (4000);
+ tchar CHAR (4000);
+ tdate DATE;
+ tnumber NUMBER;
+ stmt VARCHAR2 (200);
+ vresult PLS_INTEGER;
+ BEGIN
+ stmt := 'select * from ' || table_name;
+ DBMS_SQL.parse (cur, stmt, DBMS_SQL.native);
+ DBMS_SQL.describe_columns (cur, ncols, cols);
+
+ FOR i IN 1 .. cols.COUNT
+ LOOP
+ IF (cols (i).col_type = 1)
+ THEN
+ DBMS_SQL.define_column (cur, i, tvarchar, cols (i).col_max_len);
+ ELSIF (cols (i).col_type = 2)
+ THEN
+ DBMS_SQL.define_column (cur, i, tnumber);
+ ELSIF (cols (i).col_type = 12)
+ THEN
+ DBMS_SQL.define_column (cur, i, tdate);
+ ELSIF (cols (i).col_type = 96)
+ THEN
+ DBMS_SQL.define_column (cur, i, tchar, cols (i).col_max_len);
+ ELSE
+ raise_application_error (-20000, 'UNSUPPORTED COLUMN TYPE');
+ END IF;
+
+ IF (cols (i).col_name = col_name)
+ THEN
+ idx := i;
+ END IF;
+ END LOOP;
+
+ IF (idx = 0)
+ THEN
+ RETURN (-1);
+ END IF;
+
+ vresult := DBMS_SQL.EXECUTE (cur);
+
+ IF (DBMS_SQL.fetch_rows (cur) = 0)
+ THEN
+ RETURN (1);
+ END IF;
+
+ IF (cols (idx).col_type = 1)
+ THEN
+ DBMS_SQL.column_value (cur, idx, tvarchar);
+ col_val := tvarchar;
+ ELSIF (cols (idx).col_type = 2)
+ THEN
+ DBMS_SQL.column_value (cur, idx, tnumber);
+ col_val := TO_CHAR (tnumber);
+ ELSIF (cols (idx).col_type = 12)
+ THEN
+ DBMS_SQL.column_value (cur, idx, tdate);
+ col_val := TO_CHAR (tdate, 'DD-MON-YYYY:HH24:MI:SS');
+ ELSIF (cols (idx).col_type = 96)
+ THEN
+ DBMS_SQL.column_value (cur, idx, tchar);
+ col_val := tchar;
+ END IF;
+
+ col_type := cols (idx).col_type;
+ DBMS_SQL.close_cursor (cur);
+ RETURN (0);
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ RAISE;
+ END;
+
+ FUNCTION get_table_name
+ RETURN VARCHAR2
+ IS
+ tmp_seq NUMBER;
+ curr_user VARCHAR2 (20);
+ BEGIN
+ SELECT SYS_CONTEXT ('USERENV', 'CURRENT_USER')
+ INTO curr_user
+ FROM DUAL;
+
+ SELECT ut_refcursor_results_seq.NEXTVAL
+ INTO tmp_seq
+ FROM DUAL;
+
+ --RETURN('utplsql_temp_'||tmp_seq);
+ RETURN (curr_user || '.' || 'UTPLSQL_TEMP_' || tmp_seq);
+ END;
+
+ PROCEDURE execute_ddl (stmt VARCHAR2)
+ IS
+ &start_lt_8_1
+ fdbk PLS_INTEGER;
+ cur PLS_INTEGER := DBMS_SQL.open_cursor;
+ &end_lt_8_1
+ BEGIN
+ &start_ge_8_1
+ EXECUTE IMMEDIATE stmt;
+ &start_ge_8_1
+ &start_lt_8_1
+ DBMS_SQL.parse (cur, stmt, DBMS_SQL.native);
+ fdbk := DBMS_SQL.EXECUTE (cur);
+ DBMS_SQL.close_cursor (cur);
+ &end_lt_8_1
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ RAISE;
+ END;
+
+ FUNCTION get_create_ddl (
+ metadata utplsql_util.sqldata_tab,
+ table_name VARCHAR2,
+ owner_name VARCHAR2 DEFAULT NULL
+ )
+ RETURN VARCHAR2
+ IS
+ ddl_stmt VARCHAR2 (5000);
+ cnt PLS_INTEGER;
+ BEGIN
+ IF (NVL (metadata.COUNT, 0) = 0)
+ THEN
+ RETURN (NULL);
+ END IF;
+
+ --ddl_stmt := 'create table '||NVL(owner_name,'UTPLSQL')||'.'||table_name||' ( ';
+ ddl_stmt := 'create table ' || table_name || ' ( ';
+
+ FOR i IN 1 .. metadata.COUNT
+ LOOP
+ ddl_stmt := ddl_stmt
+ || metadata (i).col_name
+ || ' '
+ || utplsql_util.get_coltype_syntax (
+ metadata (i).col_type,
+ metadata (i).col_len
+ )
+ || ',';
+ END LOOP;
+
+ ddl_stmt := SUBSTR (ddl_stmt, 1, LENGTH (ddl_stmt) - 1) || ')';
+
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('Current user = ' || USER);
+ utplsql_util.PRINT (ddl_stmt);
+ END IF;
+
+ RETURN (ddl_stmt);
+ END;
+
+ PROCEDURE prepare_cursor_1 (
+ stmt IN OUT VARCHAR2,
+ table_name VARCHAR2,
+ call_proc_name VARCHAR2,
+ metadata utplsql_util.sqldata_tab
+ )
+ IS
+ col_str VARCHAR2 (200);
+ BEGIN
+ IF (NVL (metadata.COUNT, 0) = 0)
+ THEN
+ RETURN;
+ END IF;
+
+ stmt :=
+ 'declare
+ p_result_id PLS_INTEGER;
+ p_rec_nm PLS_INTEGER := 0;
+ TYPE refc is ref cursor;
+ rc refc;';
+
+ FOR i IN 1 .. metadata.COUNT
+ LOOP
+ stmt := stmt
+ || metadata (i).col_name
+ || ' '
+ || utplsql_util.get_coltype_syntax (
+ metadata (i).col_type,
+ metadata (i).col_len
+ )
+ || ';'
+ || CHR (10);
+ END LOOP;
+
+ col_str := utplsql_util.get_colnamesstr (metadata);
+ stmt :=
+ stmt
+ || 'BEGIN
+ rc := '
+ || call_proc_name
+ || ';
+ LOOP
+ FETCH rc INTO '
+ || col_str
+ || ';
+ EXIT WHEN rc%NOTFOUND;
+ p_rec_nm := p_rec_nm + 1;
+ INSERT INTO '
+ || table_name
+ || ' ('
+ || col_str
+ || ')'
+ || ' values ('
+ || col_str
+ || ');'
+ || '
+ END LOOP;
+ CLOSE rc;
+ END;';
+
+ IF (utplsql.tracing)
+ THEN
+ utplsql_util.PRINT (stmt);
+ END IF;
+ END;
+
+ FUNCTION get_par_for_decl (params utplsql_params)
+ RETURN VARCHAR2
+ IS
+ decl VARCHAR2 (1000);
+ BEGIN
+ FOR i IN 1 .. params.COUNT
+ LOOP
+ decl := decl
+ || params (i).par_name
+ || ' '
+ || utplsql_util.get_coltype_syntax (
+ params (i).par_sql_type,
+ 1000
+ )
+ || ';'
+ || CHR (10);
+ END LOOP;
+
+ RETURN (decl);
+ END;
+
+ FUNCTION get_param_valstr (params utplsql_params, POSITION PLS_INTEGER)
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ IF (params (POSITION).par_type = 'DATE')
+ THEN
+ RETURN ( 'TO_DATE('''
+ || params (POSITION).par_val
+ || ''',''DD-MON-YYYY:HH24:MI:SS'')'
+ );
+ ELSE
+ RETURN ('''' || params (POSITION).par_val || '''');
+ END IF;
+ END;
+
+ FUNCTION get_param_valstr_from_array (
+ params utplsql_params,
+ POSITION PLS_INTEGER,
+ array_pos PLS_INTEGER
+ )
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ IF (params (POSITION).par_type = 'DATE')
+ THEN
+ RETURN ( 'TO_DATE('''
+ || array_holder (array_pos).array_val
+ || ''',''DD-MON-YYYY:HH24:MI:SS'')'
+ );
+ ELSE
+ RETURN ('''' || array_holder (array_pos).array_val || '''');
+ END IF;
+ END;
+
+ PROCEDURE print_utplsql_params (params utplsql_params)
+ IS
+ BEGIN
+ FOR i IN 1 .. params.COUNT
+ LOOP
+ DBMS_OUTPUT.put_line (
+ 'Name='
+ || params (i).par_name
+ || ',type='
+ || params (i).par_type
+ || ',mode='
+ || TO_CHAR (params (i).par_inout)
+ || ',pos='
+ || TO_CHAR (params (i).par_pos)
+ || ',val='
+ || params (i).par_val
+ );
+ END LOOP;
+ END;
+
+ PROCEDURE init_array_holder
+ IS
+ BEGIN
+ array_holder.DELETE;
+ END;
+
+ PROCEDURE print_array_holder
+ IS
+ BEGIN
+ DBMS_OUTPUT.put_line ('Printing array holder');
+
+ FOR i IN 1 .. array_holder.COUNT
+ LOOP
+ DBMS_OUTPUT.put_line ('pos=' || TO_CHAR (array_holder (i).array_pos));
+ PRINT ('Val=' || array_holder (i).array_val);
+ END LOOP;
+ END;
+
+ FUNCTION get_index_for_array (pos INTEGER)
+ RETURN INTEGER
+ IS
+ idx PLS_INTEGER := 1;
+ BEGIN
+ LOOP
+ EXIT WHEN (array_holder (idx).array_pos = pos);
+ idx := idx + 1;
+ END LOOP;
+
+ RETURN (idx);
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN (-1);
+ END;
+
+ FUNCTION get_par_for_assign (params utplsql_params)
+ RETURN VARCHAR2
+ IS
+ assign VARCHAR2 (1000);
+ array_idx PLS_INTEGER;
+ idx PLS_INTEGER := 1;
+ BEGIN
+ IF (utplsql.tracing)
+ THEN
+ print_array_holder;
+ END IF;
+
+ FOR i IN 1 .. params.COUNT
+ LOOP
+ IF (params (i).par_inout != par_out)
+ THEN
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line (
+ 'In get_par_for_assign<' || params (i).par_type || '>'
+ );
+ END IF;
+
+ IF (params (i).par_type != 'ARRAY')
+ THEN
+ assign := assign
+ || params (i).par_name
+ || ' := '
+ || get_param_valstr (params, i)
+ || ';'
+ || CHR (10);
+ ELSE
+ array_idx := get_index_for_array (params (i).par_pos);
+
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('start index =' || TO_CHAR (
+ array_idx
+ ));
+ END IF;
+
+ LOOP
+ BEGIN
+ EXIT WHEN array_holder (array_idx).array_pos !=
+ params (i).par_pos;
+ assign := assign
+ || params (i).par_name
+ || '('
+ || TO_CHAR (idx)
+ || ') := '
+ || get_param_valstr_from_array (
+ params,
+ i,
+ array_idx
+ )
+ || ';'
+ || CHR (10);
+ array_idx := array_idx + 1;
+ idx := idx + 1;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ EXIT;
+ END;
+ END LOOP;
+ END IF;
+ END IF;
+ END LOOP;
+
+ RETURN (assign);
+ END;
+
+ FUNCTION get_par_for_call (params utplsql_params, proc_name VARCHAR2)
+ RETURN VARCHAR2
+ IS
+ call_str VARCHAR2 (1000);
+ start_idx PLS_INTEGER;
+ BEGIN
+ IF (params (1).par_pos = 0)
+ THEN
+ call_str := params (1).par_name || ' := ' || proc_name || '(';
+ start_idx := 2;
+ ELSE
+ call_str := proc_name || '(';
+ start_idx := 1;
+ END IF;
+
+ FOR i IN start_idx .. params.COUNT
+ LOOP
+ IF (i != start_idx)
+ THEN
+ call_str := call_str || ',' || params (i).par_name;
+ ELSE
+ call_str := call_str || params (i).par_name;
+ END IF;
+ END LOOP;
+
+ call_str := call_str || ')';
+ RETURN (call_str);
+ END;
+
+ PROCEDURE get_single_param (
+ params utplsql_params,
+ POSITION PLS_INTEGER,
+ single_param IN OUT params_rec
+ )
+ IS
+ idx PLS_INTEGER;
+ BEGIN
+ IF (POSITION != 0)
+ THEN
+ IF (params (1).par_pos = 0)
+ THEN
+ idx := POSITION + 1;
+ ELSE
+ idx := POSITION;
+ END IF;
+ ELSE
+ idx := POSITION + 1;
+ END IF;
+
+ single_param.par_name := params (idx).par_name;
+ single_param.par_type := params (idx).par_type;
+ single_param.par_val := params (idx).par_val;
+ single_param.par_inout := params (idx).par_inout;
+ END;
+
+ PROCEDURE prepare_cursor_100 (
+ stmt IN OUT VARCHAR2,
+ table_name VARCHAR2,
+ call_proc_name VARCHAR2,
+ POSITION PLS_INTEGER,
+ metadata utplsql_util.sqldata_tab,
+ params utplsql_params
+ )
+ IS
+ col_str VARCHAR2 (32000);
+ single_param params_rec;
+ BEGIN
+ IF (NVL (metadata.COUNT, 0) = 0)
+ THEN
+ RETURN;
+ END IF;
+
+ stmt :=
+ 'declare
+ p_result_id PLS_INTEGER;
+ p_rec_nm PLS_INTEGER := 0;
+ TYPE refc is ref cursor;
+ rc refc;';
+
+ FOR i IN 1 .. metadata.COUNT
+ LOOP
+ stmt := stmt
+ || metadata (i).col_name
+ || ' '
+ || utplsql_util.get_coltype_syntax (
+ metadata (i).col_type,
+ metadata (i).col_len
+ )
+ || ';'
+ || CHR (10);
+ END LOOP;
+
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('Done ref cursor column declarations');
+ END IF;
+
+ stmt := stmt || get_par_for_decl (params);
+
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('Done params declarations');
+ END IF;
+
+ get_single_param (params, POSITION, single_param);
+
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('Done get_single_param');
+ END IF;
+
+ col_str := utplsql_util.get_colnamesstr (metadata);
+
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('Done get_colnamesstr');
+ END IF;
+
+ stmt :=
+ stmt
+ || 'BEGIN
+ '
+ || get_par_for_assign (params)
+ || '
+ '
+ || get_par_for_call (params, call_proc_name)
+ || ';
+ LOOP
+ FETCH '
+ || single_param.par_name
+ || ' INTO '
+ || col_str
+ || ';
+ EXIT WHEN '
+ || single_param.par_name
+ || '%NOTFOUND;
+ p_rec_nm := p_rec_nm + 1;
+ INSERT INTO '
+ || table_name
+ || ' ('
+ || col_str
+ || ')'
+ || ' values ('
+ || col_str
+ || ');'
+ || '
+ END LOOP;
+ CLOSE '
+ || single_param.par_name
+ || ';
+ END;';
+
+ IF (utplsql.tracing)
+ THEN
+ utplsql_util.PRINT (stmt);
+ END IF;
+
+ init_array_holder;
+ END;
+
+ FUNCTION prepare_and_fetch_rc (proc_name VARCHAR2)
+ RETURN VARCHAR2
+ IS
+ vproc_nm VARCHAR2 (50);
+ metadata utplsql_util.sqldata_tab;
+ stmt VARCHAR2 (32000);
+ table_name VARCHAR2 (20);
+ BEGIN
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('Call=' || proc_name);
+ END IF;
+
+ vproc_nm := utplsql_util.get_proc_name (proc_name);
+
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('Proc Name=' || vproc_nm);
+ END IF;
+
+ utplsql_util.get_metadata_for_cursor (vproc_nm, metadata);
+
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('Metadata Done');
+ END IF;
+
+ table_name := get_table_name ();
+
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('Refcursor Table Name=' || table_name);
+ END IF;
+
+ stmt := get_create_ddl (metadata, table_name);
+
+ IF (utplsql.tracing)
+ THEN
+ utplsql_util.PRINT ('Create ddl=' || stmt);
+ END IF;
+
+ execute_ddl (stmt);
+
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('Table created');
+ END IF;
+
+ IF (NVL (metadata.COUNT, 0) = 0)
+ THEN
+ RETURN (NULL);
+ END IF;
+
+ --prepare_cursor_1(stmt,'UTPLSQL'||'.'||table_name,proc_name,metadata);
+ prepare_cursor_1 (stmt, table_name, proc_name, metadata);
+
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('Done prepare_cursor_1');
+ END IF;
+
+ execute_ddl (stmt);
+
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('Done execute_ddl');
+ END IF;
+
+ --RETURN(USER||'.'||table_name);
+ RETURN (table_name);
+ END;
+
+ FUNCTION prepare_and_fetch_rc (
+ proc_name VARCHAR2,
+ params utplsql_params,
+ refc_pos_in_proc PLS_INTEGER,
+ refc_metadata_from PLS_INTEGER DEFAULT 1,
+ refc_metadata_str VARCHAR2 DEFAULT NULL
+ )
+ RETURN VARCHAR2
+ IS
+ metadata utplsql_util.sqldata_tab;
+ stmt VARCHAR2 (32000);
+ table_name VARCHAR2 (50);
+ datatype VARCHAR2 (20);
+ BEGIN
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('In prepare_and_fetch_rc ');
+ DBMS_OUTPUT.put_line ('proc name =' || proc_name);
+ print_utplsql_params (params);
+ DBMS_OUTPUT.put_line ('Method=' || TO_CHAR (refc_metadata_from));
+ PRINT ('refc_metadata_str=' || refc_metadata_str);
+ --dbms_output.put_line('refc_metadata_str='||refc_metadata_str);
+ DBMS_OUTPUT.put_line ('Position=' || TO_CHAR (refc_pos_in_proc));
+ END IF;
+
+ utplsql_util.get_metadata_for_proc (
+ proc_name,
+ refc_pos_in_proc,
+ datatype,
+ metadata
+ );
+
+ IF (metadata.COUNT = 0)
+ THEN
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('Weak ref cursor');
+ END IF;
+
+ IF (refc_metadata_from = 1)
+ THEN
+ utplsql_util.get_metadata_for_table (refc_metadata_str, metadata);
+ ELSIF (refc_metadata_from = 2)
+ THEN
+ utplsql_util.get_metadata_for_query (refc_metadata_str, metadata);
+ END IF;
+ END IF;
+
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('Done metadata');
+ END IF;
+
+ IF (metadata.COUNT = 0)
+ THEN
+ DBMS_OUTPUT.put_line ('ERROR: metadata is null');
+ RETURN (NULL);
+ END IF;
+
+ table_name := get_table_name ();
+
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('Refcursor Table Name=' || table_name);
+ END IF;
+
+ stmt := get_create_ddl (metadata, table_name);
+
+ IF (utplsql.tracing)
+ THEN
+ utplsql_util.PRINT ('Create ddl=' || stmt);
+ END IF;
+
+ execute_ddl (stmt);
+
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('Table created');
+ END IF;
+
+ IF (NVL (metadata.COUNT, 0) = 0)
+ THEN
+ RETURN (NULL);
+ END IF;
+
+ --prepare_cursor_100(stmt,'UTPLSQL'||'.'||table_name,proc_name,refc_pos_in_proc,metadata,params);
+ prepare_cursor_100 (
+ stmt,
+ table_name,
+ proc_name,
+ refc_pos_in_proc,
+ metadata,
+ params
+ );
+
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('Done prepare_cursor_1');
+ END IF;
+
+ execute_ddl (stmt);
+
+ IF (utplsql.tracing)
+ THEN
+ DBMS_OUTPUT.put_line ('Done execute_ddl');
+ END IF;
+
+ --RETURN(USER||'.'||table_name);
+ RETURN (table_name);
+ END;
+END;
+/
diff --git a/source/ut_plsql_util.pks b/source/ut_plsql_util.pks
new file mode 100644
index 000000000..139a15072
--- /dev/null
+++ b/source/ut_plsql_util.pks
@@ -0,0 +1,212 @@
+CREATE OR REPLACE PACKAGE utplsql_util
+&start_ge_8_1 AUTHID CURRENT_USER &end_ge_8_1
+AS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.3 2003/11/25 13:54:49 chrisrimmer
+Added back in AUTHID line
+
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ TYPE SQLDATA IS RECORD (
+ col_name VARCHAR2 (50),
+ col_type PLS_INTEGER,
+ col_len PLS_INTEGER
+ );
+
+ TYPE sqldata_tab IS TABLE OF SQLDATA
+ INDEX BY BINARY_INTEGER;
+
+ TYPE params_rec IS RECORD (
+ par_name VARCHAR2 (50),
+ par_type VARCHAR2 (10),
+ par_sql_type VARCHAR2 (50),
+ par_inout PLS_INTEGER,
+ par_pos PLS_INTEGER,
+ par_val VARCHAR2 (32000)
+ );
+
+ TYPE utplsql_array IS RECORD (
+ array_pos PLS_INTEGER,
+ array_val VARCHAR2 (32000)
+ );
+
+ TYPE utplsql_params IS TABLE OF params_rec
+ INDEX BY BINARY_INTEGER;
+
+ TYPE array_table IS TABLE OF utplsql_array
+ INDEX BY BINARY_INTEGER;
+
+ TYPE ut_refc IS REF CURSOR;
+
+ TYPE v30_table IS TABLE OF VARCHAR2 (30)
+ INDEX BY BINARY_INTEGER;
+
+ TYPE varchar_array IS TABLE OF VARCHAR2 (4000)
+ INDEX BY BINARY_INTEGER;
+
+ array_holder array_table;
+
+ PROCEDURE reg_in_param (
+ par_pos PLS_INTEGER,
+ par_val VARCHAR2,
+ params IN OUT utplsql_params
+ );
+
+ PROCEDURE reg_in_array (
+ par_pos IN PLS_INTEGER,
+ array_name IN VARCHAR2,
+ array_vals IN varchar_array,
+ params IN OUT utplsql_params
+ );
+
+ PROCEDURE reg_in_param (
+ par_pos PLS_INTEGER,
+ par_val NUMBER,
+ params IN OUT utplsql_params
+ );
+
+ PROCEDURE reg_in_param (
+ par_pos PLS_INTEGER,
+ par_val DATE,
+ params IN OUT utplsql_params
+ );
+
+ PROCEDURE reg_inout_param (
+ par_pos PLS_INTEGER,
+ par_val VARCHAR2,
+ params IN OUT utplsql_params
+ );
+
+ PROCEDURE reg_inout_param (
+ par_pos PLS_INTEGER,
+ par_val NUMBER,
+ params IN OUT utplsql_params
+ );
+
+ PROCEDURE reg_inout_param (
+ par_pos PLS_INTEGER,
+ par_val DATE,
+ params IN OUT utplsql_params
+ );
+
+ PROCEDURE reg_out_param (
+ par_pos PLS_INTEGER,
+ par_type VARCHAR2,
+ params IN OUT utplsql_params
+ );
+
+ PROCEDURE get_table_for_str (
+ p_arr OUT v30_table,
+ p_string VARCHAR2,
+ delim VARCHAR2 := ',',
+ enclose_str VARCHAR2 DEFAULT NULL
+ );
+
+ PROCEDURE get_metadata_for_cursor (
+ proc_name VARCHAR2,
+ metadata OUT sqldata_tab
+ );
+
+ PROCEDURE get_metadata_for_query (
+ query_txt VARCHAR2,
+ metadata OUT sqldata_tab
+ );
+
+ PROCEDURE get_metadata_for_table (
+ table_name VARCHAR2,
+ metadata OUT sqldata_tab
+ );
+
+ PROCEDURE get_metadata_for_proc (
+ proc_name VARCHAR2,
+ POSITION INTEGER,
+ data_type OUT VARCHAR2,
+ metadata OUT sqldata_tab
+ );
+
+ PROCEDURE test_get_metadata_for_cursor (proc_name VARCHAR2);
+
+ PROCEDURE print_metadata (metadata sqldata_tab);
+
+ FUNCTION get_colnamesstr (metadata sqldata_tab)
+ RETURN VARCHAR2;
+
+ FUNCTION get_coltypesstr (metadata sqldata_tab)
+ RETURN VARCHAR2;
+
+ FUNCTION get_coltype_syntax (col_type PLS_INTEGER, col_len PLS_INTEGER)
+ RETURN VARCHAR2;
+
+ PROCEDURE PRINT (str VARCHAR2);
+
+ FUNCTION get_proc_name (p_proc_nm VARCHAR2)
+ RETURN VARCHAR2;
+
+ FUNCTION get_version
+ RETURN VARCHAR2;
+
+ FUNCTION get_val_for_table (
+ table_name VARCHAR2,
+ col_name VARCHAR2,
+ col_val OUT VARCHAR2,
+ col_type OUT NUMBER
+ )
+ RETURN NUMBER;
+
+ FUNCTION get_table_name
+ RETURN VARCHAR2;
+
+ PROCEDURE execute_ddl (stmt VARCHAR2);
+
+ FUNCTION get_create_ddl (
+ metadata utplsql_util.sqldata_tab,
+ table_name VARCHAR2,
+ owner_name VARCHAR2 DEFAULT NULL
+ )
+ RETURN VARCHAR2;
+
+ PROCEDURE prepare_cursor_1 (
+ stmt IN OUT VARCHAR2,
+ table_name VARCHAR2,
+ call_proc_name VARCHAR2,
+ metadata utplsql_util.sqldata_tab
+ );
+
+ FUNCTION prepare_and_fetch_rc (proc_name VARCHAR2)
+ RETURN VARCHAR2;
+
+ FUNCTION prepare_and_fetch_rc (
+ proc_name VARCHAR2,
+ params utplsql_params,
+ refc_pos_in_proc PLS_INTEGER,
+ refc_metadata_from PLS_INTEGER DEFAULT 1,
+ refc_metadata_str VARCHAR2 DEFAULT NULL
+ )
+ RETURN VARCHAR2;
+END;
+/
diff --git a/source/ut_receq.pkb b/source/ut_receq.pkb
new file mode 100644
index 000000000..5037e47bb
--- /dev/null
+++ b/source/ut_receq.pkb
@@ -0,0 +1,318 @@
+CREATE OR REPLACE PACKAGE BODY utreceq
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.3 2004/07/14 17:01:57 chrisrimmer
+Added first version of pluggable reporter packages
+
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ PROCEDURE delete_receq (id_in ut_receq.id%TYPE)
+ IS
+ v_cur PLS_INTEGER := DBMS_SQL.open_cursor;
+ sql_str VARCHAR2 (2000);
+ v_cnt PLS_INTEGER;
+ BEGIN
+ SELECT COUNT (*)
+ INTO v_cnt
+ FROM ut_receq_pkg
+ WHERE receq_id = id_in AND created_by = USER;
+
+ IF v_cnt < 1
+ THEN
+ SELECT 'DROP FUNCTION ' || test_name
+ INTO sql_str
+ FROM ut_receq
+ WHERE id = id_in AND created_by = USER;
+
+ DBMS_SQL.parse (v_cur, sql_str, DBMS_SQL.native);
+ DBMS_SQL.close_cursor (v_cur);
+ END IF;
+
+ DELETE FROM ut_receq
+ WHERE id = id_in AND created_by = USER;
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ utreport.pl (SQLERRM);
+ DBMS_SQL.close_cursor (v_cur);
+ utreport.pl (
+ 'Delete failed - function probably used by another package'
+ );
+ END;
+
+ FUNCTION id_from_name (
+ NAME_IN IN ut_receq.NAME%TYPE,
+ owner_in IN ut_receq.rec_owner%TYPE := USER
+ )
+ RETURN INTEGER
+ IS
+ retval INTEGER;
+ BEGIN
+ SELECT id
+ INTO retval
+ FROM ut_receq
+ WHERE NAME = UPPER (NAME_IN)
+ AND rec_owner = UPPER (owner_in)
+ AND created_by = USER;
+
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END id_from_name;
+
+ FUNCTION name_from_id (id_in IN ut_receq.id%TYPE)
+ RETURN VARCHAR2
+ IS
+ retval VARCHAR2 (30);
+ BEGIN
+ SELECT NAME
+ INTO retval
+ FROM ut_receq
+ WHERE id = id_in;
+
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END name_from_id;
+
+ FUNCTION receq_name (
+ NAME_IN IN VARCHAR2,
+ owner_in IN VARCHAR2 DEFAULT USER,
+ test_name_in IN VARCHAR2 DEFAULT NULL
+ )
+ RETURN VARCHAR2
+ IS
+ retval VARCHAR2 (30);
+ func_len INTEGER;
+ BEGIN
+ IF test_name_in IS NOT NULL
+ THEN
+ retval := UPPER (test_name_in);
+ ELSE
+ retval := 'eq_';
+
+ IF owner_in <> USER
+ THEN
+ retval := retval || owner_in || '_';
+ END IF;
+
+ retval := retval || NAME_IN;
+ END IF;
+
+ RETURN UPPER (retval);
+ EXCEPTION
+ WHEN VALUE_ERROR
+ THEN
+ utreport.pl ('Generated test name is too long');
+ utreport.pl (
+ 'Resubmit with a defined test_name_in=>''EQ_your_name'''
+ );
+ RETURN NULL;
+ END receq_name;
+
+ PROCEDURE COMPILE (receq_id_in IN ut_receq.id%TYPE)
+ IS
+ lines DBMS_SQL.varchar2s;
+ cur PLS_INTEGER := DBMS_SQL.open_cursor;
+ v_rec ut_receq%ROWTYPE;
+ v_schema ut_receq.rec_owner%TYPE;
+ BEGIN
+ lines.DELETE;
+
+ SELECT *
+ INTO v_rec
+ FROM ut_receq
+ WHERE id = receq_id_in AND created_by = USER;
+
+ IF v_rec.rec_owner <> USER
+ THEN
+ v_schema := v_rec.rec_owner || '.';
+ END IF;
+
+ lines (1) := 'CREATE OR REPLACE FUNCTION ' || v_rec.test_name || '(';
+ lines (lines.LAST + 1) := ' a ' || v_schema || v_rec.NAME || '%ROWTYPE , ';
+ lines (lines.LAST + 1) := ' b ' || v_schema || v_rec.NAME || '%ROWTYPE ) ';
+ lines (lines.LAST + 1) := 'RETURN BOOLEAN ';
+ lines (lines.LAST + 1) := 'IS BEGIN ';
+ lines (lines.LAST + 1) := ' RETURN (';
+
+ FOR utc_rec IN (SELECT *
+ FROM all_tab_columns
+ WHERE table_name = v_rec.NAME
+ AND owner = v_rec.rec_owner
+ ORDER BY column_id)
+ LOOP
+ IF utc_rec.column_id > 1
+ THEN
+ lines (lines.LAST + 1) := ' AND ';
+ END IF;
+
+ lines (lines.LAST + 1) := '( ( a.'
+ || utc_rec.column_name
+ || ' IS NULL AND b.'
+ || utc_rec.column_name
+ || ' IS NULL ) OR ';
+
+ IF utc_rec.data_type = 'CLOB'
+ THEN
+ lines (lines.LAST) := lines (lines.LAST)
+ || 'DBMS_LOB.COMPARE( a.'
+ || utc_rec.column_name
+ || ' , b.'
+ || utc_rec.column_name
+ || ') = 0 )';
+ ELSE
+ lines (lines.LAST) := lines (lines.LAST)
+ || 'a.'
+ || utc_rec.column_name
+ || ' = b.'
+ || utc_rec.column_name
+ || ')';
+ END IF;
+ END LOOP;
+
+ lines (lines.LAST + 1) := '); END ' || v_rec.test_name || ';';
+ DBMS_SQL.parse (
+ cur,
+ lines,
+ lines.FIRST,
+ lines.LAST,
+ TRUE ,
+ DBMS_SQL.native
+ );
+ DBMS_SQL.close_cursor (cur);
+ END COMPILE;
+ -- Public Methods
+
+ PROCEDURE ADD (
+ pkg_name_in IN ut_package.NAME%TYPE,
+ record_in IN ut_receq.NAME%TYPE,
+ rec_owner_in IN ut_receq.created_by%TYPE := USER
+ )
+ IS
+ v_pkg_id NUMBER;
+ v_receq_id NUMBER;
+ v_obj_type user_objects.object_type%TYPE;
+ v_recname VARCHAR2 (30);
+ BEGIN
+ v_pkg_id := utpackage.id_from_name (pkg_name_in);
+ v_receq_id := id_from_name (record_in);
+
+ IF v_pkg_id IS NULL
+ THEN
+ utreport.pl (pkg_name_in || ' does not exist');
+ ELSIF v_receq_id IS NULL
+ THEN
+ SELECT object_type
+ INTO v_obj_type
+ FROM all_objects
+ WHERE object_name = UPPER (record_in)
+ AND owner = UPPER (rec_owner_in)
+ AND object_type IN ('TABLE', 'VIEW');
+
+ v_receq_id := utplsql.seqval ('ut_receq');
+ v_recname := receq_name (record_in, rec_owner_in);
+
+ INSERT INTO ut_receq
+ VALUES (v_receq_id, UPPER (record_in), v_recname, USER, UPPER (
+ rec_owner_in
+ ));
+ END IF;
+
+ utreceq.COMPILE (v_receq_id);
+ utreport.pl (v_recname || ' compiled for ' || v_obj_type || ' ' || record_in);
+
+ BEGIN
+ INSERT INTO ut_receq_pkg
+ VALUES (v_receq_id, v_pkg_id, USER);
+ EXCEPTION
+ WHEN DUP_VAL_ON_INDEX
+ THEN
+ utreport.pl (
+ v_recname || ' already registered for package ' || pkg_name_in
+ );
+ END;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ utreport.pl (record_in || ' does not exist in schema ' || rec_owner_in);
+ END ADD;
+
+ PROCEDURE COMPILE (pkg_name_in IN ut_package.NAME%TYPE)
+ IS
+ v_pkg_id NUMBER;
+ BEGIN
+ v_pkg_id := utpackage.id_from_name (pkg_name_in);
+
+ FOR j IN (SELECT receq_id
+ FROM ut_receq_pkg
+ WHERE pkg_id = v_pkg_id AND created_by = USER)
+ LOOP
+ COMPILE (j.receq_id);
+ END LOOP;
+ END COMPILE;
+
+ PROCEDURE REM (
+ NAME_IN IN ut_receq.NAME%TYPE,
+ rec_owner_in IN ut_receq.created_by%TYPE,
+ for_package_in IN BOOLEAN := FALSE
+ )
+ IS
+ v_pkg_id INTEGER;
+ v_receq_id INTEGER;
+ BEGIN
+ IF for_package_in
+ THEN
+ v_pkg_id := utpackage.id_from_name (NAME_IN);
+
+ FOR j IN (SELECT receq_id
+ FROM ut_receq_pkg
+ WHERE pkg_id = v_pkg_id)
+ LOOP
+ DELETE FROM ut_receq_pkg
+ WHERE pkg_id = v_pkg_id
+ AND created_by = USER
+ AND receq_id = j.receq_id;
+
+ delete_receq (v_receq_id);
+ END LOOP;
+ ELSE
+ v_receq_id := utreceq.id_from_name (NAME_IN, rec_owner_in);
+
+ DELETE FROM ut_receq_pkg
+ WHERE receq_id = v_receq_id;
+
+ delete_receq (v_receq_id);
+ END IF;
+ END REM;
+END utreceq;
+/
diff --git a/source/ut_receq.pks b/source/ut_receq.pks
new file mode 100644
index 000000000..a5d4ca008
--- /dev/null
+++ b/source/ut_receq.pks
@@ -0,0 +1,66 @@
+CREATE OR REPLACE PACKAGE utreceq &start_ge_8_1 AUTHID CURRENT_USER &end_ge_8_1
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ PROCEDURE add(
+
+ pkg_name_in IN ut_package.name%TYPE ,
+
+ record_in IN ut_receq.name%TYPE ,
+
+ rec_owner_in IN ut_receq.created_by%TYPE := USER
+
+ );
+
+
+
+ PROCEDURE compile(
+
+ pkg_name_in IN ut_package.name%TYPE
+
+ );
+
+
+
+ PROCEDURE rem(
+
+ name_in IN ut_receq.name%TYPE,
+
+ rec_owner_in IN ut_receq.created_by%TYPE := USER,
+
+ for_package_in IN BOOLEAN := FALSE
+
+ );
+
+
+
+END utreceq;
+
+/
+
diff --git a/source/ut_receq.tab b/source/ut_receq.tab
new file mode 100644
index 000000000..08cc713c4
--- /dev/null
+++ b/source/ut_receq.tab
@@ -0,0 +1,30 @@
+-- register tables and view that will have record comparison functions created
+-- 12/26/01 dws
+CREATE TABLE ut_receq (
+ id INTEGER,
+ name VARCHAR2(30),
+ test_name VARCHAR2(30),
+ created_by VARCHAR2(30),
+ rec_owner VARCHAR2(30),
+ CONSTRAINT ut_receq_pk PRIMARY KEY (id)
+);
+
+CREATE UNIQUE INDEX ut_receq_idx1 ON
+ ut_receq(rec_owner , name);
+
+
+-- Intersection table between ut_package and ut_receq
+CREATE TABLE ut_receq_pkg (
+ receq_id integer,
+ pkg_id INTEGER,
+ created_by VARCHAR2(30)
+);
+
+ALTER TABLE ut_receq_pkg ADD CONSTRAINT ut_receq_pkg
+ primary key(receq_id,pkg_id,created_by);
+
+ALTER TABLE ut_receq_pkg ADD CONSTRAINT ut_receq_pkg_receq_FK
+ FOREIGN KEY(receq_id) REFERENCES ut_receq(id);
+
+ALTER TABLE ut_receq_pkg ADD CONSTRAINT ut_receq_pkg_pkg_FK
+ FOREIGN KEY(pkg_id) REFERENCES ut_package(id);
diff --git a/source/ut_receq_seq.seq b/source/ut_receq_seq.seq
new file mode 100644
index 000000000..5c8f218f0
--- /dev/null
+++ b/source/ut_receq_seq.seq
@@ -0,0 +1 @@
+CREATE sequence ut_receq_seq INCREMENT BY 1 START WITH 1 ORDER NOCACHE;
\ No newline at end of file
diff --git a/source/ut_refcursor_results_seq.seq b/source/ut_refcursor_results_seq.seq
new file mode 100644
index 000000000..4afb20e90
--- /dev/null
+++ b/source/ut_refcursor_results_seq.seq
@@ -0,0 +1 @@
+create sequence ut_refcursor_results_seq INCREMENT BY 1 START WITH 1 ORDER NOCACHE;
diff --git a/source/ut_report.pkb b/source/ut_report.pkb
new file mode 100644
index 000000000..9789bedd9
--- /dev/null
+++ b/source/ut_report.pkb
@@ -0,0 +1,226 @@
+/* Formatted on 2002/03/31 23:53 (Formatter Plus v4.5.2) */
+CREATE OR REPLACE PACKAGE BODY Utreport
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2004/11/16 09:46:49 chrisrimmer
+Changed to new version detection system.
+
+Revision 1.1 2004/07/14 17:01:57 chrisrimmer
+Added first version of pluggable reporter packages
+
+
+************************************************************************/
+
+ DEFAULT_REPORTER VARCHAR2(100) := 'Output';
+
+ DYNAMIC_PLSQL_FAILURE NUMBER(10) := -6550;
+
+ --This is the reporter we have been asked to use
+ g_reporter VARCHAR2(100);
+
+ --This is the reporter we are actually using
+ --(this differs from the above in the event of error)
+ g_actual VARCHAR2(100);
+
+ FUNCTION parse_it(proc IN VARCHAR2, params IN NUMBER, force_reporter IN VARCHAR2)
+ RETURN INTEGER
+ IS
+ dyn_handle INTEGER := NULL;
+ query VARCHAR2(1000);
+ BEGIN
+ dyn_handle := DBMS_SQL.OPEN_CURSOR;
+ QUERY := 'BEGIN ut' || NVL(force_reporter, g_actual) || 'Reporter.' || proc ;
+ IF params = 1 THEN
+ QUERY := QUERY || '(:p)';
+ END IF;
+ QUERY := QUERY || '; END;';
+ DBMS_SQL.PARSE(dyn_handle, QUERY, DBMS_SQL.NATIVE);
+ RETURN dyn_handle;
+ EXCEPTION
+ WHEN OTHERS THEN
+ DBMS_SQL.CLOSE_CURSOR (dyn_handle);
+ RAISE;
+ END;
+
+ PROCEDURE execute_it(dyn_handle IN OUT INTEGER)
+ IS
+ dyn_result INTEGER;
+ BEGIN
+ dyn_result := DBMS_SQL.EXECUTE (dyn_handle);
+ DBMS_SQL.CLOSE_CURSOR (dyn_handle);
+ END;
+
+ --We use this to make dynamic calls to reporter packages
+ PROCEDURE call(proc IN VARCHAR2,
+ param IN VARCHAR2,
+ params IN NUMBER := 1,
+ force_reporter IN VARCHAR2 := NULL,
+ failover IN BOOLEAN := TRUE)
+ IS
+ dyn_handle INTEGER := NULL;
+ BEGIN
+ dyn_handle := parse_it(proc, params, force_reporter);
+ IF params = 1 THEN
+ DBMS_SQL.BIND_VARIABLE (dyn_handle, 'p', param);
+ END IF;
+ execute_it(dyn_handle);
+ EXCEPTION
+ WHEN OTHERS THEN
+
+ IF dyn_handle IS NOT NULL THEN
+ DBMS_SQL.CLOSE_CURSOR (dyn_handle);
+ END IF;
+
+ IF g_actual <> DEFAULT_REPORTER THEN
+
+ IF NOT failover OR SQLCODE <> DYNAMIC_PLSQL_FAILURE THEN
+ g_actual := DEFAULT_REPORTER;
+ pl(SQLERRM);
+ pl('** REVERTING TO DEFAULT REPORTER **');
+ END IF;
+
+ ELSE
+ RAISE;
+ END IF;
+
+ call(proc, param, params, force_reporter => DEFAULT_REPORTER);
+ END;
+
+ PROCEDURE call(proc IN VARCHAR2,
+ failover IN BOOLEAN := TRUE)
+ IS
+ BEGIN
+ call(proc => proc,
+ param => '',
+ params => 0,
+ failover => failover);
+ END;
+
+ PROCEDURE use(reporter IN VARCHAR2)
+ IS
+ BEGIN
+ g_reporter := NVL(reporter, DEFAULT_REPORTER);
+ g_actual := g_reporter;
+ END;
+
+ FUNCTION using RETURN VARCHAR2
+ IS
+ BEGIN
+ RETURN g_reporter;
+ END;
+
+ PROCEDURE open
+ IS
+ BEGIN
+ g_actual := g_reporter;
+ call('open', failover => FALSE);
+ END;
+
+ PROCEDURE pl (str IN VARCHAR2)
+ IS
+ BEGIN
+ call('pl', str);
+ END;
+
+ PROCEDURE pl (bool IN BOOLEAN)
+ IS
+ BEGIN
+ pl (Utplsql.bool2vc (bool));
+ END;
+
+ PROCEDURE before_results(run_id IN utr_outcome.run_id%TYPE)
+ IS
+ BEGIN
+ call('before_results', run_id);
+ END;
+
+ PROCEDURE show_failure(rec_result IN utr_outcome%ROWTYPE)
+ IS
+ BEGIN
+ outcome := rec_result;
+ call('show_failure');
+ END;
+
+ PROCEDURE show_result(rec_result IN utr_outcome%ROWTYPE)
+ IS
+ BEGIN
+ outcome := rec_result;
+ call('show_result');
+ END;
+
+ PROCEDURE after_results(run_id IN utr_outcome.run_id%TYPE)
+ IS
+ BEGIN
+ call('after_results', run_id);
+ END;
+
+ PROCEDURE before_errors(run_id IN utr_error.run_id%TYPE)
+ IS
+ BEGIN
+ call('before_errors', run_id);
+ END;
+
+ PROCEDURE show_error(rec_error IN utr_error%ROWTYPE)
+ IS
+ BEGIN
+ error := rec_error;
+ call('show_error');
+ END;
+
+ PROCEDURE after_errors(run_id IN utr_error.run_id%TYPE)
+ IS
+ BEGIN
+ call('after_errors', run_id);
+ END;
+
+ PROCEDURE close
+ IS
+ BEGIN
+ call('close');
+ END;
+
+
+ /*
+ proc: before_suite_results
+ Show suite overall banner and suite run stats
+
+ parameters:
+ suite_id - suite id
+ */
+ PROCEDURE before_suite_results(
+ suite_id ut_suite.id%TYPE
+ )
+ IS
+ BEGIN
+ call('before_suite_results', suite_id);
+ END before_suite_results;
+
+BEGIN
+
+ g_reporter := NVL(utconfig.getreporter, DEFAULT_REPORTER);
+ g_actual := g_reporter;
+
+END;
+/
diff --git a/source/ut_report.pks b/source/ut_report.pks
new file mode 100644
index 000000000..a80d86162
--- /dev/null
+++ b/source/ut_report.pks
@@ -0,0 +1,54 @@
+CREATE OR REPLACE PACKAGE utreport &start_ge_8_1 AUTHID CURRENT_USER &end_ge_8_1
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log
+
+************************************************************************/
+
+ outcome utr_outcome%ROWTYPE;
+ error utr_error%ROWTYPE;
+
+ PROCEDURE use(reporter IN VARCHAR2);
+ FUNCTION using RETURN VARCHAR2;
+
+ PROCEDURE open;
+
+ PROCEDURE pl (str IN VARCHAR2);
+ PROCEDURE pl (bool IN BOOLEAN);
+
+ PROCEDURE before_results(run_id IN utr_outcome.run_id%TYPE);
+ PROCEDURE show_failure(rec_result utr_outcome%ROWTYPE);
+ PROCEDURE show_result(rec_result utr_outcome%ROWTYPE);
+ PROCEDURE after_results(run_id IN utr_outcome.run_id%TYPE);
+
+ PROCEDURE before_errors(run_id IN utr_error.run_id%TYPE);
+ PROCEDURE show_error(rec_error utr_error%ROWTYPE);
+ PROCEDURE after_errors(run_id IN utr_error.run_id%TYPE);
+
+ PROCEDURE close;
+
+ PROCEDURE before_suite_results(suite_id ut_suite.id%TYPE);
+
+END;
+/
diff --git a/source/ut_rerror.pkb b/source/ut_rerror.pkb
new file mode 100644
index 000000000..4c01a05bf
--- /dev/null
+++ b/source/ut_rerror.pkb
@@ -0,0 +1,339 @@
+/* Formatted on 2001/07/13 12:30 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE BODY utrerror
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.4 2004/11/16 09:46:49 chrisrimmer
+Changed to new version detection system.
+
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ FUNCTION uterrcode (errmsg_in IN VARCHAR2 := NULL)
+ RETURN INTEGER
+ IS
+ BEGIN
+ -- FORMAT ORA-XXXXXX: UT-300XXX:
+ IF NVL (errmsg_in, SQLERRM) LIKE 'ORA-_____: ' || c_error_indicator
+ THEN
+ RETURN SUBSTR (NVL (errmsg_in, SQLERRM), 15, 6);
+ ELSE
+ RETURN NULL;
+ END IF;
+ END;
+
+ PROCEDURE raise_error (
+ errcode_in IN utr_error.errcode%TYPE,
+ errtext_in IN utr_error.errtext%TYPE
+ )
+ IS
+ BEGIN
+ -- Raise "error reported"
+ IF errcode_in BETWEEN 300000 AND 399999
+ THEN
+ raise_application_error (
+ -20000,
+ SUBSTR ( 'UT-'
+ || errcode_in
+ || ': '
+ || errtext_in, 1, 255)
+ );
+ ELSE
+ raise_application_error (
+ -20000,
+ SUBSTR ( errcode_in
+ || ': '
+ || errtext_in
+ || '"', 1, 255)
+ );
+ END IF;
+ END;
+
+ PROCEDURE ins (
+ run_id_in IN utr_error.run_id%TYPE := NULL,
+ suite_id_in IN utr_error.suite_id%TYPE := NULL,
+ utp_id_in IN utr_error.utp_id%TYPE := NULL,
+ unittest_id_in IN utr_error.unittest_id%TYPE := NULL,
+ testcase_id_in IN utr_error.testcase_id%TYPE := NULL,
+ outcome_id_in IN utr_error.outcome_id%TYPE := NULL,
+ errlevel_in IN utr_error.errlevel%TYPE := NULL,
+ errcode_in IN utr_error.errcode%TYPE := NULL,
+ errtext_in IN utr_error.errtext%TYPE := NULL,
+ description_in IN utr_error.description%TYPE := NULL,
+ recorderr IN BOOLEAN := TRUE,
+ raiseexc IN BOOLEAN := TRUE
+ )
+ IS
+ l_message VARCHAR2 (2000);
+ &start_ge_8_1
+ PRAGMA autonomous_transaction;
+ &end_ge_8_1
+ BEGIN
+ -- If error already recorded, simply re-raise.
+
+ IF errtext_in LIKE c_error_indicator
+ THEN
+ -- Already recorded. SKip this step.
+ NULL;
+ ELSE
+ IF recorderr
+ THEN
+ INSERT INTO utr_error
+ (run_id, suite_id, utp_id, unittest_id,
+ testcase_id, outcome_id, errlevel, occurred_on,
+ errcode, errtext, description)
+ VALUES (run_id_in, suite_id_in, utp_id_in, unittest_id_in,
+ testcase_id_in, outcome_id_in, errlevel_in, SYSDATE,
+ errcode_in, errtext_in, description_in);
+ ELSE
+ l_message := 'Error UT-'
+ || NVL (errcode_in, general_error)
+ || ': '
+ || errtext_in;
+
+ IF errlevel_in IS NOT NULL
+ THEN
+ l_message := l_message
+ || ' '
+ || errlevel_in;
+ END IF;
+
+ IF description_in IS NOT NULL
+ THEN
+ l_message := l_message
+ || ' '
+ || description_in;
+ END IF;
+
+ -- Simply display the error information.
+ utreport.pl (l_message);
+ END IF;
+ END IF;
+
+ &start_ge_8_1
+ COMMIT;
+
+ &end_ge_8_1
+
+ IF raiseexc
+ THEN
+ raise_error (errcode_in, errtext_in);
+ END IF;
+ &start_ge_8_1
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ ROLLBACK;
+ RAISE;
+ &end_ge_8_1
+ END;
+
+ PROCEDURE report (
+ errcode_in IN INTEGER,
+ errtext_in IN VARCHAR2 := NULL,
+ description_in IN VARCHAR2 := NULL,
+ errlevel_in IN VARCHAR2 := NULL,
+ recorderr IN BOOLEAN := TRUE,
+ raiseexc IN BOOLEAN := TRUE
+ )
+ IS
+ BEGIN
+ ins (
+ run_id_in=> NULL,
+ suite_id_in=> NULL,
+ utp_id_in=> NULL,
+ unittest_id_in=> NULL,
+ testcase_id_in=> NULL,
+ outcome_id_in=> NULL,
+ errlevel_in=> errlevel_in,
+ errcode_in=> errcode_in,
+ errtext_in=> errtext_in,
+ description_in=> description_in,
+ recorderr=> recorderr,
+ raiseexc=> raiseexc
+ );
+ END;
+
+ PROCEDURE report_define_error (
+ define_in IN VARCHAR2,
+ message_in IN VARCHAR2 := NULL
+ )
+ IS
+ BEGIN
+ report (
+ errcode_in=> SQLCODE,
+ errtext_in=> SQLERRM,
+ description_in=> message_in,
+ errlevel_in=> define_in,
+ recorderr=> FALSE,
+ raiseexc=> TRUE
+ );
+ END;
+
+ PROCEDURE assert (
+ condition_in IN BOOLEAN,
+ message_in IN VARCHAR2,
+ raiseexc IN BOOLEAN := TRUE,
+ raiseerr IN INTEGER := NULL
+ )
+ IS
+ BEGIN
+ IF condition_in IS NULL
+ OR NOT condition_in
+ THEN
+ report (
+ errcode_in=> NVL (raiseerr, assertion_failure),
+ errtext_in=> message_in,
+ description_in=> NULL,
+ errlevel_in=> NULL,
+ recorderr=> FALSE,
+ raiseexc=> raiseexc
+ );
+ END IF;
+ END;
+
+ PROCEDURE suite_report (
+ run_in IN INTEGER,
+ suite_in IN ut_suite.id%TYPE,
+ errcode_in IN INTEGER,
+ errtext_in IN VARCHAR2 := NULL,
+ description_in IN VARCHAR2 := NULL,
+ raiseexc IN BOOLEAN := TRUE
+ )
+ IS
+ BEGIN
+ ins (
+ run_id_in=> run_in,
+ suite_id_in=> suite_in,
+ utp_id_in=> NULL,
+ unittest_id_in=> NULL,
+ testcase_id_in=> NULL,
+ outcome_id_in=> NULL,
+ errlevel_in=> ututp.c_abbrev,
+ errcode_in=> errcode_in,
+ errtext_in=> errtext_in,
+ description_in=> description_in,
+ raiseexc=> raiseexc
+ );
+ END;
+
+ PROCEDURE utp_report (
+ run_in IN INTEGER,
+ utp_in IN ut_utp.id%TYPE,
+ errcode_in IN INTEGER,
+ errtext_in IN VARCHAR2 := NULL,
+ description_in IN VARCHAR2 := NULL,
+ raiseexc IN BOOLEAN := TRUE
+ )
+ IS
+ BEGIN
+ ins (
+ run_id_in=> run_in,
+ utp_id_in=> utp_in,
+ unittest_id_in=> NULL,
+ testcase_id_in=> NULL,
+ outcome_id_in=> NULL,
+ errlevel_in=> ututp.c_abbrev,
+ errcode_in=> errcode_in,
+ errtext_in=> errtext_in,
+ description_in=> description_in,
+ raiseexc=> raiseexc
+ );
+ END;
+
+ PROCEDURE ut_report (
+ run_in IN INTEGER,
+ unittest_in IN ut_unittest.id%TYPE,
+ errcode_in IN INTEGER,
+ errtext_in IN VARCHAR2 := NULL,
+ description_in IN VARCHAR2 := NULL,
+ raiseexc IN BOOLEAN := TRUE
+ )
+ IS
+ BEGIN
+ ins (
+ run_id_in=> run_in,
+ utp_id_in=> NULL,
+ unittest_id_in=> unittest_in,
+ testcase_id_in=> NULL,
+ outcome_id_in=> NULL,
+ errlevel_in=> utunittest.c_abbrev,
+ errcode_in=> errcode_in,
+ errtext_in=> errtext_in,
+ description_in=> description_in,
+ raiseexc=> raiseexc
+ );
+ END;
+
+ PROCEDURE tc_report (
+ run_in IN INTEGER,
+ testcase_in IN ut_testcase.id%TYPE,
+ errcode_in IN INTEGER,
+ errtext_in IN VARCHAR2 := NULL,
+ description_in IN VARCHAR2 := NULL,
+ raiseexc IN BOOLEAN := TRUE
+ )
+ IS
+ BEGIN
+ ins (
+ run_id_in=> run_in,
+ utp_id_in=> NULL,
+ unittest_id_in=> NULL,
+ testcase_id_in=> testcase_in,
+ outcome_id_in=> NULL,
+ errlevel_in=> uttestcase.c_abbrev,
+ errcode_in=> errcode_in,
+ errtext_in=> errtext_in,
+ description_in=> description_in,
+ raiseexc=> raiseexc
+ );
+ END;
+
+ PROCEDURE oc_report (
+ run_in IN INTEGER,
+ outcome_in IN ut_outcome.id%TYPE,
+ errcode_in IN INTEGER,
+ errtext_in IN VARCHAR2 := NULL,
+ description_in IN VARCHAR2 := NULL,
+ raiseexc IN BOOLEAN := TRUE
+ )
+ IS
+ BEGIN
+ ins (
+ run_id_in=> run_in,
+ utp_id_in=> NULL,
+ unittest_id_in=> NULL,
+ testcase_id_in=> NULL,
+ outcome_id_in=> outcome_in,
+ errlevel_in=> utoutcome.c_abbrev,
+ errcode_in=> errcode_in,
+ errtext_in=> errtext_in,
+ description_in=> description_in,
+ raiseexc=> raiseexc
+ );
+ END;
+END utrerror;
+/
diff --git a/source/ut_rerror.pks b/source/ut_rerror.pks
new file mode 100644
index 000000000..add3bf61a
--- /dev/null
+++ b/source/ut_rerror.pks
@@ -0,0 +1,112 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE utrerror &start_ge_8_1 AUTHID CURRENT_USER &end_ge_8_1
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ c_error_indicator CONSTANT VARCHAR2 (7) := 'UT-300%';
+ general_error CONSTANT INTEGER := 300000;
+ no_utp_for_program CONSTANT INTEGER := 300001;
+ cannot_run_program CONSTANT INTEGER := 300002;
+ undefined_outcome CONSTANT INTEGER := 300003;
+ undefined_suite CONSTANT INTEGER := 300004;
+ assertion_failure CONSTANT INTEGER := 300005;
+ exc_undefined_suite EXCEPTION;
+
+ FUNCTION uterrcode (errmsg_in IN VARCHAR2 := NULL)
+ RETURN INTEGER;
+
+ PROCEDURE assert (
+ condition_in IN BOOLEAN,
+ message_in IN VARCHAR2,
+ raiseexc IN BOOLEAN := TRUE,
+ raiseerr IN INTEGER := NULL
+ );
+
+ PROCEDURE report (
+ errcode_in IN INTEGER,
+ errtext_in IN VARCHAR2 := NULL,
+ description_in IN VARCHAR2 := NULL,
+ errlevel_in IN VARCHAR2 := NULL,
+ recorderr IN BOOLEAN := TRUE,
+ raiseexc IN BOOLEAN := TRUE
+ );
+
+ -- Generic reporting for definition actions.
+ -- Passes SQLCODE and SQLERRM, does NOT record the error
+ PROCEDURE report_define_error (
+ define_in IN VARCHAR2,
+ message_in IN VARCHAR2 := NULL
+ );
+
+ PROCEDURE suite_report (
+ run_in IN INTEGER,
+ suite_in IN ut_suite.id%TYPE,
+ errcode_in IN INTEGER,
+ errtext_in IN VARCHAR2 := NULL,
+ description_in IN VARCHAR2 := NULL,
+ raiseexc IN BOOLEAN := TRUE
+ );
+
+ PROCEDURE utp_report (
+ run_in IN INTEGER,
+ utp_in IN ut_utp.id%TYPE,
+ errcode_in IN INTEGER,
+ errtext_in IN VARCHAR2 := NULL,
+ description_in IN VARCHAR2 := NULL,
+ raiseexc IN BOOLEAN := TRUE
+ );
+
+ PROCEDURE ut_report (
+ run_in IN INTEGER,
+ unittest_in IN ut_unittest.id%TYPE,
+ errcode_in IN INTEGER,
+ errtext_in IN VARCHAR2 := NULL,
+ description_in IN VARCHAR2 := NULL,
+ raiseexc IN BOOLEAN := TRUE
+ );
+
+ PROCEDURE tc_report (
+ run_in IN INTEGER,
+ testcase_in IN ut_testcase.id%TYPE,
+ errcode_in IN INTEGER,
+ errtext_in IN VARCHAR2 := NULL,
+ description_in IN VARCHAR2 := NULL,
+ raiseexc IN BOOLEAN := TRUE
+ );
+
+ PROCEDURE oc_report (
+ run_in IN INTEGER,
+ outcome_in IN ut_outcome.id%TYPE,
+ errcode_in IN INTEGER,
+ errtext_in IN VARCHAR2 := NULL,
+ description_in IN VARCHAR2 := NULL,
+ raiseexc IN BOOLEAN := TRUE
+ );
+END utrerror;
+/
diff --git a/source/ut_result.pkb b/source/ut_result.pkb
new file mode 100644
index 000000000..de420f150
--- /dev/null
+++ b/source/ut_result.pkb
@@ -0,0 +1,311 @@
+CREATE OR REPLACE PACKAGE BODY utresult
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ resultindx PLS_INTEGER;
+ g_header_shown BOOLEAN := FALSE ;
+ g_include_successes BOOLEAN := TRUE ;
+
+ PROCEDURE include_successes
+ IS
+ BEGIN
+ g_include_successes := TRUE ;
+ END;
+
+ PROCEDURE ignore_successes
+ IS
+ BEGIN
+ g_include_successes := FALSE ;
+ END;
+
+ PROCEDURE showone (
+ run_id_in IN utr_outcome.run_id%TYPE := NULL,
+ indx_in IN PLS_INTEGER
+ )
+ IS
+ BEGIN
+ utreport.pl (results (indx_in).NAME || ': ' || results (indx_in).msg);
+ END;
+
+ PROCEDURE show (
+ run_id_in IN utr_outcome.run_id%TYPE := NULL,
+ reset_in IN BOOLEAN := FALSE
+ )
+ IS
+ indx PLS_INTEGER := results.FIRST;
+ l_id utr_outcome.run_id%TYPE := NVL (run_id_in, utplsql2.runnum);
+ norows BOOLEAN;
+ BEGIN
+
+ utreport.before_results(run_id_in);
+
+ FOR rec IN (SELECT *
+ FROM utr_outcome
+ WHERE run_id = l_id
+ ORDER BY tc_run_id -- 2.0.9.1
+ )
+ LOOP
+ IF rec.status = utplsql.c_success
+ AND
+ (NOT NVL (g_include_successes, FALSE )
+ -- 2.0.10.1
+ OR
+ utconfig.showingfailuresonly)
+ THEN
+ -- Ignore in this case
+ NULL;
+ ELSIF utconfig.showingfailuresonly
+ THEN
+ utreport.show_failure(rec);
+ ELSE
+ utreport.show_result(rec);
+ END IF;
+ END LOOP;
+
+ utreport.after_results(run_id_in);
+
+ utreport.before_errors(run_id_in);
+
+ FOR rec IN (SELECT *
+ FROM utr_error
+ WHERE run_id = l_id)
+ LOOP
+ utreport.show_error(rec);
+ END LOOP;
+
+ utreport.after_errors(run_id_in);
+
+ IF reset_in
+ THEN
+ init;
+ END IF;
+ END;
+
+ PROCEDURE showlast (run_id_in IN utr_outcome.run_id%TYPE := NULL)
+ IS
+ indx PLS_INTEGER := results.LAST;
+ BEGIN
+ -- 2.0.1 showheader;
+
+ IF failure
+ THEN
+ showone (run_id_in, indx);
+ END IF;
+ END;
+
+ PROCEDURE report (msg_in IN VARCHAR2)
+ IS
+ indx PLS_INTEGER := NVL (results.LAST, 0) + 1;
+ BEGIN
+ results (indx).NAME := utplsql.currcase.NAME;
+ results (indx).indx := utplsql.currcase.indx;
+ results (indx).msg := msg_in;
+ END;
+
+ PROCEDURE init (from_suite_in IN BOOLEAN := FALSE )
+ IS
+ BEGIN
+ results.DELETE;
+ -- Disable functionality
+ -- IF NOT from_suite_in THEN g_header_shown := FALSE; END IF;
+ END;
+
+ FUNCTION success (run_id_in IN utr_outcome.run_id%TYPE := NULL)
+ RETURN BOOLEAN
+ IS
+ l_count PLS_INTEGER;
+ BEGIN
+ RETURN utresult2.run_succeeded (NVL (run_id_in, utplsql2.runnum));
+ END;
+
+ FUNCTION failure (run_id_in IN utr_outcome.run_id%TYPE := NULL)
+ RETURN BOOLEAN
+ IS
+ BEGIN
+ RETURN (NOT success (run_id_in));
+ END;
+
+ PROCEDURE firstresult (run_id_in IN utr_outcome.run_id%TYPE := NULL)
+ IS
+ BEGIN
+ resultindx := results.FIRST;
+ END;
+
+ FUNCTION nextresult (run_id_in IN utr_outcome.run_id%TYPE := NULL)
+ RETURN result_rt
+ IS
+ BEGIN
+ /* 1.5.3 Must increment the counter */
+ IF resultindx IS NULL
+ THEN
+ firstresult;
+ ELSE
+ resultindx := results.NEXT (resultindx);
+ END IF;
+
+ RETURN results (resultindx);
+ END;
+
+ FUNCTION nthresult (
+ indx_in IN PLS_INTEGER,
+ run_id_in IN utr_outcome.run_id%TYPE := NULL
+ )
+ RETURN result_rt
+ IS
+ nullval result_rt;
+ BEGIN
+ IF indx_in > resultcount OR NOT results.EXISTS (indx_in)
+ THEN
+ RETURN nullval;
+ ELSE
+ RETURN results (indx_in);
+ END IF;
+ END;
+
+ PROCEDURE nextresult (
+ name_out OUT VARCHAR2,
+ msg_out OUT VARCHAR2,
+ case_indx_out OUT PLS_INTEGER,
+ run_id_in IN utr_outcome.run_id%TYPE := NULL
+ )
+ IS
+ rec result_rt;
+ BEGIN
+ rec := nextresult;
+ name_out := rec.NAME;
+ msg_out := rec.msg;
+ case_indx_out := rec.indx;
+ END;
+
+ PROCEDURE nthresult (
+ indx_in IN PLS_INTEGER,
+ name_out OUT VARCHAR2,
+ msg_out OUT VARCHAR2,
+ case_indx_out OUT PLS_INTEGER,
+ run_id_in IN utr_outcome.run_id%TYPE := NULL
+ )
+ IS
+ rec result_rt;
+ BEGIN
+ rec := nthresult (indx_in);
+ name_out := rec.NAME;
+ msg_out := rec.msg;
+ case_indx_out := rec.indx;
+ END;
+
+ FUNCTION resultcount (run_id_in IN utr_outcome.run_id%TYPE := NULL)
+ RETURN PLS_INTEGER
+ IS
+ BEGIN
+ RETURN results.COUNT;
+ END;
+ /*
+ proc: showsuite
+ Show result for whole suite using reporter
+ */
+ PROCEDURE showsuite(
+ suite_id ut_suite.id%TYPE
+ )
+ IS
+
+ BEGIN
+ --show suite banner and statistics
+
+ utreport.before_suite_results(suite_id => suite_id);
+
+ FOR rec IN (
+ SELECT utp.last_run_id
+ FROM ut_package utp
+ WHERE utp.suite_id = showsuite.suite_id
+ --same order by as in utplsql.testsuite
+ ORDER BY utp.seq
+ ) LOOP
+ show(
+ run_id_in => rec.last_run_id,
+ reset_in => FALSE
+ );
+ END LOOP;
+ END showsuite;
+
+ FUNCTION suite_success (
+ suite_id ut_suite.id%TYPE
+ )
+ RETURN BOOLEAN
+ IS
+ BEGIN
+ RETURN utresult2.suite_succeded(suite_id => suite_id);
+ END suite_success;
+
+ FUNCTION suite_failure(
+ suite_id ut_suite.id%TYPE
+ )
+ RETURN BOOLEAN
+ IS
+ BEGIN
+ RETURN (NOT suite_success(suite_id => suite_id));
+ END suite_failure;
+
+ /*
+ func: get_suite_stats
+ return statistic on last run of suite.
+ Statistic consist of:
+ -number of packages
+ -number of packages succeeded
+ -number of asserts
+ -number of asserts succeeded
+ params:
+ suite_id - suite id
+ */
+ FUNCTION get_suite_stats(
+ suite_id ut_suite.id%TYPE
+ ) RETURN TSuiteStats
+ IS
+ Stats TSuiteStats;
+ BEGIN
+ SELECT COUNT(utp.id) total_cnt,
+ SUM(decode(utp.last_status,utresult2.c_success,1,0)) succeeded_cnt
+ INTO Stats.totalpackages,
+ stats.succeededpackages
+ FROM ut_package utp
+ WHERE utp.suite_id = get_suite_stats.suite_id;
+
+ SELECT COUNT(o.tc_run_id),
+ SUM(decode(o.status,utresult2.c_success,1,0))
+ INTO Stats.totalasserts,
+ Stats.succeededasserts
+ FROM utr_outcome o,
+ ut_package utp
+ WHERE o.run_id = utp.last_run_id
+ AND utp.suite_id = get_suite_stats.suite_id;
+
+ RETURN Stats;
+ END get_suite_stats;
+
+END utresult;
+/
diff --git a/source/ut_result.pks b/source/ut_result.pks
new file mode 100644
index 000000000..e78e02944
--- /dev/null
+++ b/source/ut_result.pks
@@ -0,0 +1,124 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE utresult
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ /* Test result record structure */
+ TYPE result_rt IS RECORD (
+ name VARCHAR2 (100),
+ msg VARCHAR2 (32767),
+ indx PLS_INTEGER,
+ status BOOLEAN /* V2 */);
+
+ TYPE result_tt IS TABLE OF result_rt
+ INDEX BY BINARY_INTEGER;
+
+ results result_tt;
+
+ TYPE TSuiteStats IS RECORD(
+ totalpackages PLS_INTEGER,
+ succeededpackages PLS_INTEGER,
+ totalasserts PLS_INTEGER,
+ succeededasserts PLS_INTEGER
+ );
+
+ PROCEDURE report (msg_in IN VARCHAR2);
+
+ PROCEDURE show (
+ run_id_in IN utr_outcome.run_id%TYPE := NULL,
+ reset_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE showone (
+ run_id_in IN utr_outcome.run_id%TYPE := NULL,
+ indx_in IN PLS_INTEGER
+ );
+
+ PROCEDURE showlast (run_id_in IN utr_outcome.run_id%TYPE := NULL);
+
+ PROCEDURE init (from_suite_in IN BOOLEAN := FALSE);
+
+ FUNCTION success (run_id_in IN utr_outcome.run_id%TYPE := NULL)
+ RETURN BOOLEAN;
+
+ FUNCTION failure (run_id_in IN utr_outcome.run_id%TYPE := NULL)
+ RETURN BOOLEAN;
+
+ PROCEDURE firstresult (run_id_in IN utr_outcome.run_id%TYPE := NULL);
+
+ FUNCTION nextresult (run_id_in IN utr_outcome.run_id%TYPE := NULL)
+ RETURN result_rt;
+
+ PROCEDURE nextresult (
+ name_out OUT VARCHAR2,
+ msg_out OUT VARCHAR2,
+ case_indx_out OUT PLS_INTEGER,
+ run_id_in IN utr_outcome.run_id%TYPE := NULL
+ );
+
+ FUNCTION nthresult (
+ indx_in IN PLS_INTEGER,
+ run_id_in IN utr_outcome.run_id%TYPE := NULL
+ )
+ RETURN result_rt;
+
+ PROCEDURE nthresult (
+ indx_in IN PLS_INTEGER,
+ name_out OUT VARCHAR2,
+ msg_out OUT VARCHAR2,
+ case_indx_out OUT PLS_INTEGER,
+ run_id_in IN utr_outcome.run_id%TYPE := NULL
+ );
+
+ FUNCTION resultcount (run_id_in IN utr_outcome.run_id%TYPE := NULL)
+ RETURN PLS_INTEGER;
+
+ procedure include_successes;
+ procedure ignore_successes;
+
+ PROCEDURE showsuite(
+ suite_id ut_suite.id%TYPE
+ );
+
+ FUNCTION suite_success (
+ suite_id ut_suite.id%TYPE
+ )
+ RETURN BOOLEAN;
+
+ FUNCTION suite_failure(
+ suite_id ut_suite.id%TYPE
+ )
+ RETURN BOOLEAN;
+
+ FUNCTION get_suite_stats(
+ suite_id ut_suite.id%TYPE
+ ) RETURN TSuiteStats;
+
+END utresult;
+/
diff --git a/source/ut_result2.pkb b/source/ut_result2.pkb
new file mode 100644
index 000000000..519ba1264
--- /dev/null
+++ b/source/ut_result2.pkb
@@ -0,0 +1,355 @@
+CREATE OR REPLACE PACKAGE BODY utresult2
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ PROCEDURE report (
+ outcome_in IN ut_outcome.ID%TYPE
+ ,description_in IN VARCHAR2
+ )
+ IS
+ BEGIN
+ NULL;
+ END;
+
+ PROCEDURE report (
+ outcome_in IN ut_outcome.ID%TYPE
+ ,test_failed_in IN BOOLEAN
+ ,description_in IN VARCHAR2
+ ,register_in IN BOOLEAN := TRUE
+ , -- v1 compatibility
+ showresults_in IN BOOLEAN := FALSE -- v1 compatibility
+ )
+ IS
+ l_id utr_outcome.outcome_id%TYPE := outcome_in;
+ l_description utr_outcome.description%TYPE := substr(description_in,1,2000);
+ BEGIN
+ IF utplsql2.tracing
+ THEN
+ utreport.pl ('Record outcome result:');
+ utreport.pl (utplsql2.runnum);
+ utreport.pl (utplsql2.tc_runnum);
+ utreport.pl (outcome_in);
+ utreport.pl (test_failed_in);
+ utreport.pl (description_in);
+ END IF;
+
+ IF register_in
+ THEN
+ IF l_id IS NULL
+ THEN
+ -- v1 compatibility. Create an outcome ID and
+ -- construct the message to match screen output.
+ l_id := utroutcome.next_v1_id (utplsql2.runnum);
+ l_description := substr(utplsql.currcase.NAME || ': ' || l_description,1,2000);
+ END IF;
+
+ utroutcome.RECORD (utplsql2.runnum
+ ,utplsql2.tc_runnum
+ , -- 2.0.9.1
+ l_id
+ ,test_failed_in
+ ,description_in
+ );
+ END IF;
+
+ -- v1 compatibility and output to screen
+ IF test_failed_in
+ THEN
+ IF register_in
+ THEN
+ utresult.report (description_in);
+ ELSE
+ utreport.pl (description_in);
+ END IF;
+
+ IF showresults_in AND register_in
+ THEN
+ utresult.showlast;
+ END IF;
+ END IF;
+ END;
+
+ -- NOTE: the logic in the following function is REPEATED three times.
+ -- Need to move to cursor variables or dynamic SQL.
+
+ FUNCTION run_succeeded (runnum_in IN utr_outcome.run_id%TYPE)
+ RETURN BOOLEAN
+ /* A run succeeds if
+ a. there are no FAILUREs
+ b. there are no errors
+ */
+ IS
+ l_val CHAR (1);
+ success_found BOOLEAN;
+ failure_found BOOLEAN;
+
+ CURSOR err_cur
+ IS
+ SELECT 'x'
+ FROM utr_error
+ WHERE run_id = runnum_in;
+
+ CURSOR stat_cur (status_in IN VARCHAR2)
+ IS
+ SELECT 'x'
+ FROM utr_outcome
+ WHERE run_id = runnum_in AND status LIKE status_in;
+ BEGIN
+ -- start: same for all *_succeeded programs
+ OPEN err_cur;
+ FETCH err_cur INTO l_val;
+ failure_found := err_cur%FOUND;
+
+ IF NOT failure_found
+ THEN
+ OPEN stat_cur (c_success);
+ FETCH stat_cur INTO l_val;
+ success_found := stat_cur%FOUND;
+ CLOSE stat_cur;
+ OPEN stat_cur (c_failure);
+ FETCH stat_cur INTO l_val;
+ failure_found := stat_cur%FOUND;
+ CLOSE stat_cur;
+ END IF;
+
+ IF NOT failure_found AND NOT success_found
+ THEN
+ RETURN NULL; -- Nothing was run.
+ ELSE
+ RETURN NOT failure_found;
+ END IF;
+ -- end: same for all *_succeeded programs
+ END run_succeeded;
+
+ FUNCTION run_status (runnum_in IN utr_outcome.run_id%TYPE)
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ IF run_succeeded (runnum_in)
+ THEN
+ RETURN c_success;
+ ELSE
+ RETURN c_failure;
+ END IF;
+ END;
+
+ FUNCTION utp_succeeded (
+ runnum_in IN utr_outcome.run_id%TYPE
+ ,utp_in IN utr_utp.utp_id%TYPE
+ )
+ RETURN BOOLEAN
+ IS
+ l_val CHAR (1);
+ success_found BOOLEAN;
+ failure_found BOOLEAN;
+
+ CURSOR err_cur
+ IS
+ SELECT 'x'
+ FROM utr_error
+ WHERE run_id = runnum_in
+ AND utp_id = utp_in
+ AND errlevel = ututp.c_abbrev;
+
+ CURSOR stat_cur (status_in IN VARCHAR2)
+ IS
+ SELECT 'x'
+ FROM utr_outcome
+ WHERE run_id = runnum_in
+ AND utoutcome.utp (outcome_id) = utp_in
+ AND status LIKE status_in;
+ BEGIN
+ OPEN err_cur;
+ FETCH err_cur INTO l_val;
+ failure_found := err_cur%FOUND;
+
+ IF NOT failure_found
+ THEN
+ OPEN stat_cur (c_success);
+ FETCH stat_cur INTO l_val;
+ success_found := stat_cur%FOUND;
+ CLOSE stat_cur;
+ OPEN stat_cur (c_failure);
+ FETCH stat_cur INTO l_val;
+ failure_found := stat_cur%FOUND;
+ CLOSE stat_cur;
+ END IF;
+
+ IF NOT failure_found AND NOT success_found
+ THEN
+ RETURN NULL; -- Nothing was run.
+ ELSE
+ RETURN NOT failure_found;
+ END IF;
+ END utp_succeeded;
+
+ FUNCTION utp_status (
+ runnum_in IN utr_outcome.run_id%TYPE
+ ,utp_in IN utr_utp.utp_id%TYPE
+ )
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ IF utp_succeeded (runnum_in, utp_in)
+ THEN
+ RETURN c_success;
+ ELSE
+ RETURN c_failure;
+ END IF;
+ END;
+
+ FUNCTION unittest_succeeded (
+ runnum_in IN utr_outcome.run_id%TYPE
+ ,unittest_in IN utr_unittest.unittest_id%TYPE
+ )
+ RETURN BOOLEAN
+ IS
+ l_val CHAR (1);
+ success_found BOOLEAN;
+ failure_found BOOLEAN;
+
+ CURSOR err_cur
+ IS
+ SELECT 'x'
+ FROM utr_error
+ WHERE run_id = runnum_in
+ AND unittest_id = unittest_in
+ AND errlevel = utunittest.c_abbrev;
+
+ CURSOR stat_cur (status_in IN VARCHAR2)
+ IS
+ SELECT 'x'
+ FROM utr_outcome
+ WHERE run_id = runnum_in
+ AND utoutcome.unittest (outcome_id) = unittest_in
+ AND status LIKE status_in;
+ BEGIN
+ OPEN err_cur;
+ FETCH err_cur INTO l_val;
+ failure_found := err_cur%FOUND;
+
+ IF NOT failure_found
+ THEN
+ OPEN stat_cur (c_success);
+ FETCH stat_cur INTO l_val;
+ success_found := stat_cur%FOUND;
+ CLOSE stat_cur;
+ OPEN stat_cur (c_failure);
+ FETCH stat_cur INTO l_val;
+ failure_found := stat_cur%FOUND;
+ CLOSE stat_cur;
+ END IF;
+
+ IF NOT failure_found AND NOT success_found
+ THEN
+ RETURN NULL; -- Nothing was run.
+ ELSE
+ RETURN NOT failure_found;
+ END IF;
+ END unittest_succeeded;
+
+ FUNCTION unittest_status (
+ runnum_in IN utr_outcome.run_id%TYPE
+ ,unittest_in IN utr_unittest.unittest_id%TYPE
+ )
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ IF unittest_succeeded (runnum_in, unittest_in)
+ THEN
+ RETURN c_success;
+ ELSE
+ RETURN c_failure;
+ END IF;
+ END;
+
+ FUNCTION results_headers (schema_in IN VARCHAR2, program_in IN VARCHAR2)
+ RETURN utconfig.refcur_t
+ IS
+ retval utconfig.refcur_t;
+ BEGIN
+ OPEN retval FOR
+ SELECT run_id, start_on, end_on, status
+ FROM ut_utp utp, utr_utp utpr
+ WHERE utp.ID = utpr.utp_id
+ AND utp.program = UPPER (program_in)
+ AND utp.owner = UPPER (schema_in)
+ ORDER BY end_on;
+ RETURN retval;
+ END results_headers;
+
+ FUNCTION results_details (
+ run_id_in IN utr_utp.run_id%TYPE
+ ,show_failures_only_in IN ut_config.show_failures_only%TYPE
+ )
+ RETURN utconfig.refcur_t
+ IS
+ retval utconfig.refcur_t;
+ BEGIN
+ OPEN retval FOR
+ SELECT start_on, end_on, status, description
+ FROM utr_outcome
+ WHERE run_id = run_id_in
+ AND ( show_failures_only_in = 'N'
+ OR (show_failures_only_in = 'Y' AND status = 'FAILURE'
+ )
+ )
+ ORDER BY start_on;
+ RETURN retval;
+ END results_details;
+ /*
+ func: suite_succeded
+ Return TRUE if last run for all packages of suite was successfull
+ otherwise return FALSE
+
+ parameters:
+ suuite_id
+ */
+ FUNCTION suite_succeded(
+ suite_id ut_suite.id%TYPE
+ )
+ RETURN BOOLEAN
+ IS
+ res BOOLEAN := TRUE;
+ BEGIN
+ FOR rec IN (
+ SELECT u.last_run_id
+ FROM ut_package u
+ WHERE u.suite_id = suite_succeded.suite_id
+ ) LOOP
+ res := res AND run_succeeded(runnum_in => rec.last_run_id);
+ IF NOT res THEN
+ EXIT;
+ END IF;
+ END LOOP;
+
+ RETURN res;
+ END suite_succeded;
+END utresult2;
+/
diff --git a/source/ut_result2.pks b/source/ut_result2.pks
new file mode 100644
index 000000000..dca31aab7
--- /dev/null
+++ b/source/ut_result2.pks
@@ -0,0 +1,110 @@
+CREATE OR REPLACE PACKAGE utresult2
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ c_success CONSTANT CHAR (7) := 'SUCCESS';
+ c_failure CONSTANT CHAR (7) := 'FAILURE';
+
+ /* Test result record structure */
+ TYPE result_rt IS RECORD (
+ NAME VARCHAR2 (100)
+ ,msg VARCHAR2 (32767)
+ ,indx PLS_INTEGER
+ );
+
+ TYPE result_tt IS TABLE OF result_rt
+ INDEX BY BINARY_INTEGER;
+
+ CURSOR results_header_cur (schema_in IN VARCHAR2, program_in IN VARCHAR2)
+ IS
+ SELECT run_id, start_on, end_on, status
+ FROM ut_utp utp, utr_utp utpr
+ WHERE utp.ID = utpr.utp_id
+ AND utp.program = program_in
+ AND utp.owner = schema_in;
+
+ PROCEDURE report (
+ outcome_in IN ut_outcome.ID%TYPE
+ ,description_in IN VARCHAR2
+ );
+
+ PROCEDURE report (
+ outcome_in IN ut_outcome.ID%TYPE
+ ,test_failed_in IN BOOLEAN
+ ,description_in IN VARCHAR2
+ ,register_in IN BOOLEAN := TRUE
+ , -- v1 compatibility
+ showresults_in IN BOOLEAN := FALSE -- v1 compatibility
+ );
+
+ FUNCTION run_succeeded (runnum_in IN utr_outcome.run_id%TYPE)
+ RETURN BOOLEAN;
+
+ FUNCTION run_status (runnum_in IN utr_outcome.run_id%TYPE)
+ RETURN VARCHAR2;
+
+ FUNCTION utp_succeeded (
+ runnum_in IN utr_outcome.run_id%TYPE
+ ,utp_in IN utr_utp.utp_id%TYPE
+ )
+ RETURN BOOLEAN;
+
+ FUNCTION utp_status (
+ runnum_in IN utr_outcome.run_id%TYPE
+ ,utp_in IN utr_utp.utp_id%TYPE
+ )
+ RETURN VARCHAR2;
+
+ FUNCTION unittest_succeeded (
+ runnum_in IN utr_outcome.run_id%TYPE
+ ,unittest_in IN utr_unittest.unittest_id%TYPE
+ )
+ RETURN BOOLEAN;
+
+ FUNCTION unittest_status (
+ runnum_in IN utr_outcome.run_id%TYPE
+ ,unittest_in IN utr_unittest.unittest_id%TYPE
+ )
+ RETURN VARCHAR2;
+
+ FUNCTION results_headers (schema_in IN VARCHAR2, program_in IN VARCHAR2)
+ RETURN utconfig.refcur_t;
+
+ FUNCTION results_details (
+ run_id_in IN utr_utp.run_id%TYPE
+ ,show_failures_only_in IN ut_config.show_failures_only%TYPE
+ )
+ RETURN utconfig.refcur_t;
+
+ FUNCTION suite_succeded(
+ suite_id ut_suite.id%TYPE
+ )
+ RETURN BOOLEAN;
+END utresult2;
+/
diff --git a/source/ut_routcome.pkb b/source/ut_routcome.pkb
new file mode 100644
index 000000000..d5c976d4e
--- /dev/null
+++ b/source/ut_routcome.pkb
@@ -0,0 +1,235 @@
+CREATE OR REPLACE PACKAGE BODY utroutcome
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.3 2004/11/16 09:46:49 chrisrimmer
+Changed to new version detection system.
+
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ PROCEDURE initiate (
+ run_id_in IN utr_outcome.run_id%TYPE
+ , outcome_id_in IN utr_outcome.outcome_id%TYPE
+ , start_on_in IN DATE := SYSDATE
+ )
+ IS
+ &start_ge_8_1
+ PRAGMA AUTONOMOUS_TRANSACTION;
+ &end_ge_8_1
+ BEGIN
+ utplsql2.set_current_outcome (outcome_id_in);
+
+ INSERT INTO utr_outcome
+ (run_id, outcome_id, start_on
+ )
+ VALUES (run_id_in, outcome_id_in, start_on_in
+ );
+
+ &start_ge_8_1
+ COMMIT;
+ &end_ge_8_1
+ EXCEPTION
+ WHEN DUP_VAL_ON_INDEX
+ THEN
+ -- Run has already been initiated. Ignore...
+ NULL;
+ &start_ge_8_1
+ ROLLBACK;
+ &end_ge_8_1
+ WHEN OTHERS
+ THEN
+ &start_ge_8_1
+ ROLLBACK;
+ &end_ge_8_1
+ utrerror.oc_report (run_id_in
+ , outcome_id_in
+ , SQLCODE
+ , SQLERRM
+ , 'Unable to initiate outcome for run '
+ || run_id_in
+ || ' outcome ID '
+ || outcome_id_in
+ );
+ END initiate;
+
+ PROCEDURE RECORD (
+ run_id_in IN utr_outcome.run_id%TYPE
+ , tc_run_id_in IN PLS_INTEGER
+ , outcome_id_in IN utr_outcome.outcome_id%TYPE
+ , test_failed_in IN BOOLEAN
+ , description_in IN VARCHAR2 := NULL
+ , end_on_in IN DATE := SYSDATE
+ )
+ IS
+ &start_ge_8_1
+ PRAGMA AUTONOMOUS_TRANSACTION;
+
+ &end_ge_8_1
+
+ CURSOR start_cur (id_in IN utr_outcome.outcome_id%TYPE)
+ IS
+ SELECT start_on, end_on
+ FROM utr_outcome
+ WHERE run_id = run_id_in AND outcome_id = id_in;
+
+ rec start_cur%ROWTYPE;
+ l_status utr_outcome.status%TYPE;
+ BEGIN
+ -- FALSE means that the test succeeded.
+ IF test_failed_in
+ THEN
+ l_status := utresult2.c_failure;
+ ELSE
+ l_status := utresult2.c_success;
+ END IF;
+
+ OPEN start_cur (outcome_id_in);
+ FETCH start_cur INTO rec;
+
+ IF start_cur%FOUND AND rec.end_on IS NULL
+ THEN
+ UPDATE utr_outcome
+ SET end_on = end_on_in
+ , status = l_status
+ , description = description_in
+ WHERE run_id = run_id_in AND outcome_id = outcome_id_in;
+ ELSIF start_cur%FOUND AND rec.end_on IS NOT NULL
+ THEN
+ -- Run is already terminated. Ignore...
+ NULL;
+ ELSE
+ INSERT INTO utr_outcome
+ (run_id, tc_run_id, outcome_id, status
+ , end_on, description
+ )
+ VALUES (run_id_in, tc_run_id_in, outcome_id_in, l_status
+ , end_on_in, substr(description_in,1,2000)
+ );
+
+ utplsql2.move_ahead_tc_runnum; -- 2.0.9.1
+ END IF;
+
+ CLOSE start_cur;
+ &start_ge_8_1
+ COMMIT;
+ &end_ge_8_1
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ &start_ge_8_1
+ ROLLBACK;
+ &end_ge_8_1
+ utrerror.oc_report (run_id_in
+ , outcome_id_in
+ , SQLCODE
+ , SQLERRM
+ , 'Unable to insert or update the utr_outcome table for run '
+ || run_id_in
+ || ' outcome ID '
+ || outcome_id_in
+ );
+ END RECORD;
+
+ FUNCTION next_v1_id (run_id_in IN utr_outcome.run_id%TYPE)
+ RETURN utr_outcome.outcome_id%TYPE
+ IS
+ retval utr_outcome.outcome_id%TYPE;
+ BEGIN
+ SELECT MIN (outcome_id)
+ INTO retval
+ FROM utr_outcome
+ WHERE run_id = run_id_in;
+
+ retval := LEAST (NVL (retval, 0), 0) - 1;
+ RETURN retval;
+ END;
+
+ PROCEDURE clear_results (run_id_in IN utr_outcome.run_id%TYPE)
+ IS
+ &start_ge_8_1
+ PRAGMA AUTONOMOUS_TRANSACTION;
+ &end_ge_8_1
+ BEGIN
+ DELETE FROM utr_outcome
+ WHERE run_id = run_id_in;
+
+ &start_ge_8_1
+ COMMIT;
+ &end_ge_8_1
+ END;
+
+ PROCEDURE clear_results (
+ owner_in IN VARCHAR2
+ , program_in IN VARCHAR2
+ , start_from_in IN DATE
+ )
+ IS
+ &start_ge_8_1
+ PRAGMA AUTONOMOUS_TRANSACTION;
+ &end_ge_8_1
+ BEGIN
+ DELETE FROM utr_outcome
+ WHERE start_on >= start_from_in
+ AND run_id IN (
+ SELECT r.run_id
+ FROM utr_utp r, ut_utp u
+ WHERE r.utp_id = u.ID
+ AND u.owner = owner_in
+ AND u.program = program_in);
+
+ &start_ge_8_1
+ COMMIT;
+ &end_ge_8_1
+ END;
+
+ PROCEDURE clear_all_but_last (owner_in IN VARCHAR2, program_in IN VARCHAR2)
+ IS
+ &start_ge_8_1
+ PRAGMA AUTONOMOUS_TRANSACTION;
+ &end_ge_8_1
+ BEGIN
+ DELETE FROM utr_outcome
+ WHERE start_on <
+ (SELECT MAX (o.start_on)
+ FROM utr_outcome o, utr_utp r, ut_utp u
+ WHERE r.utp_id = u.ID
+ AND u.owner = owner_in
+ AND u.program = program_in
+ AND o.run_id = r.run_id)
+ AND run_id IN (
+ SELECT r.run_id
+ FROM utr_utp r, ut_utp u
+ WHERE r.utp_id = u.ID
+ AND u.owner = owner_in
+ AND u.program = program_in);
+ &start_ge_8_1
+ COMMIT;
+ &start_ge_8_1
+ END;
+END utroutcome;
+/
+
diff --git a/source/ut_routcome.pks b/source/ut_routcome.pks
new file mode 100644
index 000000000..3c474038c
--- /dev/null
+++ b/source/ut_routcome.pks
@@ -0,0 +1,60 @@
+CREATE OR REPLACE PACKAGE utroutcome
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ PROCEDURE RECORD (
+ run_id_in IN utr_outcome.run_id%TYPE
+ , tc_run_id_in IN PLS_INTEGER
+ , outcome_id_in IN utr_outcome.outcome_id%TYPE
+ , test_failed_in IN BOOLEAN
+ , description_in IN VARCHAR2 := NULL
+ , end_on_in IN DATE := SYSDATE
+ );
+
+ PROCEDURE initiate (
+ run_id_in IN utr_outcome.run_id%TYPE
+ , outcome_id_in IN utr_outcome.outcome_id%TYPE
+ , start_on_in IN DATE := SYSDATE
+ );
+
+ FUNCTION next_v1_id (run_id_in IN utr_outcome.run_id%TYPE)
+ RETURN utr_outcome.outcome_id%TYPE;
+
+ PROCEDURE clear_results (run_id_in IN utr_outcome.run_id%TYPE);
+
+ PROCEDURE clear_results (
+ owner_in IN VARCHAR2
+ , program_in IN VARCHAR2
+ , start_from_in IN DATE
+ );
+
+ PROCEDURE clear_all_but_last (owner_in IN VARCHAR2, program_in IN VARCHAR2);
+END utroutcome;
+/
+
diff --git a/source/ut_rsuite.pkb b/source/ut_rsuite.pkb
new file mode 100644
index 000000000..174a9342b
--- /dev/null
+++ b/source/ut_rsuite.pkb
@@ -0,0 +1,145 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE BODY utrsuite
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.3 2004/11/16 09:46:49 chrisrimmer
+Changed to new version detection system.
+
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ PROCEDURE initiate (
+ run_id_in IN utr_suite.run_id%TYPE,
+ suite_id_in IN utr_suite.suite_id%TYPE,
+ start_on_in IN DATE := SYSDATE
+ )
+ IS
+ &start_ge_8_1
+ PRAGMA autonomous_transaction;
+ &end_ge_8_1
+
+ BEGIN
+ utplsql2.set_current_suite (suite_id_in);
+
+ INSERT INTO utr_suite
+ (run_id, suite_id, start_on)
+ VALUES (run_id_in, suite_id_in, start_on_in);
+
+ &start_ge_8_1
+ COMMIT;
+ &end_ge_8_1
+ EXCEPTION
+ WHEN DUP_VAL_ON_INDEX
+ THEN
+ -- Run has already been initiated. Ignore...
+ NULL;
+ &start_ge_8_1
+ ROLLBACK;
+ &end_ge_8_1
+ WHEN OTHERS
+ THEN
+ &start_ge_8_1
+ ROLLBACK;
+ &end_ge_8_1
+ utrerror.suite_report (
+ run_id_in,
+ suite_id_in,
+ SQLCODE,
+ SQLERRM,
+ 'Unable to initiate suite for run '
+ || run_id_in
+ || ' SUITE ID '
+ || suite_id_in
+ );
+ END initiate;
+
+ PROCEDURE terminate (
+ run_id_in IN utr_suite.run_id%TYPE,
+ suite_id_in IN utr_suite.suite_id%TYPE,
+ end_on_in IN DATE := SYSDATE
+ )
+ IS
+ &start_ge_8_1
+ PRAGMA autonomous_transaction;
+
+ &end_ge_8_1
+
+ CURSOR start_cur
+ IS
+ SELECT start_on, end_on
+ FROM utr_suite
+ WHERE run_id = run_id_in
+ AND suite_id_in = suite_id;
+
+ rec start_cur%ROWTYPE;
+ l_status utr_suite.status%TYPE;
+ BEGIN
+ l_status := utresult2.run_status (run_id_in);
+ OPEN start_cur;
+ FETCH start_cur INTO rec;
+
+ IF start_cur%FOUND
+ AND rec.end_on IS NULL
+ THEN
+ UPDATE utr_suite
+ SET end_on = end_on_in,
+ status = l_status
+ WHERE run_id = run_id_in
+ AND suite_id_in = suite_id;
+ ELSIF start_cur%FOUND
+ AND rec.end_on IS NOT NULL
+ THEN
+ -- Run is already terminated. Ignore...
+ NULL;
+ ELSE
+ INSERT INTO utr_suite
+ (run_id, suite_id, status, end_on)
+ VALUES (run_id_in, suite_id_in, l_status, end_on_in);
+ END IF;
+
+ &start_ge_8_1
+ COMMIT;
+ &end_ge_8_1
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ &start_ge_8_1
+ ROLLBACK;
+ &end_ge_8_1
+ utrerror.suite_report (
+ run_id_in,
+ suite_id_in,
+ SQLCODE,
+ SQLERRM,
+ 'Unable to insert or update the utr_suite table for run '
+ || run_id_in
+ || ' SUITE ID '
+ || suite_id_in
+ );
+ END terminate;
+END utrsuite;
+/
diff --git a/source/ut_rsuite.pks b/source/ut_rsuite.pks
new file mode 100644
index 000000000..ad39fe58f
--- /dev/null
+++ b/source/ut_rsuite.pks
@@ -0,0 +1,44 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE utrsuite
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ PROCEDURE terminate (
+ run_id_in IN utr_suite.run_id%TYPE,
+ suite_id_in IN utr_suite.suite_id%TYPE,
+ end_on_in IN DATE := SYSDATE
+ );
+
+ PROCEDURE initiate (
+ run_id_in IN utr_suite.run_id%TYPE,
+ suite_id_in IN utr_suite.suite_id%TYPE,
+ start_on_in IN DATE := SYSDATE
+ );
+END utrsuite;
+/
diff --git a/source/ut_rtestcase.pkb b/source/ut_rtestcase.pkb
new file mode 100644
index 000000000..bbefd44d4
--- /dev/null
+++ b/source/ut_rtestcase.pkb
@@ -0,0 +1,139 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE BODY utrtestcase
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.3 2004/11/16 09:46:49 chrisrimmer
+Changed to new version detection system.
+
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ PROCEDURE initiate (
+ run_id_in IN utr_testcase.run_id%TYPE,
+ testcase_id_in IN utr_testcase.testcase_id%TYPE,
+ start_on_in IN DATE := SYSDATE
+ )
+ IS
+ &start_ge_8_1
+ PRAGMA autonomous_transaction;
+ &end_ge_8_1
+ BEGIN
+ INSERT INTO utr_testcase
+ (run_id, testcase_id, start_on)
+ VALUES (run_id_in, testcase_id_in, start_on_in);
+ EXCEPTION
+ WHEN DUP_VAL_ON_INDEX
+ THEN
+ -- Run has already been initiated. Ignore...
+ NULL;
+ &start_ge_8_1
+ ROLLBACK;
+ &end_ge_8_1
+ WHEN OTHERS
+ THEN
+ &start_ge_8_1
+ ROLLBACK;
+ &end_ge_8_1
+ utrerror.tc_report (
+ run_id_in,
+ testcase_id_in,
+ SQLCODE,
+ SQLERRM,
+ 'Unable to initiate testcase for run '
+ || run_id_in
+ || ' testcase ID '
+ || testcase_id_in
+ );
+ END initiate;
+
+ PROCEDURE terminate (
+ run_id_in IN utr_testcase.run_id%TYPE,
+ testcase_id_in IN utr_testcase.testcase_id%TYPE,
+ end_on_in IN DATE := SYSDATE
+ )
+ IS
+ &start_ge_8_1
+ PRAGMA autonomous_transaction;
+
+ &end_ge_8_1
+ CURSOR start_cur
+ IS
+ SELECT start_on, end_on
+ FROM utr_testcase
+ WHERE run_id = run_id_in
+ AND testcase_id_in = testcase_id;
+
+ rec start_cur%ROWTYPE;
+ l_status utr_testcase.status%TYPE;
+ BEGIN
+ l_status := utresult2.run_status (run_id_in);
+ OPEN start_cur;
+ FETCH start_cur INTO rec;
+
+ IF start_cur%FOUND
+ AND rec.end_on IS NULL
+ THEN
+ UPDATE utr_testcase
+ SET end_on = end_on_in,
+ status = l_status
+ WHERE run_id = run_id_in
+ AND testcase_id_in = testcase_id;
+ ELSIF start_cur%FOUND
+ AND rec.end_on IS NOT NULL
+ THEN
+ -- Run is already terminated. Ignore...
+ NULL;
+ ELSE
+ INSERT INTO utr_testcase
+ (run_id, testcase_id, status, end_on)
+ VALUES (run_id_in, testcase_id_in, l_status, end_on_in);
+ END IF;
+
+ CLOSE start_cur;
+ CLOSE start_cur;
+ &start_ge_8_1
+ COMMIT;
+ &end_ge_8_1
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ &start_ge_8_1
+ ROLLBACK;
+ &end_ge_8_1
+ utrerror.oc_report (
+ run_id_in,
+ testcase_id_in,
+ SQLCODE,
+ SQLERRM,
+ 'Unable to insert or update the utr_testcase table for run '
+ || run_id_in
+ || ' testcase ID '
+ || testcase_id_in
+ );
+ END terminate;
+END utrtestcase;
+/
diff --git a/source/ut_rtestcase.pks b/source/ut_rtestcase.pks
new file mode 100644
index 000000000..bebc37e8b
--- /dev/null
+++ b/source/ut_rtestcase.pks
@@ -0,0 +1,44 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE utrtestcase
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ PROCEDURE terminate (
+ run_id_in IN utr_testcase.run_id%TYPE,
+ testcase_id_in IN utr_testcase.testcase_id%TYPE,
+ end_on_in IN DATE := SYSDATE
+ );
+
+ PROCEDURE initiate (
+ run_id_in IN utr_testcase.run_id%TYPE,
+ testcase_id_in IN utr_testcase.testcase_id%TYPE,
+ start_on_in IN DATE := SYSDATE
+ );
+END utrtestcase;
+/
diff --git a/source/ut_runittest.pkb b/source/ut_runittest.pkb
new file mode 100644
index 000000000..86c3d7dfb
--- /dev/null
+++ b/source/ut_runittest.pkb
@@ -0,0 +1,147 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE BODY utrunittest
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.3 2004/11/16 09:46:49 chrisrimmer
+Changed to new version detection system.
+
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ PROCEDURE initiate (
+ run_id_in IN utr_unittest.run_id%TYPE,
+ unittest_id_in IN utr_unittest.unittest_id%TYPE,
+ start_on_in IN DATE := SYSDATE
+ )
+ IS
+ &start_ge_8_1
+ PRAGMA autonomous_transaction;
+ &end_ge_8_1
+ BEGIN
+ utplsql2.set_current_unittest (unittest_id_in);
+
+ INSERT INTO utr_unittest
+ (run_id, unittest_id, start_on)
+ VALUES (run_id_in, unittest_id_in, start_on_in);
+
+ &start_ge_8_1
+ COMMIT;
+ &end_ge_8_1
+ EXCEPTION
+ WHEN DUP_VAL_ON_INDEX
+ THEN
+ -- Run has already been initiated. Ignore...
+ NULL;
+ &start_ge_8_1
+ ROLLBACK;
+ &end_ge_8_1
+ WHEN OTHERS
+ THEN
+ &start_ge_8_1
+ ROLLBACK;
+ &end_ge_8_1
+ utrerror.ut_report (
+ run_id_in,
+ unittest_id_in,
+ SQLCODE,
+ SQLERRM,
+ 'Unable to initiate unit test for run '
+ || run_id_in
+ || ' unit test ID '
+ || unittest_id_in
+ );
+ END initiate;
+
+ PROCEDURE terminate (
+ run_id_in IN utr_unittest.run_id%TYPE,
+ unittest_id_in IN utr_unittest.unittest_id%TYPE,
+ end_on_in IN DATE := SYSDATE
+ )
+ IS
+ &start_ge_8_1
+ PRAGMA autonomous_transaction;
+
+ &end_ge_8_1
+
+ CURSOR start_cur
+ IS
+ SELECT start_on, end_on
+ FROM utr_unittest
+ WHERE run_id = run_id_in
+ AND unittest_id_in = unittest_id;
+
+ rec start_cur%ROWTYPE;
+ l_status utr_unittest.status%TYPE
+ := utresult2.unittest_status (run_id_in, unittest_id_in);
+ BEGIN
+ OPEN start_cur;
+ FETCH start_cur INTO rec;
+
+ IF start_cur%FOUND
+ AND rec.end_on IS NULL
+ THEN
+ UPDATE utr_unittest
+ SET end_on = end_on_in,
+ status = l_status
+ WHERE run_id = run_id_in
+ AND unittest_id_in = unittest_id;
+ ELSIF start_cur%FOUND
+ AND rec.end_on IS NOT NULL
+ THEN
+ -- Run is already terminated. Ignore...
+ NULL;
+ ELSE
+ INSERT INTO utr_unittest
+ (run_id, unittest_id, status, start_on,
+ end_on)
+ VALUES (run_id_in, unittest_id_in, l_status, SYSDATE,
+ end_on_in);
+ END IF;
+
+ CLOSE start_cur;
+ &start_ge_8_1
+ COMMIT;
+ &end_ge_8_1
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ &start_ge_8_1
+ ROLLBACK;
+ &end_ge_8_1
+ utrerror.ut_report (
+ run_id_in,
+ unittest_id_in,
+ SQLCODE,
+ SQLERRM,
+ 'Unable to insert or update the utr_unittest table for run '
+ || run_id_in
+ || ' outcome ID '
+ || unittest_id_in
+ );
+ END terminate;
+END utrunittest;
+/
diff --git a/source/ut_runittest.pks b/source/ut_runittest.pks
new file mode 100644
index 000000000..51042bb1f
--- /dev/null
+++ b/source/ut_runittest.pks
@@ -0,0 +1,44 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE utrunittest
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ PROCEDURE terminate (
+ run_id_in IN utr_unittest.run_id%TYPE,
+ unittest_id_in IN utr_unittest.unittest_id%TYPE,
+ end_on_in IN DATE := SYSDATE
+ );
+
+ PROCEDURE initiate (
+ run_id_in IN utr_unittest.run_id%TYPE,
+ unittest_id_in IN utr_unittest.unittest_id%TYPE,
+ start_on_in IN DATE := SYSDATE
+ );
+END utrunittest;
+/
diff --git a/source/ut_rutp.pkb b/source/ut_rutp.pkb
new file mode 100644
index 000000000..17d517abf
--- /dev/null
+++ b/source/ut_rutp.pkb
@@ -0,0 +1,233 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE BODY utrutp
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.3 2004/11/16 09:46:49 chrisrimmer
+Changed to new version detection system.
+
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ PROCEDURE initiate (
+ run_id_in IN utr_utp.run_id%TYPE,
+ utp_id_in IN utr_utp.utp_id%TYPE,
+ start_on_in IN DATE := SYSDATE
+ )
+ IS
+ &start_ge_8_1
+ PRAGMA autonomous_transaction;
+ &end_ge_8_1
+
+ BEGIN
+ utplsql2.set_current_utp (utp_id_in);
+
+ INSERT INTO utr_utp
+ (run_id, utp_id, start_on)
+ VALUES (run_id_in, utp_id_in, start_on_in);
+
+ &start_ge_8_1
+ COMMIT;
+ &end_ge_8_1
+ EXCEPTION
+ WHEN DUP_VAL_ON_INDEX
+ THEN
+ -- Run has already been initiated. Ignore...
+ NULL;
+ &start_ge_8_1
+ ROLLBACK;
+ &end_ge_8_1
+ WHEN OTHERS
+ THEN
+ &start_ge_8_1
+ ROLLBACK;
+ &end_ge_8_1
+ utrerror.utp_report (
+ run_id_in,
+ utp_id_in,
+ SQLCODE,
+ SQLERRM,
+ 'Unable to initiate UTP for run '
+ || run_id_in
+ || ' UTP ID '
+ || utp_id_in
+ );
+ END initiate;
+
+ PROCEDURE terminate (
+ run_id_in IN utr_utp.run_id%TYPE,
+ utp_id_in IN utr_utp.utp_id%TYPE,
+ end_on_in IN DATE := SYSDATE
+ )
+ IS
+ &start_ge_8_1
+ PRAGMA autonomous_transaction;
+
+ &end_ge_8_1
+
+ CURSOR start_cur
+ IS
+ SELECT start_on, end_on
+ FROM utr_utp
+ WHERE run_id = run_id_in
+ AND utp_id_in = utp_id;
+
+ rec start_cur%ROWTYPE;
+ l_status utr_utp.status%TYPE;
+ BEGIN
+ l_status := utresult2.run_status (run_id_in);
+ OPEN start_cur;
+ FETCH start_cur INTO rec;
+
+ IF start_cur%FOUND
+ AND rec.end_on IS NULL
+ THEN
+ UPDATE utr_utp
+ SET end_on = end_on_in,
+ status = l_status
+ WHERE run_id = run_id_in
+ AND utp_id_in = utp_id;
+ ELSIF start_cur%FOUND
+ AND rec.end_on IS NOT NULL
+ THEN
+ -- Run is already terminated. Ignore...
+ NULL;
+ ELSE
+ INSERT INTO utr_utp
+ (run_id, utp_id, status, start_on, end_on)
+ VALUES (run_id_in, utp_id_in, l_status, end_on_in, end_on_in);
+ END IF;
+
+ CLOSE start_cur;
+ &start_ge_8_1
+ COMMIT;
+ &end_ge_8_1
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ &start_ge_8_1
+ ROLLBACK;
+ &end_ge_8_1
+ utrerror.utp_report (
+ run_id_in,
+ utp_id_in,
+ SQLCODE,
+ SQLERRM,
+ 'Unable to insert or update the utr_utp table for run '
+ || run_id_in
+ || ' outcome ID '
+ || utp_id_in
+ );
+ END terminate;
+
+ PROCEDURE clear_results (run_id_in IN utr_utp.run_id%TYPE)
+ IS
+ &start_ge_8_1
+ PRAGMA AUTONOMOUS_TRANSACTION;
+ &end_ge_8_1
+ BEGIN
+ DELETE FROM utr_utp
+ WHERE run_id = run_id_in;
+
+ &start_ge_8_1
+ COMMIT;
+ &end_ge_8_1
+ END;
+
+ PROCEDURE clear_results (
+ owner_in IN VARCHAR2
+ , program_in IN VARCHAR2
+ , start_from_in IN DATE
+ )
+ IS
+ &start_ge_8_1
+ PRAGMA AUTONOMOUS_TRANSACTION;
+ &end_ge_8_1
+ BEGIN
+ DELETE FROM utr_utp
+ WHERE start_on >= start_from_in
+ AND run_id IN (
+ SELECT r.run_id
+ FROM utr_utp r, ut_utp u
+ WHERE r.utp_id = u.ID
+ AND u.owner = owner_in
+ AND u.program = program_in);
+
+ &start_ge_8_1
+ COMMIT;
+ &end_ge_8_1
+ END;
+
+ PROCEDURE clear_all_but_last (owner_in IN VARCHAR2, program_in IN VARCHAR2)
+ IS
+ &start_ge_8_1
+ PRAGMA AUTONOMOUS_TRANSACTION;
+ &end_ge_8_1
+ BEGIN
+ DELETE FROM utr_utp
+ WHERE start_on <
+ (SELECT MAX (r.start_on)
+ FROM utr_utp r, ut_utp u
+ WHERE r.utp_id = u.ID
+ AND u.owner = owner_in
+ AND u.program = program_in)
+ AND run_id IN (
+ SELECT r.run_id
+ FROM utr_utp r, ut_utp u
+ WHERE r.utp_id = u.ID
+ AND u.owner = owner_in
+ AND u.program = program_in);
+ &start_ge_8_1
+ COMMIT;
+ &start_ge_8_1
+ END;
+
+ FUNCTION last_run_status (owner_in IN VARCHAR2, program_in IN VARCHAR2)
+ RETURN utr_utp.status%TYPE
+ IS
+ retval utr_utp.status%TYPE;
+ BEGIN
+ SELECT status
+ INTO retval
+ FROM utr_utp
+ WHERE (utp_id, start_on) =
+ (SELECT r.utp_id, MAX (r.start_on)
+ FROM utr_utp r, ut_utp u
+ WHERE r.utp_id = u.ID
+ AND u.owner = owner_in
+ AND u.program = program_in
+ GROUP BY r.utp_id)
+ AND ROWNUM < 2;
+
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END;
+
+END utrutp;
+/
diff --git a/source/ut_rutp.pks b/source/ut_rutp.pks
new file mode 100644
index 000000000..95d5f292e
--- /dev/null
+++ b/source/ut_rutp.pks
@@ -0,0 +1,60 @@
+CREATE OR REPLACE PACKAGE utrutp
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ PROCEDURE TERMINATE (
+ run_id_in IN utr_utp.run_id%TYPE
+ , utp_id_in IN utr_utp.utp_id%TYPE
+ , end_on_in IN DATE := SYSDATE
+ );
+
+ PROCEDURE initiate (
+ run_id_in IN utr_utp.run_id%TYPE
+ , utp_id_in IN utr_utp.utp_id%TYPE
+ , start_on_in IN DATE := SYSDATE
+ );
+
+ PROCEDURE clear_results (run_id_in IN utr_utp.run_id%TYPE);
+
+ PROCEDURE clear_results (
+ owner_in IN VARCHAR2
+ , program_in IN VARCHAR2
+ , start_from_in IN DATE
+ );
+
+ PROCEDURE clear_all_but_last (owner_in IN VARCHAR2, program_in IN VARCHAR2);
+
+ function last_run_status (
+ owner_in IN VARCHAR2
+ , program_in IN VARCHAR2
+ )
+ return utr_utp.status%type;
+END utrutp;
+/
+
diff --git a/source/ut_suite.pkb b/source/ut_suite.pkb
new file mode 100644
index 000000000..c378fa90e
--- /dev/null
+++ b/source/ut_suite.pkb
@@ -0,0 +1,282 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE BODY utsuite
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.6 2004/11/23 14:56:48 chrisrimmer
+Moved dbms_pipe code into its own package. Also changed some preprocessor flags
+
+Revision 1.5 2004/11/16 09:46:49 chrisrimmer
+Changed to new version detection system.
+
+Revision 1.4 2004/07/14 17:01:57 chrisrimmer
+Added first version of pluggable reporter packages
+
+Revision 1.3 2003/12/23 15:30:53 chrisrimmer
+Added Jens Schauder's show_suites procedure
+
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ FUNCTION name_from_id (id_in IN ut_suite.id%TYPE)
+ RETURN ut_suite.name%TYPE
+ IS
+ retval ut_suite.name%TYPE;
+ BEGIN
+ SELECT name
+ INTO retval
+ FROM ut_suite
+ WHERE id = id_in;
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END;
+
+ FUNCTION id_from_name (name_in IN ut_suite.name%TYPE)
+ RETURN ut_suite.id%TYPE
+ IS
+ retval ut_suite.id%TYPE;
+ BEGIN
+ SELECT id
+ INTO retval
+ FROM ut_suite
+ WHERE name = UPPER (name_in);
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END;
+
+ FUNCTION onerow (name_in IN ut_suite.name%TYPE)
+ RETURN ut_suite%ROWTYPE
+ IS
+ retval ut_suite%ROWTYPE;
+ BEGIN
+ SELECT *
+ INTO retval
+ FROM ut_suite
+ WHERE name = UPPER (name_in);
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN retval;
+ END;
+
+ PROCEDURE ADD (
+ name_in IN ut_suite.name%TYPE,
+ desc_in IN VARCHAR2 := NULL,
+ rem_if_exists_in IN BOOLEAN := TRUE,
+ per_method_setup_in in ut_suite.per_method_setup%type := null
+ )
+ IS
+ &start_ge_8_1 PRAGMA AUTONOMOUS_TRANSACTION; &end_ge_8_1
+ v_id ut_suite.id%TYPE;
+ BEGIN
+ utrerror.assert (name_in IS NOT NULL, 'Suite names cannot be null.');
+
+ &start_ge_8_1 v_id := utplsql.seqval ('ut_suite'); &end_ge_8_1
+ &start_lt_8_1 SELECT ut_suite_seq.NEXTVAL INTO v_id FROM dual; &end_lt_8_1
+
+ INSERT INTO ut_suite
+ (id, name, description, executions, failures,per_method_setup)
+ VALUES (v_id, UPPER (name_in), desc_in, 0, 0,per_method_setup_in);
+ &start_ge_8_1 COMMIT; &end_ge_8_1
+ EXCEPTION
+ WHEN DUP_VAL_ON_INDEX
+ THEN
+ IF rem_if_exists_in
+ THEN
+ rem (name_in);
+ ADD (name_in, desc_in, per_method_setup_in => per_method_setup_in);
+ ELSE
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ RAISE;
+ END IF;
+ WHEN OTHERS
+ THEN
+
+ IF utrerror.uterrcode = utrerror.assertion_failure
+ THEN
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ raise;
+ ELSE
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ utrerror.report_define_error (
+ c_abbrev,
+ 'Suite '
+ || name_in
+ );
+ END IF;
+
+ END;
+
+ PROCEDURE rem (id_in IN ut_suite.id%TYPE)
+ IS
+ &start_ge_8_1 PRAGMA AUTONOMOUS_TRANSACTION; &end_ge_8_1
+ BEGIN
+ -- V1 compatibility
+ DELETE FROM ut_package
+ WHERE suite_id = id_in;
+
+ DELETE FROM ut_suite_utp
+ WHERE suite_id = id_in;
+
+ DELETE FROM ut_suite
+ WHERE id = id_in;
+ &start_ge_8_1 COMMIT; &end_ge_8_1
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ utreport.pl ( 'Remove suite error: '
+ || SQLERRM);
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ RAISE;
+ END;
+
+ PROCEDURE rem (name_in IN ut_suite.name%TYPE)
+ IS
+ &start_ge_8_1 PRAGMA AUTONOMOUS_TRANSACTION; &end_ge_8_1
+ v_id ut_suite.id%TYPE;
+ BEGIN
+ rem (id_from_name (name_in));
+ END;
+
+ PROCEDURE upd (
+ id_in IN ut_suite.id%TYPE,
+ start_in DATE,
+ end_in DATE,
+ successful_in in BOOLEAN,
+ per_method_setup_in in ut_suite.per_method_setup%type := null
+ )
+ IS
+ &start_ge_8_1 PRAGMA AUTONOMOUS_TRANSACTION; &end_ge_8_1
+ l_status VARCHAR2 (100) := utplsql.c_success;
+ v_failure PLS_INTEGER := 0;
+
+ PROCEDURE do_upd
+ IS
+ BEGIN
+ UPDATE ut_suite
+ SET last_status = l_status,
+ last_start = start_in,
+ last_end = end_in,
+ per_method_setup = per_method_setup_in,
+ executions = NVL (executions, 0)
+ + 1,
+ failures = NVL (failures, 0)
+ + v_failure
+ WHERE id = id_in;
+ END;
+ BEGIN
+ IF NOT successful_in
+ THEN
+ v_failure := 1;
+ l_status := utplsql.c_failure;
+ END IF;
+
+ do_upd;
+
+ IF SQL%ROWCOUNT = 0
+ THEN
+ ADD (
+ name_in=> name_from_id (id_in),
+ desc_in=> 'No description for "'
+ || name_from_id (id_in)
+ || '"',
+ rem_if_exists_in=> FALSE,
+ per_method_setup_in=>per_method_setup_in
+ );
+ do_upd;
+ END IF;
+ &start_ge_8_1 COMMIT; &end_ge_8_1
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ utreport.pl ( 'Update suite error: '
+ || SQLERRM);
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ RAISE;
+ END;
+
+ PROCEDURE upd (
+ name_in IN ut_suite.name%TYPE,
+ start_in DATE,
+ end_in DATE,
+ successful_in BOOLEAN,
+ per_method_setup_in in ut_suite.per_method_setup%type := null
+ )
+ IS
+ BEGIN
+ upd (id_from_name (name_in), start_in, end_in, successful_in,
+ per_method_setup_in);
+ END;
+
+ FUNCTION suites (name_like_in IN VARCHAR2 := '%')
+ RETURN utconfig.refcur_t
+ IS
+ retval utconfig.refcur_t;
+ BEGIN
+ OPEN retval FOR
+ SELECT *
+ FROM ut_suite
+ WHERE NAME LIKE UPPER (name_like_in);
+ RETURN retval;
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ RETURN retval;
+ END;
+
+ --Simply write out the results of the above to dbms_output
+ PROCEDURE show_suites (name_like_in IN VARCHAR2 := '%')
+ IS
+ indent VARCHAR2(20) := ' ';
+ suites_cur utconfig.refcur_t;
+ suite ut_suite%ROWTYPE;
+
+ CURSOR packages_cur (pi_id ut_suite.id%TYPE) IS
+ SELECT * FROM ut_package
+ WHERE suite_id = pi_id;
+
+ BEGIN
+ suites_cur := suites(name_like_in);
+
+ LOOP
+ FETCH suites_cur INTO suite;
+ EXIT WHEN suites_cur%NOTFOUND;
+ dbms_output.put_line(suite.name);
+ FOR pack IN packages_cur(suite.id) LOOP
+ dbms_output.put_line(indent || pack.name);
+ END LOOP;
+ END LOOP;
+ END show_suites;
+
+END utsuite;
+/
diff --git a/source/ut_suite.pks b/source/ut_suite.pks
new file mode 100644
index 000000000..90da3f0c1
--- /dev/null
+++ b/source/ut_suite.pks
@@ -0,0 +1,87 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE utsuite -- &start_ge_8_1 AUTHID CURRENT_USER &end_ge_8_1
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.3 2003/12/23 15:30:54 chrisrimmer
+Added Jens Schauder's show_suites procedure
+
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ /* Test suite API */
+
+ c_name CONSTANT CHAR (18) := 'TEST SUITE PACKAGE';
+ c_abbrev CONSTANT CHAR (5) := 'SUITE';
+
+ FUNCTION name_from_id (id_in IN ut_suite.id%TYPE)
+ RETURN ut_suite.name%TYPE;
+
+ FUNCTION id_from_name (name_in IN ut_suite.name%TYPE)
+ RETURN ut_suite.id%TYPE;
+
+ FUNCTION onerow (name_in IN ut_suite.name%TYPE)
+ RETURN ut_suite%ROWTYPE;
+
+ PROCEDURE ADD (
+ name_in IN ut_suite.name%TYPE,
+ desc_in IN VARCHAR2 := NULL,
+ rem_if_exists_in IN BOOLEAN := TRUE,
+ per_method_setup_in in ut_suite.per_method_setup%type := null
+
+ );
+
+ PROCEDURE rem (name_in IN ut_suite.name%TYPE);
+
+ PROCEDURE rem (id_in IN ut_suite.id%TYPE);
+
+ PROCEDURE upd (
+ name_in IN ut_suite.name%TYPE,
+ start_in DATE,
+ end_in DATE,
+ successful_in BOOLEAN,
+ per_method_setup_in in ut_suite.per_method_setup%type := null
+ );
+
+ PROCEDURE upd (
+ id_in IN ut_suite.id%TYPE,
+ start_in DATE,
+ end_in DATE,
+ successful_in BOOLEAN,
+ per_method_setup_in in ut_suite.per_method_setup%type := null
+ );
+
+ --Get a ref cursor returning suite details
+ FUNCTION suites (
+ name_like_in IN VARCHAR2 := '%'
+ )
+ RETURN utconfig.refcur_t;
+
+ --Simply write out the results of the above to dbms_output
+ PROCEDURE show_suites (name_like_in IN VARCHAR2 := '%');
+
+END utsuite;
+/
diff --git a/source/ut_suite.tab b/source/ut_suite.tab
new file mode 100644
index 000000000..7fc835a23
--- /dev/null
+++ b/source/ut_suite.tab
@@ -0,0 +1,19 @@
+CREATE TABLE ut_suite (
+ id INTEGER,
+ name VARCHAR2(200),
+ description VARCHAR2(2000),
+ frequency VARCHAR2(2000),
+ created_by VARCHAR2(30),
+ created_on DATE,
+ executions INTEGER, -- V2 no longer used. see utr_suite
+ failures INTEGER, -- V2 no longer used. see utr_suite
+ last_status VARCHAR2(20), -- V2 no longer used. see utr_suite
+ last_start DATE, -- V2 no longer used. see utr_suite
+ last_end DATE, -- V2 no longer used. see utr_suite
+ per_method_setup char(1), -- 2.0.8.1
+ CONSTRAINT ut_suite_pk PRIMARY KEY (id)
+);
+
+CREATE unique index ut_suite_idx1 ON
+ ut_suite (name);
+
diff --git a/source/ut_suite_seq.seq b/source/ut_suite_seq.seq
new file mode 100644
index 000000000..61195ee47
--- /dev/null
+++ b/source/ut_suite_seq.seq
@@ -0,0 +1 @@
+CREATE sequence ut_suite_seq INCREMENT BY 1 START WITH 1 ORDER NOCACHE;
diff --git a/source/ut_suite_utp.tab b/source/ut_suite_utp.tab
new file mode 100644
index 000000000..c22a938b5
--- /dev/null
+++ b/source/ut_suite_utp.tab
@@ -0,0 +1,11 @@
+create table ut_suite_utp (
+suite_id integer,
+utp_id integer,
+seq integer
+);
+
+ALTER table ut_suite_utp add CONSTRAINT ut_suite_utp_pk
+ primary key (suite_id, utp_id);
+
+REM 2.1 - Allow enable/disable of individual packages in the suite.
+ALTER table ut_suite_utp add enabled VARCHAR2(1);
diff --git a/source/ut_suiteutp.pkb b/source/ut_suiteutp.pkb
new file mode 100644
index 000000000..1054bc599
--- /dev/null
+++ b/source/ut_suiteutp.pkb
@@ -0,0 +1,194 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE BODY utsuiteutp
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.5 2005/01/19 16:10:59 chrisrimmer
+Removed AUTHID clauses from package bodies
+
+Revision 1.4 2004/11/16 09:46:49 chrisrimmer
+Changed to new version detection system.
+
+Revision 1.3 2004/07/14 17:01:57 chrisrimmer
+Added first version of pluggable reporter packages
+
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ FUNCTION defined (
+ suite_id_in IN ut_suite.id%TYPE,
+ utp_id_in IN ut_utp.id%TYPE
+ )
+ RETURN BOOLEAN
+ IS
+ l_val CHAR (1);
+ BEGIN
+ SELECT 'x'
+ INTO l_val
+ FROM ut_suite_utp
+ WHERE suite_id = suite_id_in
+ AND utp_id_in = utp_id;
+ RETURN TRUE;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN FALSE;
+ END;
+
+ FUNCTION seq (
+ suite_id_in IN ut_suite.id%TYPE,
+ utp_id_in IN ut_utp.id%TYPE
+ )
+ RETURN ut_suite_utp.seq%TYPE
+ IS
+ retval ut_suite_utp.seq%TYPE;
+ BEGIN
+ SELECT seq
+ INTO retval
+ FROM ut_suite_utp
+ WHERE suite_id = suite_id_in
+ AND utp_id_in = utp_id;
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END;
+
+ FUNCTION enabled (
+ suite_id_in IN ut_suite.id%TYPE,
+ utp_id_in IN ut_utp.id%TYPE
+ )
+ RETURN ut_suite_utp.enabled%TYPE
+ IS
+ l_val ut_suite_utp.enabled%TYPE;
+ BEGIN
+ SELECT enabled
+ INTO l_val
+ FROM ut_suite_utp
+ WHERE suite_id = suite_id_in
+ AND utp_id_in = utp_id;
+ RETURN l_val;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END;
+
+ PROCEDURE ADD (
+ suite_id_in IN ut_suite.id%TYPE,
+ utp_id_in IN ut_utp.id%TYPE,
+ seq_in IN ut_suite_utp.seq%TYPE := NULL
+ ,enabled_in IN ut_suite_utp.enabled%TYPE := NULL
+ )
+ IS
+ &start_ge_8_1 PRAGMA AUTONOMOUS_TRANSACTION; &end_ge_8_1
+ BEGIN
+ utrerror.assert (suite_id_in IS NOT NULL, 'Suite ID cannot be null.');
+ utrerror.assert (utp_id_in IS NOT NULL, 'UTP ID cannot be null.');
+
+ INSERT INTO ut_suite_utp
+ (suite_id, utp_id, seq, enabled)
+ VALUES (suite_id_in, utp_id_in, seq_in, enabled_in);
+ &start_ge_8_1 COMMIT; &end_ge_8_1
+ EXCEPTION
+ WHEN DUP_VAL_ON_INDEX
+ THEN
+ -- already exists. Just ignore.
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ NULL;
+ WHEN OTHERS
+ THEN
+ IF utrerror.uterrcode = utrerror.assertion_failure
+ THEN
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ raise;
+ ELSE
+
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ utrerror.report_define_error (
+ c_abbrev,
+ 'Suite '
+ || suite_id_in
+ || ' UTP '
+ || utp_id_in
+ );
+ end if;
+ END;
+
+ PROCEDURE rem (
+ suite_id_in IN ut_suite.id%TYPE,
+ utp_id_in IN ut_utp.id%TYPE
+ )
+ IS
+ &start_ge_8_1
+ PRAGMA autonomous_transaction;
+ &end_ge_8_1
+ BEGIN
+ DELETE FROM ut_suite_utp
+ WHERE suite_id = suite_id_in
+ AND utp_id = utp_id_in;
+ &start_ge_8_1 COMMIT; &end_ge_8_1
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ utreport.pl ( 'Remove suite-utp error: '
+ || SQLERRM);
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ RAISE;
+ END;
+
+
+ FUNCTION utps (
+ suite_in in ut_suite.id%TYPE
+ )
+ RETURN utconfig.refcur_t
+ IS
+ retval utconfig.refcur_t;
+ BEGIN
+ OPEN retval FOR
+ SELECT u.program, u.name, u.id utp_id, su.enabled
+ FROM ut_utp u, ut_suite_utp su
+ WHERE su.suite_id = suite_in
+ and su.utp_id = u.id;
+ RETURN retval;
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ RETURN retval;
+ END;
+
+ FUNCTION utps (
+ suite_in in ut_suite.name%TYPE
+ )
+ RETURN utconfig.refcur_t
+ IS
+ retval utconfig.refcur_t;
+ BEGIN
+ return utps (utsuite.id_from_name (suite_in));
+ END;
+END utsuiteutp;
+/
diff --git a/source/ut_suiteutp.pks b/source/ut_suiteutp.pks
new file mode 100644
index 000000000..c6f53df24
--- /dev/null
+++ b/source/ut_suiteutp.pks
@@ -0,0 +1,74 @@
+CREATE OR REPLACE PACKAGE utsuiteutp -- &start_ge_8_1 AUTHID CURRENT_USER &end_ge_8_1
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ c_name CONSTANT CHAR (18) := 'SUITE-UTP PACKAGE';
+ c_abbrev CONSTANT CHAR (9) := 'SUITE-UTP';
+
+ FUNCTION defined (
+ suite_id_in IN ut_suite.ID%TYPE
+ ,utp_id_in IN ut_utp.ID%TYPE
+ )
+ RETURN BOOLEAN;
+
+ FUNCTION seq (
+ suite_id_in IN ut_suite.ID%TYPE
+ ,utp_id_in IN ut_utp.ID%TYPE
+ )
+ RETURN ut_suite_utp.seq%TYPE;
+
+ PROCEDURE ADD (
+ suite_id_in IN ut_suite.ID%TYPE
+ ,utp_id_in IN ut_utp.ID%TYPE
+ ,seq_in IN ut_suite_utp.seq%TYPE := NULL
+ ,enabled_in IN ut_suite_utp.enabled%TYPE := NULL
+ );
+
+ FUNCTION enabled (
+ suite_id_in IN ut_suite.ID%TYPE
+ ,utp_id_in IN ut_utp.ID%TYPE
+ )
+ RETURN ut_suite_utp.enabled%TYPE;
+
+ PROCEDURE REM (
+ suite_id_in IN ut_suite.ID%TYPE
+ ,utp_id_in IN ut_utp.ID%TYPE
+ );
+
+ FUNCTION utps (
+ suite_in in ut_suite.name%TYPE
+ )
+ RETURN utconfig.refcur_t;
+
+ FUNCTION utps (
+ suite_in in ut_suite.id%TYPE
+ )
+ RETURN utconfig.refcur_t;
+END utsuiteutp;
+/
diff --git a/source/ut_test.pkb b/source/ut_test.pkb
new file mode 100644
index 000000000..43c845110
--- /dev/null
+++ b/source/ut_test.pkb
@@ -0,0 +1,188 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE BODY uttest
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.5 2004/11/23 14:56:48 chrisrimmer
+Moved dbms_pipe code into its own package. Also changed some preprocessor flags
+
+Revision 1.4 2004/11/16 09:46:49 chrisrimmer
+Changed to new version detection system.
+
+Revision 1.3 2004/07/14 17:01:57 chrisrimmer
+Added first version of pluggable reporter packages
+
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ FUNCTION name_from_id (id_in IN ut_test.id%TYPE)
+ RETURN ut_test.name%TYPE
+ IS
+ retval ut_test.name%TYPE;
+ BEGIN
+ SELECT name
+ INTO retval
+ FROM ut_test
+ WHERE id = id_in;
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END;
+
+ FUNCTION id_from_name (name_in IN ut_test.name%TYPE)
+ RETURN ut_test.id%TYPE
+ IS
+ retval ut_test.id%TYPE;
+ BEGIN
+ SELECT name
+ INTO retval
+ FROM ut_test
+ WHERE name = UPPER (name_in);
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END;
+
+ PROCEDURE ADD (
+ package_in IN INTEGER,
+ test_in IN VARCHAR2,
+ desc_in IN VARCHAR2 := NULL,
+ seq_in IN PLS_INTEGER := NULL
+ )
+ IS
+ &start_ge_8_1 PRAGMA AUTONOMOUS_TRANSACTION; &end_ge_8_1
+ v_id ut_test.id%TYPE;
+ BEGIN
+ &start_ge_8_1 v_id := utplsql.seqval ('ut_test'); &end_ge_8_1
+ &start_lt_8_1 SELECT ut_test_seq.NEXTVAL INTO v_id FROM dual; &end_lt_8_1
+
+ INSERT INTO ut_test
+ (id, package_id, name, description,
+ seq)
+ VALUES (v_id, package_in, UPPER (test_in), desc_in,
+ NVL (seq_in, 1));
+ &start_ge_8_1 COMMIT; &end_ge_8_1
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ utreport.pl ( 'Add test error: '
+ || SQLERRM);
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ RAISE;
+ END;
+
+ PROCEDURE ADD (
+ package_in IN VARCHAR2,
+ test_in IN VARCHAR2,
+ desc_in IN VARCHAR2 := NULL,
+ seq_in IN PLS_INTEGER := NULL
+ )
+ IS
+ BEGIN
+ ADD (utpackage.id_from_name (package_in), test_in, desc_in, seq_in);
+ END;
+
+ PROCEDURE rem (package_in IN INTEGER, test_in IN VARCHAR2)
+ IS
+ &start_ge_8_1 PRAGMA AUTONOMOUS_TRANSACTION; &end_ge_8_1
+ BEGIN
+ DELETE FROM ut_test
+ WHERE package_id = package_in
+ AND name LIKE UPPER (test_in);
+ &start_ge_8_1 COMMIT; &end_ge_8_1
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ utreport.pl ( 'Remove test error: '
+ || SQLERRM);
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ RAISE;
+ END;
+
+ PROCEDURE rem (package_in IN VARCHAR2, test_in IN VARCHAR2)
+ IS
+ BEGIN
+ rem (utpackage.id_from_name (package_in), test_in);
+ END;
+
+ PROCEDURE upd (
+ package_in IN INTEGER,
+ test_in IN VARCHAR2,
+ start_in DATE,
+ end_in DATE,
+ successful_in BOOLEAN
+ )
+ IS
+ &start_ge_8_1 PRAGMA AUTONOMOUS_TRANSACTION; &end_ge_8_1
+ v_failure PLS_INTEGER := 0;
+ BEGIN
+ IF NOT successful_in
+ THEN
+ v_failure := 1;
+ END IF;
+
+ UPDATE ut_test
+ SET last_start = start_in,
+ last_end = end_in,
+ executions = executions
+ + 1,
+ failures = failures
+ + v_failure
+ WHERE package_id = package_in
+ AND name = UPPER (test_in);
+ &start_ge_8_1 COMMIT; &end_ge_8_1
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ utreport.pl ( 'Update test error: '
+ || SQLERRM);
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ RAISE;
+ END;
+
+ PROCEDURE upd (
+ package_in IN VARCHAR2,
+ test_in IN VARCHAR2,
+ start_in DATE,
+ end_in DATE,
+ successful_in BOOLEAN
+ )
+ IS
+ BEGIN
+ upd (
+ utpackage.id_from_name (package_in),
+ test_in,
+ start_in,
+ end_in,
+ successful_in
+ );
+ END;
+END uttest;
+/
diff --git a/source/ut_test.pks b/source/ut_test.pks
new file mode 100644
index 000000000..fdda008e7
--- /dev/null
+++ b/source/ut_test.pks
@@ -0,0 +1,72 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE uttest -- &start_ge_8_1 AUTHID CURRENT_USER &end_ge_8_1
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ FUNCTION name_from_id (id_in IN ut_test.id%TYPE)
+ RETURN ut_test.name%TYPE;
+
+ FUNCTION id_from_name (name_in IN ut_test.name%TYPE)
+ RETURN ut_test.id%TYPE;
+
+ PROCEDURE ADD (
+ package_in IN INTEGER,
+ test_in IN VARCHAR2,
+ desc_in IN VARCHAR2 := NULL,
+ seq_in IN PLS_INTEGER := NULL
+ );
+
+ PROCEDURE ADD (
+ package_in IN VARCHAR2,
+ test_in IN VARCHAR2,
+ desc_in IN VARCHAR2 := NULL,
+ seq_in IN PLS_INTEGER := NULL
+ );
+
+ PROCEDURE rem (package_in IN INTEGER, test_in IN VARCHAR2);
+
+ PROCEDURE rem (package_in IN VARCHAR2, test_in IN VARCHAR2);
+
+ PROCEDURE upd (
+ package_in IN INTEGER,
+ test_in IN VARCHAR2,
+ start_in DATE,
+ end_in DATE,
+ successful_in BOOLEAN
+ );
+
+ PROCEDURE upd (
+ package_in IN VARCHAR2,
+ test_in IN VARCHAR2,
+ start_in DATE,
+ end_in DATE,
+ successful_in BOOLEAN
+ );
+END uttest;
+/
diff --git a/source/ut_test.tab b/source/ut_test.tab
new file mode 100644
index 000000000..9248386c8
--- /dev/null
+++ b/source/ut_test.tab
@@ -0,0 +1,19 @@
+CREATE TABLE ut_test (
+ id INTEGER ,
+ package_id INTEGER,
+ name VARCHAR2(200),
+ description VARCHAR2(2000),
+ seq INTEGER,
+ executions INTEGER,
+ failures INTEGER,
+ last_start DATE,
+ last_end DATE,
+ CONSTRAINT ut_test_pk PRIMARY KEY (id)
+);
+
+CREATE unique index ut_test_idx1 ON
+ ut_test (name);
+
+ALTER table ut_test add CONSTRAINT ut_test_package_fk
+ FOREIGN KEY (package_id) REFERENCES ut_package;
+
diff --git a/source/ut_test_seq.seq b/source/ut_test_seq.seq
new file mode 100644
index 000000000..86b102997
--- /dev/null
+++ b/source/ut_test_seq.seq
@@ -0,0 +1 @@
+CREATE sequence ut_test_seq INCREMENT BY 1 START WITH 1 ORDER NOCACHE;
diff --git a/source/ut_testcase.pkb b/source/ut_testcase.pkb
new file mode 100644
index 000000000..3fb04f5d4
--- /dev/null
+++ b/source/ut_testcase.pkb
@@ -0,0 +1,187 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE BODY uttestcase
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.5 2004/11/23 14:56:48 chrisrimmer
+Moved dbms_pipe code into its own package. Also changed some preprocessor flags
+
+Revision 1.4 2004/11/16 09:46:49 chrisrimmer
+Changed to new version detection system.
+
+Revision 1.3 2004/07/14 17:01:57 chrisrimmer
+Added first version of pluggable reporter packages
+
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ FUNCTION name_from_id (id_in IN ut_testcase.id%TYPE)
+ RETURN ut_testcase.name%TYPE
+ IS
+ retval ut_testcase.name%TYPE;
+ BEGIN
+ SELECT name
+ INTO retval
+ FROM ut_testcase
+ WHERE id = id_in;
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END;
+
+ FUNCTION id_from_name (name_in IN ut_testcase.name%TYPE)
+ RETURN ut_testcase.id%TYPE
+ IS
+ retval ut_testcase.id%TYPE;
+ BEGIN
+ SELECT name
+ INTO retval
+ FROM ut_testcase
+ WHERE name = UPPER (name_in);
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END;
+
+ PROCEDURE ADD (
+ test_in IN INTEGER,
+ testcase_in IN VARCHAR2,
+ desc_in IN VARCHAR2 := NULL,
+ seq_in IN PLS_INTEGER := NULL
+ )
+ IS
+ &start_ge_8_1 PRAGMA AUTONOMOUS_TRANSACTION; &end_ge_8_1
+ v_id ut_testcase.id%TYPE;
+ BEGIN
+ &start_ge_8_1 v_id := utplsql.seqval ('ut_testcase'); &end_ge_8_1
+ &start_lt_8_1 SELECT ut_testcase_seq.NEXTVAL INTO v_id FROM dual; &end_lt_8_1
+ INSERT INTO ut_testcase
+ (id, test_id, name, description,
+ seq)
+ VALUES (v_id, test_in, UPPER (testcase_in), desc_in,
+ NVL (seq_in, 1));
+ &start_ge_8_1 COMMIT; &end_ge_8_1
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ utreport.pl ( 'Add test error: '
+ || SQLERRM);
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ RAISE;
+ END;
+
+ PROCEDURE ADD (
+ test_in IN VARCHAR2,
+ testcase_in IN VARCHAR2,
+ desc_in IN VARCHAR2 := NULL,
+ seq_in IN PLS_INTEGER := NULL
+ )
+ IS
+ BEGIN
+ ADD (uttest.id_from_name (test_in), testcase_in, desc_in, seq_in);
+ END;
+
+ PROCEDURE rem (test_in IN INTEGER, testcase_in IN VARCHAR2)
+ IS
+ &start_ge_8_1 PRAGMA AUTONOMOUS_TRANSACTION; &end_ge_8_1
+ BEGIN
+ DELETE FROM ut_testcase
+ WHERE test_id = test_in
+ AND name LIKE UPPER (testcase_in);
+ &start_ge_8_1 COMMIT; &end_ge_8_1
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ utreport.pl ( 'Remove test error: '
+ || SQLERRM);
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ RAISE;
+ END;
+
+ PROCEDURE rem (test_in IN VARCHAR2, testcase_in IN VARCHAR2)
+ IS
+ BEGIN
+ rem (uttest.id_from_name (test_in), testcase_in);
+ END;
+
+ PROCEDURE upd (
+ test_in IN INTEGER,
+ testcase_in IN VARCHAR2,
+ start_in DATE,
+ end_in DATE,
+ successful_in BOOLEAN
+ )
+ IS
+ &start_ge_8_1 PRAGMA AUTONOMOUS_TRANSACTION; &end_ge_8_1
+ v_failure PLS_INTEGER := 0;
+ BEGIN
+ IF NOT successful_in
+ THEN
+ v_failure := 1;
+ END IF;
+
+ UPDATE ut_testcase
+ SET last_start = start_in,
+ last_end = end_in,
+ executions = executions
+ + 1,
+ failures = failures
+ + v_failure
+ WHERE test_id = test_in
+ AND name = UPPER (testcase_in);
+ &start_ge_8_1 COMMIT; &end_ge_8_1
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ utreport.pl ( 'Update test error: '
+ || SQLERRM);
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ RAISE;
+ END;
+
+ PROCEDURE upd (
+ test_in IN VARCHAR2,
+ testcase_in IN VARCHAR2,
+ start_in DATE,
+ end_in DATE,
+ successful_in BOOLEAN
+ )
+ IS
+ BEGIN
+ upd (
+ uttest.id_from_name (test_in),
+ testcase_in,
+ start_in,
+ end_in,
+ successful_in
+ );
+ END;
+END uttestcase;
+/
diff --git a/source/ut_testcase.pks b/source/ut_testcase.pks
new file mode 100644
index 000000000..c0ce414cc
--- /dev/null
+++ b/source/ut_testcase.pks
@@ -0,0 +1,75 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE uttestcase -- &start_ge_8_1 AUTHID CURRENT_USER &end_ge_8_1
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ c_name CONSTANT CHAR (9) := 'TEST CASE';
+ c_abbrev CONSTANT CHAR (3) := 'TC';
+
+ FUNCTION name_from_id (id_in IN ut_testcase.id%TYPE)
+ RETURN ut_testcase.name%TYPE;
+
+ FUNCTION id_from_name (name_in IN ut_testcase.name%TYPE)
+ RETURN ut_testcase.id%TYPE;
+
+ PROCEDURE ADD (
+ test_in IN INTEGER,
+ testcase_in IN VARCHAR2,
+ desc_in IN VARCHAR2 := NULL,
+ seq_in IN PLS_INTEGER := NULL
+ );
+
+ PROCEDURE ADD (
+ test_in IN VARCHAR2,
+ testcase_in IN VARCHAR2,
+ desc_in IN VARCHAR2 := NULL,
+ seq_in IN PLS_INTEGER := NULL
+ );
+
+ PROCEDURE rem (test_in IN INTEGER, testcase_in IN VARCHAR2);
+
+ PROCEDURE rem (test_in IN VARCHAR2, testcase_in IN VARCHAR2);
+
+ PROCEDURE upd (
+ test_in IN INTEGER,
+ testcase_in IN VARCHAR2,
+ start_in DATE,
+ end_in DATE,
+ successful_in BOOLEAN
+ );
+
+ PROCEDURE upd (
+ test_in IN VARCHAR2,
+ testcase_in IN VARCHAR2,
+ start_in DATE,
+ end_in DATE,
+ successful_in BOOLEAN
+ );
+END uttestcase;
+/
diff --git a/source/ut_testcase.tab b/source/ut_testcase.tab
new file mode 100644
index 000000000..258e96f9d
--- /dev/null
+++ b/source/ut_testcase.tab
@@ -0,0 +1,31 @@
+CREATE TABLE ut_testcase (
+ id INTEGER,
+ unittest_id INTEGER,
+ name VARCHAR2(200),
+ seq integer DEFAULT 1,
+ description VARCHAR2(2000),
+ status VARCHAR2(20), /* ENABLED or DISABLED */
+ declarations varchar2(2000),
+ setup varchar2(2000),
+ teardown varchar2(2000),
+ exceptions varchar2(2000),
+ /* From here down, for v1 compatibility only */
+ test_id INTEGER,
+ prefix VARCHAR2(200),
+ assertion VARCHAR2(100),
+ inline_assertion_call CHAR(1) DEFAULT 'N',
+ executions INTEGER,
+ failures INTEGER,
+ last_start DATE,
+ last_end DATE,
+ CONSTRAINT ut_testcase_pk PRIMARY KEY (id)
+)
+/
+
+CREATE unique index ut_testcase_idx1 ON
+ ut_testcase (name);
+
+ALTER table ut_testcase add CONSTRAINT ut_testcase_unitest_fk
+ FOREIGN KEY (unittest_id) REFERENCES ut_unittest;
+
+
diff --git a/source/ut_testcase_seq.seq b/source/ut_testcase_seq.seq
new file mode 100644
index 000000000..4b608a9a6
--- /dev/null
+++ b/source/ut_testcase_seq.seq
@@ -0,0 +1 @@
+CREATE sequence ut_testcase_seq INCREMENT BY 1 START WITH 1 ORDER NOCACHE;
diff --git a/source/ut_testprep.pkb b/source/ut_testprep.pkb
new file mode 100644
index 000000000..3be4f99e2
--- /dev/null
+++ b/source/ut_testprep.pkb
@@ -0,0 +1,46 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE BODY uttestprep
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ FUNCTION setup_program (utp_in IN ut_utp%ROWTYPE)
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ return null;
+ END setup_program;
+
+ FUNCTION teardown_program (utp_in IN ut_utp%ROWTYPE)
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ return null;
+ END teardown_program;
+END;
+/
diff --git a/source/ut_testprep.pks b/source/ut_testprep.pks
new file mode 100644
index 000000000..922da4b9c
--- /dev/null
+++ b/source/ut_testprep.pks
@@ -0,0 +1,39 @@
+/* Formatted on 2001/07/13 12:29 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE uttestprep
+-- NO LONGER USED.
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ FUNCTION setup_program (utp_in IN ut_utp%ROWTYPE)
+ RETURN VARCHAR2;
+
+ FUNCTION teardown_program (utp_in IN ut_utp%ROWTYPE)
+ RETURN VARCHAR2;
+END;
+/
diff --git a/source/ut_testprep.tab b/source/ut_testprep.tab
new file mode 100644
index 000000000..225e0a129
--- /dev/null
+++ b/source/ut_testprep.tab
@@ -0,0 +1,13 @@
+CREATE TABLE ut_testprep (
+id integer,
+type varchar2(20),
+name varchar2(200),
+action_level varchar2(10),
+prep_id integer,
+declarations varchar2 (2000),
+setup varchar2 (2000),
+teardown varchar2 (2000),
+ CONSTRAINT ut_testprep_pk PRIMARY KEY (id)
+);
+
+
diff --git a/source/ut_unittest.pkb b/source/ut_unittest.pkb
new file mode 100644
index 000000000..f22ccd547
--- /dev/null
+++ b/source/ut_unittest.pkb
@@ -0,0 +1,196 @@
+/* Formatted on 2001/07/14 08:45 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE BODY utunittest
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.3 2004/11/16 09:46:49 chrisrimmer
+Changed to new version detection system.
+
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ FUNCTION name (
+ ut_in IN ut_unittest%ROWTYPE
+ )
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ RETURN c_abbrev || utconfig.delimiter || ut_in.id;
+ END name;
+
+ FUNCTION name (
+ id_in IN ut_unittest.id%TYPE
+ )
+ RETURN VARCHAR2 is rec ut_unittest%rowtype;
+ begin
+ rec := onerow (id_in);
+ return name (rec); end;
+
+
+FUNCTION full_name (
+ utp_in IN ut_utp%ROWTYPE,
+ ut_in IN ut_unittest%ROWTYPE
+ )
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ RETURN ututp.qualified_name (utp_in) || '.'
+ || name (ut_in.id);
+ END full_name;
+
+ FUNCTION onerow (id_in IN ut_unittest.id%TYPE)
+ RETURN ut_unittest%ROWTYPE
+ IS
+ retval ut_unittest%ROWTYPE;
+ empty_rec ut_unittest%ROWTYPE;
+ BEGIN
+ SELECT *
+ INTO retval
+ FROM ut_unittest
+ WHERE id = id_in;
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN empty_rec;
+ END;
+
+ FUNCTION program_name (id_in IN ut_unittest.id%TYPE)
+ RETURN ut_unittest.program_name%TYPE
+ IS
+ retval ut_unittest.program_name%TYPE;
+ BEGIN
+ SELECT program_name
+ INTO retval
+ FROM ut_unittest
+ WHERE id = id_in;
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END;
+
+ FUNCTION id (name_in IN VARCHAR2)
+ RETURN ut_unittest.id%TYPE
+ IS
+ l_delimiter ut_config.delimiter%TYPE := utconfig.delimiter;
+ l_loc PLS_INTEGER;
+ retval ut_unittest.id%TYPE;
+ BEGIN
+ l_loc := INSTR (name_in, l_delimiter);
+
+ IF l_loc = 0
+ THEN
+ RETURN NULL;
+ ELSE
+ RETURN to_number (SUBSTR (name_in, l_loc
+ + LENGTH (l_delimiter))
+ );
+ END IF;
+ end;
+
+ PROCEDURE ADD (
+ utp_id_in IN ut_unittest.utp_id%TYPE,
+ program_name_in IN ut_unittest.program_name%TYPE,
+ seq_in IN ut_unittest.seq%TYPE := NULL,
+ description_in IN ut_unittest.description%TYPE
+ := NULL
+ )
+ IS
+ &start_ge_8_1
+ PRAGMA autonomous_transaction;
+ &end_ge_8_1
+ l_id ut_unittest.id%TYPE;
+ BEGIN
+ SELECT ut_unittest_seq.NEXTVAL
+ INTO l_id
+ FROM DUAL;
+
+ INSERT INTO ut_unittest
+ (id, program_name, seq,
+ description)
+ VALUES (l_id, UPPER (program_name_in), seq_in, description_in);
+
+ &start_ge_8_1
+ COMMIT;
+ &end_ge_8_1
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ IF utrerror.uterrcode = utrerror.assertion_failure
+ THEN
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ RAISE;
+ ELSE
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ utrerror.report_define_error (
+ c_abbrev,
+ 'Unittest for '
+ || program_name_in
+ || ' UTP ID '
+ || utp_id_in
+ );
+ END IF;
+ END;
+
+ PROCEDURE rem (
+ name_in IN varchar2
+ )
+ IS begin rem (id (name_in));
+ END;
+
+ PROCEDURE rem (id_in IN ut_unittest.id%TYPE)
+ IS
+ &start_ge_8_1
+ PRAGMA autonomous_transaction;
+ &end_ge_8_1
+ BEGIN
+ DELETE FROM ut_unittest
+ WHERE id = id_in;
+
+ &start_ge_8_1
+ COMMIT;
+ &end_ge_8_1
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ IF utrerror.uterrcode = utrerror.assertion_failure
+ THEN
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ RAISE;
+ ELSE
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ utrerror.report_define_error (
+ c_abbrev,
+ 'Unittest ID '
+ || id_in
+ );
+ END IF;
+ END;
+END utunittest;
+/
+
diff --git a/source/ut_unittest.pks b/source/ut_unittest.pks
new file mode 100644
index 000000000..05e684ff7
--- /dev/null
+++ b/source/ut_unittest.pks
@@ -0,0 +1,77 @@
+/* Formatted on 2001/07/13 17:50 (RevealNet Formatter v4.4.0) */
+CREATE OR REPLACE PACKAGE utunittest
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ c_name CONSTANT CHAR (9) := 'UNIT TEST';
+ c_abbrev CONSTANT CHAR (2) := 'UT';
+
+ /* UT##NNN */
+ FUNCTION name (
+ ut_in IN ut_unittest%ROWTYPE
+ )
+ RETURN VARCHAR2;
+
+ /* SCHEMA.UTP##NNN.UT##NNN */
+ FUNCTION full_name (
+ utp_in IN ut_utp%ROWTYPE,
+ ut_in IN ut_unittest%ROWTYPE
+ )
+ RETURN VARCHAR2;
+
+ FUNCTION name (
+ id_in IN ut_unittest.id%TYPE
+ )
+ RETURN VARCHAR2;
+
+ FUNCTION onerow (id_in IN ut_unittest.id%TYPE)
+ RETURN ut_unittest%ROWTYPE;
+
+ FUNCTION program_name (id_in IN ut_unittest.id%TYPE)
+ RETURN ut_unittest.program_name%TYPE;
+
+ FUNCTION id (name_in IN VARCHAR2)
+ RETURN ut_unittest.id%TYPE;
+
+ PROCEDURE ADD (
+ utp_id_in IN ut_unittest.utp_id%TYPE,
+ program_name_in IN ut_unittest.program_name%TYPE,
+ seq_in IN ut_unittest.seq%TYPE := NULL,
+ description_in IN ut_unittest.description%TYPE
+ := NULL
+ );
+
+ PROCEDURE rem (
+ name_in IN VARCHAR2
+ );
+
+ PROCEDURE rem (id_in IN ut_unittest.id%TYPE);
+END;
+/
+
diff --git a/source/ut_unittest.tab b/source/ut_unittest.tab
new file mode 100644
index 000000000..236deff91
--- /dev/null
+++ b/source/ut_unittest.tab
@@ -0,0 +1,19 @@
+CREATE TABLE ut_unittest (
+id INTEGER,
+utp_id INTEGER,
+program_name VARCHAR2(30),
+overload INTEGER, /* overloading in the package definition */
+seq INTEGER,
+description VARCHAR2(2000),
+status VARCHAR2(20), /* ENABLED or DISABLED */
+is_deterministic CHAR(1),
+declarations varchar2(2000),
+setup varchar2(2000),
+teardown varchar2(2000),
+exceptions varchar2(2000),
+ CONSTRAINT ut_unittest_pk PRIMARY KEY (id)
+);
+
+ALTER TABLE ut_unittest ADD CONSTRAINT ut_unittest_utp_fk
+ FOREIGN KEY (utp_id) REFERENCES ut_utp;
+
diff --git a/source/ut_unittest_seq.seq b/source/ut_unittest_seq.seq
new file mode 100644
index 000000000..f84bfe20b
--- /dev/null
+++ b/source/ut_unittest_seq.seq
@@ -0,0 +1 @@
+CREATE sequence ut_unittest_seq INCREMENT BY 1 START WITH 1 ORDER NOCACHE;
diff --git a/source/ut_utoutput.pkb b/source/ut_utoutput.pkb
new file mode 100644
index 000000000..59e471cf5
--- /dev/null
+++ b/source/ut_utoutput.pkb
@@ -0,0 +1,220 @@
+CREATE OR REPLACE PACKAGE BODY ut_utoutput
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.3 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ PROCEDURE clear_buffer
+ IS
+ lines number;
+ buffer DBMS_OUTPUT.CHARARR;
+ BEGIN
+ lines := 1000000;
+ dbms_output.get_lines(buffer, lines);
+ END;
+
+ PROCEDURE ut_setup
+ IS
+ BEGIN
+ dbms_output.enable(1000000);
+ END;
+
+ PROCEDURE ut_teardown
+ IS
+ BEGIN
+ NULL;
+ END;
+
+ PROCEDURE ut_count
+ IS
+ BEGIN
+
+ clear_buffer;
+
+ utassert.eq('Count Empty buffer', utoutput.count, 0);
+
+ dbms_output.put_line('XYZ');
+
+ utassert.eq('Count Single Line', utoutput.count, 1);
+
+ utassert.eq('Count Single Line Still Present', utoutput.count, 1);
+
+ dbms_output.put_line('ABC');
+
+ utassert.eq('Count Two Lines', utoutput.count, 2);
+
+ clear_buffer;
+
+ END ut_count;
+
+ PROCEDURE ut_extract
+ IS
+
+ buf dbms_output.CHARARR;
+ buf2 dbms_output.CHARARR;
+
+ BEGIN
+
+ utoutput.replace;
+ clear_buffer;
+
+ dbms_output.put_line('Alpha');
+ dbms_output.put_line('Beta');
+ dbms_output.put_line('Gamma');
+
+ utoutput.save;
+ utassert.eq('Pull one line', utoutput.extract(max_lines_in => 1,
+ save_in => FALSE), 1);
+ utassert.eq('Pull two lines', utoutput.extract(buffer_out => buf,
+ max_lines_in => 2,
+ save_in => FALSE), 2);
+ utassert.eq('How Many Lines Pulled', buf.COUNT, 2);
+ utassert.eq('First Line Pulled', buf(buf.FIRST), 'Beta');
+ utassert.eq('Second Line Pulled', buf(buf.NEXT(buf.FIRST)), 'Gamma');
+
+ clear_buffer;
+
+ dbms_output.put_line('Al');
+ dbms_output.put_line('Ben');
+ dbms_output.put_line('Carol');
+ dbms_output.put_line('Donna');
+
+ utoutput.extract(max_lines_in => 1);
+ utoutput.extract(buffer_out => buf);
+
+ utassert.eq('2: How Many Lines Pulled', buf.COUNT, 3);
+ utassert.eq('2: First Line Pulled', buf(buf.FIRST), 'Ben');
+ utassert.eq('2: Second Line Pulled', buf(buf.NEXT(buf.FIRST)), 'Carol');
+ utassert.eq('2: Third Line Pulled', buf(buf.NEXT(buf.NEXT(buf.FIRST))), 'Donna');
+
+ utoutput.replace;
+
+ utassert.eq('Count Lines Collected and Replaced', utoutput.COUNT, 4);
+
+ clear_buffer;
+
+ END ut_extract;
+
+ PROCEDURE ut_nextline
+ IS
+ BEGIN
+
+ clear_buffer;
+
+ utassert.isnull('NextLine Empty Buffer', utoutput.nextline(raise_exc_in => FALSE, save_in => FALSE));
+ utassert.throws('NextLine Empty Buffer with Exception',
+ 'declare
+ v varchar2(2000);
+ begin
+ v := utoutput.nextline(raise_exc_in => TRUE, save_in => FALSE);
+ end;',
+ 'utoutput.EMPTY_OUTPUT_BUFFER');
+
+ dbms_output.put_line('DEF');
+ dbms_output.put_line('GHI');
+
+ utassert.eq('NextLine Typical 1', utoutput.nextline(raise_exc_in => FALSE, save_in => FALSE), 'DEF');
+ utassert.eq('NextLine Typical 2', utoutput.nextline(raise_exc_in => FALSE, save_in => FALSE), 'GHI');
+
+ utassert.isnull('NextLine Empty Buffer Again', utoutput.nextline(raise_exc_in => FALSE, save_in => FALSE));
+
+ clear_buffer;
+
+ END ut_nextline;
+
+ PROCEDURE ut_replace
+ IS
+
+ dummy VARCHAR2(2000);
+
+ BEGIN
+
+ utoutput.replace;
+ clear_buffer;
+
+ --Put in some text, extract, then replace it
+ dbms_output.put_line('JKL');
+ dummy := utoutput.nextline(raise_exc_in => FALSE, save_in => TRUE);
+ utoutput.replace;
+
+ --Extract again, but don't save
+ dummy := utoutput.nextline(raise_exc_in => FALSE, save_in => FALSE);
+ utassert.eq('NextLine after replace', dummy, 'JKL');
+
+ --Try replacing when there should be nothing to replace
+ utoutput.replace;
+
+ dummy := utoutput.nextline(raise_exc_in => FALSE, save_in => FALSE);
+ utassert.isnull('NextLine after empty replace', dummy);
+
+ dbms_output.put_line('MNO');
+ dbms_output.put_line('PQR');
+
+ --Pull out all the data, but save it
+ utoutput.save;
+ utoutput.extract(max_lines_in => 1000);
+ utoutput.nosave;
+
+ --It should be empty now
+ dummy := utoutput.nextline(raise_exc_in => FALSE);
+ utassert.isnull('NextLine after full extract', dummy);
+
+ --Put it back
+ utoutput.replace;
+
+ utassert.eq('Count after multi-replace', utoutput.count, 2);
+
+ utassert.eq('NextLine after multi-replace', utoutput.nextline, 'MNO');
+ utassert.eq('NextLine again after multi-replace', utoutput.nextline, 'PQR');
+
+ --Make sure all is clear
+ utoutput.replace;
+ clear_buffer;
+
+ END ut_replace;
+
+ PROCEDURE ut_saving
+ IS
+ BEGIN
+
+ utoutput.save;
+
+ utassert.this('Saving Turned On', utoutput.saving);
+
+ utoutput.nosave;
+
+ utassert.this('Saving Turned Off', NOT utoutput.saving);
+
+ utoutput.save;
+
+ utassert.this('Saving Turned Back On', utoutput.saving);
+
+ END ut_saving;
+
+END ut_utoutput;
+
+/
diff --git a/source/ut_utoutput.pks b/source/ut_utoutput.pks
new file mode 100644
index 000000000..0dbc5f529
--- /dev/null
+++ b/source/ut_utoutput.pks
@@ -0,0 +1,41 @@
+CREATE OR REPLACE PACKAGE ut_utoutput
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ PROCEDURE ut_setup;
+ PROCEDURE ut_teardown;
+
+ PROCEDURE ut_count;
+ PROCEDURE ut_extract;
+ PROCEDURE ut_nextline;
+ PROCEDURE ut_replace;
+ PROCEDURE ut_saving;
+
+END ut_utoutput;
+/
diff --git a/source/ut_utp.pkb b/source/ut_utp.pkb
new file mode 100644
index 000000000..203335e4c
--- /dev/null
+++ b/source/ut_utp.pkb
@@ -0,0 +1,413 @@
+/* Formatted on 2001/09/14 10:34 (RevealNet Formatter v4.4.1) */
+CREATE OR REPLACE PACKAGE BODY ututp
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.4 2004/11/16 09:46:49 chrisrimmer
+Changed to new version detection system.
+
+Revision 1.3 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ /* UTP##NNN */
+ FUNCTION name (utp_in IN ut_utp%ROWTYPE)
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ RETURN c_abbrev
+ || utconfig.delimiter
+ || utp_in.id;
+ END;
+
+ FUNCTION name (id_in IN ut_utp.id%TYPE)
+ RETURN VARCHAR2
+ IS
+ rec ut_utp%ROWTYPE;
+ BEGIN
+ rec := onerow (id_in);
+ RETURN name (rec);
+ END;
+
+ /* schema.UTP##NNN */
+ FUNCTION qualified_name (utp_in IN ut_utp%ROWTYPE)
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ RETURN utp_in.owner
+ || '.'
+ || name (utp_in);
+ END;
+
+ FUNCTION qualified_name (id_in IN ut_utp.id%TYPE)
+ RETURN VARCHAR2
+ IS
+ rec ut_utp%ROWTYPE;
+ BEGIN
+ rec := onerow (id_in);
+ RETURN qualified_name (rec);
+ END;
+
+ FUNCTION setup_procedure (utp_in IN ut_utp%ROWTYPE)
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ RETURN utp_in.owner
+ || '.'
+ || name (utp_in)
+ || '.'
+ || utplsql.c_setup;
+ END;
+
+ FUNCTION teardown_procedure (utp_in IN ut_utp%ROWTYPE)
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ RETURN utp_in.owner
+ || '.'
+ || name (utp_in)
+ || '.'
+ || utplsql.c_teardown;
+ END;
+
+ FUNCTION prefix (utp_in IN ut_utp%ROWTYPE)
+ RETURN VARCHAR2
+ IS
+ BEGIN
+ RETURN utp_in.prefix;
+ END;
+
+ FUNCTION onerow (
+ owner_in IN ut_utp.owner%TYPE,
+ program_in IN ut_utp.program%TYPE
+ )
+ RETURN ut_utp%ROWTYPE
+ IS
+ retval ut_utp%ROWTYPE;
+ empty_rec ut_utp%ROWTYPE;
+ BEGIN
+ SELECT *
+ INTO retval
+ FROM ut_utp
+ WHERE owner = NVL (UPPER (owner_in), USER)
+ AND program = UPPER (program_in);
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN empty_rec;
+ END;
+
+ PROCEDURE get_onerow (
+ owner_in IN ut_utp.owner%TYPE
+ ,program_in IN ut_utp.program%TYPE
+ ,id_out OUT ut_utp.ID%TYPE
+ ,description_out OUT ut_utp.description%TYPE
+ ,filename_out OUT ut_utp.filename%TYPE
+ ,program_directory_out OUT ut_utp.program_directory%TYPE
+ ,directory_out OUT ut_utp.DIRECTORY%TYPE
+ ,name_out OUT ut_utp.NAME%TYPE
+ ,utp_owner_out OUT ut_utp.utp_owner%TYPE
+ ,prefix_out OUT ut_utp.prefix%TYPE
+ )
+ is
+ rec ut_utp%rowtype;
+ begin
+ rec := onerow (owner_in, program_in);
+ id_out := rec.id;
+ if rec.id is not null then
+description_out := rec.description;
+filename_out := rec.filename;
+program_directory_out := rec.program_directory;
+directory_out := rec.directory;
+name_out := rec.name;
+utp_owner_out := rec.utp_owner;
+prefix_out := rec.prefix;
+
+ end if;
+ end get_onerow;
+
+ FUNCTION exists (
+ owner_in IN ut_utp.owner%TYPE,
+ program_in IN ut_utp.program%TYPE
+ )
+ RETURN Boolean
+ IS
+ retval char(1);
+
+ BEGIN
+ SELECT 'x'
+ INTO retval
+ FROM ut_utp
+ WHERE owner = NVL (UPPER (owner_in), USER)
+ AND program = UPPER (program_in);
+ RETURN true;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN false;
+ END;
+
+ FUNCTION onerow (utp_id_in IN ut_utp.id%TYPE)
+ RETURN ut_utp%ROWTYPE
+ IS
+ retval ut_utp%ROWTYPE;
+ empty_rec ut_utp%ROWTYPE;
+ BEGIN
+ SELECT *
+ INTO retval
+ FROM ut_utp
+ WHERE id = utp_id_in;
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN empty_rec;
+ END;
+
+ FUNCTION id (name_in IN VARCHAR2)
+ RETURN ut_utp.id%TYPE
+ IS
+ l_delimiter ut_config.delimiter%TYPE := utconfig.delimiter;
+ l_loc PLS_INTEGER;
+ retval ut_utp.id%TYPE;
+ BEGIN
+ l_loc := INSTR (name_in, l_delimiter);
+
+ IF l_loc = 0
+ THEN
+ RETURN NULL;
+ ELSE
+ RETURN to_number (SUBSTR (name_in, l_loc
+ + LENGTH (l_delimiter))
+ );
+ END IF;
+ /* Use new formula; no query required
+ SELECT id
+ INTO retval
+ FROM ut_utp
+ WHERE name = UPPER (name_in);
+ RETURN retval;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ */
+ END;
+
+ PROCEDURE ADD (
+ program_in IN ut_utp.program%TYPE := NULL,
+ owner_in IN ut_utp.owner%TYPE := NULL,
+ description_in IN ut_utp.description%TYPE := NULL,
+ filename_in IN ut_utp.filename%TYPE := NULL,
+ frequency_in IN ut_utp.frequency%TYPE := NULL,
+ program_map_in IN ut_utp.program_map%TYPE := NULL,
+ declarations_in IN ut_utp.declarations%TYPE
+ := NULL,
+ setup_in IN ut_utp.setup%TYPE := NULL,
+ teardown_in IN ut_utp.teardown%TYPE := NULL,
+ exceptions_in IN ut_utp.exceptions%TYPE := NULL,
+ program_directory_in IN ut_utp.program_directory%TYPE := NULL,
+ directory_in IN ut_utp.directory%TYPE := NULL,
+ name_in IN ut_utp.name%TYPE := NULL,
+ utp_owner_in IN ut_utp.utp_owner%TYPE := NULL,
+ prefix_in IN ut_utp.prefix%TYPE := NULL,
+ id_out OUT ut_utp.id%TYPE
+ )
+ IS
+ &start_ge_8_1
+ PRAGMA autonomous_transaction;
+ &end_ge_8_1
+ l_id ut_utp.id%TYPE;
+ l_program ut_utp.name%type := program_in;
+ BEGIN
+ if l_program not like '"%' then l_program := upper (l_program); end if;
+ SELECT ut_utp_seq.NEXTVAL
+ INTO l_id
+ FROM DUAL;
+
+ INSERT INTO ut_utp
+ (id, program,
+ owner, description, filename,
+ frequency, program_map, declarations,
+ setup, teardown, program_directory, directory,
+ name, utp_owner, prefix
+ )
+ VALUES (l_id, l_program,
+ NVL (owner_in, USER), description_in, filename_in,
+ frequency_in, program_map_in, declarations_in,
+ setup_in, teardown_in, program_directory_in, directory_in,
+ name_in, utp_owner_in, prefix_in
+ );
+
+ &start_ge_8_1
+ COMMIT;
+
+ &end_ge_8_1
+ id_out := l_id;
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ IF utrerror.uterrcode = utrerror.assertion_failure
+ THEN
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ RAISE;
+ ELSE
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ utrerror.report_define_error (
+ c_abbrev,
+ 'UTP for '
+ || program_in
+ || ' Owner '
+ || owner_in
+ );
+ END IF;
+ END;
+
+ PROCEDURE ADD (
+ program_in IN ut_utp.program%TYPE := NULL,
+ owner_in IN ut_utp.owner%TYPE := NULL,
+ description_in IN ut_utp.description%TYPE := NULL,
+ filename_in IN ut_utp.filename%TYPE := NULL,
+ frequency_in IN ut_utp.frequency%TYPE := NULL,
+ program_map_in IN ut_utp.program_map%TYPE := NULL,
+ declarations_in IN ut_utp.declarations%TYPE
+ := NULL,
+ setup_in IN ut_utp.setup%TYPE := NULL,
+ teardown_in IN ut_utp.teardown%TYPE := NULL,
+ exceptions_in IN ut_utp.exceptions%TYPE := NULL,
+ program_directory_in IN ut_utp.program_directory%TYPE := NULL,
+ directory_in IN ut_utp.directory%TYPE := NULL,
+ name_in IN ut_utp.name%TYPE := NULL,
+ utp_owner_in IN ut_utp.utp_owner%TYPE := NULL,
+ prefix_in IN ut_utp.prefix%TYPE := NULL
+ ) is l_id ut_utp.id%TYPE; begin
+ add (program_in => program_in,
+ owner_in => owner_in,
+ description_in => description_in,
+ filename_in => filename_in,
+ frequency_in => frequency_in,
+ program_map_in => program_map_in,
+ declarations_in => declarations_in,
+ setup_in => setup_in,
+ teardown_in => teardown_in,
+ exceptions_in => exceptions_in,
+ program_directory_in => program_directory_in,
+ directory_in => directory_in,
+ name_in => name_in,
+ utp_owner_in => utp_owner_in,
+ prefix_in => prefix_in,
+ id_out => l_id);
+ end;
+
+ PROCEDURE rem (name_in IN VARCHAR2)
+ IS
+ BEGIN
+ rem (id (name_in));
+ END;
+
+ PROCEDURE rem (id_in IN ut_utp.id%TYPE)
+ IS
+ &start_ge_8_1
+ PRAGMA autonomous_transaction;
+ &end_ge_8_1
+ BEGIN
+ DELETE FROM ut_utp
+ WHERE id = id_in;
+
+ &start_ge_8_1
+ COMMIT;
+ &end_ge_8_1
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ IF utrerror.uterrcode = utrerror.assertion_failure
+ THEN
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ RAISE;
+ ELSE
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ utrerror.report_define_error (c_abbrev, 'UTP '
+ || id_in);
+ END IF;
+ END;
+
+ PROCEDURE upd (
+ id_in IN ut_utp.id%TYPE,
+ program_directory_in IN ut_utp.program_directory%TYPE := NULL,
+ directory_in IN ut_utp.directory%TYPE := NULL,
+ name_in IN ut_utp.name%TYPE := NULL,
+ utp_owner_in IN ut_utp.utp_owner%TYPE := NULL,
+ filename_in IN ut_utp.filename%TYPE := NULL,
+ prefix_in IN ut_utp.prefix%TYPE := NULL
+ )
+ IS
+ &start_ge_8_1
+ PRAGMA autonomous_transaction;
+ &end_ge_8_1
+ l_name ut_utp.name%type := name_in;
+ BEGIN
+ if l_name not like '"%' then l_name := upper (l_name); end if;
+ update ut_utp
+ set filename = filename_in,
+ program_directory = program_directory_in,
+ directory = directory_in,
+ name = l_name,
+ utp_owner = utp_owner_in,
+ prefix = prefix_in
+ where id = id_in;
+ &start_ge_8_1
+ COMMIT;
+
+ &end_ge_8_1
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ &start_ge_8_1 ROLLBACK; &end_ge_8_1
+ utrerror.report_define_error (
+ c_abbrev,
+ 'UTP update for UTP '
+ || id_in
+ );
+ END;
+
+ FUNCTION utps (program_like_in IN VARCHAR2 := '%')
+ RETURN utconfig.refcur_t
+ IS
+ retval utconfig.refcur_t;
+ BEGIN
+ OPEN retval FOR
+ SELECT *
+ FROM ut_utp
+ WHERE program LIKE UPPER (program_like_in);
+ RETURN retval;
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ RETURN retval;
+ END;
+END ututp;
+/
+
diff --git a/source/ut_utp.pks b/source/ut_utp.pks
new file mode 100644
index 000000000..97f09e6a1
--- /dev/null
+++ b/source/ut_utp.pks
@@ -0,0 +1,138 @@
+CREATE OR REPLACE PACKAGE ututp
+IS
+
+/************************************************************************
+GNU General Public License for utPLSQL
+
+Copyright (C) 2000-2003
+Steven Feuerstein and the utPLSQL Project
+(steven@stevenfeuerstein.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (see license.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+************************************************************************
+$Log$
+Revision 1.2 2003/07/01 19:36:47 chrisrimmer
+Added Standard Headers
+
+************************************************************************/
+
+ c_name CONSTANT CHAR (18) := 'UNIT TEST PACKAGE';
+ c_abbrev CONSTANT CHAR (3) := 'UTP';
+
+ /* UTP##NNN */
+ FUNCTION NAME (utp_in IN ut_utp%ROWTYPE)
+ RETURN VARCHAR2;
+
+ FUNCTION NAME (id_in IN ut_utp.ID%TYPE)
+ RETURN VARCHAR2;
+
+ /* schema.UTP##NNN */
+ FUNCTION qualified_name (utp_in IN ut_utp%ROWTYPE)
+ RETURN VARCHAR2;
+
+ FUNCTION qualified_name (id_in IN ut_utp.ID%TYPE)
+ RETURN VARCHAR2;
+
+ FUNCTION setup_procedure (utp_in IN ut_utp%ROWTYPE)
+ RETURN VARCHAR2;
+
+ FUNCTION teardown_procedure (utp_in IN ut_utp%ROWTYPE)
+ RETURN VARCHAR2;
+
+ /* V1 compatibility */
+ FUNCTION prefix (utp_in IN ut_utp%ROWTYPE)
+ RETURN VARCHAR2;
+
+ FUNCTION onerow (
+ owner_in IN ut_utp.owner%TYPE
+ ,program_in IN ut_utp.program%TYPE
+ )
+ RETURN ut_utp%ROWTYPE;
+
+ FUNCTION onerow (utp_id_in IN ut_utp.ID%TYPE)
+ RETURN ut_utp%ROWTYPE;
+
+ PROCEDURE get_onerow (
+ owner_in IN ut_utp.owner%TYPE
+ ,program_in IN ut_utp.program%TYPE
+ ,id_out OUT ut_utp.ID%TYPE
+ ,description_out OUT ut_utp.description%TYPE
+ ,filename_out OUT ut_utp.filename%TYPE
+ ,program_directory_out OUT ut_utp.program_directory%TYPE
+ ,directory_out OUT ut_utp.DIRECTORY%TYPE
+ ,name_out OUT ut_utp.NAME%TYPE
+ ,utp_owner_out OUT ut_utp.utp_owner%TYPE
+ ,prefix_out OUT ut_utp.prefix%TYPE
+ );
+
+ FUNCTION EXISTS (
+ owner_in IN ut_utp.owner%TYPE
+ ,program_in IN ut_utp.program%TYPE
+ )
+ RETURN BOOLEAN;
+
+ FUNCTION ID (NAME_IN IN VARCHAR2)
+ RETURN ut_utp.ID%TYPE;
+
+ PROCEDURE ADD (
+ -- 2.0.7 name_in IN ut_utp.name%TYPE,
+ program_in IN ut_utp.program%TYPE := NULL
+ ,owner_in IN ut_utp.owner%TYPE := NULL
+ ,description_in IN ut_utp.description%TYPE := NULL
+ ,filename_in IN ut_utp.filename%TYPE := NULL
+ ,frequency_in IN ut_utp.frequency%TYPE := NULL
+ ,program_map_in IN ut_utp.program_map%TYPE := NULL
+ ,declarations_in IN ut_utp.declarations%TYPE := NULL
+ ,setup_in IN ut_utp.setup%TYPE := NULL
+ ,teardown_in IN ut_utp.teardown%TYPE := NULL
+ ,exceptions_in IN ut_utp.EXCEPTIONS%TYPE := NULL
+ ,program_directory_in IN ut_utp.program_directory%TYPE := NULL
+ ,directory_in IN ut_utp.DIRECTORY%TYPE := NULL
+ ,NAME_IN IN ut_utp.NAME%TYPE := NULL
+ ,utp_owner_in IN ut_utp.utp_owner%TYPE := NULL
+ ,prefix_in IN ut_utp.prefix%TYPE := NULL
+ -- V1 prefix_in IN ut_utp.prefix%TYPE := utconfig.c_prefix
+ );
+
+ PROCEDURE ADD (
+ program_in IN ut_utp.program%TYPE := NULL
+ ,owner_in IN ut_utp.owner%TYPE := NULL
+ ,description_in IN ut_utp.description%TYPE := NULL
+ ,filename_in IN ut_utp.filename%TYPE := NULL
+ ,frequency_in IN ut_utp.frequency%TYPE := NULL
+ ,program_map_in IN ut_utp.program_map%TYPE := NULL
+ ,declarations_in IN ut_utp.declarations%TYPE := NULL
+ ,setup_in IN ut_utp.setup%TYPE := NULL
+ ,teardown_in IN ut_utp.teardown%TYPE := NULL
+ ,exceptions_in IN ut_utp.EXCEPTIONS%TYPE := NULL
+ ,program_directory_in IN ut_utp.program_directory%TYPE := NULL
+ ,directory_in IN ut_utp.DIRECTORY%TYPE := NULL
+ ,NAME_IN IN ut_utp.NAME%TYPE := NULL
+ ,utp_owner_in IN ut_utp.utp_owner%TYPE := NULL
+ ,prefix_in IN ut_utp.prefix%TYPE := NULL
+ ,id_out OUT ut_utp.ID%TYPE
+ );
+
+ PROCEDURE REM (NAME_IN IN VARCHAR2);
+
+ PROCEDURE REM (id_in IN ut_utp.ID%TYPE);
+
+ FUNCTION utps (
+ program_like_in IN VARCHAR2 := '%'
+ )
+ RETURN utconfig.refcur_t;
+
+END ututp;
+/
diff --git a/source/ut_utp.tab b/source/ut_utp.tab
new file mode 100644
index 000000000..9f7a9720d
--- /dev/null
+++ b/source/ut_utp.tab
@@ -0,0 +1,32 @@
+CREATE TABLE ut_utp (
+ id INTEGER,
+ description VARCHAR2(2000),
+ prefix VARCHAR2(10), /* V1 compatibility. V2: use ut_config.delimiter to construct names. */
+ program VARCHAR2(30), /* name of program being tested */
+ owner VARCHAR2(30), /* owner of program */
+ filename VARCHAR2(2000), /* name of file containing source code for UTP */
+ frequency VARCHAR2(2000),
+ program_map VARCHAR2(2000),
+ /* XML document representing parsed version of package. Should be LOB. */
+ declarations varchar2(2000),
+ setup varchar2(2000),
+ teardown varchar2(2000),
+ exceptions varchar2(2000),
+ CONSTRAINT ut_utp_pk PRIMARY KEY (id)
+);
+
+REM 2.0.8.1
+ALTER TABLE ut_utp ADD per_method_setup char(1);
+
+ALTER TABLE ut_utp ADD name VARCHAR2(30);
+
+REM 2.1.1
+REM /* Owner of UTP */
+ALTER TABLE ut_utp ADD utp_owner VARCHAR2(30);
+REM File containing source code of program
+ALTER TABLE ut_utp ADD program_filename VARCHAR2(30);
+REM-- Location of UTP source file
+ALTER TABLE ut_utp ADD directory VARCHAR2(30);
+REM-- Location of program
+ALTER TABLE ut_utp ADD program_directory VARCHAR2(30);
+
diff --git a/source/ut_utp_seq.seq b/source/ut_utp_seq.seq
new file mode 100644
index 000000000..2f0799bbf
--- /dev/null
+++ b/source/ut_utp_seq.seq
@@ -0,0 +1 @@
+CREATE sequence ut_utp_seq INCREMENT BY 1 START WITH 1 ORDER NOCACHE;
diff --git a/source/ut_utreport.pkb b/source/ut_utreport.pkb
new file mode 100644
index 000000000..53b1d8e76
--- /dev/null
+++ b/source/ut_utreport.pkb
@@ -0,0 +1,148 @@
+CREATE OR REPLACE PACKAGE BODY UT_UTREPORT
+AS
+
+ reporter_before VARCHAR2(1000);
+
+ PROCEDURE ut_setup
+ IS
+ BEGIN
+
+ reporter_before := utConfig.getreporter;
+
+ EXECUTE IMMEDIATE 'CREATE OR REPLACE PACKAGE utTestReporter
+AS
+ char_log VARCHAR2(1000);
+
+ PROCEDURE open;
+ PROCEDURE pl (str IN VARCHAR2);
+ PROCEDURE before_results(run_id IN utr_outcome.run_id%TYPE);
+ PROCEDURE show_failure;
+ PROCEDURE show_result;
+ PROCEDURE after_results(run_id IN utr_outcome.run_id%TYPE);
+ PROCEDURE before_errors(run_id IN utr_error.run_id%TYPE);
+ PROCEDURE show_error;
+ PROCEDURE after_errors(run_id IN utr_error.run_id%TYPE);
+ PROCEDURE close;
+END;';
+
+ EXECUTE IMMEDIATE 'CREATE OR REPLACE PACKAGE BODY utTestReporter
+AS
+ PROCEDURE open IS BEGIN char_log := char_log || '' open''; END;
+ PROCEDURE pl (str IN VARCHAR2) IS BEGIN char_log := char_log || '' pl(''|| str || '')''; END;
+ PROCEDURE before_results(run_id IN utr_outcome.run_id%TYPE)
+ IS BEGIN char_log := char_log || '' before_results''; END;
+ PROCEDURE show_failure
+ IS BEGIN char_log := char_log || '' show_failure''; END;
+ PROCEDURE show_result
+ IS BEGIN char_log := char_log || '' show_result''; END;
+ PROCEDURE after_results(run_id IN utr_outcome.run_id%TYPE)
+ IS BEGIN char_log := char_log || '' after_results''; END;
+ PROCEDURE before_errors(run_id IN utr_error.run_id%TYPE)
+ IS BEGIN char_log := char_log || '' before_errors''; END;
+ PROCEDURE show_error
+ IS BEGIN char_log := char_log || '' show_error''; END;
+ PROCEDURE after_errors(run_id IN utr_error.run_id%TYPE)
+ IS BEGIN char_log := char_log || '' after_errors''; END;
+ PROCEDURE close
+ IS BEGIN char_log := char_log || '' close''; END;
+END;';
+
+ END;
+
+ PROCEDURE ut_teardown
+ IS
+ BEGIN
+ BEGIN
+ EXECUTE IMMEDIATE 'DROP PACKAGE utTestReporter';
+ EXCEPTION
+ WHEN OTHERS THEN
+ NULL;
+ END;
+
+ utConfig.setreporter(reporter_before);
+
+ END;
+
+ FUNCTION get_log RETURN VARCHAR2 IS
+ char_log VARCHAR2(1000);
+ BEGIN
+ EXECUTE IMMEDIATE 'BEGIN :1 := utTestReporter.char_log; END;' USING OUT char_log;
+ RETURN char_log;
+ END;
+
+ PROCEDURE clear_log IS
+ BEGIN
+ EXECUTE IMMEDIATE 'BEGIN utTestReporter.char_log := NULL; END;';
+ END;
+
+ -----------------------------------------------------------
+ --This checks that calls to utreport get passed through to
+ --our custom reporter package.
+ -----------------------------------------------------------
+ PROCEDURE ut_check_report_facade
+ IS
+
+ run_id utr_outcome.run_id%TYPE;
+ rec_result utr_outcome%ROWTYPE;
+ rec_error utr_error%ROWTYPE;
+
+ BEGIN
+
+ utreport.outcome.status := NULL;
+ utreport.error.description := NULL;
+
+ utConfig.setreporter('Test');
+
+ clear_log;
+ utReport.open;
+ utAssert.eq('open', get_log, ' open');
+
+ clear_log;
+ utReport.pl('Blah');
+ utAssert.eq('pl', get_log, ' pl(Blah)');
+
+ clear_log;
+ utReport.before_results(run_id);
+ utAssert.eq('before_results', get_log, ' before_results');
+
+ clear_log;
+ rec_result.STATUS := 'FAILURE';
+ utReport.show_failure(rec_result);
+ utAssert.eq('show_failure', get_log, ' show_failure');
+ utAssert.eq('show_failure: outcome set', utreport.outcome.status, 'FAILURE');
+
+ clear_log;
+ rec_result.STATUS := 'RESULT';
+ utReport.show_result(rec_result);
+ utAssert.eq('show_result', get_log, ' show_result');
+ utAssert.eq('show_failure: outcome set', utreport.outcome.status, 'RESULT');
+
+ clear_log;
+ utReport.after_results(run_id);
+ utAssert.eq('after_results', get_log, ' after_results');
+
+ clear_log;
+ utReport.before_errors(run_id);
+ utAssert.eq('before_errors', get_log, ' before_errors');
+
+ clear_log;
+ rec_error.DESCRIPTION := 'BOOM!';
+ utReport.show_error(rec_error);
+ utAssert.eq('show_error', get_log, ' show_error');
+ utAssert.eq('show_error: error set', utreport.error.description, 'BOOM!');
+
+ clear_log;
+ utReport.after_errors(run_id);
+ utAssert.eq('after_errors', get_log, ' after_errors');
+
+ utConfig.setreporter(reporter_before);
+
+ EXCEPTION
+ WHEN OTHERS THEN
+ utConfig.setreporter(reporter_before);
+ RAISE;
+
+ END;
+
+END;
+/
diff --git a/source/ut_utreport.pks b/source/ut_utreport.pks
new file mode 100644
index 000000000..25ff468c6
--- /dev/null
+++ b/source/ut_utreport.pks
@@ -0,0 +1,10 @@
+CREATE OR REPLACE PACKAGE UT_UTREPORT
+AS
+
+ PROCEDURE ut_setup;
+ PROCEDURE ut_teardown;
+
+ PROCEDURE ut_check_report_facade;
+
+END;
+/
\ No newline at end of file
diff --git a/source/utr_error.tab b/source/utr_error.tab
new file mode 100644
index 000000000..8181239cf
--- /dev/null
+++ b/source/utr_error.tab
@@ -0,0 +1,28 @@
+CREATE TABLE utr_error (
+ run_id INTEGER,
+ suite_id INTEGER,
+ utp_id INTEGER,
+ unittest_id INTEGER,
+ testcase_id INTEGER,
+ outcome_id INTEGER,
+ errlevel varchar2(100),
+ occurred_on DATE,
+ errcode integer,
+ errtext varchar2(1000),
+ description varchar2(2000));
+
+ALTER TABLE utr_error ADD CONSTRAINT utr_error_suite_fk
+ FOREIGN KEY (suite_id) REFERENCES ut_suite;
+
+ALTER TABLE utr_error ADD CONSTRAINT utr_error_utp_fk
+ FOREIGN KEY (utp_id) REFERENCES ut_utp;
+
+ALTER TABLE utr_error ADD CONSTRAINT utr_error_unittest_fk
+ FOREIGN KEY (unittest_id) REFERENCES ut_unittest;
+
+ALTER TABLE utr_error ADD CONSTRAINT utr_error_testcase_fk
+ FOREIGN KEY (testcase_id) REFERENCES ut_testcase;
+
+ALTER TABLE utr_error ADD CONSTRAINT utr_error_outcome_fk
+ FOREIGN KEY (outcome_id) REFERENCES ut_outcome;
+
diff --git a/source/utr_outcome.tab b/source/utr_outcome.tab
new file mode 100644
index 000000000..e85eb2a28
--- /dev/null
+++ b/source/utr_outcome.tab
@@ -0,0 +1,23 @@
+/* Formatted by PL/Formatter v3.1.2.1 on 2001/04/12 10:49 */
+
+CREATE TABLE utr_outcome (
+ run_id INTEGER,
+ outcome_id integer,
+ start_on date,
+ end_on date,
+ status varchar2(100),
+ description varchar2(2000)
+);
+
+REM 2.0.9.1 Record order of execution of test.
+ALTER TABLE utr_outcome ADD tc_run_id INTEGER;
+
+ALTER table utr_outcome add CONSTRAINT utr_outcome_pk
+ primary key (run_id, outcome_id);
+
+-- Turn off to support V1 compatibility
+--ALTER table utr_outcome add CONSTRAINT utr_outcome_fk1
+-- FOREIGN KEY (outcome_id) REFERENCES ut_outcome;
+
+
+
diff --git a/source/utr_suite.tab b/source/utr_suite.tab
new file mode 100644
index 000000000..e3610b478
--- /dev/null
+++ b/source/utr_suite.tab
@@ -0,0 +1,17 @@
+/* Formatted by PL/Formatter v3.1.2.1 on 2001/02/09 16:21 */
+
+CREATE TABLE utr_suite (
+ run_id INTEGER,
+ run_by VARCHAR2(30),
+ profiler_run_id INTEGER,
+ suite_id integer,
+ start_on date,
+ end_on date,
+ status varchar2(100));
+
+ALTER table utr_suite add CONSTRAINT utr_suite_pk
+ primary key (run_id, suite_id);
+
+ALTER table utr_suite add CONSTRAINT utr_suite_fk1
+ FOREIGN KEY (suite_id) REFERENCES ut_suite;
+
diff --git a/source/utr_testcase.tab b/source/utr_testcase.tab
new file mode 100644
index 000000000..e000cabcb
--- /dev/null
+++ b/source/utr_testcase.tab
@@ -0,0 +1,16 @@
+/* Formatted by PL/Formatter v3.1.2.1 on 2001/04/12 10:49 */
+
+CREATE TABLE utr_testcase (
+ run_id INTEGER,
+ testcase_id integer,
+ start_on date,
+ end_on date,
+ status varchar2(100));
+
+ALTER table utr_testcase add CONSTRAINT utr_testcase_pk
+ primary key (run_id, testcase_id);
+
+ALTER table utr_testcase add CONSTRAINT utr_testcase_fk1
+ FOREIGN KEY (testcase_id) REFERENCES ut_testcase;
+
+
diff --git a/source/utr_unittest.tab b/source/utr_unittest.tab
new file mode 100644
index 000000000..ef3279c32
--- /dev/null
+++ b/source/utr_unittest.tab
@@ -0,0 +1,16 @@
+/* Formatted by PL/Formatter v3.1.2.1 on 2001/04/12 10:49 */
+
+CREATE TABLE utr_unittest (
+ run_id INTEGER,
+ unittest_id integer,
+ start_on date,
+ end_on date,
+ status varchar2(100));
+
+ALTER table utr_unittest add CONSTRAINT utr_unittest_pk
+ primary key (run_id, unittest_id);
+
+ALTER table utr_unittest add CONSTRAINT utr_unittest_fk1
+ FOREIGN KEY (unittest_id) REFERENCES ut_unittest;
+
+
diff --git a/source/utr_utp.tab b/source/utr_utp.tab
new file mode 100644
index 000000000..6e042b543
--- /dev/null
+++ b/source/utr_utp.tab
@@ -0,0 +1,17 @@
+/* Formatted by PL/Formatter v3.1.2.1 on 2001/02/09 16:21 */
+
+CREATE TABLE utr_utp (
+ run_id INTEGER,
+ run_by VARCHAR2(30),
+ profiler_run_id INTEGER,
+ utp_id integer,
+ start_on date,
+ end_on date,
+ status varchar2(100));
+
+ALTER table utr_utp add CONSTRAINT utr_utp_pk
+ primary key (run_id, utp_id);
+
+ALTER table utr_utp add CONSTRAINT utr_utp_fk1
+ FOREIGN KEY (utp_id) REFERENCES ut_utp;
+
diff --git a/source/utv_last_run.sql b/source/utv_last_run.sql
new file mode 100644
index 000000000..f9604c075
--- /dev/null
+++ b/source/utv_last_run.sql
@@ -0,0 +1,9 @@
+CREATE OR REPLACE VIEW utv_last_run
+AS
+ SELECT a.id utp_id, program, run_id last_run_id
+ FROM ut_utp a,
+ (SELECT utp_id, MAX (run_id) run_id
+ FROM utv_result_full
+ GROUP BY utp_id) b
+ WHERE a.id = b.utp_id(+);
+
diff --git a/source/utv_result_full.sql b/source/utv_result_full.sql
new file mode 100644
index 000000000..484879f0e
--- /dev/null
+++ b/source/utv_result_full.sql
@@ -0,0 +1,14 @@
+CREATE OR REPLACE VIEW utv_result_full
+AS
+ SELECT utp.id utp_id, program, ut.id unittest_id,
+ tc.id testcase_id, utr.outcome_id, run_id,
+ start_on, end_on, utr.status, utr.description
+ FROM ut_utp utp,
+ ut_unittest ut,
+ ut_testcase tc,
+ ut_outcome oc,
+ utr_outcome utr
+ WHERE utp.id = ut.utp_id
+ AND ut.id = tc.unittest_id
+ AND tc.id = oc.testcase_id
+ AND oc.id = utr.outcome_id;
diff --git a/test/common_helper/utplsql.pkb b/test/common_helper/utplsql.pkb
deleted file mode 100644
index c752caa41..000000000
--- a/test/common_helper/utplsql.pkb
+++ /dev/null
@@ -1,11 +0,0 @@
-create or replace package body utplsql is
-
- procedure global_setup is
- begin
- --we need to have dbms_output enable for our tests
- --TODO - move this to utPLSQL-cli once cli has support for it.
- dbms_output.enable(null);
- end;
-
-end;
-/
diff --git a/test/common_helper/utplsql.pks b/test/common_helper/utplsql.pks
deleted file mode 100644
index 51adbb117..000000000
--- a/test/common_helper/utplsql.pks
+++ /dev/null
@@ -1,9 +0,0 @@
-create or replace package utplsql is
-
- --%suite
-
- --%beforeall
- procedure global_setup;
-
-end;
-/
diff --git a/test/install_and_run_tests.sh b/test/install_and_run_tests.sh
deleted file mode 100755
index 24932d663..000000000
--- a/test/install_and_run_tests.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-set -e
-
-#goto git root directory
-git rev-parse && cd "$(git rev-parse --show-toplevel)"
-. ./development/env.sh
-set -v
-cd test
-
-time . ./install_tests.sh
-time . ./run_tests.sh
diff --git a/test/install_tests.sh b/test/install_tests.sh
deleted file mode 100755
index 1b97ec33d..000000000
--- a/test/install_tests.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-set -ev
-
-SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
-cd ${SCRIPT_DIR}
-
-
-"$SQLCLI" UT3_TESTER_HELPER/ut3@//${CONNECTION_STR} @install_ut3_tester_helper.sql
-
-"$SQLCLI" UT3_USER/ut3@//${CONNECTION_STR} @install_ut3_user_tests.sql
-
-"$SQLCLI" UT3_TESTER/ut3@//${CONNECTION_STR} @install_ut3_tester_tests.sql
-
diff --git a/test/install_ut3_tester_helper.sql b/test/install_ut3_tester_helper.sql
deleted file mode 100644
index b78221627..000000000
--- a/test/install_ut3_tester_helper.sql
+++ /dev/null
@@ -1,74 +0,0 @@
-set define off
-whenever sqlerror exit failure rollback
-whenever oserror exit failure rollback
-
-alter session set plsql_optimize_level=0;
---Install ut3_tester_helper
-@@ut3_tester_helper/test_dummy_object.tps
-@@ut3_tester_helper/other_dummy_object.tps
-@@ut3_tester_helper/test_dummy_nested_object.tps
-@@ut3_tester_helper/test_dummy_double_nested_object.tps
-@@ut3_tester_helper/test_dummy_object_list.tps
-@@ut3_tester_helper/test_dummy_nested_object_list.tps
-@@ut3_tester_helper/test_dummy_double_nested_list.tps
-@@ut3_tester_helper/test_dummy_dble_nest_lst_obj.tps
-@@ut3_tester_helper/test_tab_varchar2.tps
-@@ut3_tester_helper/test_tab_varray.tps
-@@ut3_tester_helper/test_nested_tab_varray.tps
-@@ut3_tester_helper/test_dummy_number.tps
-@@ut3_tester_helper/ut_test_table.sql
-@@ut3_tester_helper/test_event_object.tps
-@@ut3_tester_helper/test_event_list.tps
-
-@@ut3_tester_helper/main_helper.pks
-@@ut3_tester_helper/run_helper.pks
-@@ut3_tester_helper/coverage_helper.pks
-@@ut3_tester_helper/expectations_helper.pks
-@@ut3_tester_helper/ut_example_tests.pks
-
-@@ut3_tester_helper/main_helper.pkb
-@@ut3_tester_helper/run_helper.pkb
-@@ut3_tester_helper/coverage_helper.pkb
-@@ut3_tester_helper/expectations_helper.pkb
-@@ut3_tester_helper/ut_example_tests.pkb
-
-@@ut3_tester_helper/annotation_cache_helper.pks
-@@ut3_tester_helper/annotation_cache_helper.pkb
-create or replace synonym ut3_tester.annotation_cache_helper for ut3_tester_helper.annotation_cache_helper;
-create or replace synonym ut3_user.coverage_helper for ut3_tester_helper.coverage_helper;
-
-set linesize 200
-set define on
-set verify off
-column text format a100
-column error_count noprint new_value error_count
-
-prompt Validating installation
-
-set heading on
-select type, name, sequence, line, position, text, count(1) over() error_count
- from all_errors
- where owner = USER
- and name not like 'BIN$%' --not recycled
- and name != 'UT_WITH_INVALID_BODY'
- -- errors only. ignore warnings
- and attribute = 'ERROR'
- order by name, type, sequence
-/
-
-begin
- if to_number('&&error_count') > 0 then
- raise_application_error(-20000, 'Not all sources were successfully installed.');
- else
- dbms_output.put_line('Installation completed successfully');
- end if;
-
- for i in ( select object_name from user_objects t where t.object_type in ('PACKAGE','TYPE'))
- loop
- execute immediate 'grant execute on '||i.object_name||' to PUBLIC';
- end loop;
-
-end;
-/
-
-exit;
diff --git a/test/install_ut3_tester_tests.sql b/test/install_ut3_tester_tests.sql
deleted file mode 100644
index fa1331e00..000000000
--- a/test/install_ut3_tester_tests.sql
+++ /dev/null
@@ -1,82 +0,0 @@
-set define off
-whenever sqlerror exit failure rollback
-whenever oserror exit failure rollback
-
-alter session set plsql_optimize_level=0;
-
-@@common_helper/utplsql.pks
-@@common_helper/utplsql.pkb
-
---Install tests
-@@ut3_tester/core.pks
-@@ut3_tester/core/annotations/test_before_after_annotations.pks
-@@ut3_tester/core/annotations/test_annotation_parser.pks
-@@ut3_tester/core/annotations/test_annot_throws_exception.pks
-@@ut3_tester/core/annotations/test_annotation_manager.pks
-@@ut3_tester/core/annotations/test_annotation_cache.pks
-@@ut3_tester/core/annotations/test_annot_disabled_reason.pks
-@@ut3_tester/core/expectations/test_expectation_processor.pks
-@@ut3_tester/core/test_ut_utils.pks
-@@ut3_tester/core/test_ut_suite_tag_filter.pks
-@@ut3_tester/core/test_ut_test.pks
-@@ut3_tester/core/test_ut_suite.pks
-@@ut3_tester/core/test_ut_executable.pks
-@@ut3_tester/core/test_suite_manager.pks
-@@ut3_tester/core/test_file_mapper.pks
-@@ut3_tester/core/test_output_buffer.pks
-@@ut3_tester/core/test_suite_builder.pks
-@@ut3_tester/core/test_ut_metadata.pks
-@@ut3_tester/core/test_coverage_report_html_helper.pks
-
-
-@@ut3_tester/core.pkb
-@@ut3_tester/core/annotations/test_before_after_annotations.pkb
-@@ut3_tester/core/annotations/test_annotation_parser.pkb
-@@ut3_tester/core/annotations/test_annotation_manager.pkb
-@@ut3_tester/core/annotations/test_annot_throws_exception.pkb
-@@ut3_tester/core/annotations/test_annotation_cache.pkb
-@@ut3_tester/core/annotations/test_annot_disabled_reason.pkb
-@@ut3_tester/core/expectations/test_expectation_processor.pkb
-@@ut3_tester/core/test_ut_utils.pkb
-@@ut3_tester/core/test_ut_suite_tag_filter.pkb
-@@ut3_tester/core/test_ut_test.pkb
-@@ut3_tester/core/test_ut_suite.pkb
-@@ut3_tester/core/test_ut_executable.pkb
-@@ut3_tester/core/test_suite_manager.pkb
-@@ut3_tester/core/test_file_mapper.pkb
-@@ut3_tester/core/test_output_buffer.pkb
-@@ut3_tester/core/test_suite_builder.pkb
-@@ut3_tester/core/test_ut_metadata.pkb
-@@ut3_tester/core/test_coverage_report_html_helper.pkb
-
-
-
-set linesize 200
-set define on
-set verify off
-column text format a100
-column error_count noprint new_value error_count
-
-prompt Validating installation
-
-set heading on
-select type, name, sequence, line, position, text, count(1) over() error_count
- from all_errors
- where owner = USER
- and name not like 'BIN$%' --not recycled
- and name != 'UT_WITH_INVALID_BODY'
- -- errors only. ignore warnings
- and attribute = 'ERROR'
- order by name, type, sequence
-/
-
-begin
- if to_number('&&error_count') > 0 then
- raise_application_error(-20000, 'Not all sources were successfully installed.');
- else
- dbms_output.put_line('Installation completed successfully');
- end if;
-end;
-/
-
-exit;
diff --git a/test/install_ut3_user_tests.sql b/test/install_ut3_user_tests.sql
deleted file mode 100644
index 36966b3f6..000000000
--- a/test/install_ut3_user_tests.sql
+++ /dev/null
@@ -1,132 +0,0 @@
-set define off
-whenever sqlerror exit failure rollback
-whenever oserror exit failure rollback
-
-alter session set plsql_optimize_level=0;
-
-@@common_helper/utplsql.pks
-@@common_helper/utplsql.pkb
-
-prompt Install user tests
-@@ut3_user/helpers/some_item.tps
-@@ut3_user/helpers/some_items.tps
-@@ut3_user/helpers/some_object.tps
-@@ut3_user/test_user.pks
-@@ut3_user/expectations.pks
-@@ut3_user/expectations.pkb
-@@ut3_user/expectations/unary/test_expect_not_to_be_null.pks
-@@ut3_user/expectations/unary/test_expect_to_be_null.pks
-@@ut3_user/expectations/unary/test_expect_to_be_empty.pks
-@@ut3_user/expectations/unary/test_expect_to_have_count.pks
-@@ut3_user/expectations/unary/test_expect_to_be_true_false.pks
-@@ut3_user/expectations/unary/test_expect_to_be_not_null.pks
-@@ut3_user/expectations/binary/test_equal.pks
-@@ut3_user/expectations/binary/test_expect_to_be_less_than.pks
-@@ut3_user/expectations/binary/test_be_less_or_equal.pks
-@@ut3_user/expectations/binary/test_be_greater_or_equal.pks
-@@ut3_user/expectations/binary/test_be_greater_than.pks
-@@ut3_user/expectations/binary/test_to_be_within.pks
-@@ut3_user/expectations/binary/test_to_be_within_pct.pks
-@@ut3_user/expectations/test_matchers.pks
-@@ut3_user/expectations/test_expectation_anydata.pks
-@@ut3_user/expectations/test_expectations_cursor.pks
-@@ut3_user/expectations/test_expectations_json.pks
-@@ut3_user/api/test_ut_runner.pks
-@@ut3_user/api/test_ut_run.pks
-@@ut3_user/reporters.pks
-@@ut3_user/reporters/test_tfs_junit_reporter.pks
-@@ut3_user/reporters/test_teamcity_reporter.pks
-@@ut3_user/reporters/test_sonar_test_reporter.pks
-@@ut3_user/reporters/test_junit_reporter.pks
-@@ut3_user/reporters/test_documentation_reporter.pks
-@@ut3_user/reporters/test_debug_reporter.pks
-@@ut3_user/reporters/test_realtime_reporter.pks
-@@ut3_user/reporters/test_tap_reporter.pks
-@@ut3_user/reporters/test_coverage.pks
-@@ut3_user/reporters/test_coverage/test_coverage_standalone.pks
-set define on
-@@ut3_user/reporters/test_coverage/test_extended_coverage.pks
-@@ut3_user/reporters/test_coverage/test_html_coverage_reporter.pks
-set define off
-@@ut3_user/reporters/test_coverage/test_cov_cobertura_reporter.pks
-@@ut3_user/reporters/test_coverage/test_coverage_sonar_reporter.pks
-set define on
-@@ut3_user/reporters/test_coverage/test_proftab_coverage.pks
-set define off
-
-@@ut3_user/test_user.pkb
-@@ut3_user/expectations/unary/test_expect_not_to_be_null.pkb
-@@ut3_user/expectations/unary/test_expect_to_be_null.pkb
-@@ut3_user/expectations/unary/test_expect_to_be_empty.pkb
-@@ut3_user/expectations/unary/test_expect_to_have_count.pkb
-@@ut3_user/expectations/unary/test_expect_to_be_true_false.pkb
-@@ut3_user/expectations/unary/test_expect_to_be_not_null.pkb
-@@ut3_user/expectations/binary/test_equal.pkb
-@@ut3_user/expectations/binary/test_expect_to_be_less_than.pkb
-@@ut3_user/expectations/binary/test_be_less_or_equal.pkb
-@@ut3_user/expectations/binary/test_be_greater_or_equal.pkb
-@@ut3_user/expectations/binary/test_be_greater_than.pkb
-@@ut3_user/expectations/binary/test_to_be_within.pkb
-@@ut3_user/expectations/binary/test_to_be_within_pct.pkb
-@@ut3_user/expectations/test_matchers.pkb
-@@ut3_user/expectations/test_expectation_anydata.pkb
-@@ut3_user/expectations/test_expectations_cursor.pkb
-@@ut3_user/expectations/test_expectations_json.pkb
-@@ut3_user/api/test_ut_runner.pkb
-@@ut3_user/api/test_ut_run.pkb
-@@ut3_user/reporters.pkb
-@@ut3_user/reporters/test_tfs_junit_reporter.pkb
-@@ut3_user/reporters/test_teamcity_reporter.pkb
-@@ut3_user/reporters/test_sonar_test_reporter.pkb
-@@ut3_user/reporters/test_junit_reporter.pkb
-@@ut3_user/reporters/test_documentation_reporter.pkb
-@@ut3_user/reporters/test_debug_reporter.pkb
-@@ut3_user/reporters/test_realtime_reporter.pkb
-@@ut3_user/reporters/test_tap_reporter.pkb
-@@ut3_user/reporters/test_coverage/test_coverage_standalone.pkb
-set define on
-@@ut3_user/reporters/test_coverage/test_extended_coverage.pkb
-@@ut3_user/reporters/test_coverage/test_html_coverage_reporter.pkb
-set define off
-@@ut3_user/reporters/test_coverage/test_cov_cobertura_reporter.pkb
-@@ut3_user/reporters/test_coverage/test_coverage_sonar_reporter.pkb
-set define on
-@@ut3_user/reporters/test_coverage/test_proftab_coverage.pkb
-set define off
-
-
-set linesize 200
-set define on
-set verify off
-column text format a100
-column error_count noprint new_value error_count
-
-prompt Validating installation
-
-set heading on
-select type, name, sequence, line, position, text, count(1) over() error_count
- from all_errors
- where owner = USER
- and name not like 'BIN$%' --not recycled
- and name != 'UT_WITH_INVALID_BODY'
- -- errors only. ignore warnings
- and attribute = 'ERROR'
- order by name, type, sequence
-/
-
-begin
- if to_number('&&error_count') > 0 then
- raise_application_error(-20000, 'Not all sources were successfully installed.');
- else
- dbms_output.put_line('Installation completed successfully');
- end if;
-
- for i in ( select object_name from user_objects t where t.object_type = 'PACKAGE')
- loop
- execute immediate 'grant execute on '||i.object_name||' to UT3_TESTER';
- end loop;
-
-end;
-/
-
-exit;
diff --git a/test/run_tests.sh b/test/run_tests.sh
deleted file mode 100755
index 1a6970283..000000000
--- a/test/run_tests.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-set -ev
-
-#goto git root directory
-git rev-parse && cd "$(git rev-parse --show-toplevel)"
-
-export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
-
-time utPLSQL-cli/bin/utplsql run UT3_TESTER_HELPER/ut3@//${CONNECTION_STR} -D \
--source_path=source -owner=ut3_develop \
--p='ut3_tester,ut3_user' \
--test_path=test -c \
- -regex_expression="test/(\w+)(/(\w+))*/(\w+)\.(.{3})$" \
- -owner_subexpression=1 \
- -type_subexpression=5 \
- -name_subexpression=4 \
--f=ut_coverage_sonar_reporter -o=coverage.xml \
--f=ut_coverage_cobertura_reporter -o=cobertura.xml \
--f=ut_coverage_html_reporter -o=coverage.html \
--f=ut_sonar_test_reporter -o=test_results.xml \
--f=ut_junit_reporter -o=junit_test_results.xml \
--f=ut_tfs_junit_reporter -o=tfs_test_results.xml \
--f=ut_documentation_reporter -o=test_results.log -s
diff --git a/test/ut3_tester/core.pkb b/test/ut3_tester/core.pkb
deleted file mode 100644
index 41b6b10d1..000000000
--- a/test/ut3_tester/core.pkb
+++ /dev/null
@@ -1,11 +0,0 @@
-create or replace package body core is
-
- procedure global_setup is
- begin
- ut3_tester_helper.coverage_helper.set_develop_mode();
- --improve performance of test execution by disabling all compiler optimizations
- ut3_tester_helper.main_helper.execute_autonomous('ALTER SESSION SET PLSQL_OPTIMIZE_LEVEL=0');
- end;
-
-end;
-/
diff --git a/test/ut3_tester/core.pks b/test/ut3_tester/core.pks
deleted file mode 100644
index 4565c47f3..000000000
--- a/test/ut3_tester/core.pks
+++ /dev/null
@@ -1,10 +0,0 @@
-create or replace package core is
-
- --%suite
- --%suitepath(utplsql.ut3_tester)
-
- --%beforeall
- procedure global_setup;
-
-end;
-/
diff --git a/test/ut3_tester/core/annotations/test_annot_disabled_reason.pkb b/test/ut3_tester/core/annotations/test_annot_disabled_reason.pkb
deleted file mode 100644
index 7f1e068a8..000000000
--- a/test/ut3_tester/core/annotations/test_annot_disabled_reason.pkb
+++ /dev/null
@@ -1,484 +0,0 @@
-create or replace package body test_annot_disabled_reason
-is
-
-
- procedure compile_dummy_packages is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace package test_package_1 is
-
- --%suite
- --%displayname(disable_test_suite_level)
- --%suitepath(tests)
- --%rollback(manual)
-
- --%disabled( Tests are disabled on suite level )
-
- --%context( First context )
-
- --%test(Test1 from test package 1)
- procedure test1;
-
- --%test(Test2 from test package 1)
- procedure test2;
-
- --%endcontext
-
- --%context( Second context )
-
- --%test(Test3 from test package 1)
- procedure test3;
-
- --%test(Test4 from test package 1)
- procedure test4;
-
- --%endcontext
-
-end test_package_1;]';
-
- execute immediate q'[create or replace package body test_package_1 is
-
- procedure test1 is
- begin
- ut.expect(1).to_equal(1);
- end;
-
- procedure test2 is
- begin
- ut.expect(2).to_equal(2);
- end;
-
- procedure test3 is
- begin
- ut.expect(1).to_equal(1);
- end;
-
- procedure test4 is
- begin
- ut.expect(2).to_equal(2);
- end;
-
-end test_package_1;]';
-
- execute immediate q'[create or replace package test_package_2 is
-
- --%suite
- --%displayname(Disable on context level)
- --%suitepath(tests)
- --%rollback(manual)
-
- --%context( First context )
-
- --%disabled( Tests and disabled on first context level )
-
- --%test(Test1 from test package 2)
- procedure test1;
-
- --%test(Test2 from test package 2)
- procedure test2;
-
- --%endcontext
-
- --%context( Second context )
-
- --%test(Test3 from test package 2)
- procedure test3;
-
- --%test(Test4 from test package 3)
- procedure test4;
-
- --%endcontext
-
-end test_package_2;]';
-
- execute immediate q'[create or replace package body test_package_2 is
-
- procedure test1 is
- begin
- ut.expect(1).to_equal(1);
- end;
-
- procedure test2 is
- begin
- ut.expect(2).to_equal(2);
- end;
-
- procedure test3 is
- begin
- ut.expect(1).to_equal(1);
- end;
-
- procedure test4 is
- begin
- ut.expect(2).to_equal(2);
- end;
-
-end test_package_2;]';
-
- execute immediate q'[create or replace package testing_package_3 is
-
- --%suite
- --%displayname(Disable tests on test level)
- --%suitepath(tests)
- --%rollback(manual)
-
- --%context( First context )
-
- --%test(Test1 from test package 3)
- --%disabled( Test1 disabled from first context )
- procedure test1;
-
- --%test(Test2 from test package 3)
- procedure test2;
-
- --%endcontext
-
- --%context( Second context )
-
- --%test(Test3 from test package 3)
- procedure test3;
-
- --%test(Test4 from test package 3)
- --%disabled( Test4 disabled from second context )
- procedure test4;
-
- --%endcontext
-
-end testing_package_3;]';
-
- execute immediate q'[create or replace package body testing_package_3 is
-
- procedure test1 is
- begin
- ut.expect(1).to_equal(1);
- end;
-
- procedure test2 is
- begin
- ut.expect(2).to_equal(2);
- end;
-
- procedure test3 is
- begin
- ut.expect(1).to_equal(1);
- end;
-
- procedure test4 is
- begin
- ut.expect(2).to_equal(2);
- end;
-
-end testing_package_3;]';
-
- execute immediate q'[create or replace package test_package_4 is
-
- --%suite
- --%displayname(Disable reason is very long or have special characters)
- --%suitepath(tests)
- --%rollback(manual)
-
-
- --%test(Test1 from test package 4)
- --%disabled( $#?!%*&-/\^ )
- procedure test1;
-
- --%test(Test2 from test package 4)
- --%disabled(verylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtext)
- procedure test2;
-
-end test_package_4;]';
-
- execute immediate q'[create or replace package body test_package_4 is
-
- procedure test1 is
- begin
- ut.expect(1).to_equal(1);
- end;
-
- procedure test2 is
- begin
- ut.expect(2).to_equal(2);
- end;
-
-end test_package_4;]';
-
- execute immediate q'[create or replace package test_package_5 is
-
- --%suite
- --%displayname(Disable tests on suite level overriding rest)
- --%suitepath(tests)
- --%rollback(manual)
-
- --%disabled( Disable on suite level )
-
- --%context( First context )
-
- --%disabled( Disable on 1st context level )
-
- --%test(Test1 from test package 3)
- --%disabled( Disable on 1st test level )
- procedure test1;
-
- --%test(Test2 from test package 3)
- --%disabled( Disable on 2nd test level )
- procedure test2;
-
- --%endcontext
-
- --%context( Second context )
-
- --%disabled( Disable on 2nd context level )
-
- --%test(Test3 from test package 3)
- --%disabled( Disable on 3rd test level )
- procedure test3;
-
- --%test(Test4 from test package 3)
- --%disabled( Disable on 4th test level )
- procedure test4;
-
- --%endcontext
-
-end test_package_5;]';
-
- execute immediate q'[create or replace package body test_package_5 is
-
- procedure test1 is
- begin
- ut.expect(1).to_equal(1);
- end;
-
- procedure test2 is
- begin
- ut.expect(2).to_equal(2);
- end;
-
- procedure test3 is
- begin
- ut.expect(1).to_equal(1);
- end;
-
- procedure test4 is
- begin
- ut.expect(2).to_equal(2);
- end;
-
-end test_package_5;]';
-
- execute immediate q'[create or replace package test_package_6 is
-
- --%suite
- --%displayname(Disable tests on each of ctx level overriding rest)
- --%suitepath(tests)
- --%rollback(manual)
-
- --%context( First context )
-
- --%disabled( Disable on 1st context level )
-
- --%test(Test1 from test package 3)
- --%disabled( Disable on 1st test level )
- procedure test1;
-
- --%test(Test2 from test package 3)
- --%disabled( Disable on 2nd test level )
- procedure test2;
-
- --%endcontext
-
- --%context( Second context )
-
- --%disabled( Disable on 2nd context level )
-
- --%test(Test3 from test package 3)
- --%disabled( Disable on 3rd test level )
- procedure test3;
-
- --%test(Test4 from test package 3)
- --%disabled( Disable on 4th test level )
- procedure test4;
-
- --%endcontext
-
-end test_package_6;]';
-
- execute immediate q'[create or replace package body test_package_6 is
-
- procedure test1 is
- begin
- ut.expect(1).to_equal(1);
- end;
-
- procedure test2 is
- begin
- ut.expect(2).to_equal(2);
- end;
-
- procedure test3 is
- begin
- ut.expect(1).to_equal(1);
- end;
-
- procedure test4 is
- begin
- ut.expect(2).to_equal(2);
- end;
-
-end test_package_6;]';
-
- end;
-
-
- procedure drop_dummy_packages is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package test_package_1';
- execute immediate 'drop package test_package_2';
- execute immediate 'drop package testing_package_3';
- execute immediate 'drop package test_package_4';
- execute immediate 'drop package test_package_5';
- execute immediate 'drop package test_package_6';
- end;
-
- procedure test_disable_on_suite_level is
- l_test_results ut3_develop.ut_varchar2_list;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- --Act
-
- select * bulk collect into l_test_results from table(ut3_develop.ut.run((sys_context('USERENV', 'CURRENT_USER')||'.test_package_1')));
-
- l_actual_message := ut3_develop.ut_utils.table_to_clob(l_test_results);
-
- l_expected_message := q'[%tests
-%disable_test_suite_level
-%First context
-%Test1 from test package 1 [0 sec] (DISABLED - Tests are disabled on suite level)
-%Test2 from test package 1 [0 sec] (DISABLED - Tests are disabled on suite level)
-%Second context
-%Test3 from test package 1 [0 sec] (DISABLED - Tests are disabled on suite level)
-%Test4 from test package 1 [0 sec] (DISABLED - Tests are disabled on suite level)%]';
- ut.expect(l_actual_message).to_be_like(l_expected_message);
-
- end;
-
- procedure test_dis_on_1st_ctx_level is
- l_test_results ut3_develop.ut_varchar2_list;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- --Act
-
- select * bulk collect into l_test_results from table(ut3_develop.ut.run((sys_context('USERENV', 'CURRENT_USER')||'.test_package_2')));
-
- l_actual_message := ut3_develop.ut_utils.table_to_clob(l_test_results);
-
- l_expected_message := q'[%tests
-%Disable on context level
-%First context
-%Test1 from test package 2 [0 sec] (DISABLED - Tests and disabled on first context level)
-%Test2 from test package 2 [0 sec] (DISABLED - Tests and disabled on first context level)
-%Second context
-%Test3 from test package 2 [% sec]
-%Test4 from test package 3 [% sec]%]';
-
- ut.expect(l_actual_message).to_be_like(l_expected_message);
-
- end;
-
- procedure test_disable_tests_level is
- l_test_results ut3_develop.ut_varchar2_list;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- --Act
-
- select * bulk collect into l_test_results from table(ut3_develop.ut.run((sys_context('USERENV', 'CURRENT_USER')||'.testing_package_3')));
-
- l_actual_message := ut3_develop.ut_utils.table_to_clob(l_test_results);
-
- l_expected_message := q'[%tests
-%Disable tests on test level
-%First context
-%Test1 from test package 3 [0 sec] (DISABLED - Test1 disabled from first context)
-%Test2 from test package 3 [% sec]
-%Second context
-%Test3 from test package 3 [% sec]
-%Test4 from test package 3 [0 sec] (DISABLED - Test4 disabled from second context)%]';
-
- ut.expect(l_actual_message).to_be_like(l_expected_message);
-
-
- end;
-
- procedure test_long_text_spec_chr is
- l_test_results ut3_develop.ut_varchar2_list;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- --Act
-
- select * bulk collect into l_test_results from table(ut3_develop.ut.run((sys_context('USERENV', 'CURRENT_USER')||'.test_package_4')));
-
- l_actual_message := ut3_develop.ut_utils.table_to_clob(l_test_results);
-
- l_expected_message := q'[%tests
-%Disable reason is very long or have special characters
-%Test1 from test package 4 [0 sec] (DISABLED - $#?!%*&-/\^)
-%Test2 from test package 4 [0 sec] (DISABLED - verylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtext)%]';
-
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure test_disable_suite_ctx_tst is
- l_test_results ut3_develop.ut_varchar2_list;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- --Act
-
- select * bulk collect into l_test_results from table(ut3_develop.ut.run((sys_context('USERENV', 'CURRENT_USER')||'.test_package_5')));
-
- l_actual_message := ut3_develop.ut_utils.table_to_clob(l_test_results);
-
- l_expected_message := q'[%tests
-%Disable tests on suite level overriding rest
-%First context
-%Test1 from test package 3 [0 sec] (DISABLED - Disable on suite level)
-%Test2 from test package 3 [0 sec] (DISABLED - Disable on suite level)
-%Second context
-%Test3 from test package 3 [0 sec] (DISABLED - Disable on suite level)
-%Test4 from test package 3 [0 sec] (DISABLED - Disable on suite level)%]';
-
- ut.expect(l_actual_message).to_be_like(l_expected_message);
-
-
- end;
-
- procedure test_disable_ctx_tst is
- l_test_results ut3_develop.ut_varchar2_list;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- --Act
-
- select * bulk collect into l_test_results from table(ut3_develop.ut.run((sys_context('USERENV', 'CURRENT_USER')||'.test_package_6')));
-
- l_actual_message := ut3_develop.ut_utils.table_to_clob(l_test_results);
-
- l_expected_message := q'[%tests
-%Disable tests on each of ctx level overriding rest
-%First context
-%Test1 from test package 3 [0 sec] (DISABLED - Disable on 1st context level)
-%Test2 from test package 3 [0 sec] (DISABLED - Disable on 1st context level)
-%Second context
-%Test3 from test package 3 [0 sec] (DISABLED - Disable on 2nd context level)
-%Test4 from test package 3 [0 sec] (DISABLED - Disable on 2nd context level)%]';
-
- ut.expect(l_actual_message).to_be_like(l_expected_message);
-
- end;
-
-end;
-/
diff --git a/test/ut3_tester/core/annotations/test_annot_disabled_reason.pks b/test/ut3_tester/core/annotations/test_annot_disabled_reason.pks
deleted file mode 100644
index cae5da1ee..000000000
--- a/test/ut3_tester/core/annotations/test_annot_disabled_reason.pks
+++ /dev/null
@@ -1,31 +0,0 @@
-create or replace package test_annot_disabled_reason
-is
- --%suite(annotations - disabled)
- --%suitepath(utplsql.ut3_tester.core.annotations)
-
- --%beforeall
- procedure compile_dummy_packages;
-
- --%afterall
- procedure drop_dummy_packages;
-
- --%test(Disable all tests under the suite displaying suite level reason)
- procedure test_disable_on_suite_level;
-
- --%test(Disable all tests under one of two contexts displaying context level reason)
- procedure test_dis_on_1st_ctx_level;
-
- --%test(Disable a single tests from each of the contexts displaying test level reason)
- procedure test_disable_tests_level;
-
- --%test(Disable tests with reason using special characters and long reason)
- procedure test_long_text_spec_chr;
-
- --%test(Disable tests on suite , context and test level and display suite level reason)
- procedure test_disable_suite_ctx_tst;
-
- --%test(Disable tests on context and test level and display context level reason)
- procedure test_disable_ctx_tst;
-
-end;
-/
diff --git a/test/ut3_tester/core/annotations/test_annot_throws_exception.pkb b/test/ut3_tester/core/annotations/test_annot_throws_exception.pkb
deleted file mode 100644
index 761377765..000000000
--- a/test/ut3_tester/core/annotations/test_annot_throws_exception.pkb
+++ /dev/null
@@ -1,516 +0,0 @@
-create or replace package body test_annot_throws_exception
-is
- g_tests_results clob;
- g_results_other_schema clob;
-
- procedure recollect_tests_results is
- pragma autonomous_transaction;
-
- l_package_spec varchar2(32737);
- l_package_body varchar2(32737);
- l_exception_spec varchar2(32737);
- l_test_results ut3_develop.ut_varchar2_list;
- begin
- l_exception_spec := q'[
- create or replace package exc_pkg is
- c_e_single_exc constant number := -20200;
- c_e_dummy constant varchar2(10) := 'dummy';
- c_e_varch_exc constant varchar2(10) := '-20201';
- c_e_list_1 number := -20202;
- c_e_list_2 constant number := -20203;
- c_e_diff_exc constant number := -20204;
- c_e_mix_list constant number := -20205;
- c_e_mix_missin constant number := -20206;
- c_e_positive constant number := 20207;
-
- e_some_exception exception;
- pragma exception_init(e_some_exception, -20207);
-
- end;
- ]';
-
- l_package_spec := q'[
- create or replace package annotated_package_with_throws is
-
- c_local_error_no constant number := -20211;
- e_some_local_exception exception;
- pragma exception_init(e_some_local_exception, -20212);
-
- e_uninitialized_exception_variable exception;
-
- --%suite(Dummy package to test annotation throws)
-
- --%test(Throws same annotated exception)
- --%throws(-20145)
- procedure raised_same_exception;
-
- --%test(Throws one of the listed exceptions)
- --%throws(-20145,-20146, -20189 ,-20563)
- procedure raised_one_listed_exception;
-
- --%test(Leading zero is ignored in exception list)
- --%throws(-01476)
- procedure leading_0_exception_no;
-
- --%test(Throws diff exception)
- --%throws(-20144)
- procedure raised_diff_exception;
-
- --%test(Throws empty)
- --%throws()
- procedure empty_throws;
-
- --%test(Ignores annotation and fails when exception was thrown)
- --%throws(hello,784#,0-=234,,u1234)
- procedure bad_paramters_with_except;
-
- --%test(Ignores annotation and succeeds when no exception thrown)
- --%throws(hello,784#,0-=234,,u1234)
- procedure bad_paramters_without_except;
-
- --%test(Ignores annotation for positive exception number value)
- --%throws(20001)
- procedure positive_exception_number;
-
- --%test(Ignores annotation for positive exception number variable)
- --%throws(exc_pkg.c_e_positive)
- procedure positive_exception_number_var;
-
- --%test(Detects a valid exception number within many invalid ones)
- --%throws(7894562, operaqk, -=1, -1, pow74d, posdfk3)
- procedure one_valid_exception_number;
-
- --%test(Gives failure when a exception is expected and nothing is thrown)
- --%throws(-20459, -20136, -20145)
- procedure nothing_thrown;
-
- --%test(Single exception defined as a constant number in package)
- --%throws(exc_pkg.c_e_single_exc)
- procedure single_exc_const_pkg;
-
- --%test(Gives success when one of annotated exception using constant is thrown)
- --%throws(exc_pkg.c_e_list_1,exc_pkg.c_e_list_2)
- procedure list_of_exc_constant;
-
- --%test(Gives failure when the raised exception is different that the annotated one using variable)
- --%throws(exc_pkg.c_e_diff_exc)
- procedure fail_not_match_exc;
-
- --%test(Success when one of exception from mixed list of number and constant is thrown)
- --%throws(exc_pkg.c_e_mix_list,-20105)
- procedure mixed_exc_list;
-
- --%test(Success when match exception even if other variable on list dont exists)
- --%throws(exc_pkg.c_e_mix_missin,utter_rubbish)
- procedure mixed_list_notexi;
-
- --%test(Success referencing an exception variable when running from another schema)
- --%throws(exc_pkg.e_some_exception)
- procedure named_exc_pragma_run_from_another_schema;
-
- --%test(Success referencing a numeric exception variable when running from another schema)
- --%throws(exc_pkg.c_e_list_1)
- procedure exc_number_var_run_from_another_schema;
-
- --%test(Success referencing an exception variable without package name when running from another schema)
- --%throws(e_some_local_exception)
- procedure named_exc_pragma_run_from_another_schema_no_package_name;
-
- --%test(Success referencing a numeric exception variable without package name when running from another schema)
- --%throws(c_local_error_no)
- procedure exc_number_var_run_from_another_schema_no_package_name;
-
- --%test(Success resolve and match named exception defined in pragma exception init)
- --%throws(exc_pkg.e_some_exception)
- procedure named_exc_pragma;
-
- --%test(Success resolve and match oracle named exception)
- --%throws(NO_DATA_FOUND)
- procedure named_exc_ora;
-
- --%test(Success resolve and match oracle named exception dup val index)
- --%throws(DUP_VAL_ON_INDEX)
- procedure named_exc_ora_dup_ind;
-
- --%test(Success map no data 100 to -1403)
- --%throws(-1403)
- procedure nodata_exc_ora;
-
- --%test(Success for exception defined as varchar)
- --%throws(exc_pkg.c_e_varch_exc)
- procedure defined_varchar_exc;
-
- --%test(Non existing constant exception)
- --%throws(dummy.c_dummy);
- procedure non_existing_const;
-
- --%test(Bad exception constant)
- --%throws(exc_pkg.c_e_dummy);
- procedure bad_exc_const;
-
- --%test(Uninitialized exception variable can be used successfully in a test)
- --%throws(e_uninitialized_exception_variable)
- procedure referencing_uninitialized_exception;
-
- --%test(Failure report shows all expected exceptions)
- --%throws(c_local_error_no,e_some_local_exception,e_uninitialized_exception_variable)
- procedure not_throwing_expected_exceptions;
-
- end;
- ]';
-
- l_package_body := '
- create or replace package body annotated_package_with_throws is
- procedure raised_same_exception is
- begin
- raise_application_error(-20145, ''Test error'');
- end;
-
- procedure raised_one_listed_exception is
- begin
- raise_application_error(-20189, ''Test error'');
- end;
-
- procedure leading_0_exception_no is
- x integer;
- begin
- x := 1 / 0;
- end;
-
- procedure raised_diff_exception is
- begin
- raise_application_error(-20143, ''Test error'');
- end;
-
- procedure empty_throws is
- begin
- raise_application_error(-20143, ''Test error'');
- end;
-
- procedure bad_paramters_with_except is
- begin
- raise_application_error(-20143, ''Test error'');
- end;
-
- procedure bad_paramters_without_except is
- begin
- null;
- end;
-
- procedure positive_exception_number is
- begin
- null;
- end;
-
- procedure positive_exception_number_var is
- begin
- null;
- end;
-
- procedure one_valid_exception_number is
- begin
- raise dup_val_on_index;
- end;
-
- procedure nothing_thrown is
- begin
- null;
- end;
-
- procedure single_exc_const_pkg is
- begin
- raise_application_error(exc_pkg.c_e_single_exc,''Test'');
- end;
-
- procedure list_of_exc_constant is
- begin
- raise_application_error(exc_pkg.c_e_list_1,''Test'');
- end;
-
- procedure fail_not_match_exc is
- begin
- raise NO_DATA_FOUND;
- end;
-
- procedure mixed_exc_list is
- begin
- raise_application_error(exc_pkg.c_e_mix_list,''Test'');
- end;
-
- procedure mixed_list_notexi is
- begin
- raise_application_error(exc_pkg.c_e_mix_missin,''Test'');
- end;
-
- procedure named_exc_pragma_run_from_another_schema is
- begin
- raise exc_pkg.e_some_exception;
- end;
-
- procedure exc_number_var_run_from_another_schema is
- begin
- raise_application_error(exc_pkg.c_e_list_1,''Test'');
- end;
-
- procedure named_exc_pragma_run_from_another_schema_no_package_name is
- begin
- raise e_some_local_exception;
- end;
-
- procedure exc_number_var_run_from_another_schema_no_package_name is
- begin
- raise_application_error(c_local_error_no,''Test'');
- end;
-
- procedure named_exc_pragma is
- begin
- raise exc_pkg.e_some_exception;
- end;
-
- procedure named_exc_ora is
- begin
- raise NO_DATA_FOUND;
- end;
-
- procedure named_exc_ora_dup_ind is
- begin
- raise DUP_VAL_ON_INDEX;
- end;
-
- procedure nodata_exc_ora is
- begin
- raise NO_DATA_FOUND;
- end;
-
- procedure defined_varchar_exc is
- begin
- raise_application_error(exc_pkg.c_e_varch_exc,''Test'');
- end;
-
- procedure non_existing_const is
- begin
- raise_application_error(-20143, ''Test error'');
- end;
-
- procedure bad_exc_const is
- begin
- raise_application_error(-20143, ''Test error'');
- end;
-
- procedure referencing_uninitialized_exception is
- begin
- raise e_uninitialized_exception_variable;
- end;
-
- procedure not_throwing_expected_exceptions is
- begin
- raise_application_error(-20143, ''Test error'');
- end;
- end;
- ';
-
- execute immediate l_exception_spec;
- execute immediate l_package_spec;
- execute immediate l_package_body;
-
-
- select * bulk collect into l_test_results from table(ut3_develop.ut.run(('annotated_package_with_throws')));
-
- g_tests_results := ut3_develop.ut_utils.table_to_clob(l_test_results);
- end;
-
- procedure drop_test_package is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package annotated_package_with_throws';
- execute immediate 'drop package exc_pkg';
- end;
-
-
- procedure throws_same_annotated_except is
- begin
- ut.expect(g_tests_results).to_match('^\s*Throws same annotated exception \[[,\.0-9]+ sec\]\s*$','m');
- ut.expect(g_tests_results).not_to_match('raised_same_exception');
- end;
-
- procedure throws_one_of_annotated_excpt is
- begin
- ut.expect(g_tests_results).to_match('^\s*Throws one of the listed exceptions \[[,\.0-9]+ sec\]\s*$','m');
- ut.expect(g_tests_results).not_to_match('raised_one_listed_exception');
- end;
-
- procedure throws_with_leading_zero is
- begin
- ut.expect(g_tests_results).to_match('^\s*Leading zero is ignored in exception list \[[,\.0-9]+ sec\]\s*$','m');
- ut.expect(g_tests_results).not_to_match('leading_0_exception_no');
- end;
-
- procedure throws_diff_annotated_except is
- begin
- ut.expect(g_tests_results).to_match('^\s*Throws diff exception \[[,\.0-9]+ sec\] \(FAILED - [0-9]+\)\s*$','m');
- ut.expect(g_tests_results).to_match('raised_diff_exception\s+Actual: -20143 was expected to equal: -20144\s+ORA-20143: Test error\s+ORA-06512: at "UT3_TESTER.ANNOTATED_PACKAGE_WITH_THROWS"');
- end;
-
- procedure throws_empty is
- begin
- ut.expect(g_tests_results).to_match('^\s*Throws empty \[[,\.0-9]+ sec\] \(FAILED - [0-9]+\)\s*$','m');
- ut.expect(g_tests_results).to_match('empty_throws\s*ORA-20143: Test error\s*ORA-06512: at "UT3_TESTER.ANNOTATED_PACKAGE_WITH_THROWS"');
- end;
-
- procedure bad_paramters_with_except is
- begin
- ut.expect(g_tests_results).to_match('^\s*Ignores annotation and fails when exception was thrown \[[,\.0-9]+ sec\] \(FAILED - [0-9]+\)\s*$','m');
- ut.expect(g_tests_results).to_match('bad_paramters_with_except\s*ORA-20143: Test error\s*ORA-06512: at "UT3_TESTER.ANNOTATED_PACKAGE_WITH_THROWS"');
- end;
-
- procedure bad_paramters_without_except is
- begin
- ut.expect(g_tests_results).to_match('^\s*Ignores annotation and succeeds when no exception thrown \[[,\.0-9]+ sec\]\s*$','m');
- ut.expect(g_tests_results).to_match('bad_paramters_without_except\s*Invalid parameter value ".*" for "--%throws" annotation. Parameter ignored.','m');
- end;
-
- procedure positive_exception_number is
- begin
- ut.expect(g_tests_results).to_match('^\s*Ignores annotation for positive exception number value \[[,\.0-9]+ sec\]\s*$','m');
- ut.expect(g_tests_results).to_match('positive_exception_number\s*Invalid parameter value "20001" for "--%throws" annotation. Exception value must be a negative integer. Parameter ignored.','m');
- end;
-
- procedure positive_exception_number_var is
- begin
- ut.expect(g_tests_results).to_match('^\s*Ignores annotation for positive exception number variable \[[,\.0-9]+ sec\]\s*$','m');
- ut.expect(g_tests_results).to_match('positive_exception_number_var\s*Invalid parameter value ".*" for "--%throws" annotation. Exception value must be a negative integer. Parameter ignored.','m');
- end;
-
- procedure one_valid_exception_number is
- begin
- ut.expect(g_tests_results).to_match('^\s*Detects a valid exception number within many invalid ones \[[,\.0-9]+ sec\]\s*$','m');
- ut.expect(g_tests_results).to_match('one_valid_exception_number\s*Invalid parameter value ".*" for "--%throws" annotation. Parameter ignored.','m');
- end;
-
- procedure nothing_thrown is
- begin
- ut.expect(g_tests_results).to_match('^\s*Gives failure when a exception is expected and nothing is thrown \[[,\.0-9]+ sec\] \(FAILED - [0-9]+\)\s*$','m');
- ut.expect(g_tests_results).to_match('nothing_thrown\s*Expected one of exceptions \(-20459, -20136, -20145\) but nothing was raised.');
- end;
-
- procedure single_exc_const_pkg is
- begin
- ut.expect(g_tests_results).to_match('^\s*Single exception defined as a constant number in package \[[,\.0-9]+ sec\]\s*$','m');
- ut.expect(g_tests_results).not_to_match('single_exc_const_pkg');
- end;
-
- procedure list_of_exc_constant is
- begin
- ut.expect(g_tests_results).to_match('^\s*Gives success when one of annotated exception using constant is thrown \[[,\.0-9]+ sec\]\s*$','m');
- ut.expect(g_tests_results).not_to_match('list_of_exc_constant');
- end;
-
- procedure fail_not_match_exc is
- begin
- ut.expect(g_tests_results).to_match('^\s*Gives failure when the raised exception is different that the annotated one using variable \[[,\.0-9]+ sec\] \(FAILED - [0-9]+\)\s*$','m');
- ut.expect(g_tests_results).to_match('fail_not_match_exc\s+Actual: -1403 was expected to equal: -20204\s+ORA-01403: no data found\s+ORA-06512: at "UT3_TESTER.ANNOTATED_PACKAGE_WITH_THROWS"');
- end;
-
- procedure mixed_exc_list is
- begin
- ut.expect(g_tests_results).to_match('^\s*Success when one of exception from mixed list of number and constant is thrown \[[,\.0-9]+ sec\]\s*$','m');
- ut.expect(g_tests_results).not_to_match('mixed_exc_list');
- end;
-
- procedure mixed_list_notexi is
- begin
- ut.expect(g_tests_results).to_match('^\s*Success when match exception even if other variable on list dont exists \[[,\.0-9]+ sec\]\s*$','m');
- ut.expect(g_tests_results).to_match('mixed_list_notexi\s*Invalid parameter value "utter_rubbish" for "--%throws" annotation. Parameter ignored.','m');
- end;
-
- procedure named_exc_pragma is
- begin
- ut.expect(g_tests_results).to_match('^\s*Success resolve and match named exception defined in pragma exception init \[[,\.0-9]+ sec\]\s*$','m');
- ut.expect(g_tests_results).not_to_match('named_exc_pragma');
- end;
-
- procedure run_from_another_schema is
- begin
- ut3_tester_helper.run_helper.run(('ut3_tester.annotated_package_with_throws'));
- g_results_other_schema := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- end;
-
- procedure named_exc_pragma_run_from_another_schema is
- begin
- ut.expect(g_results_other_schema).to_match('^\s*Success referencing an exception variable when running from another schema \[[,\.0-9]+ sec\]\s*$', 'm');
- ut.expect(g_results_other_schema).not_to_match('named_exc_pragma_run_from_another_schema');
- end;
-
- procedure named_exc_pragma_run_from_another_schema_no_package_name is
- begin
- ut.expect(g_results_other_schema).to_match('^\s*Success referencing an exception variable without package name when running from another schema \[[,\.0-9]+ sec\]\s*$', 'm');
- ut.expect(g_results_other_schema).not_to_match('named_exc_pragma_run_from_another_schema_no_package_name');
- end;
-
- procedure exc_number_var_run_from_another_schema_no_package_name is
- begin
- ut.expect(g_results_other_schema).to_match('^\s*Success referencing a numeric exception variable without package name when running from another schema \[[,\.0-9]+ sec\]\s*$', 'm');
- ut.expect(g_results_other_schema).not_to_match('exc_number_var_run_from_another_schema_no_package_name');
- end;
-
- procedure exc_number_var_run_from_another_schema is
- begin
- ut.expect(g_results_other_schema).to_match('^\s*Success referencing a numeric exception variable when running from another schema \[[,\.0-9]+ sec\]\s*$', 'm');
- ut.expect(g_results_other_schema).not_to_match('exc_number_var_run_from_another_schema');
- end;
-
- procedure named_exc_ora is
- begin
- ut.expect(g_tests_results).to_match('^\s*Success resolve and match oracle named exception \[[,\.0-9]+ sec\]\s*$','m');
- ut.expect(g_tests_results).not_to_match('named_exc_ora');
- end;
-
- procedure named_exc_ora_dup_ind is
- begin
- ut.expect(g_tests_results).to_match('^\s*Success resolve and match oracle named exception dup val index \[[,\.0-9]+ sec\]\s*$','m');
- ut.expect(g_tests_results).not_to_match('named_exc_ora_dup_ind');
- end;
-
- procedure nodata_exc_ora is
- begin
- ut.expect(g_tests_results).to_match('^\s*Success map no data 100 to -1403 \[[,\.0-9]+ sec\]\s*$','m');
- ut.expect(g_tests_results).not_to_match('nodata_exc_ora');
- end;
-
- procedure defined_varchar_exc is
- begin
- ut.expect(g_tests_results).to_match('^\s*Success for exception defined as varchar \[[,\.0-9]+ sec\]\s*$','m');
- ut.expect(g_tests_results).not_to_match('defined_varchar_exc');
- end;
-
- procedure non_existing_const is
- begin
- ut.expect(g_tests_results).to_match('^\s*Non existing constant exception \[[,\.0-9]+ sec\] \(FAILED - [0-9]+\)\s*$','m');
- ut.expect(g_tests_results).to_match('non_existing_const\s*ORA-20143: Test error\s*ORA-06512: at "UT3_TESTER.ANNOTATED_PACKAGE_WITH_THROWS"');
- end;
-
- procedure bad_exc_const is
- begin
- ut.expect(g_tests_results).to_match('^\s*Bad exception constant \[[,\.0-9]+ sec\] \(FAILED - [0-9]+\)\s*$','m');
- ut.expect(g_tests_results).to_match('bad_exc_const\s*ORA-20143: Test error\s*ORA-06512: at "UT3_TESTER.ANNOTATED_PACKAGE_WITH_THROWS"');
- end;
-
- procedure referencing_uninitialized_exception is
- l_test_results ut3_develop.ut_varchar2_list;
- l_actual clob;
- begin
- select * bulk collect into l_test_results from table(ut3_develop.ut.run(('annotated_package_with_throws.referencing_uninitialized_exception')));
-
- l_actual := ut3_develop.ut_utils.table_to_clob(l_test_results);
- ut.expect(l_actual).to_match('^\s*Uninitialized exception variable can be used successfully in a test \[[,\.0-9]+ sec\]\s*$','m');
- ut.expect(l_actual).not_to_match('referencing_uninitialized_exception');
- end;
-
- procedure not_throwing_expected_exceptions is
- begin
- ut.expect(g_tests_results).to_match('not_throwing_expected_exceptions');
- ut.expect(g_tests_results).to_match('Actual: -20143 was expected to be one of: \(annotated_package_with_throws.e_some_local_exception, annotated_package_with_throws.e_uninitialized_exception_variable, -20211\)');
- end;
-
-end;
-/
diff --git a/test/ut3_tester/core/annotations/test_annot_throws_exception.pks b/test/ut3_tester/core/annotations/test_annot_throws_exception.pks
deleted file mode 100644
index a41c18d2b..000000000
--- a/test/ut3_tester/core/annotations/test_annot_throws_exception.pks
+++ /dev/null
@@ -1,108 +0,0 @@
-create or replace package test_annot_throws_exception
-is
- --%suite(annotations - throws)
- --%suitepath(utplsql.ut3_tester.core.annotations)
-
- --%beforeall
- procedure recollect_tests_results;
-
- --%afterall
- procedure drop_test_package;
-
-
- --%test(Gives success when annotated number exception is thrown)
- procedure throws_same_annotated_except;
-
- --%test(Gives success when one of the annotated number exceptions is thrown)
- procedure throws_one_of_annotated_excpt;
-
- --%test(Gives success when annotated number exceptions has leading zero)
- procedure throws_with_leading_zero;
-
- --%test(Gives failure when the raised exception is different that the annotated one)
- procedure throws_diff_annotated_except;
-
- --%test(Ignores the throws annotation when it is empty)
- procedure throws_empty;
-
- --%test(Ignores when only bad parameters are passed, the test raise a exception and it shows errored test)
- procedure bad_paramters_with_except;
-
- --%test(Ignores when only bad parameters are passed, the test does not raise a exception and it shows successful test)
- procedure bad_paramters_without_except;
-
- --%test(Ignores annotation for positive exception number value)
- procedure positive_exception_number;
-
- --%test(Ignores annotation for positive exception number variable)
- procedure positive_exception_number_var;
-
- --%test(Detects a valid exception number within many invalid ones)
- procedure one_valid_exception_number;
-
- --%test(Gives failure when an exception is expected and nothing is thrown)
- procedure nothing_thrown;
-
- --%test(Single exception defined as a constant number in package)
- procedure single_exc_const_pkg;
-
- --%test(Gives success when one of annotated exception using constant is thrown)
- procedure list_of_exc_constant;
-
- --%test(Gives failure when the raised exception is different than the annotated one using variable)
- procedure fail_not_match_exc;
-
- --%test(Success when one of exception from a mixed list of number and constant is thrown)
- procedure mixed_exc_list;
-
- --%test(Success when match exception even if another variable on list doesn't exists)
- procedure mixed_list_notexi;
-
- --%test(Success resolve and match named exception defined in pragma exception init)
- procedure named_exc_pragma;
-
- --%test(Success resolve and match oracle named exception no data)
- procedure named_exc_ora;
-
- --%test(Success resolve and match oracle named exception dup val index)
- procedure named_exc_ora_dup_ind;
-
- --%test(Success map no data 100 to -1403)
- procedure nodata_exc_ora;
-
- --%test(Success for exception defined as varchar)
- procedure defined_varchar_exc;
-
- --%test(Non existing constant exception)
- procedure non_existing_const;
-
- --%test(Bad exception constant)
- procedure bad_exc_const;
-
- --%test(Uninitialized exception variable can be used successfully in a test)
- procedure referencing_uninitialized_exception;
-
- --%test(a Failure report shows all expected exceptions)
- procedure not_throwing_expected_exceptions;
-
- --%context(referencing exceptions when running from another schema)
-
- --%beforeall
- procedure run_from_another_schema;
-
- --%test(Success referencing an exception variable when running from another schema)
- procedure named_exc_pragma_run_from_another_schema;
-
- --%test(Success referencing a numeric exception variable when running from another schema)
- procedure exc_number_var_run_from_another_schema;
-
- --%test(Success referencing an exception variable without a package name when running from another schema)
- procedure named_exc_pragma_run_from_another_schema_no_package_name;
-
- --%test(Success referencing a numeric exception variable without a package name when running from another schema)
- procedure exc_number_var_run_from_another_schema_no_package_name;
-
- --%endcontext
-
-end;
-/
diff --git a/test/ut3_tester/core/annotations/test_annotation_cache.pkb b/test/ut3_tester/core/annotations/test_annotation_cache.pkb
deleted file mode 100644
index 36f8f983d..000000000
--- a/test/ut3_tester/core/annotations/test_annotation_cache.pkb
+++ /dev/null
@@ -1,650 +0,0 @@
-create or replace package body test_annotation_cache is
-
- procedure cache_populated_for_packages(a_packages ut_varchar2_rows) is
- l_actual_cache_info sys_refcursor;
- l_expected_cache_info sys_refcursor;
- begin
- open l_actual_cache_info for
- select *
- from ut3_develop.ut_annotation_cache_info
- where object_owner = 'UT3_CACHE_TEST_OWNER';
- open l_expected_cache_info for
- select 'UT3_CACHE_TEST_OWNER' as object_owner, upper( column_value ) as object_name
- from table (a_packages) x;
- ut.expect( l_actual_cache_info ).to_equal( l_expected_cache_info ).exclude( 'CACHE_ID,PARSE_TIME,OBJECT_TYPE' ).JOIN_BY('OBJECT_NAME');
- end;
-
- procedure cant_run_any_packages(a_user varchar2) is
- l_actual clob;
- l_current_time date := sysdate;
- pragma autonomous_transaction;
- begin
- --Act
- l_actual := annotation_cache_helper.run_tests_as( a_user );
-
- --Assert - no suites are
- ut.expect( l_actual ).to_be_like( '%0 tests, 0 failed%' );
- rollback;
- end;
-
- procedure can_run_one_package(a_user varchar2) is
- l_actual clob;
- l_current_time date := sysdate;
- pragma autonomous_transaction;
- begin
- --Act
- l_actual := annotation_cache_helper.run_tests_as( a_user );
-
- --Assert - only granted_test_suite is invoked
- ut.expect( l_actual ).to_be_like( 'granted_test_suite%2 tests, 0 failed%' );
- rollback;
- end;
-
- procedure can_run_new_package(a_user varchar2) is
- l_actual clob;
- l_current_time date := sysdate;
- pragma autonomous_transaction;
- begin
- --Arrange
- l_actual := annotation_cache_helper.run_tests_as( a_user );
- annotation_cache_helper.add_new_suite( );
- --Act
- l_actual := annotation_cache_helper.run_tests_as( a_user );
- --Assert -Both granted_test_suite and new_suite are invoked
- ut.expect( l_actual ).to_be_like( 'granted_test_suite%new_suite%4 tests, 0 failed%' );
- rollback;
- end ;
-
- procedure cant_run_revoked_package(a_user varchar2) is
- l_actual clob;
- l_current_time date := sysdate;
- pragma autonomous_transaction;
- begin
- --Arrange
- l_actual := annotation_cache_helper.run_tests_as( a_user );
- annotation_cache_helper.add_new_suite( );
- annotation_cache_helper.revoke_granted_suite( );
-
- --Act
- l_actual := annotation_cache_helper.run_tests_as( a_user );
- --Assert -Only new_suite gets invoked
- ut.expect( l_actual ).to_be_like( 'new_suite%2 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)%' );
- ut.expect( l_actual ).not_to_be_like( '%granted_test_suite%' );
- rollback;
- end;
-
- procedure cant_run_dropped_package(a_user varchar2) is
- l_actual clob;
- l_current_time date := sysdate;
- pragma autonomous_transaction;
- begin
- --Arrange
- l_actual := annotation_cache_helper.run_tests_as( a_user );
- annotation_cache_helper.add_new_suite( );
- l_actual := annotation_cache_helper.run_tests_as( a_user );
- annotation_cache_helper.revoke_granted_suite( );
- annotation_cache_helper.cleanup_new_suite( );
-
- --Act
- l_actual := annotation_cache_helper.run_tests_as( a_user );
- --Assert - no test suites are invoked
- ut.expect( l_actual ).to_be_like( '%0 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)%' );
- ut.expect( l_actual ).not_to_be_like( '%new_suite%' );
- ut.expect( l_actual ).not_to_be_like( '%granted_test_suite%' );
- rollback;
- end;
-
- procedure can_run_all_packages(a_user varchar2) is
- l_actual clob;
- l_current_time date := sysdate;
- pragma autonomous_transaction;
- begin
- --Act
- l_actual := annotation_cache_helper.run_tests_as( a_user );
-
- --Assert - only granted_test_suite is invoked
- ut.expect( l_actual ).to_be_like( 'granted_test_suite%not_granted_test_suite%4 tests, 0 failed%' );
- rollback;
- end;
-
- procedure can_run_all_new_packages(a_user varchar2) is
- l_actual clob;
- l_current_time date := sysdate;
- pragma autonomous_transaction;
- begin
- --Arrange
- l_actual := annotation_cache_helper.run_tests_as( a_user );
- annotation_cache_helper.add_new_suite( );
- --Act
- l_actual := annotation_cache_helper.run_tests_as( a_user );
-
- --Assert - only granted_test_suite is invoked
- ut.expect( l_actual ).to_be_like( 'granted_test_suite%new_suite%not_granted_test_suite% tests, 0 failed%' );
- rollback;
- end;
-
- procedure can_run_revoked_packages(a_user varchar2) is
- l_actual clob;
- l_current_time date := sysdate;
- pragma autonomous_transaction;
- begin
- --Arrange
- l_actual := annotation_cache_helper.run_tests_as( a_user );
- annotation_cache_helper.add_new_suite( );
- annotation_cache_helper.revoke_granted_suite( );
- --Act
- l_actual := annotation_cache_helper.run_tests_as( a_user );
-
- --Assert - only granted_test_suite is invoked
- ut.expect( l_actual ).to_be_like( 'granted_test_suite%new_suite%not_granted_test_suite% tests, 0 failed%' );
- rollback;
- end;
-
- procedure can_run_all_but_dropped(a_user varchar2) is
- l_actual clob;
- l_current_time date := sysdate;
- pragma autonomous_transaction;
- begin
- --Arrange
- l_actual := annotation_cache_helper.run_tests_as( a_user );
- annotation_cache_helper.add_new_suite( );
- l_actual := annotation_cache_helper.run_tests_as( a_user );
- annotation_cache_helper.revoke_granted_suite( );
- annotation_cache_helper.cleanup_new_suite( );
-
- --Act
- l_actual := annotation_cache_helper.run_tests_as( a_user );
- --Assert - no test suites are invoked
- ut.expect( l_actual ).to_be_like( 'granted_test_suite%not_granted_test_suite%4 tests, 0 failed%' );
- ut.expect( l_actual ).not_to_be_like( '%new_suite%' );
- rollback;
- end;
-
-
- procedure user_can_run_one_package is
- begin
- can_run_one_package( 'ut3_no_extra_priv_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE' ) );
- end;
-
- procedure user_can_run_new_package is
- begin
- can_run_new_package( 'ut3_no_extra_priv_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE' ) );
- end;
-
- procedure user_cant_run_revoked_package is
- begin
- cant_run_revoked_package( 'ut3_no_extra_priv_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE' ) );
- end;
-
- procedure user_cant_run_dropped_package is
- begin
- cant_run_dropped_package( 'ut3_no_extra_priv_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE' ) );
- end;
-
- procedure sel_cat_user_can_run_one is
- begin
- can_run_one_package( 'ut3_select_catalog_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE' ) );
- end;
-
- procedure sel_cat_user_can_run_new is
- begin
- can_run_new_package( 'ut3_select_catalog_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE' ) );
- end;
-
- procedure sel_cat_user_cant_run_revoked is
- begin
- cant_run_revoked_package( 'ut3_select_catalog_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE' ) );
- end;
-
- procedure sel_cat_user_cant_run_dropped is
- begin
- cant_run_dropped_package( 'ut3_select_catalog_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE' ) );
- end;
-
- procedure sel_any_user_can_run_one is
- begin
- can_run_one_package( 'ut3_select_any_table_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE' ) );
- end;
-
- procedure sel_any_user_can_run_new is
- begin
- can_run_new_package( 'ut3_select_any_table_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE' ) );
- end;
-
- procedure sel_any_user_cant_run_revoked is
- begin
- cant_run_revoked_package( 'ut3_select_any_table_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE' ) );
- end;
-
- procedure sel_any_user_cant_run_dropped is
- begin
- cant_run_dropped_package( 'ut3_select_any_table_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE' ) );
- end;
-
- procedure exe_any_user_can_run_all is
- begin
- can_run_all_packages( 'ut3_execute_any_proc_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure exe_any_user_can_run_new is
- begin
- can_run_all_new_packages( 'ut3_execute_any_proc_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure exe_any_user_can_run_revoked is
- begin
- can_run_revoked_packages('ut3_execute_any_proc_user');
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure exe_any_user_cant_run_dropped is
- begin
- can_run_all_but_dropped('ut3_execute_any_proc_user');
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure owner_user_can_run_all is
- begin
- can_run_all_packages( 'ut3_cache_test_owner' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
-
- procedure owner_user_can_run_new is
- begin
- can_run_all_new_packages( 'ut3_cache_test_owner' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure owner_user_cant_run_dropped is
- begin
- can_run_all_but_dropped('ut3_cache_test_owner');
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
-
- procedure t_user_can_run_one_package is
- begin
- can_run_one_package( 'ut3_no_extra_priv_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure t_user_can_run_new_package is
- begin
- can_run_new_package( 'ut3_no_extra_priv_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure t_user_cant_run_revoked_pkg is
- begin
- cant_run_revoked_package( 'ut3_no_extra_priv_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure t_user_cant_run_dropped_pkg is
- begin
- cant_run_dropped_package( 'ut3_no_extra_priv_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure t_sel_cat_user_can_run_one is
- begin
- can_run_one_package( 'ut3_select_catalog_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure t_sel_cat_user_can_run_new is
- begin
- can_run_new_package( 'ut3_select_catalog_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure t_sel_cat_user_cant_run_revokd is
- begin
- cant_run_revoked_package( 'ut3_select_catalog_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure t_sel_cat_user_cant_run_dropd is
- begin
- cant_run_dropped_package( 'ut3_select_catalog_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
-
- procedure t_sel_any_user_can_run_one is
- begin
- can_run_one_package( 'ut3_select_any_table_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure t_sel_any_user_can_run_new is
- begin
- can_run_new_package( 'ut3_select_any_table_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure t_sel_any_user_cant_run_revokd is
- begin
- cant_run_revoked_package( 'ut3_select_any_table_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure t_sel_any_user_cant_run_dropd is
- begin
- cant_run_dropped_package( 'ut3_select_any_table_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
-
- procedure t_exe_any_user_can_run_all is
- begin
- can_run_all_packages( 'ut3_execute_any_proc_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure t_exe_any_user_can_run_new is
- begin
- can_run_all_new_packages( 'ut3_execute_any_proc_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure t_exe_any_user_can_run_revokd is
- begin
- can_run_revoked_packages( 'ut3_execute_any_proc_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure t_exe_any_user_cant_run_dropd is
- begin
- can_run_all_but_dropped( 'ut3_execute_any_proc_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure t_owner_user_can_run_all is
- begin
- can_run_all_packages( 'ut3_cache_test_owner' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure t_owner_user_can_run_new is
- begin
- can_run_all_new_packages( 'ut3_cache_test_owner' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure t_owner_user_cant_run_dropd is
- begin
- can_run_all_but_dropped( 'ut3_cache_test_owner' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure t_ut_owner_cannot_run_tests is
- begin
- cant_run_any_packages( 'ut3_develop' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
-
-
- procedure p_user_can_run_one_package is
- begin
- can_run_one_package( 'ut3_no_extra_priv_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE' ) );
- end;
-
- procedure p_user_can_run_new_package is
- begin
- can_run_new_package( 'ut3_no_extra_priv_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE' ) );
- end;
-
- procedure p_user_cant_run_revoked_pack is
- begin
- cant_run_revoked_package( 'ut3_no_extra_priv_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE' ) );
- end;
-
- procedure p_user_cant_run_dropped_pack is
- begin
- cant_run_dropped_package( 'ut3_no_extra_priv_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE' ) );
- end;
-
-
-
- procedure p_sel_cat_user_can_run_one is
- begin
- can_run_one_package( 'ut3_select_catalog_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE' ) );
- end;
-
- procedure p_sel_cat_user_can_run_new is
- begin
- can_run_new_package( 'ut3_select_catalog_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE' ) );
- end;
-
- procedure p_sel_cat_user_cant_run_revokd is
- begin
- cant_run_revoked_package( 'ut3_select_catalog_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE' ) );
- end;
-
- procedure p_sel_cat_user_cant_run_dropd is
- begin
- cant_run_dropped_package( 'ut3_select_catalog_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE' ) );
- end;
-
- procedure p_sel_any_user_can_run_one is
- begin
- can_run_one_package( 'ut3_select_any_table_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE' ) );
- end;
-
- procedure p_sel_any_user_can_run_new is
- begin
- can_run_new_package( 'ut3_select_any_table_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE' ) );
- end;
-
- procedure p_sel_any_user_cant_run_revokd is
- begin
- cant_run_revoked_package( 'ut3_select_any_table_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE' ) );
- end;
-
- procedure p_sel_any_user_cant_run_dropd is
- begin
- cant_run_dropped_package( 'ut3_select_any_table_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE' ) );
- end;
-
- procedure p_exe_any_user_can_run_all is
- begin
- can_run_all_packages( 'ut3_execute_any_proc_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure p_exe_any_user_can_run_new is
- begin
- can_run_all_new_packages( 'ut3_execute_any_proc_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure p_exe_any_user_can_run_revokd is
- begin
- can_run_revoked_packages( 'ut3_execute_any_proc_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure p_exe_any_user_cant_run_dropd is
- begin
- can_run_all_but_dropped( 'ut3_execute_any_proc_user' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure p_owner_user_can_run_all is
- begin
- can_run_all_packages( 'ut3_cache_test_owner' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure p_owner_user_can_run_new is
- begin
- can_run_all_new_packages( 'ut3_cache_test_owner' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NEW_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure p_owner_user_cant_run_dropped is
- begin
- can_run_all_but_dropped( 'ut3_cache_test_owner' );
- cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
- end;
-
- procedure user_runs_child_of_hidden_suite is
- l_actual clob;
- pragma autonomous_transaction;
- begin
- --Act
- l_actual := annotation_cache_helper.run_tests_as( 'ut3_no_extra_priv_user', 'ut3_cache_test_owner.child_suite' );
- --Assert
- ut.expect( l_actual ).to_be_like( '%parent_suite%child_test%1 tests, 0 failed%' );
- ut.expect( l_actual ).not_to_be_like( '%parent_test%' );
- rollback;
- end;
-
- procedure user_warned_about_hidden_parent is
- l_actual clob;
- pragma autonomous_transaction;
- begin
- --Act
- l_actual := annotation_cache_helper.run_tests_as( 'ut3_no_extra_priv_user', 'ut3_cache_test_owner.child_suite' );
- --Assert
- ut.expect( l_actual ).to_be_like(
- '%Warnings:%parent_suite%Suite ut3_cache_test_owner.parent_suite is not run, as it does not exist or you have no EXECUTE privilege on it.%'
- );
- ut.expect( l_actual ).to_be_like( '%1 tests, 0 failed, 0 errored, 0 disabled, 1 warning(s)%' );
- rollback;
- end;
-
- procedure user_runs_child_without_parent_tags is
- l_actual clob;
- pragma autonomous_transaction;
- begin
- --Act - child_suite inherits parent_tag only when parent_suite is accessible
- l_actual := annotation_cache_helper.run_tests_as( 'ut3_no_extra_priv_user', 'ut3_cache_test_owner', '!parent_tag' );
- --Assert
- ut.expect( l_actual ).to_be_like( '%child_test%1 tests, 0 failed%' );
- --Act
- l_actual := annotation_cache_helper.run_tests_as( 'ut3_cache_test_owner', 'ut3_cache_test_owner', '!parent_tag' );
- --Assert
- ut.expect( l_actual ).not_to_be_like( '%child_test%' );
- ut.expect( l_actual ).not_to_be_like( '%parent_test%' );
- rollback;
- end;
-
- procedure user_runs_hidden_suite_path is
- l_actual clob;
- pragma autonomous_transaction;
- begin
- --Act
- l_actual := annotation_cache_helper.run_tests_as( 'ut3_no_extra_priv_user', 'ut3_cache_test_owner:parent_suite' );
- --Assert
- ut.expect( l_actual ).to_be_like( '%child_test%1 tests, 0 failed%' );
- ut.expect( l_actual ).not_to_be_like( '%parent_test%' );
- rollback;
- end;
-
- procedure user_no_empty_logical_suites is
- l_actual clob;
- pragma autonomous_transaction;
- begin
- --Act
- l_actual := annotation_cache_helper.get_suites_info_as( 'ut3_no_extra_priv_user' );
- --Assert
- ut.expect( l_actual ).to_be_like( '%UT_TEST parent_suite.child_suite.child_test%' );
- ut.expect( l_actual ).not_to_be_like( '%hidden_path%' );
- ut.expect( l_actual ).not_to_be_like( '%parent_test%' );
- rollback;
- end;
-
- procedure user_runs_granted_by_wildcard is
- l_actual clob;
- pragma autonomous_transaction;
- begin
- --Act - matches child_suite (granted) and lone_suite (not granted)
- l_actual := annotation_cache_helper.run_tests_as( 'ut3_no_extra_priv_user', 'ut3_cache_test_owner.*l*_suite' );
- --Assert
- ut.expect( l_actual ).to_be_like( '%child_test%1 tests, 0 failed%' );
- ut.expect( l_actual ).not_to_be_like( '%lone_test%' );
- rollback;
- end;
-
- procedure user_runs_granted_tests_by_wildcard is
- l_actual clob;
- pragma autonomous_transaction;
- begin
- --Act - matches child_suite.child_test (granted) and lone_suite.lone_test (not granted)
- l_actual := annotation_cache_helper.run_tests_as( 'ut3_no_extra_priv_user', 'ut3_cache_test_owner.*l*_suite.*_test' );
- --Assert
- ut.expect( l_actual ).to_be_like( '%child_test%1 tests, 0 failed%' );
- ut.expect( l_actual ).not_to_be_like( '%lone_test%' );
- rollback;
- end;
-
- procedure user_runs_granted_by_path_wildcard is
- l_actual clob;
- pragma autonomous_transaction;
- begin
- --Act - matches parent_suite (not granted) and parent_suite.child_suite (granted)
- l_actual := annotation_cache_helper.run_tests_as( 'ut3_no_extra_priv_user', 'ut3_cache_test_owner:parent*' );
- --Assert
- ut.expect( l_actual ).to_be_like( '%child_test%1 tests, 0 failed%' );
- ut.expect( l_actual ).not_to_be_like( '%parent_test%' );
- rollback;
- end;
-
- procedure user_hidden_path_wildcard_not_found is
- l_actual clob;
- pragma autonomous_transaction;
- begin
- --Act - matches only hidden_path.sub.lone_suite (not granted)
- l_actual := annotation_cache_helper.run_tests_as( 'ut3_no_extra_priv_user', 'ut3_cache_test_owner:hidden*' );
- rollback;
- exception
- when others then
- rollback;
- raise;
- end;
-
- procedure user_hidden_path_not_found is
- l_actual clob;
- pragma autonomous_transaction;
- begin
- --Act
- l_actual := annotation_cache_helper.run_tests_as( 'ut3_no_extra_priv_user', 'ut3_cache_test_owner:hidden_path' );
- rollback;
- exception
- when others then
- rollback;
- raise;
- end;
-
-end;
-/
diff --git a/test/ut3_tester/core/annotations/test_annotation_cache.pks b/test/ut3_tester/core/annotations/test_annotation_cache.pks
deleted file mode 100644
index fec89cf3b..000000000
--- a/test/ut3_tester/core/annotations/test_annotation_cache.pks
+++ /dev/null
@@ -1,319 +0,0 @@
-create or replace package test_annotation_cache is
-
- --%suite(annotation cache)
- --%suitepath(utplsql.ut3_tester.core.annotations)
- --%beforeall(annotation_cache_helper.create_run_function_for_users)
- --%afterall(annotation_cache_helper.drop_run_function_for_users)
-
- --%context(With DDL trigger enabled)
-
- --%beforeall(annotation_cache_helper.enable_ddl_trigger)
- --%beforeeach(annotation_cache_helper.setup_two_suites)
- --%aftereach(annotation_cache_helper.cleanup_new_suite)
- --%afterall(annotation_cache_helper.cleanup_two_suites)
-
- --%context(User without elevated privileges)
-
- --%test(Can only execute granted packages)
- procedure t_user_can_run_one_package;
-
- --%test(Can see newly created packages as they are added)
- procedure t_user_can_run_new_package;
-
- --%test(Cannot execute revoked packages)
- procedure t_user_cant_run_revoked_pkg;
-
- --%test(Cannot execute dropped unit test packages)
- procedure t_user_cant_run_dropped_pkg;
-
- --%endcontext
-
- --%context(User with select_catalog_role)
-
- --%test(Can only execute granted packages)
- procedure t_sel_cat_user_can_run_one;
-
- --%test(Can see newly created packages as they are added)
- procedure t_sel_cat_user_can_run_new;
-
- --%test(Cannot execute revoked packages)
- procedure t_sel_cat_user_cant_run_revokd;
-
- --%test(Cannot execute dropped unit test packages)
- procedure t_sel_cat_user_cant_run_dropd;
-
- --%endcontext
-
- --%context(User with select any table privilege)
-
- --%test(Can only execute granted packages)
- procedure t_sel_any_user_can_run_one;
-
- --%test(Can see newly created packages as they are added)
- procedure t_sel_any_user_can_run_new;
-
- --%test(Cannot execute revoked packages)
- procedure t_sel_any_user_cant_run_revokd;
-
- --%test(Cannot execute dropped unit test packages)
- procedure t_sel_any_user_cant_run_dropd;
-
- --%endcontext
-
- --%context(User with execute any procedure)
-
- --%test(Can execute and see all unit test packages)
- procedure t_exe_any_user_can_run_all;
-
- --%test(Can see newly created packages as they are added)
- procedure t_exe_any_user_can_run_new;
-
- --%test(Can execute revoked packages)
- procedure t_exe_any_user_can_run_revokd;
-
- --%test(Cannot execute dropped unit test packages)
- procedure t_exe_any_user_cant_run_dropd;
-
- --%endcontext
-
- --%context(User owning test packages)
-
- --%test(Can execute and see all unit test packages)
- procedure t_owner_user_can_run_all;
-
- --%test(Can see newly created packages as they are added)
- procedure t_owner_user_can_run_new;
-
- --%test(Cannot execute dropped unit test packages)
- procedure t_owner_user_cant_run_dropd;
-
- --%endcontext
-
- --%context(utPLSQL framework owner)
-
- --%test(Cannot see any tests and doesn't impact annotation cache )
- procedure t_ut_owner_cannot_run_tests;
-
- --%endcontext
-
- --%endcontext
-
- --%context(With DDL trigger disabled)
-
- --%beforeall(annotation_cache_helper.disable_ddl_trigger)
- --%beforeeach(annotation_cache_helper.setup_two_suites)
- --%beforeeach(annotation_cache_helper.purge_annotation_cache)
- --%aftereach(annotation_cache_helper.cleanup_new_suite)
- --%afterall(annotation_cache_helper.enable_ddl_trigger)
- --%afterall(annotation_cache_helper.cleanup_two_suites)
-
- --%context(User without elevated privileges)
-
- --%test(Can only execute granted packages)
- procedure user_can_run_one_package;
-
- --%test(Can see newly created packages as they are added)
- procedure user_can_run_new_package;
-
- --%test(Cannot execute revoked packages)
- procedure user_cant_run_revoked_package;
-
- --%test(Cannot execute dropped unit test packages)
- procedure user_cant_run_dropped_package;
-
- --%endcontext
-
- --%context(User with select_catalog_role)
-
- --%test(Can only execute granted packages)
- procedure sel_cat_user_can_run_one;
-
- --%test(Can see newly created packages as they are added)
- procedure sel_cat_user_can_run_new;
-
- --%test(Cannot execute revoked packages)
- procedure sel_cat_user_cant_run_revoked;
-
- --%test(Cannot execute dropped unit test packages)
- procedure sel_cat_user_cant_run_dropped;
-
- --%endcontext
-
- --%context(User with select any table privilege)
-
- --%test(Can only execute granted packages)
- procedure sel_any_user_can_run_one;
-
- --%test(Can see newly created packages as they are added)
- procedure sel_any_user_can_run_new;
-
- --%test(Cannot execute revoked packages)
- procedure sel_any_user_cant_run_revoked;
-
- --%test(Cannot execute dropped unit test packages)
- procedure sel_any_user_cant_run_dropped;
-
- --%endcontext
-
- --%context(User with execute any procedure)
-
- --%test(Can execute and see all unit test packages)
- procedure exe_any_user_can_run_all;
-
- --%test(Can see newly created packages as they are added)
- procedure exe_any_user_can_run_new;
-
- --%test(Can execute revoked packages)
- procedure exe_any_user_can_run_revoked;
-
- --%test(Cannot execute dropped unit test packages)
- procedure exe_any_user_cant_run_dropped;
-
- --%endcontext
-
- --%context(User owning test packages)
-
- --%test(Can execute and see all unit test packages)
- procedure owner_user_can_run_all;
-
- --%test(Can see newly created packages as they are added)
- procedure owner_user_can_run_new;
-
- --%test(Cannot execute dropped unit test packages)
- procedure owner_user_cant_run_dropped;
-
- --%endcontext
-
- --%endcontext
-
- --%context(With DDL trigger enabled and cache purged)
-
- --%beforeall(annotation_cache_helper.enable_ddl_trigger)
-
- --%beforeeach(annotation_cache_helper.setup_two_suites)
- --%beforeeach(annotation_cache_helper.purge_annotation_cache)
-
- --%aftereach(annotation_cache_helper.cleanup_new_suite)
- --%aftereach(annotation_cache_helper.cleanup_two_suites)
-
- --%context(User without elevated privileges)
-
- --%test(Can only execute granted packages)
- procedure p_user_can_run_one_package;
-
- --%test(Can see newly created packages as they are added)
- procedure p_user_can_run_new_package;
-
- --%test(Cannot execute revoked packages)
- procedure p_user_cant_run_revoked_pack;
-
- --%test(Cannot execute dropped unit test packages)
- procedure p_user_cant_run_dropped_pack;
-
- --%endcontext
-
- --%context(User with select_catalog_role)
-
- --%test(Can only execute granted packages)
- procedure p_sel_cat_user_can_run_one;
-
- --%test(Can see newly created packages as they are added)
- procedure p_sel_cat_user_can_run_new;
-
- --%test(Cannot execute revoked packages)
- procedure p_sel_cat_user_cant_run_revokd;
-
- --%test(Cannot execute dropped unit test packages)
- procedure p_sel_cat_user_cant_run_dropd;
-
- --%endcontext
-
- --%context(User with select any table privilege)
-
- --%test(Can only execute granted packages)
- procedure p_sel_any_user_can_run_one;
-
- --%test(Can see newly created packages as they are added)
- procedure p_sel_any_user_can_run_new;
-
- --%test(Cannot execute revoked packages)
- procedure p_sel_any_user_cant_run_revokd;
-
- --%test(Cannot execute dropped unit test packages)
- procedure p_sel_any_user_cant_run_dropd;
-
- --%endcontext
-
- --%context(User with execute any procedure)
-
- --%test(Can execute and see all unit test packages)
- procedure p_exe_any_user_can_run_all;
-
- --%test(Can see newly created packages as they are added)
- procedure p_exe_any_user_can_run_new;
-
- --%test(Can execute revoked packages)
- procedure p_exe_any_user_can_run_revokd;
-
- --%test(Cannot execute dropped unit test packages)
- procedure p_exe_any_user_cant_run_dropd;
-
- --%endcontext
-
- --%context(User owning test packages)
-
- --%test(Can execute and see all unit test packages)
- procedure p_owner_user_can_run_all;
-
- --%test(Can see newly created packages as they are added)
- procedure p_owner_user_can_run_new;
-
- --%test(Cannot execute dropped unit test packages)
- procedure p_owner_user_cant_run_dropped;
-
- --%endcontext
-
-
- --%endcontext
-
- --%context(Suites spread across packages, user without elevated privileges)
- --%beforeall(annotation_cache_helper.enable_ddl_trigger)
- --%beforeall(annotation_cache_helper.setup_suite_hierarchy)
- --%afterall(annotation_cache_helper.cleanup_suite_hierarchy)
-
- --%test(Runs a granted package whose parent suite is in a package that is not granted)
- procedure user_runs_child_of_hidden_suite;
-
- --%test(Warns that the parent suite in a package that is not granted is not run)
- procedure user_warned_about_hidden_parent;
-
- --%test(Does not apply tags of the parent suite in a package that is not granted)
- procedure user_runs_child_without_parent_tags;
-
- --%test(Runs a granted package when its parent suitepath is given)
- procedure user_runs_hidden_suite_path;
-
- --%test(Lists no logical suites without granted packages below them)
- procedure user_no_empty_logical_suites;
-
- --%test(Raises an error for a suitepath without granted packages below it)
- --%throws(-20204)
- procedure user_hidden_path_not_found;
-
- --%test(Runs only granted packages matched by a package name with wildcards)
- procedure user_runs_granted_by_wildcard;
-
- --%test(Runs only tests of granted packages matched by procedure name with wildcards)
- procedure user_runs_granted_tests_by_wildcard;
-
- --%test(Runs granted packages below a suitepath with wildcards)
- procedure user_runs_granted_by_path_wildcard;
-
- --%test(Raises an error for a suitepath with wildcards without granted packages below it)
- --%throws(-20204)
- procedure user_hidden_path_wildcard_not_found;
-
- --%endcontext
-
-end;
-/
diff --git a/test/ut3_tester/core/annotations/test_annotation_manager.pkb b/test/ut3_tester/core/annotations/test_annotation_manager.pkb
deleted file mode 100644
index 8eb3c2f6d..000000000
--- a/test/ut3_tester/core/annotations/test_annotation_manager.pkb
+++ /dev/null
@@ -1,466 +0,0 @@
-create or replace package body test_annotation_manager is
-
- procedure exec_autonomous(a_sql varchar2) is
- pragma autonomous_transaction;
- begin
- execute immediate a_sql;
- end;
-
- procedure create_dummy_package is
- begin
- exec_autonomous(q'[create or replace package dummy_package as
- procedure some_dummy_procedure;
- end;]');
- end;
-
- procedure drop_dummy_package is
- begin
- exec_autonomous(q'[drop package dummy_package]');
- exception
- when others then
- null;
- end;
-
- procedure recompile_dummy_package is
- begin
- exec_autonomous(q'[alter package dummy_package compile]');
- end;
-
- procedure create_dummy_test_package is
- begin
- exec_autonomous(q'[
- /*
- * Some multiline comments before package spec
- create or replace package dummy_test_package dummy comment to prove that we pick the right piece of code
- */
- -- create or replace package dummy_test_package dummy comment to prove that we pick the right piece of code
- --Some single-line comment before package spec
- create or replace package dummy_test_package as
- --%suite(dummy_test_suite)
- --%rollback(manual)
-
- --create or replace package dummy_test_package dummy comment to prove that we pick the right piece of code
-
- --%test(dummy_test)
- --%beforetest(some_procedure)
- procedure some_dummy_test_procedure;
- end;]');
- exec_autonomous(q'[grant execute on dummy_test_package to public]');
- end;
-
- procedure modify_dummy_test_package is
- begin
- exec_autonomous(q'[create or replace package dummy_test_package as
- --%suite(dummy_test_suite)
-
- --%test(dummy_test)
- procedure some_dummy_test_procedure;
- end;]');
- end;
-
- procedure drop_dummy_test_package is
- begin
- exec_autonomous(q'[drop package dummy_test_package]');
- exception
- when others then
- null;
- end;
-
- procedure recompile_dummy_test_package is
- begin
- exec_autonomous(q'[alter package dummy_test_package compile]');
- end;
-
- procedure create_parse_proc_as_ut3_user is
- begin
- ut3_tester_helper.main_helper.create_parse_proc_as_ut3_user();
- end;
-
- procedure parse_dummy_test_as_ut3_user is
- begin
- ut3_tester_helper.main_helper.parse_dummy_test_as_ut3_user();
- end;
-
- procedure drop_parse_proc_as_ut3_user is
- begin
- ut3_tester_helper.main_helper.drop_parse_proc_as_ut3_user();
- exception
- when others then
- null;
- end;
-
- procedure cleanup_annotation_cache is
- begin
- ut3_tester_helper.main_helper.cleanup_annotation_cache();
- end;
-
- procedure assert_dummy_package(a_start_date date) is
- l_actual_cache_id integer;
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- select max(cache_id)
- into l_actual_cache_id
- from ut3_develop.ut_annotation_cache_info
- where object_owner = sys_context('USERENV', 'CURRENT_USER') and object_type = 'PACKAGE' and object_name = 'DUMMY_PACKAGE'
- and parse_time >= a_start_date;
- ut.expect(l_actual_cache_id).to_be_not_null;
-
- open l_actual for
- select annotation_position, annotation_name, annotation_text, subobject_name
- from ut3_develop.ut_annotation_cache where cache_id = l_actual_cache_id
- order by annotation_position;
-
- ut.expect(l_actual).to_be_empty();
- end;
-
- procedure assert_dummy_test_package(a_start_time timestamp) is
- l_actual_cache_id integer;
- l_data ut3_develop.ut_annotated_objects;
- l_result sys_refcursor;
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- open l_expected for
- select
- ut3_develop.ut_annotated_object(
- sys_context('USERENV', 'CURRENT_USER'),
- 'DUMMY_TEST_PACKAGE', 'PACKAGE', a_start_time,
- ut3_develop.ut_annotations(
- ut3_develop.ut_annotation( 2, 'suite', 'dummy_test_suite', null ),
- ut3_develop.ut_annotation( 3, 'rollback', 'manual', null ),
- ut3_develop.ut_annotation( 7, 'test', 'dummy_test', 'some_dummy_test_procedure' ),
- ut3_develop.ut_annotation( 8, 'beforetest', 'some_procedure', 'some_dummy_test_procedure' )
- )
- ) annotated_object
- from dual;
-
- l_result := ut3_develop.ut_annotation_manager.get_annotated_objects(sys_context('USERENV', 'CURRENT_USER'), 'PACKAGE', a_start_time);
- fetch l_result bulk collect into l_data;
- open l_actual for select value(x) as annotated_object from table(l_data) x where object_name = 'DUMMY_TEST_PACKAGE';
- ut.expect(l_actual).to_equal(l_expected).exclude('ANNOTATED_OBJECT/PARSE_TIME').join_by('ANNOTATED_OBJECT/OBJECT_NAME');
- end;
-
-
- procedure trg_skip_existing_package is
- l_actual_cache_id integer;
- begin
- --Arrange
- annotation_cache_helper.disable_ddl_trigger();
- create_dummy_test_package();
- --Act
- annotation_cache_helper.enable_ddl_trigger();
- --Assert
- select max(cache_id)
- into l_actual_cache_id
- from ut3_develop.ut_annotation_cache_info
- where object_owner = sys_context('USERENV', 'CURRENT_USER') and object_type = 'PACKAGE' and object_name = 'DUMMY_TEST_PACKAGE';
-
- ut.expect(l_actual_cache_id).to_be_null;
- end;
-
- --%test(Adds existing package to cache when package recompiled)
- procedure trg_add_existing_on_compile is
- l_start_date date;
- begin
- --Arrange
- annotation_cache_helper.disable_ddl_trigger();
- create_dummy_test_package();
- --Act
- annotation_cache_helper.enable_ddl_trigger();
- l_start_date := sysdate;
- recompile_dummy_test_package();
- --Assert
- assert_dummy_test_package(l_start_date);
- end;
-
- --%test(Adds existing package to cache when schema cache refreshed)
- procedure trg_add_existing_on_refresh is
- l_start_date date;
- begin
- --Arrange
- annotation_cache_helper.disable_ddl_trigger();
- create_dummy_test_package();
- create_dummy_package();
- --Act
- annotation_cache_helper.enable_ddl_trigger();
- l_start_date := sysdate;
- ut3_develop.ut_annotation_manager.rebuild_annotation_cache(sys_context('USERENV', 'CURRENT_USER'),'PACKAGE');
- --Assert
- assert_dummy_test_package(l_start_date);
- assert_dummy_package(l_start_date);
- end;
-
- procedure trg_not_add_new_package is
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_actual for
- select *
- from ut3_develop.ut_annotation_cache_info
- where object_owner = sys_context('USERENV', 'CURRENT_USER') and object_type = 'PACKAGE' and object_name = 'DUMMY_PACKAGE';
-
- ut.expect(l_actual).to_be_empty();
-
- --Act
- create_dummy_package();
- --Assert
- open l_actual for
- select *
- from ut3_develop.ut_annotation_cache_info
- where object_owner = sys_context('USERENV', 'CURRENT_USER') and object_type = 'PACKAGE' and object_name = 'DUMMY_PACKAGE';
-
- ut.expect(l_actual).to_be_empty();
- end;
-
- procedure trg_add_new_test_package is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_start_date date;
- begin
- --Arrange
- l_start_date := sysdate;
- --Act
- create_dummy_test_package();
- --Assert
- assert_dummy_test_package(l_start_date);
- end;
-
- procedure trg_no_data_for_dropped_object is
- l_actual sys_refcursor;
- begin
- drop_dummy_test_package();
- --Assert
- open l_actual for
- select *
- from ut3_develop.ut_annotation_cache_info
- where object_owner = sys_context('USERENV', 'CURRENT_USER')
- and object_type = 'PACKAGE' and object_name = 'DUMMY_TEST_PACKAGE';
-
- ut.expect(l_actual).to_be_empty();
-
- end;
-
- procedure trg_populate_cache_after_purge is
- l_start_date date;
- begin
- --Arrange
- create_dummy_test_package();
- l_start_date := sysdate;
- ut3_develop.ut_annotation_manager.purge_cache(sys_context('USERENV', 'CURRENT_USER'), 'PACKAGE');
- --Act & Assert
- assert_dummy_test_package(l_start_date);
- end;
-
- procedure add_annotated_package is
- l_start_time timestamp := systimestamp;
- begin
- --Arrange
- create_dummy_test_package();
- --Act & Assert
- assert_dummy_test_package( l_start_time );
- end;
-
- procedure remove_annotated_package is
- l_start_time timestamp := systimestamp;
- begin
- --Arrange
- create_dummy_test_package();
- assert_dummy_test_package( l_start_time );
-
- --Act
- drop_dummy_test_package();
-
- --Assert
- ut.expect(
- ut3_develop.ut_annotation_manager.get_annotated_objects(
- sys_context( 'USERENV', 'CURRENT_USER' ), 'PACKAGE', l_start_time
- ),
- 'Annotations are empty after package was dropped'
- ).to_be_empty();
- end;
-
- procedure add_not_annotated_package is
- l_start_time timestamp := systimestamp;
- begin
- --Arrange
- create_dummy_package();
- --Act & Assert
- ut.expect(
- ut3_develop.ut_annotation_manager.get_annotated_objects(
- sys_context( 'USERENV', 'CURRENT_USER' ), 'PACKAGE', l_start_time
- ),
- 'Annotations are empty for not annotated package'
- ).to_be_empty();
- end;
-
- procedure remove_not_annotated_package is
- l_start_time timestamp := systimestamp;
- begin
- --Arrange
- create_dummy_package();
- ut.expect(
- ut3_develop.ut_annotation_manager.get_annotated_objects(
- sys_context( 'USERENV', 'CURRENT_USER' ), 'PACKAGE', l_start_time
- ),
- 'Annotations are empty for non annotated package'
- ).to_be_empty();
-
- --Act
- drop_dummy_package();
-
- --Assert
- ut.expect(
- ut3_develop.ut_annotation_manager.get_annotated_objects(
- sys_context( 'USERENV', 'CURRENT_USER' ), 'PACKAGE', l_start_time
- ),
- 'Annotations are empty after non annoteted package was dropped'
- ).to_be_empty();
- end;
-
- procedure remove_annotations_from_pkg is
- l_start_time timestamp := systimestamp;
- begin
- --Arrange
- create_dummy_test_package();
- assert_dummy_test_package( l_start_time );
-
- --Act
- exec_autonomous(q'[create or replace package dummy_test_package as
- procedure some_dummy_test_procedure;
- end;]');
-
- --Assert
- ut.expect(
- ut3_develop.ut_annotation_manager.get_annotated_objects(
- sys_context( 'USERENV', 'CURRENT_USER' ), 'PACKAGE', l_start_time
- )
- ).to_be_empty();
- end;
-
- procedure add_annotations_to_package is
- l_start_time timestamp := systimestamp;
- begin
- --Arrange
- exec_autonomous(q'[create or replace package dummy_test_package as
- procedure some_dummy_test_procedure;
- end;]');
- ut.expect(
- ut3_develop.ut_annotation_manager.get_annotated_objects(
- sys_context( 'USERENV', 'CURRENT_USER' ), 'PACKAGE', l_start_time
- )
- ).to_be_empty();
-
- --Act
- create_dummy_test_package();
-
- --Assert
- assert_dummy_test_package( l_start_time );
- end;
-
- procedure update_modified_test_package is
- l_actual_cache_id integer;
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_start_date date;
- begin
- --Arrange
- ut3_develop.ut_annotation_manager.rebuild_annotation_cache(sys_context('USERENV', 'CURRENT_USER'),'PACKAGE');
- l_start_date := sysdate;
- modify_dummy_test_package();
- --Act
- ut3_develop.ut_annotation_manager.rebuild_annotation_cache(sys_context('USERENV', 'CURRENT_USER'),'PACKAGE');
- --Assert
- select max(cache_id)
- into l_actual_cache_id
- from ut3_develop.ut_annotation_cache_info
- where object_owner = sys_context('USERENV', 'CURRENT_USER') and object_type = 'PACKAGE' and object_name = 'DUMMY_TEST_PACKAGE'
- and parse_time >= l_start_date;
-
- ut.expect(l_actual_cache_id).to_be_not_null;
-
- open l_actual for
- select annotation_position, annotation_name, annotation_text, subobject_name
- from ut3_develop.ut_annotation_cache where cache_id = l_actual_cache_id
- order by annotation_position;
-
- open l_expected for
- select 2 as annotation_position, 'suite' as annotation_name,
- 'dummy_test_suite' as annotation_text, to_char(null) as subobject_name
- from dual union all
- select 4, 'test' , 'dummy_test', 'some_dummy_test_procedure' as subobject_name
- from dual;
-
- ut.expect(l_actual).to_equal(l_expected);
- end;
-
-
- procedure keep_dropped_data_in_cache is
- l_cache_count integer;
- l_start_date date;
- begin
- l_start_date := sysdate;
- parse_dummy_test_as_ut3_user();
- drop_dummy_test_package();
- --Act
- parse_dummy_test_as_ut3_user();
- --Assert
- select count(1)
- into l_cache_count
- from ut3_develop.ut_annotation_cache_info
- where object_owner = sys_context('USERENV', 'CURRENT_USER')
- and object_type = 'PACKAGE'
- and object_name = 'DUMMY_TEST_PACKAGE'
- and parse_time > l_start_date;
- ut.expect( l_cache_count ).to_equal(1);
- end;
-
- procedure no_data_for_dropped_object is
- l_result sys_refcursor;
- l_data ut3_develop.ut_annotated_objects;
- l_actual sys_refcursor;
- l_start_time timestamp := systimestamp;
- begin
- --Arrange
- drop_dummy_test_package();
- --Act
- l_result := ut3_develop.ut_annotation_manager.get_annotated_objects( sys_context('USERENV', 'CURRENT_USER'),'PACKAGE', l_start_time );
- fetch l_result bulk collect into l_data;
- open l_actual for select object_name from table(l_data) where object_name = 'DUMMY_TEST_PACKAGE';
- --Assert
- ut.expect(l_actual).to_be_empty();
- end;
-
- procedure cleanup_dropped_data_in_cache is
- l_cache_count integer;
- begin
- --Arrange
- ut3_develop.ut_annotation_manager.rebuild_annotation_cache(sys_context('USERENV', 'CURRENT_USER'),'PACKAGE');
- drop_dummy_test_package();
- --Act
- ut3_develop.ut_annotation_manager.rebuild_annotation_cache(sys_context('USERENV', 'CURRENT_USER'),'PACKAGE');
- --Assert
- select count(1)
- into l_cache_count
- from ut3_develop.ut_annotation_cache_info
- where object_owner = sys_context('USERENV', 'CURRENT_USER')
- and object_type = 'PACKAGE'
- and object_name = 'DUMMY_TEST_PACKAGE';
-
- ut.expect(l_cache_count).to_equal(0);
-
- end;
-
- procedure populate_cache_after_purge is
- l_start_date date;
- begin
- --Arrange
- create_dummy_test_package();
- l_start_date := sysdate;
- ut3_develop.ut_annotation_manager.purge_cache(sys_context('USERENV', 'CURRENT_USER'), 'PACKAGE');
- --Act & Assert
- assert_dummy_test_package(l_start_date);
- end;
-
-end test_annotation_manager;
-/
diff --git a/test/ut3_tester/core/annotations/test_annotation_manager.pks b/test/ut3_tester/core/annotations/test_annotation_manager.pks
deleted file mode 100644
index 7207917f3..000000000
--- a/test/ut3_tester/core/annotations/test_annotation_manager.pks
+++ /dev/null
@@ -1,104 +0,0 @@
-create or replace package test_annotation_manager is
-
- --%suite(ut_annotation_manager)
- --%suitepath(utplsql.ut3_tester.core.annotations)
-
- --%afterall(drop_dummy_test_package)
-
- --%aftereach
- procedure cleanup_annotation_cache;
-
- procedure create_dummy_package;
-
- procedure drop_dummy_package;
-
- procedure create_dummy_test_package;
-
- procedure create_parse_proc_as_ut3_user;
-
- procedure drop_parse_proc_as_ut3_user;
-
- procedure drop_dummy_test_package;
-
- --%context(With DDL trigger enabled)
-
- --%aftereach(drop_dummy_test_package,drop_dummy_package)
-
- --%test(Does not detect unit test packages created before enabling trigger)
- procedure trg_skip_existing_package;
-
- --%test(Adds existing package to cache when package recompiled)
- procedure trg_add_existing_on_compile;
-
- --%test(Adds existing package to cache when schema cache refreshed)
- procedure trg_add_existing_on_refresh;
-
- --%test(Doesn't add package to annotation cache info when it is not unit test package)
- procedure trg_not_add_new_package;
-
- --%test(Populates annotation cache when package created)
- procedure trg_add_new_test_package;
-
- --%test(Removes annotations from cache when object was removed and user can't see whole schema)
- --%beforetest(create_dummy_test_package)
- procedure trg_no_data_for_dropped_object;
-
- --%test(Objects are populated on scan after cache was purged)
- --%beforetest(annotation_cache_helper.disable_ddl_trigger)
- --%aftertest(annotation_cache_helper.enable_ddl_trigger)
- procedure trg_populate_cache_after_purge;
-
- --%endcontext
-
- --%context(Without DDL trigger)
-
- --%beforeall(annotation_cache_helper.disable_ddl_trigger)
-
- --%afterall(annotation_cache_helper.enable_ddl_trigger)
-
- --%beforeeach(create_dummy_package)
- --%aftereach(drop_dummy_package)
-
- --%test(Returns annotations when annotated package was created)
- --%aftertest(drop_dummy_test_package)
- procedure add_annotated_package;
-
- --%test(Doesn't return annotations when annotated package was removed)
- --%aftertest(drop_dummy_test_package)
- procedure remove_annotated_package;
-
- --%test(Doesn't return annotations when package doesn't contain annotations)
- procedure add_not_annotated_package;
-
- --%test(Doesn't return annotations when package without annotations was dropped)
- procedure remove_not_annotated_package;
-
- --%test(Doesn't return annotations when annotations removed from package)
- --%aftertest(drop_dummy_test_package)
- procedure remove_annotations_from_pkg;
-
- --%test(Returns annotations when annotations were added to package)
- --%aftertest(drop_dummy_test_package)
- procedure add_annotations_to_package;
-
- --%test(Updates annotations in cache for modified test package)
- procedure update_modified_test_package;
-
- --%test(Keeps annotations in cache when object was removed but user can't see whole schema)
- --%beforetest(create_dummy_test_package,create_parse_proc_as_ut3_user)
- --%aftertest(drop_parse_proc_as_ut3_user)
- procedure keep_dropped_data_in_cache;
-
- --%test(Does not return data for dropped object)
- procedure no_data_for_dropped_object;
-
- --%test(Remove object from cache when object dropped and user can see whole schema)
- procedure cleanup_dropped_data_in_cache;
-
- --%test(Objects are populated on scan after cache was purged)
- procedure populate_cache_after_purge;
-
- --%endcontext
-
-end test_annotation_manager;
-/
diff --git a/test/ut3_tester/core/annotations/test_annotation_parser.pkb b/test/ut3_tester/core/annotations/test_annotation_parser.pkb
deleted file mode 100644
index beb526863..000000000
--- a/test/ut3_tester/core/annotations/test_annotation_parser.pkb
+++ /dev/null
@@ -1,904 +0,0 @@
-create or replace package body test_annotation_parser is
-
- procedure test_proc_comments is
- l_source dbms_preprocessor.source_lines_t;
- l_actual ut3_develop.ut_annotations;
- l_expected ut3_develop.ut_annotations;
- begin
- --Arrange
- l_source := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'PACKAGE test_tt AS' || chr(10),
- ' -- %suite' || chr(10),
- ' -- %displayname(Name of suite)' || chr(10),
- ' -- %suitepath(all.globaltests)' || chr(10),
- '' || chr(10),
- ' -- %ann1(Name of suite)' || chr(10),
- ' -- wrong line' || chr(10),
- ' -- %ann2(some_value)' || chr(10),
- ' procedure foo;' || chr(10),
- ' END;' || chr(10)
- ));
-
- --Act
- l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source, 'PACKAGE');
-
- --Assert
- l_expected := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2,'suite',null, null),
- ut3_develop.ut_annotation(3,'displayname','Name of suite',null),
- ut3_develop.ut_annotation(4,'suitepath','all.globaltests',null),
- ut3_develop.ut_annotation(6,'ann1','Name of suite',null),
- ut3_develop.ut_annotation(8,'ann2','some_value','foo')
- );
-
- ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
- end;
-
- procedure include_floating_annotations is
- l_source dbms_preprocessor.source_lines_t;
- l_actual ut3_develop.ut_annotations;
- l_expected ut3_develop.ut_annotations;
- begin
- --Arrange
- l_source := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'PACKAGE test_tt AS' || chr(10),
- ' -- %suite' || chr(10),
- ' -- %displayname(Name of suite)' || chr(10),
- ' -- %suitepath(all.globaltests)' || chr(10),
- '' || chr(10),
- ' -- %ann1(Name of suite)' || chr(10),
- ' -- %ann2(all.globaltests)' || chr(10),
- '' || chr(10),
- ' --%test' || chr(10),
- ' procedure foo;' || chr(10),
- '' || chr(10),
- ' -- %ann3(Name of suite)' || chr(10),
- ' -- %ann4(all.globaltests)' || chr(10),
- '' || chr(10),
- ' --%test' || chr(10),
- ' procedure bar;' || chr(10),
- ' END;' || chr(10)
- ));
-
- --Act
- l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source, 'PACKAGE');
-
- --Assert
- l_expected := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation( 2, 'suite', null, null ),
- ut3_develop.ut_annotation( 3, 'displayname', 'Name of suite', null ),
- ut3_develop.ut_annotation( 4, 'suitepath', 'all.globaltests', null ),
- ut3_develop.ut_annotation( 6, 'ann1', 'Name of suite', null ),
- ut3_develop.ut_annotation( 7, 'ann2', 'all.globaltests', null ),
- ut3_develop.ut_annotation( 9, 'test', null, 'foo'),
- ut3_develop.ut_annotation( 12, 'ann3', 'Name of suite', null ),
- ut3_develop.ut_annotation( 13, 'ann4', 'all.globaltests', null ),
- ut3_develop.ut_annotation( 15, 'test', null, 'bar')
- );
-
- ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
-
- end;
-
- procedure parse_complex_with_functions is
- l_source dbms_preprocessor.source_lines_t;
- l_actual ut3_develop.ut_annotations;
- l_expected ut3_develop.ut_annotations;
-
- begin
- l_source := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'PACKAGE test_tt AS' || chr(10),
- ' -- %suite' || chr(10),
- ' -- %displayname(Name of suite)' || chr(10),
- ' -- %suitepath(all.globaltests)' || chr(10),
- '' || chr(10),
- ' --%test' || chr(10),
- ' procedure foo;' || chr(10),
- '' || chr(10),
- '' || chr(10),
- ' --%beforeeach' || chr(10),
- ' procedure foo2;' || chr(10),
- '' || chr(10),
- ' --test comment' || chr(10),
- ' -- wrong comment' || chr(10),
- '' || chr(10),
- '' || chr(10),
- '/*' || chr(10),
- ' describtion of the procedure' || chr(10),
- ' */' || chr(10),
- ' --%beforeeach(key=testval)' || chr(10),
- ' PROCEDURE foo3(a_value number default null);' || chr(10),
- '' || chr(10),
- ' --%all' || chr(10),
- ' function foo4(a_val number default null' || chr(10),
- ' , a_par varchar2 default := ''asdf'');' || chr(10),
- 'END;'));
-
- --Act
- l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source, 'PACKAGE');
-
- --Assert
- l_expected := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation( 2, 'suite', null, null ),
- ut3_develop.ut_annotation( 3, 'displayname', 'Name of suite', null ),
- ut3_develop.ut_annotation( 4, 'suitepath', 'all.globaltests', null ),
- ut3_develop.ut_annotation( 6, 'test', null, 'foo' ),
- ut3_develop.ut_annotation( 10, 'beforeeach', null,'foo2' ),
- ut3_develop.ut_annotation( 20, 'beforeeach', 'key=testval','foo3' ),
- ut3_develop.ut_annotation( 23, 'all', null,'foo4' )
- );
-
- ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
-
- end;
-
- procedure no_procedure_annotation is
- l_source dbms_preprocessor.source_lines_t;
- l_actual ut3_develop.ut_annotations;
- l_expected ut3_develop.ut_annotations;
-
- begin
- --Arrange
- l_source := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'PACKAGE test_tt AS' || chr(10),
- ' -- %suite' || chr(10),
- ' -- %displayname(Name of suite)' || chr(10),
- ' -- %suitepath(all.globaltests)' || chr(10),
- '' || chr(10),
- ' procedure foo;' || chr(10),
- ' END;' || chr(10)
- ));
-
- --Act
- l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source, 'PACKAGE');
-
- --Assert
- l_expected := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation( 2, 'suite', null, null ),
- ut3_develop.ut_annotation( 3, 'displayname', 'Name of suite', null ),
- ut3_develop.ut_annotation( 4, 'suitepath', 'all.globaltests', null )
- );
-
- ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
-
- end;
-
- procedure parse_accessible_by is
- l_source dbms_preprocessor.source_lines_t;
- l_actual ut3_develop.ut_annotations;
- l_expected ut3_develop.ut_annotations;
-
- begin
- --Arrange
- l_source := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'PACKAGE test_tt accessible by (foo) AS' || chr(10),
- ' -- %suite' || chr(10),
- ' -- %displayname(Name of suite)' || chr(10),
- ' -- %suitepath(all.globaltests)' || chr(10),
- '' || chr(10),
- ' procedure foo;' || chr(10),
- ' END;' || chr(10)
- ));
-
- --Act
- l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source, 'PACKAGE');
-
- --Assert
- l_expected := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation( 2, 'suite', null, null ),
- ut3_develop.ut_annotation( 3, 'displayname', 'Name of suite', null ),
- ut3_develop.ut_annotation( 4, 'suitepath', 'all.globaltests', null )
- );
-
- ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
-
- end;
-
- procedure complex_package_declaration is
- l_source dbms_preprocessor.source_lines_t;
- l_actual ut3_develop.ut_annotations;
- l_expected ut3_develop.ut_annotations;
-
- begin
- --Arrange
- l_source := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'PACKAGE test_tt' || chr(10),
- ' ACCESSIBLE BY (calling_proc)' || chr(10),
- ' authid current_user' || chr(10),
- ' AS' || chr(10),
- ' -- %suite' || chr(10),
- ' -- %displayname(Name of suite)' || chr(10),
- ' -- %suitepath(all.globaltests)' || chr(10),
- '' || chr(10),
- ' procedure foo;' || chr(10),
- ' END;' || chr(10)
- ));
-
- --Act
- l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source, 'PACKAGE');
-
- --Assert
- l_expected := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation( 5, 'suite', null, null ),
- ut3_develop.ut_annotation( 6, 'displayname', 'Name of suite', null ),
- ut3_develop.ut_annotation( 7, 'suitepath', 'all.globaltests', null )
- );
-
- ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
-
- end;
-
- procedure complex_text is
- l_source dbms_preprocessor.source_lines_t;
- l_actual ut3_develop.ut_annotations;
- l_expected ut3_develop.ut_annotations;
-
- begin
- --Arrange
- l_source := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'PACKAGE test_tt AS' || chr(10),
- ' -- %suite' || chr(10),
- ' --%displayname(name = Name of suite)' || chr(10),
- ' -- %suitepath(key=all.globaltests,key2=foo,"--%some text")' || chr(10),
- '' || chr(10),
- ' procedure foo;' || chr(10),
- ' END;' || chr(10)
- ));
-
- --Act
- l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source, 'PACKAGE');
-
- --Assert
- l_expected := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation( 2, 'suite', null, null ),
- ut3_develop.ut_annotation( 3, 'displayname', 'name = Name of suite', null ),
- ut3_develop.ut_annotation( 4, 'suitepath', 'key=all.globaltests,key2=foo,"--%some text"', null )
- );
-
- ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
-
- end;
-
- procedure ignore_annotations_in_comments is
- l_source dbms_preprocessor.source_lines_t;
- l_actual ut3_develop.ut_annotations;
- l_expected ut3_develop.ut_annotations;
-
- begin
- --Arrange
- l_source := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'PACKAGE test_tt AS' || chr(10),
- ' /*' || chr(10),
- ' Some comment' || chr(10),
- ' -- inlined' || chr(10),
- ' -- %ignored' || chr(10),
- ' */' || chr(10),
- ' -- %suite' || chr(10),
- ' --%displayname(Name of suite)' || chr(10),
- ' -- %suitepath(all.globaltests)' || chr(10),
- '' || chr(10),
- ' procedure foo;' || chr(10),
- ' END;' || chr(10)
- ));
-
- --Act
- l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source, 'PACKAGE');
-
- --Assert
- l_expected := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation( 7, 'suite', null, null ),
- ut3_develop.ut_annotation( 8, 'displayname', 'Name of suite', null ),
- ut3_develop.ut_annotation( 9, 'suitepath', 'all.globaltests', null )
- );
-
- ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
-
- end;
-
- procedure ignore_wrapped_package is
- l_source dbms_preprocessor.source_lines_t;
- l_actual ut3_develop.ut_annotations;
- begin
- --Arrange
- l_source(1) := 'create or replace PACKAGE tst_wrapped_pck wrapped
-a000000
-369
-abcd
-abcd
-abcd
-abcd
-abcd
-abcd
-abcd
-abcd
-abcd
-abcd
-abcd
-abcd
-abcd
-abcd
-abcd
-9
-34 6d
-bg9Jaf2KguofrwaqloE8yvbggKcwg5m49TOf9b9cFj7R9JaW8lYWWi70llr/K6V0iwlp5+eb
-v58yvbLAXLi9gYHwoIvAgccti+Cmpg0DKLY=
--- %some_annotation_like_text
-';
- --Act
- l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source,'PACKAGE');
- --Assert
- ut.expect(anydata.convertCollection(l_actual)).to_be_empty();
- end;
-
- procedure brackets_in_desc is
- l_source dbms_preprocessor.source_lines_t;
- l_actual ut3_develop.ut_annotations;
- l_expected ut3_develop.ut_annotations;
- begin
- --Arrange
- l_source := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'PACKAGE test_tt AS' || chr(10),
- ' -- %suite(Name of suite (including some brackets) and some more text)' || chr(10),
- 'END;' || chr(10)
- ));
-
- --Act
- l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source, 'PACKAGE');
-
- --Assert
- l_expected := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation( 2, 'suite', 'Name of suite (including some brackets) and some more text', null )
- );
-
- ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
- end;
-
- procedure test_space_before_annot_params is
- l_source dbms_preprocessor.source_lines_t;
- l_actual ut3_develop.ut_annotations;
- l_expected ut3_develop.ut_annotations;
-
- begin
- --Arrange
- l_source := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'PACKAGE test_tt AS' || chr(10),
- ' /*' || chr(10),
- ' Some comment' || chr(10),
- ' -- inlined' || chr(10),
- ' */' || chr(10),
- ' -- %suite' || chr(10),
- ' -- %suitepath (all.globaltests)'|| chr(10),
- '' || chr(10),
- ' procedure foo;' || chr(10),
- 'END;' || chr(10)
- ));
-
- --Act
- l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source, 'PACKAGE');
-
- --Assert
- l_expected := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation( 6, 'suite', null, null ),
- ut3_develop.ut_annotation( 7, 'suitepath', 'all.globaltests', null )
- );
-
- ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
- end;
-
- procedure test_windows_newline
- as
- l_source dbms_preprocessor.source_lines_t;
- l_actual ut3_develop.ut_annotations;
- l_expected ut3_develop.ut_annotations;
- begin
- --Arrange
- l_source := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'PACKAGE test_tt AS' || chr(10),
- ' -- %suite' || chr(10),
- ' -- %displayname(Name of suite)' || chr(13) || chr(10),
- ' -- %suitepath(all.globaltests)' || chr(10),
- ' END;' || chr(10)
- ));
-
- --Act
- l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source, 'PACKAGE');
-
- --Assert
- l_expected := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation( 2, 'suite', null, null ),
- ut3_develop.ut_annotation( 3, 'displayname', 'Name of suite', null ),
- ut3_develop.ut_annotation( 4, 'suitepath', 'all.globaltests', null )
- );
-
- ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
- end;
-
- procedure test_annot_very_long_name
- as
- l_source dbms_preprocessor.source_lines_t;
- l_actual ut3_develop.ut_annotations;
- l_expected ut3_develop.ut_annotations;
- begin
- --Arrange
- l_source := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'PACKAGE very_long_procedure_name_valid_for_oracle_12_so_utPLSQL_should_allow_it_definitely_well_still_not_reached_128_but_wait_we_did_it AS' || chr(10),
- ' -- %suite' || chr(10),
- ' -- %displayname(Name of suite)' || chr(10),
- ' -- %suitepath(all.globaltests)' || chr(10),
- '' || chr(10),
- ' --%test' || chr(10),
- ' procedure very_long_procedure_name_valid_for_oracle_12_so_utPLSQL_should_allow_it_definitely_well_still_not_reached_128_but_wait_we_dit_it;' || chr(10),
- ' END;' || chr(10)
- ));
-
- --Act
- l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source, 'PACKAGE');
-
- --Assert
- l_expected := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation( 2, 'suite', null, null ),
- ut3_develop.ut_annotation( 3, 'displayname', 'Name of suite', null ),
- ut3_develop.ut_annotation( 4, 'suitepath', 'all.globaltests', null ),
- ut3_develop.ut_annotation( 6, 'test', null, 'very_long_procedure_name_valid_for_oracle_12_so_utPLSQL_should_allow_it_definitely_well_still_not_reached_128_but_wait_we_dit_it' )
- );
-
- ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
- end;
-
- procedure test_upper_annot is
- l_source dbms_preprocessor.source_lines_t;
- l_actual ut3_develop.ut_annotations;
- l_expected ut3_develop.ut_annotations;
- begin
- --Arrange
- l_source := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'PACKAGE test_tt AS' || chr(10),
- ' -- %SUITE' || chr(10),
- ' -- %DISPLAYNAME(Name of suite)' || chr(10),
- ' -- %SUITEPATH(all.globaltests)' || chr(10),
- '' || chr(10),
- ' -- %ANN1(Name of suite)' || chr(10),
- ' -- %ANN2(all.globaltests)' || chr(10),
- '' || chr(10),
- ' --%TEST' || chr(10),
- ' procedure foo;' || chr(10),
- '' || chr(10),
- ' -- %ANN3(Name of suite)' || chr(10),
- ' -- %ANN4(all.globaltests)' || chr(10),
- '' || chr(10),
- ' --%TEST' || chr(10),
- ' procedure bar;' || chr(10),
- ' END;' || chr(10)
- ));
-
- --Act
- l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source, 'PACKAGE');
-
- --Assert
- l_expected := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation( 2, 'suite', null, null ),
- ut3_develop.ut_annotation( 3, 'displayname', 'Name of suite', null ),
- ut3_develop.ut_annotation( 4, 'suitepath', 'all.globaltests', null ),
- ut3_develop.ut_annotation( 6, 'ann1', 'Name of suite', null ),
- ut3_develop.ut_annotation( 7, 'ann2', 'all.globaltests', null ),
- ut3_develop.ut_annotation( 9, 'test', null, 'foo'),
- ut3_develop.ut_annotation( 12, 'ann3', 'Name of suite', null ),
- ut3_develop.ut_annotation( 13, 'ann4', 'all.globaltests', null ),
- ut3_develop.ut_annotation( 15, 'test', null, 'bar')
- );
-
- ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
-
- end;
-
- ------------------------------------------------------------
- -- replace_multiline_comments coverage tests
- ------------------------------------------------------------
-
- procedure test_rmc_empty_source is
- l_input dbms_preprocessor.source_lines_t;
- l_result dbms_preprocessor.source_lines_t;
- begin
- --Act
- l_result := ut3_develop.ut_utils.replace_multiline_comments(l_input);
-
- --Assert
- ut.expect(l_result.count).to_equal(0);
- end;
-
- procedure test_rmc_no_ml_comment_marker is
- l_input dbms_preprocessor.source_lines_t;
- l_result dbms_preprocessor.source_lines_t;
- begin
- --Arrange
- l_input := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'procedure foo is' || chr(10),
- 'begin' || chr(10),
- ' null;' || chr(10),
- 'end;' || chr(10)
- ));
-
- --Act
- l_result := ut3_develop.ut_utils.replace_multiline_comments(l_input);
-
- --Assert
- ut.expect(ut3_tester_helper.main_helper.lines_to_str(l_result)).to_equal(ut3_tester_helper.main_helper.lines_to_str(l_input));
- end;
-
- procedure test_rmc_line_inside_ml_comment is
- l_input dbms_preprocessor.source_lines_t;
- l_result dbms_preprocessor.source_lines_t;
- begin
- --Arrange
- l_input := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'x := 1; /* start' || chr(10),
- 'this whole line is comment' || chr(10),
- 'end comment */ x := 2;' || chr(10)
- ));
-
- --Act
- l_result := ut3_develop.ut_utils.replace_multiline_comments(l_input);
-
- --Assert
- ut.expect(l_result(1)).to_equal('x := 1; ' || chr(10));
- ut.expect(l_result(2)).to_equal('');
- ut.expect(l_result(3)).to_equal(' x := 2;' || chr(10));
- end;
-
- procedure test_rmc_ml_comment_closed_midline is
- l_input dbms_preprocessor.source_lines_t;
- l_result dbms_preprocessor.source_lines_t;
- begin
- --Arrange
- l_input := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- '/* open' || chr(10),
- 'still inside' || chr(10),
- '*/ code /* remove this too */ kept' || chr(10)
- ));
-
- --Act
- l_result := ut3_develop.ut_utils.replace_multiline_comments(l_input);
-
- --Assert
- ut.expect(l_result(2)).to_equal('');
- ut.expect(l_result(3)).to_equal(' code kept' || chr(10));
- end;
-
- procedure test_rmc_fast_path_no_tokens is
- l_input dbms_preprocessor.source_lines_t;
- l_result dbms_preprocessor.source_lines_t;
- begin
- --Arrange
- -- line 2 has none of / - ' so hits fast path B; line 1 needed to pass pre-scan
- l_input := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- '/* comment */' || chr(10),
- 'begin' || chr(10)
- ));
-
- --Act
- l_result := ut3_develop.ut_utils.replace_multiline_comments(l_input);
-
- --Assert
- ut.expect(l_result(2)).to_equal('begin' || chr(10));
- end;
-
- procedure test_rmc_ml_comment_single_line is
- l_input dbms_preprocessor.source_lines_t;
- l_result dbms_preprocessor.source_lines_t;
- begin
- --Arrange
- l_input := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'x := /* inline comment */ 42;' || chr(10)
- ));
-
- --Act
- l_result := ut3_develop.ut_utils.replace_multiline_comments(l_input);
-
- --Assert
- ut.expect(l_result(1)).to_equal('x := 42;' || chr(10));
- end;
-
- procedure test_rmc_single_line_comment_preserved is
- l_input dbms_preprocessor.source_lines_t;
- l_result dbms_preprocessor.source_lines_t;
- begin
- --Arrange
- l_input := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- '/* marker */' || chr(10),
- ' -- %test annotation' || chr(10)
- ));
-
- --Act
- l_result := ut3_develop.ut_utils.replace_multiline_comments(l_input);
-
- --Assert
- ut.expect(l_result(2)).to_equal(' -- %test annotation' || chr(10));
- end;
-
- procedure test_rmc_string_literal_protects_markers is
- l_input dbms_preprocessor.source_lines_t;
- l_result dbms_preprocessor.source_lines_t;
- begin
- --Arrange
- l_input := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'v := ''val /* not a comment */ here'';' || chr(10)
- ));
-
- --Act
- l_result := ut3_develop.ut_utils.replace_multiline_comments(l_input);
-
- --Assert
- ut.expect(l_result(1)).to_equal('v := ''val /* not a comment */ here'';' || chr(10));
- end;
-
- procedure test_rmc_string_literal_escaped_quotes is
- l_input dbms_preprocessor.source_lines_t;
- l_result dbms_preprocessor.source_lines_t;
- begin
- --Arrange
- l_input := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'v := ''it''''s a /* test */'';' || chr(10)
- ));
-
- --Act
- l_result := ut3_develop.ut_utils.replace_multiline_comments(l_input);
-
- --Assert
- ut.expect(l_result(1)).to_equal('v := ''it''''s a /* test */'';' || chr(10));
- end;
-
- procedure test_rmc_q_quoted_string_literal is
- l_input dbms_preprocessor.source_lines_t;
- l_result dbms_preprocessor.source_lines_t;
- begin
- --Arrange
- l_input := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'v := q''[/* not a comment */]'';' || chr(10)
- ));
-
- --Act
- l_result := ut3_develop.ut_utils.replace_multiline_comments(l_input);
-
- --Assert
- ut.expect(l_result(1)).to_equal('v := q''[/* not a comment */]'';' || chr(10));
- end;
-
- procedure test_rmc_unclosed_string_literal is
- l_input dbms_preprocessor.source_lines_t;
- l_result dbms_preprocessor.source_lines_t;
- begin
- --Arrange
- l_input := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'v := ''hello /* inside unclosed' || chr(10)
- ));
-
- --Act
- l_result := ut3_develop.ut_utils.replace_multiline_comments(l_input);
-
- --Assert
- ut.expect(l_result(1)).to_equal('v := ''hello /* inside unclosed' || chr(10));
- end;
-
- procedure test_rmc_unclosed_q_string is
- l_input dbms_preprocessor.source_lines_t;
- l_result dbms_preprocessor.source_lines_t;
- c_line constant varchar2(100) := q'(v := q'[/* unclosed q-string)' || chr(10);
- begin
- --Arrange
- l_input := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(c_line));
-
- --Act
- l_result := ut3_develop.ut_utils.replace_multiline_comments(l_input);
-
- --Assert
- ut.expect(l_result(1)).to_equal(c_line);
- end;
-
- procedure test_rmc_multiple_ml_comments_one_line is
- l_input dbms_preprocessor.source_lines_t;
- l_result dbms_preprocessor.source_lines_t;
- begin
- --Arrange
- l_input := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'a /* one */ := /* two */ 1;' || chr(10)
- ));
-
- --Act
- l_result := ut3_develop.ut_utils.replace_multiline_comments(l_input);
-
- --Assert
- ut.expect(l_result(1)).to_equal('a := 1;' || chr(10));
- end;
-
- procedure test_rmc_comment_after_string_with_slash is
- l_input dbms_preprocessor.source_lines_t;
- l_result dbms_preprocessor.source_lines_t;
- begin
- --Arrange
- l_input := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'v := ''a/b''; -- this is /* not */ a ml comment' || chr(10)
- ));
-
- --Act
- l_result := ut3_develop.ut_utils.replace_multiline_comments(l_input);
-
- --Assert
- ut.expect(l_result(1)).to_equal('v := ''a/b''; -- this is /* not */ a ml comment' || chr(10));
- end;
-
- procedure test_multiline_proc_header_lines is
- l_source dbms_preprocessor.source_lines_t;
- l_actual ut3_develop.ut_annotations;
- l_expected ut3_develop.ut_annotations;
- begin
- --Arrange
- -- procedure header spans multiple lines before terminating ;
- l_source := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'PACKAGE test_tt AS' || chr(10),
- ' -- %suite' || chr(10),
- '' || chr(10),
- ' --%test' || chr(10),
- ' procedure foo(' || chr(10),
- ' a_param1 varchar2' || chr(10),
- ' ,a_param2 number default null' || chr(10),
- ' );' || chr(10),
- ' END;' || chr(10)
- ));
-
- --Act
- l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source, 'PACKAGE');
-
- --Assert
- l_expected := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation( 2, 'suite', null, null ),
- ut3_develop.ut_annotation( 4, 'test', null, 'foo' )
- );
-
- ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
- end;
-
- procedure test_non_comment_line_resets_block_lines is
- l_source dbms_preprocessor.source_lines_t;
- l_actual ut3_develop.ut_annotations;
- l_expected ut3_develop.ut_annotations;
- begin
- --Arrange
- -- a non-comment non-proc line between annotation and procedure breaks the association
- -- %test becomes a floating top-level annotation with no subobject
- l_source := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'PACKAGE test_tt AS' || chr(10),
- ' -- %suite' || chr(10),
- '' || chr(10),
- ' --%test' || chr(10),
- ' pragma serially_reusable;' || chr(10),
- ' procedure foo;' || chr(10),
- ' END;' || chr(10)
- ));
-
- --Act
- l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source, 'PACKAGE');
-
- --Assert
- -- %test is NOT associated with foo — accumulator was reset by pragma line
- -- it surfaces as a top-level annotation with no subobject_name
- l_expected := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation( 2, 'suite', null, null ),
- ut3_develop.ut_annotation( 4, 'test', null, null )
- );
-
- ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
- end;
-
- procedure test_annotation_not_at_line_start_ignored_lines is
- l_source dbms_preprocessor.source_lines_t;
- l_actual ut3_develop.ut_annotations;
- l_expected ut3_develop.ut_annotations;
- begin
- --Arrange
- -- code before -- means it is not at start of line and must be ignored
- l_source := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'PACKAGE test_tt AS' || chr(10),
- ' -- %suite' || chr(10),
- ' x := 1; -- %not_an_annotation' || chr(10),
- ' procedure foo;' || chr(10),
- ' END;' || chr(10)
- ));
-
- --Act
- l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source, 'PACKAGE');
-
- --Assert
- l_expected := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation( 2, 'suite', null, null )
- );
-
- ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
- end;
-
- procedure test_whitespace_line_between_comment_and_proc_lines is
- l_source dbms_preprocessor.source_lines_t;
- l_actual ut3_develop.ut_annotations;
- l_expected ut3_develop.ut_annotations;
- begin
- --Arrange
- -- space-only line between annotation comment and procedure declaration is tolerated
- l_source := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'PACKAGE test_tt AS' || chr(10),
- ' -- %suite' || chr(10),
- '' || chr(10),
- ' --%test' || chr(10),
- ' ' || chr(10),
- ' procedure foo;' || chr(10),
- ' END;' || chr(10)
- ));
-
- --Act
- l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source, 'PACKAGE');
-
- --Assert
- l_expected := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation( 2, 'suite', null, null ),
- ut3_develop.ut_annotation( 4, 'test', null, 'foo' )
- );
-
- ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
- end;
-
- procedure test_space_between_dashes_and_qualifier_lines is
- l_source dbms_preprocessor.source_lines_t;
- l_actual ut3_develop.ut_annotations;
- l_expected ut3_develop.ut_annotations;
- begin
- --Arrange
- -- spaces between -- and % are skipped and annotation is still recognised
- -- annotations are not adjacent to a procedure so they are top-level
- l_source := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'PACKAGE test_tt AS' || chr(10),
- ' -- %suite' || chr(10),
- ' -- %displayname(my suite)' || chr(10),
- '' || chr(10),
- ' procedure foo;' || chr(10),
- ' END;' || chr(10)
- ));
-
- --Act
- l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source, 'PACKAGE');
-
- --Assert
- l_expected := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation( 2, 'suite', null, null ),
- ut3_develop.ut_annotation( 3, 'displayname', 'my suite', null )
- );
-
- ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
- end;
-
- procedure test_percent_not_after_dashes_ignored_lines is
- l_source dbms_preprocessor.source_lines_t;
- l_actual ut3_develop.ut_annotations;
- l_expected ut3_develop.ut_annotations;
- begin
- --Arrange
- -- -- present and % present on line but % is not immediately after --
- -- e.g. a regular comment that happens to mention 100%
- l_source := ut3_tester_helper.main_helper.make_source(ut3_develop.ut_varchar2_list(
- 'PACKAGE test_tt AS' || chr(10),
- ' -- %suite' || chr(10),
- ' -- coverage is 100% on this module' || chr(10),
- ' procedure foo;' || chr(10),
- ' END;' || chr(10)
- ));
-
- --Act
- l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source, 'PACKAGE');
-
- --Assert
- l_expected := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation( 2, 'suite', null, null )
- );
-
- ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
- end;
-
-end test_annotation_parser;
-/
\ No newline at end of file
diff --git a/test/ut3_tester/core/annotations/test_annotation_parser.pks b/test/ut3_tester/core/annotations/test_annotation_parser.pks
deleted file mode 100644
index c61c14d3a..000000000
--- a/test/ut3_tester/core/annotations/test_annotation_parser.pks
+++ /dev/null
@@ -1,75 +0,0 @@
-create or replace package test_annotation_parser is
-
- --%suite(ut_annotation_parser)
- --%suitepath(utplsql.ut3_tester.core.annotations)
-
- --%test(Treats procedure level annotations as package level, if mixed with comments)
- procedure test_proc_comments;
- --%test(Includes floating annotations between procedures and package)
- procedure include_floating_annotations;
- --%test(Parses complex annotations on procedures and functions)
- procedure parse_complex_with_functions;
- --%test(Parses package annotations without any procedure annotations)
- procedure no_procedure_annotation;
- --%test(Parses package level annotations with Accessible by)
- procedure parse_accessible_by;
- --%test(Parses package level annotations with multiline declaration)
- procedure complex_package_declaration;
- --%test(Parses complex text in annotation)
- procedure complex_text;
- --%test(Ignores content of multi-line comments)
- procedure ignore_annotations_in_comments;
- -- %test(ignore wrapped package source)
- procedure ignore_wrapped_package;
- --%test(Parses package level annotations with annotation params containing brackets)
- procedure brackets_in_desc;
- --%test(Parses annotation text even with spaces before brackets)
- procedure test_space_before_annot_params;
- -- %test(Parses source-code with Windows-style newline)
- procedure test_windows_newline;
- -- %test(parse annotations with very long procedure name)
- procedure test_annot_very_long_name;
- -- %test(Parses upper case annotations)
- procedure test_upper_annot;
-
- -- %test(empty source returns immediately without processing)
- procedure test_rmc_empty_source;
- -- %test(source with no multiline comment markers returned unchanged)
- procedure test_rmc_no_ml_comment_marker;
- -- %test(line entirely inside multiline comment is blanked)
- procedure test_rmc_line_inside_ml_comment;
- -- %test(closing delimiter mid-line falls through to scan remainder)
- procedure test_rmc_ml_comment_closed_midline;
- -- %test(fast path line with no slash dash or quote copied unchanged)
- procedure test_rmc_fast_path_no_tokens;
- -- %test(single-line block comment removed on same line)
- procedure test_rmc_ml_comment_single_line;
- -- %test(single-line comment preserved intact)
- procedure test_rmc_single_line_comment_preserved;
- -- %test(string literal containing comment markers not stripped)
- procedure test_rmc_string_literal_protects_markers;
- -- %test(string literal with escaped quotes handled correctly)
- procedure test_rmc_string_literal_escaped_quotes;
- -- %test(q-quoted string literal protects interior comment markers)
- procedure test_rmc_q_quoted_string_literal;
- -- %test(unclosed string literal copies remainder and exits scan)
- procedure test_rmc_unclosed_string_literal;
- -- %test(unclosed q-quoted string copies remainder and exits scan)
- procedure test_rmc_unclosed_q_string;
- -- %test(multiple block comments on single line all removed)
- procedure test_rmc_multiple_ml_comments_one_line;
- -- %test(comment markers after string with slash handled correctly)
- procedure test_rmc_comment_after_string_with_slash;
- --%test(Procedure header spanning multiple lines is handled correctly)
- procedure test_multiline_proc_header_lines;
- --%test(Non-comment line between annotation and procedure resets association)
- procedure test_non_comment_line_resets_block_lines;
- --%test(Comment with non-whitespace before dashes is not treated as annotation)
- procedure test_annotation_not_at_line_start_ignored_lines;
- --%test(Spaces between dashes and annotation qualifier are skipped correctly)
- procedure test_space_between_dashes_and_qualifier_lines;
- --%test(Percent sign not immediately after dashes is not treated as annotation)
- procedure test_percent_not_after_dashes_ignored_lines;
-
-end test_annotation_parser;
-/
\ No newline at end of file
diff --git a/test/ut3_tester/core/annotations/test_before_after_annotations.pkb b/test/ut3_tester/core/annotations/test_before_after_annotations.pkb
deleted file mode 100644
index 75bbadcc0..000000000
--- a/test/ut3_tester/core/annotations/test_before_after_annotations.pkb
+++ /dev/null
@@ -1,310 +0,0 @@
-create or replace package body test_before_after_annotations is
-
- type t_executed_procedures is table of t_procedures index by t_procedure_name;
- g_tests_results clob;
- g_executed_procedures t_executed_procedures;
-
-
- procedure set_procs_called(a_for_procedure t_procedure_name, a_procedures t_procedures) is
- begin
- g_executed_procedures(a_for_procedure) := a_procedures;
- end;
-
- function get_procs_called(a_for_procedure varchar2) return t_procedures pipelined is
- begin
- if g_executed_procedures.exists(a_for_procedure) then
- for i in 1 .. g_executed_procedures(a_for_procedure).count loop
- pipe row (g_executed_procedures(a_for_procedure)(i));
- end loop;
- end if;
- return;
- end;
-
- procedure create_tests_results is
- pragma autonomous_transaction;
-
-
- l_dummy_utility_pkg_spec varchar2(32737);
- l_dummy_utility_pkg_body varchar2(32737);
- l_test_package_spec varchar2(32737);
- l_test_package_body varchar2(32737);
- l_test_results ut3_develop.ut_varchar2_list;
-
- begin
- l_dummy_utility_pkg_spec := q'[
- create or replace package shared_test_package is
-
- procedure before_test;
-
- procedure set_proc_called(a_procedure_name varchar2);
-
- function get_procs_called return test_before_after_annotations.t_procedures;
-
- procedure reset_proc_called;
-
- end;
- ]';
-
- l_dummy_utility_pkg_body := q'[
- create or replace package body shared_test_package is
-
- g_called_procedures test_before_after_annotations.t_procedures := test_before_after_annotations.t_procedures();
-
- procedure set_proc_called(a_procedure_name varchar2) is
- begin
- g_called_procedures.extend;
- g_called_procedures(g_called_procedures.last) := a_procedure_name;
- end;
-
- function get_procs_called return test_before_after_annotations.t_procedures is
- begin
- return g_called_procedures;
- end;
-
- procedure reset_proc_called is
- begin
- g_called_procedures.delete;
- end;
-
- procedure before_test is
- begin
- set_proc_called('shared_test_package.before_test');
- end;
-
- end;
- ]';
-
- l_test_package_spec := q'[
- create or replace package dummy_before_after_test is
- --%suite(Package to test annotations beforetest and aftertest)
-
- --%aftereach
- procedure clean_global_variables;
-
- --%test(Executes Beforetest call to procedure inside package)
- --%beforetest(before_test)
- procedure beforetest_local_procedure;
-
- --%test(Executes beforetest procedure defined in the package when specified with package name)
- --%beforetest(dummy_before_after_test.before_test)
- procedure beforetest_local_proc_with_pkg;
-
- --%test(Executes Beforetest procedure twice when defined twice)
- --%beforetest(before_test, before_test)
- procedure beforetest_twice;
-
- --%test(Executes Beforetest procedure from external package)
- --%beforetest(shared_test_package.before_test)
- procedure beforetest_one_ext_procedure;
-
- --%test(Executed external and internal Beforetest procedures)
- --%beforetest(shared_test_package.before_test, before_test)
- procedure beforetest_multi_ext_procedure;
-
- --%test(Stops execution at first non-existing Beforetest procedure and marks test as errored)
- --%beforetest(shared_test_package.before_test, non_existent_procedure, before_test)
- procedure beforetest_missing_procedure;
-
- --%test(Stops execution at first erroring Beforetest procedure and marks test as errored)
- --%beforetest(shared_test_package.before_test, before_test_erroring, before_test)
- procedure beforetest_one_err_procedure;
-
- procedure before_test;
-
- procedure before_test_erroring;
-
- end;
- ]';
-
- l_test_package_body := q'[
- create or replace package body dummy_before_after_test is
-
- procedure clean_global_variables is
- begin
- shared_test_package.reset_proc_called;
- end;
-
- procedure beforetest_local_procedure is
- begin
- test_before_after_annotations.set_procs_called(
- 'beforetest_local_procedure',
- shared_test_package.get_procs_called()
- );
- end;
-
- procedure beforetest_local_proc_with_pkg is
- begin
- test_before_after_annotations.set_procs_called(
- 'beforetest_local_proc_with_pkg',
- shared_test_package.get_procs_called()
- );
- end;
-
- procedure beforetest_twice is
- begin
- test_before_after_annotations.set_procs_called(
- 'beforetest_twice',
- shared_test_package.get_procs_called()
- );
- end;
-
- procedure beforetest_one_ext_procedure is
- begin
- test_before_after_annotations.set_procs_called(
- 'beforetest_one_ext_procedure',
- shared_test_package.get_procs_called()
- );
- end;
-
- procedure beforetest_multi_ext_procedure is
- begin
- test_before_after_annotations.set_procs_called(
- 'beforetest_multi_ext_procedure',
- shared_test_package.get_procs_called()
- );
- end;
-
- procedure beforetest_missing_procedure is
- begin
- test_before_after_annotations.set_procs_called(
- 'beforetest_missing_procedure',
- shared_test_package.get_procs_called()
- );
- end;
-
- procedure beforetest_one_err_procedure is
- begin
- test_before_after_annotations.set_procs_called(
- 'beforetest_one_err_procedure',
- shared_test_package.get_procs_called()
- );
- end;
-
- procedure before_test is
- begin
- shared_test_package.set_proc_called('dummy_before_after_test.before_test');
- end;
-
- procedure before_test_erroring is
- begin
- shared_test_package.set_proc_called('dummy_before_after_test.before_test_erroring');
- raise program_error;
- end;
-
- end;
- ]';
-
- execute immediate l_dummy_utility_pkg_spec;
- execute immediate l_dummy_utility_pkg_body;
- execute immediate l_test_package_spec;
- execute immediate l_test_package_body;
-
- --Execute the tests and collect the results
- select * bulk collect into l_test_results from table(ut3_develop.ut.run(('ut3_tester.dummy_before_after_test')));
-
- execute immediate 'drop package dummy_before_after_test';
- execute immediate 'drop package shared_test_package';
-
- g_tests_results := ut3_tester_helper.main_helper.table_to_clob(l_test_results);
- end;
-
- procedure beforetest_local_procedure is
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- open l_expected for
- select 'dummy_before_after_test.before_test' as column_value from dual;
- open l_actual for
- select * from table(test_before_after_annotations.get_procs_called('beforetest_local_procedure'));
- ut.expect(l_actual).to_equal(l_expected);
- end;
-
- procedure beforetest_local_proc_with_pkg is
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- open l_expected for
- select 'dummy_before_after_test.before_test' as column_value from dual;
- open l_actual for
- select * from table(test_before_after_annotations.get_procs_called('beforetest_local_procedure'));
- ut.expect(l_actual).to_equal(l_expected);
- end;
-
- procedure beforetest_twice is
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- open l_expected for
- select 'dummy_before_after_test.before_test' as column_value from dual union all
- select 'dummy_before_after_test.before_test' as column_value from dual;
-
- open l_actual for
- select * from table(test_before_after_annotations.get_procs_called('beforetest_twice'));
- ut.expect(l_actual).to_equal(l_expected);
- end;
-
- procedure beforetest_one_ext_procedure is
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- open l_expected for
- select 'shared_test_package.before_test' as column_value from dual;
-
- open l_actual for
- select * from table(test_before_after_annotations.get_procs_called('beforetest_one_ext_procedure'));
- ut.expect(l_actual).to_equal(l_expected);
- end;
-
- procedure beforetest_multi_ext_procedure is
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- open l_expected for
- select 'shared_test_package.before_test' as column_value from dual union all
- select 'dummy_before_after_test.before_test' as column_value from dual;
-
- open l_actual for
- select * from table(test_before_after_annotations.get_procs_called('beforetest_multi_ext_procedure'));
- ut.expect(l_actual).to_equal(l_expected);
- end;
-
- procedure beforetest_missing_procedure is
- l_actual sys_refcursor;
- begin
- open l_actual for
- select * from table(test_before_after_annotations.get_procs_called('beforetest_missing_procedure'));
-
- ut.expect(l_actual).to_be_empty;
-
- ut.expect(g_tests_results).to_match(
- '^\s*Stops execution at first non-existing Beforetest procedure and marks test as errored \[[,\.0-9]+ sec\] \(FAILED - 1\)\s*$'
- ,'m'
- );
- ut.expect(g_tests_results).to_match(
- '1\) beforetest_missing_procedure\s+' ||
- 'Call params for beforetest are not valid: procedure UT3_TESTER\.DUMMY_BEFORE_AFTER_TEST\.NON_EXISTENT_PROCEDURE does not exist\.'
- ,'m'
- );
- end;
-
- procedure beforetest_one_err_procedure is
- l_actual sys_refcursor;
- begin
- open l_actual for
- select * from table(test_before_after_annotations.get_procs_called('beforetest_one_err_procedure'));
-
- ut.expect(l_actual).to_be_empty;
-
- ut.expect(g_tests_results).to_match(
- '^\s*Stops execution at first non-existing Beforetest procedure and marks test as errored \[[,\.0-9]+ sec\] \(FAILED - 1\)\s*$'
- ,'m'
- );
- ut.expect(g_tests_results).to_match(
- '2\) beforetest_one_err_procedure\s+' ||
- 'ORA-06501: PL/SQL: program error'
- ,'m'
- );
- end;
-
-end;
-/
\ No newline at end of file
diff --git a/test/ut3_tester/core/annotations/test_before_after_annotations.pks b/test/ut3_tester/core/annotations/test_before_after_annotations.pks
deleted file mode 100644
index 062efff48..000000000
--- a/test/ut3_tester/core/annotations/test_before_after_annotations.pks
+++ /dev/null
@@ -1,38 +0,0 @@
-create or replace package test_before_after_annotations is
-
- --%suite(annotations - beforetest and aftertest)
- --%suitepath(utplsql.ut3_tester.core.annotations)
-
- subtype t_procedure_name is varchar2(250) not null;
- type t_procedures is table of t_procedure_name;
-
- procedure set_procs_called(a_for_procedure t_procedure_name, a_procedures t_procedures);
-
- function get_procs_called(a_for_procedure varchar2) return t_procedures pipelined;
-
- --%beforeall
- procedure create_tests_results;
-
- --%test(Executes Beforetest call to procedure inside package)
- procedure beforetest_local_procedure;
-
- --%test(Executes beforetest procedure defined in the package when specified with package name)
- procedure beforetest_local_proc_with_pkg;
-
- --%test(Executes Beforetest procedure twice when defined twice)
- procedure beforetest_twice;
-
- --%test(Executes Beforetest procedure from external package)
- procedure beforetest_one_ext_procedure;
-
- --%test(Executed external and internal Beforetest procedures)
- procedure beforetest_multi_ext_procedure;
-
- --%test(Stops execution at first non-existing Beforetest procedure and marks test as errored)
- procedure beforetest_missing_procedure;
-
- --%test(Stops execution at first erroring Beforetest procedure and marks test as errored)
- procedure beforetest_one_err_procedure;
-
-end;
-/
\ No newline at end of file
diff --git a/test/ut3_tester/core/expectations/test_expectation_processor.pkb b/test/ut3_tester/core/expectations/test_expectation_processor.pkb
deleted file mode 100644
index e93d93141..000000000
--- a/test/ut3_tester/core/expectations/test_expectation_processor.pkb
+++ /dev/null
@@ -1,173 +0,0 @@
-create or replace package body test_expectation_processor is
-
- gc_user constant varchar2(128) := sys_context('userenv','current_schema');
- gc_long_line_package constant varchar2(128) := 'TEST_EXPECTATION_LONG_LINE';
- gc_long_line constant varchar2(4000) := 'ut.expect(1).to_equal(2); /*'||rpad('*', 3900, '*')||'*/';
-
- procedure who_called_expectation is
- l_stack_trace varchar2(4000);
- l_source_line varchar2(4000);
- begin
- l_stack_trace := q'[----- PL/SQL Call Stack -----
- object line object
- handle number name
-34f88e4420 124 package body SCH_TEST.UT_EXPECTATION_PROCESSOR
-353dfeb2f8 26 SCH_TEST.UT_EXPECTATION_RESULT
-cba2493ce0 112 SCH_TEST.UT_EXPECTATION
-3539881cf0 21 SCH_TEST.UT_EXPECTATION_NUMBER
-351a608008 9 package body ]'||gc_user||q'[.TEST_EXPECTATION_PROCESSOR
-351a608018 12 package body ]'||gc_user||q'[.TEST_EXPECTATION_PROCESSOR
-351a608018 24 package body ]'||gc_user||q'[.TEST_EXPECTATION_PROCESSOR
-351a6862b8 6 anonymous block
-351fe31010 1825 package body SYS.DBMS_SQL
-20befbe4d8 129 SCH_TEST.UT_EXECUTABLE
-20befbe4d8 65 SCH_TEST.UT_EXECUTABLE
-34f8ab7cd8 80 SCH_TEST.UT_TEST
-34f8ab98f0 48 SCH_TEST.UT_SUITE_ITEM
-34f8ab9b10 74 SCH_TEST.UT_SUITE
-34f8ab98f0 48 SCH_TEST.UT_SUITE_ITEM
-cba24bfad0 75 SCH_TEST.UT_LOGICAL_SUITE
-353dfecf30 59 SCH_TEST.UT_RUN
-34f8ab98f0 48 SCH_TEST.UT_SUITE_ITEM
-357f5421e8 77 package body SCH_TEST.UT_RUNNER
-357f5421e8 111 package body SCH_TEST.UT_RUNNER
-20be951ab0 292 package body SCH_TEST.UT
-20be951ab0 320 package body SCH_TEST.UT
-]';
- ut.expect(
- ut3_develop.ut_expectation_processor.who_called_expectation(l_stack_trace)
- ).to_equal('at "'||gc_user||'.TEST_EXPECTATION_PROCESSOR", line 9 l_source_line varchar2(4000);
-at "'||gc_user||'.TEST_EXPECTATION_PROCESSOR", line 12
-at "'||gc_user||'.TEST_EXPECTATION_PROCESSOR", line 24');
- end;
-
-
- procedure who_called_expectation_0x is
- l_stack_trace varchar2(4000);
- l_source_line varchar2(4000);
- begin
- l_stack_trace := q'[----- PL/SQL Call Stack -----
- object line object
- handle number name
-0x80e701d8 26 UT3_DEVELOP.UT_EXPECTATION_RESULT
-0x85e10150 112 UT3_DEVELOP.UT_EXPECTATION
-0x8b54bad8 21 UT3_DEVELOP.UT_EXPECTATION_NUMBER
-0x85cfd238 20 package body UT3_DEVELOP.UT_EXAMPLETEST
-0x85def380 6 anonymous block
-0x85e93750 1825 package body SYS.DBMS_SQL
-0x80f4f608 129 UT3_DEVELOP.UT_EXECUTABLE
-0x80f4f608 65 UT3_DEVELOP.UT_EXECUTABLE
-0x8a116010 76 UT3_DEVELOP.UT_TEST
-0x8a3348a0 48 UT3_DEVELOP.UT_SUITE_ITEM
-0x887e9948 67 UT3_DEVELOP.UT_LOGICAL_SUITE
-0x8a26de20 59 UT3_DEVELOP.UT_RUN
-0x8a3348a0 48 UT3_DEVELOP.UT_SUITE_ITEM
-0x838d17c0 28 anonymous block
-]';
- ut.expect(
- ut3_develop.ut_expectation_processor.who_called_expectation(l_stack_trace)
- ).to_be_like('at "UT3_DEVELOP.UT_EXAMPLETEST", line 20 %');
- end;
-
- procedure who_call_expectation_win_stack is
- l_stack_trace varchar2(4000);
- l_source_line varchar2(4000);
- begin
- l_stack_trace := q'[----- PL/SQL Call Stack -----
-object line object
-handle number name
-00007FF8547B7D30 124 package body SCH_TEST.UT_EXPECTATION_PROCESSOR
-00007FF8547B7D30 26 SCH_TEST.UT_EXPECTATION_RESULT
-00007FF8547B7D30 112 SCH_TEST.UT_EXPECTATION
-00007FF8547B7D30 21 SCH_TEST.UT_EXPECTATION_NUMBER
-00007FF8547B7D30 7 package body SCOTT.TEST_BETWNSTR.BASIC_USAGE
-00007FF81FF207B0 345 type body SCOTT.TEST_BETWNSTR.BASIC_USAGE_TYP
-00007FF8544B21B8 6 anonymous block
-00007FF8267FBFC8 1721 package body SYS.DBMS_SQL.EXECUTE
-00007FF852BCFC68 142 type body UT3_DEVELOP.UT_EXECUTABLE.DO_EXECUTE
-00007FF852BCFC68 44 type body UT3_DEVELOP.UT_EXECUTABLE.DO_EXECUTE
-00007FF8512F9A90 74 type body UT3_DEVELOP.UT_EXECUTABLE_TEST.DO_EXECUTE
-00007FF8512F9A90 38 type body UT3_DEVELOP.UT_EXECUTABLE_TEST.DO_EXECUTE
-00007FF8231A2088 79 type body UT3_DEVELOP.UT_TEST.DO_EXECUTE
-00007FF81FF207B0 49 type body UT3_DEVELOP.UT_SUITE_ITEM.DO_EXECUTE
-00007FF852C83270 66 type body UT3_DEVELOP.UT_SUITE.DO_EXECUTE
-00007FF82165F3B0 67 type body UT3_DEVELOP.UT_RUN.DO_EXECUTE
-00007FF81FF207B0 49 type body UT3_DEVELOP.UT_SUITE_ITEM.DO_EXECUTE
-00007FF8266285C0 172 package body UT3_DEVELOP.UT_RUNNER.RUN
-00007FF854710538 134 package body UT3_DEVELOP.UT.RUN_AUTONOMOUS
-00007FF854710538 488 package body UT3_DEVELOP.UT.RUN
-00007FF854710538 623 package body UT3_DEVELOP.UT.RUN
-00007FF81CFFA388 1 anonymous block]';
- ut.expect(
- ut3_develop.ut_expectation_processor.who_called_expectation(l_stack_trace)
- ).to_be_like('at "SCOTT.TEST_BETWNSTR.BASIC_USAGE", line 7 %');
- end;
-
- procedure create_long_line_package is
- pragma autonomous_transaction;
- begin
- execute immediate 'create or replace package '||gc_long_line_package||' is
- procedure long_line;
-end;';
- execute immediate 'create or replace package body '||gc_long_line_package||' is
- procedure long_line is
- begin
- '||gc_long_line||'
- end;
-end;';
- end;
-
- procedure drop_long_line_package is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package '||gc_long_line_package;
- end;
-
- procedure who_called_exp_long_line is
- l_stack_trace varchar2(4000);
- l_result varchar2(32767);
- begin
- l_stack_trace := q'[----- PL/SQL Call Stack -----
- object line object
- handle number name
-0x80e701d8 26 UT3_DEVELOP.UT_EXPECTATION_RESULT
-0x85e10150 112 UT3_DEVELOP.UT_EXPECTATION
-0x8b54bad8 21 UT3_DEVELOP.UT_EXPECTATION_NUMBER
-0x85cfd238 4 package body ]'||gc_user||'.'||gc_long_line_package||q'[
-0x85def380 6 anonymous block
-]';
- l_result := ut3_develop.ut_expectation_processor.who_called_expectation(l_stack_trace);
-
- ut.expect( l_result ).to_equal(
- 'at "'||gc_user||'.'||gc_long_line_package||'", line 4 '
- || substr( gc_long_line, 1, 500 - length('[...]') ) || '[...]'
- || chr(10) || 'at "anonymous block", line 6'
- );
- end;
-
- procedure who_called_exp_long_stack is
- l_stack_trace varchar2(32767);
- l_result varchar2(32767);
- begin
- l_stack_trace := q'[----- PL/SQL Call Stack -----
- object line object
- handle number name
-0x80e701d8 26 UT3_DEVELOP.UT_EXPECTATION_RESULT
-0x85e10150 112 UT3_DEVELOP.UT_EXPECTATION
-0x8b54bad8 21 UT3_DEVELOP.UT_EXPECTATION_NUMBER
-0x85cfd238 4 package body ]'||gc_user||'.'||gc_long_line_package||chr(10);
- -- distinct callers, so the stack after the first frame is long
- for i in 1 .. 100 loop
- l_stack_trace := l_stack_trace
- || '0x85cfd238 '||to_char(1000 + i)||' package body '||gc_user||'.'||gc_long_line_package||chr(10);
- end loop;
-
- l_result := ut3_develop.ut_expectation_processor.who_called_expectation(l_stack_trace);
-
- ut.expect( lengthb( l_result ) ).to_be_less_or_equal( 4000 );
- ut.expect( l_result ).to_be_like( 'at "'||gc_user||'.'||gc_long_line_package||'", line 4 ut.expect(1).to_equal(2); /*%' );
- ut.expect( l_result ).to_be_like( '%[...]' );
- end;
-
-end;
-/
diff --git a/test/ut3_tester/core/expectations/test_expectation_processor.pks b/test/ut3_tester/core/expectations/test_expectation_processor.pks
deleted file mode 100644
index 4797dd613..000000000
--- a/test/ut3_tester/core/expectations/test_expectation_processor.pks
+++ /dev/null
@@ -1,39 +0,0 @@
-create or replace package test_expectation_processor is
-
- --%suite(expectation_processor)
- --%suitepath(utplsql.ut3_tester.core.expectations)
-
- --%beforeall(ut3_tester_helper.main_helper.set_ut_run_context)
- --%afterall(ut3_tester_helper.main_helper.clear_ut_run_context)
-
- --%context(who_called_expectation_in_test)
-
- --%test(parses stack trace containing 0x and returns objects and line that called expectation)
- procedure who_called_expectation_0x;
-
- --%test(parses stack trace and returns objects and line that called expectation)
- procedure who_called_expectation;
-
- --%test(parses stack trace for Windows DB os - regression for #1000)
- procedure who_call_expectation_win_stack;
-
- --%endcontext
-
- --%context(who_called_expectation_long_lines)
-
- --%beforeall
- procedure create_long_line_package;
-
- --%afterall
- procedure drop_long_line_package;
-
- --%test(truncates a long source line of the calling code - regression for #1397)
- procedure who_called_exp_long_line;
-
- --%test(limits caller info to 4000 bytes when the call stack is long - regression for #1397)
- procedure who_called_exp_long_stack;
-
- --%endcontext
-
-end;
-/
diff --git a/test/ut3_tester/core/test_coverage_report_html_helper.pkb b/test/ut3_tester/core/test_coverage_report_html_helper.pkb
deleted file mode 100644
index a4cd36ed1..000000000
--- a/test/ut3_tester/core/test_coverage_report_html_helper.pkb
+++ /dev/null
@@ -1,29 +0,0 @@
-create or replace package body test_coverage_report_html_helper is
-
- gc_support_link constant varchar2(4000) :=
- '' || ut3_develop.ut_utils.gc_support_text || '';
-
- function get_index(a_support_info boolean) return clob is
- l_coverage_data ut3_develop.ut_coverage.t_coverage;
- begin
- return ut3_develop.ut_utils.table_to_clob(
- ut3_develop.ut_coverage_report_html_helper.get_index(
- a_coverage_data => l_coverage_data,
- a_assets_path => null,
- a_support_info => a_support_info
- )
- );
- end;
-
- procedure index_includes_support_link is
- begin
- ut.expect( get_index(a_support_info => true) ).to_be_like( '%%' );
- end;
-
- procedure index_omits_support_link is
- begin
- ut.expect( get_index(a_support_info => false) ).not_to_be_like( '%' || ut3_develop.ut_utils.gc_support_url || '%' );
- end;
-
-end;
-/
diff --git a/test/ut3_tester/core/test_coverage_report_html_helper.pks b/test/ut3_tester/core/test_coverage_report_html_helper.pks
deleted file mode 100644
index bad1192b8..000000000
--- a/test/ut3_tester/core/test_coverage_report_html_helper.pks
+++ /dev/null
@@ -1,13 +0,0 @@
-create or replace package test_coverage_report_html_helper is
-
- --%suite(coverage_report_html_helper)
- --%suitepath(utplsql.ut3_tester.core)
-
- --%test(Index page footer includes support link by default)
- procedure index_includes_support_link;
-
- --%test(Index page footer omits support link when switched off)
- procedure index_omits_support_link;
-
-end;
-/
diff --git a/test/ut3_tester/core/test_file_mapper.pkb b/test/ut3_tester/core/test_file_mapper.pkb
deleted file mode 100644
index fccc487bd..000000000
--- a/test/ut3_tester/core/test_file_mapper.pkb
+++ /dev/null
@@ -1,45 +0,0 @@
-create or replace package body test_file_mapper is
-
- procedure default_mappings is
- l_actual ut3_develop.ut_file_mappings;
- l_expected ut3_develop.ut_file_mappings;
- begin
- --Arrange
- l_expected := ut3_develop.ut_file_mappings(
- ut3_develop.ut_file_mapping('C:\tests\helpers\core.pkb',sys_context('USERENV', 'CURRENT_USER'),'CORE','PACKAGE BODY'),
- ut3_develop.ut_file_mapping('tests/helpers/test_file_mapper.pkb',sys_context('USERENV', 'CURRENT_USER'),'TEST_FILE_MAPPER','PACKAGE BODY')
- );
- --Act
- l_actual := ut3_develop.ut_file_mapper.build_file_mappings(
- ut3_develop.ut_varchar2_list(
- 'C:\tests\helpers\core.pkb',
- 'tests/helpers/test_file_mapper.pkb'
- )
- );
- --Assert
- ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
- end;
-
- procedure specific_owner is
- l_actual ut3_develop.ut_file_mappings;
- l_expected ut3_develop.ut_file_mappings;
- begin
- --Arrange
- l_expected := ut3_develop.ut_file_mappings(
- ut3_develop.ut_file_mapping('C:\source\core\types\ut_file_mapping.tpb','UT3_DEVELOP','UT_FILE_MAPPING','TYPE BODY'),
- ut3_develop.ut_file_mapping('source/core/ut_file_mapper.pkb','UT3_DEVELOP','UT_FILE_MAPPER','PACKAGE BODY')
- );
- --Act
- l_actual := ut3_develop.ut_file_mapper.build_file_mappings(
- 'UT3_DEVELOP',
- ut3_develop.ut_varchar2_list(
- 'C:\source\core\types\ut_file_mapping.tpb',
- 'source/core/ut_file_mapper.pkb'
- )
- );
- --Assert
- ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
- end;
-
-end;
-/
diff --git a/test/ut3_tester/core/test_file_mapper.pks b/test/ut3_tester/core/test_file_mapper.pks
deleted file mode 100644
index b2443766c..000000000
--- a/test/ut3_tester/core/test_file_mapper.pks
+++ /dev/null
@@ -1,13 +0,0 @@
-create or replace package test_file_mapper is
-
- --%suite(file_mapper)
- --%suitepath(utplsql.ut3_tester.core)
-
- --%test(Maps file paths into database objects using default mappings)
- procedure default_mappings;
-
- --%test(Used specified object owner to perform mapping when files have no owner indication)
- procedure specific_owner;
-
-end;
-/
diff --git a/test/ut3_tester/core/test_output_buffer.pkb b/test/ut3_tester/core/test_output_buffer.pkb
deleted file mode 100644
index de53b957a..000000000
--- a/test/ut3_tester/core/test_output_buffer.pkb
+++ /dev/null
@@ -1,370 +0,0 @@
-create or replace package body test_output_buffer is
-
- -- Writer action that waits (up to 30 seconds) until the reader removes the buffer info.
- -- It keeps the writer only as long as the test needs it, so it does not delay jobs of the following tests.
- gc_wait_for_reader_to_finish constant varchar2(4000) := q'[
- for i in 1 .. 300 loop
- select count(1) into l_info_count from ut3_develop.ut_output_buffer_info_tmp b where b.output_id = l_buffer.output_id;
- exit when l_info_count = 0;
- dbms_session.sleep(0.1);
- end loop;]';
-
- function long_text return varchar2 is
- l_txt varchar2(32767);
- begin
- for i in 1 .. 100 loop
- l_txt := l_txt||lpad('a text', 310, ',a text');
- end loop;
- return l_txt;
- end;
-
- -- Runs a_writer_actions in a separate session (scheduler job) on a buffer sharing output_id with a_reader.
- -- The writer buffer is available to the actions as l_buffer.
- procedure start_writer(a_reader ut3_develop.ut_output_buffer_base, a_writer_actions varchar2) is
- begin
- ut3_tester_helper.run_helper.run_as_job(
- 'declare
- l_buffer ut3_develop.ut_output_buffer_base := ut3_develop.'||a_reader.self_type||'(a_output_id => '''||a_reader.output_id||''');
- l_info_count integer;
- begin
- '||a_writer_actions||'
- end;'
- );
- end;
-
- procedure wait_for_writer_lock(a_reader ut3_develop.ut_output_buffer_base) is
- c_max_wait_sec constant number := 30;
- l_waited_sec number := 0;
- begin
- while a_reader.get_lock_status() = 0 and l_waited_sec < c_max_wait_sec loop
- dbms_session.sleep(0.1);
- l_waited_sec := l_waited_sec + 0.1;
- end loop;
- ut.expect(a_reader.get_lock_status(), 'Writer session holds the buffer lock').not_to_equal(0);
- end;
-
- procedure reads_lines_from_writer(a_reader ut3_develop.ut_output_buffer_base) is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange - writer stays silent for 1 second longer than reader's initial timeout
- start_writer(
- a_reader,
- q'[l_buffer.lock_buffer();
- dbms_session.sleep(1.2);
- l_buffer.send_line('line 1');
- l_buffer.send_line('line 2');
- l_buffer.close();]'
- );
- wait_for_writer_lock(a_reader);
- --Act
- open l_actual for
- select to_char(text) as text from table(a_reader.get_lines(a_initial_timeout => 0.2, a_timeout_sec => 30));
- --Assert
- open l_expected for
- select 'line 1' as text from dual union all
- select 'line 2' as text from dual;
- ut.expect(l_actual).to_equal(l_expected);
- end;
-
- procedure test_receive is
- l_actual_text clob;
- l_actual_item_type varchar2(1000);
- l_remaining integer;
- l_expected_text clob;
- l_expected_item_type varchar2(1000);
- l_buffer ut3_develop.ut_output_buffer_base;
- begin
- --Arrange
- l_buffer := ut3_develop.ut_output_clob_table_buffer();
- l_expected_text := to_clob('a text') ||long_text()
- || chr(10) || long_text()
- || chr(13) || long_text()
- || chr(13) || chr(10) || long_text() || long_text();
- l_expected_item_type := lpad('some item type',1000,'-');
- --Act
- l_buffer.lock_buffer();
- l_buffer.send_clob(l_expected_text, l_expected_item_type);
- l_buffer.close();
-
- select text, item_type
- into l_actual_text, l_actual_item_type
- from table(l_buffer.get_lines(0.1,0.1));
-
- --Assert
- ut.expect(l_actual_text).to_equal(l_expected_text);
- ut.expect(l_actual_item_type).to_equal(l_expected_item_type);
-
- select count(1) into l_remaining from table(ut3_tester_helper.run_helper.ut_output_buffer_tmp)
- where output_id = l_buffer.output_id;
-
- ut.expect(l_remaining).to_equal(0);
- end;
-
- procedure test_wait_for_producer is
- l_buffer ut3_develop.ut_output_buffer_base;
- begin
- l_buffer := ut3_develop.ut_output_clob_table_buffer();
- ut.expect( l_buffer.get_lines_cursor(0.1) ).to_be_empty();
- end;
-
- procedure test_doesnt_send_on_null_text is
- l_cur sys_refcursor;
- l_result integer;
- l_buffer ut3_develop.ut_output_buffer_base := ut3_develop.ut_output_table_buffer();
- begin
- ut3_tester_helper.run_helper.delete_buffer();
- --Act
- l_buffer.send_line(null);
-
- open l_cur for select * from table(ut3_tester_helper.run_helper.ut_output_buffer_tmp);
- ut.expect(l_cur).to_be_empty;
- end;
-
-
- procedure test_doesnt_send_on_null_elem is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_buffer ut3_develop.ut_output_buffer_base := ut3_develop.ut_output_table_buffer();
- l_message_id varchar2(255);
- l_text varchar2(4000);
- begin
- ut3_tester_helper.run_helper.delete_buffer();
- --Act
- l_buffer.send_lines(ut3_develop.ut_varchar2_rows(null));
- l_buffer.send_lines(ut3_develop.ut_varchar2_rows('test'));
-
- open l_actual for
- select text from table(ut3_tester_helper.run_helper.ut_output_buffer_tmp);
- open l_expected for
- select 'test' as text from dual;
-
- ut.expect(l_actual).to_equal(l_expected);
- end;
-
- procedure test_send_line is
- l_result varchar2(4000);
- c_expected constant varchar2(4000) := lpad('a text',4000,',a text');
- l_buffer ut3_develop.ut_output_buffer_base := ut3_develop.ut_output_table_buffer();
- begin
- l_buffer.send_line(c_expected);
-
- select text into l_result from table(ut3_tester_helper.run_helper.ut_output_buffer_tmp) where output_id = l_buffer.output_id;
-
- ut.expect(l_result).to_equal(c_expected);
- end;
-
- procedure test_waiting_for_data is
- l_result clob;
- l_remaining integer;
- l_expected clob;
- l_buffer ut3_develop.ut_output_buffer_base := ut3_develop.ut_output_table_buffer();
- l_start timestamp;
- l_duration interval day to second;
- begin
- --Arrange
- l_expected := 'a text';
- l_buffer.lock_buffer();
- l_buffer.send_line(l_expected);
- l_start := localtimestamp;
- --Act
- begin
- select text into l_result from table(l_buffer.get_lines(0,0.3));
- ut.fail('Expected a timeout exception but nothing was raised');
- exception
- when others then
- l_duration := localtimestamp - l_start;
- --Assert
- --Fetches data from output
- ut.expect(l_result).to_equal(l_expected);
- --Throws a timeout exception
- ut.expect(dbms_utility.format_error_stack()).to_match('ORA'||ut3_develop.ut_utils.gc_out_buffer_timeout);
- --Waited for one second
- ut.expect(l_duration).to_be_greater_or_equal(interval '0.3' second);
- end;
-
- select count(1) into l_remaining from table(ut3_tester_helper.run_helper.ut_output_buffer_tmp) where output_id = l_buffer.output_id;
- --Data got removed from output buffer
- ut.expect(l_remaining).to_equal(0);
-
- end;
-
- procedure test_purge(a_buffer ut3_develop.ut_output_buffer_base ) is
- l_stale_buffer ut3_develop.ut_output_buffer_base := a_buffer;
- l_fresh_buffer ut3_develop.ut_output_buffer_base;
- l_buffer ut3_develop.ut_output_buffer_base;
- begin
- --Arrange
- l_stale_buffer.start_date := sysdate - 10;
- --initialize with new start date
- l_stale_buffer.init();
- l_stale_buffer.lock_buffer();
- l_stale_buffer.send_line('some text');
- l_stale_buffer.close();
-
- l_fresh_buffer := ut3_develop.ut_output_table_buffer();
- l_fresh_buffer.lock_buffer();
- l_fresh_buffer.send_line('some text');
- l_fresh_buffer.close();
-
- --Act - purge is performed on new buffer create
- l_buffer := ut3_develop.ut_output_table_buffer();
-
- --Assert
- -- Data in "fresh" buffer remains
- ut.expect( l_fresh_buffer.get_lines_cursor(0,0), l_fresh_buffer.self_type ).to_have_count(1);
- -- Data in "stale" buffer is purged and so the call to get_lines_cursor throws ORA-20218
- ut.expect( l_stale_buffer.get_lines_cursor(0,0), l_stale_buffer.self_type ).to_be_empty();
- end;
-
- procedure test_purge_text_buffer is
- begin
- test_purge(ut3_develop.ut_output_table_buffer());
- end;
-
- procedure test_purge_clob_buffer is
- begin
- test_purge(ut3_develop.ut_output_clob_table_buffer());
- end;
-
- procedure text_buffer_send_multibyte is
- l_input varchar2(32767);
- l_max_len integer := ut3_develop.ut_utils.gc_max_storage_varchar2_len;
- l_buffer ut3_develop.ut_output_buffer_base := ut3_develop.ut_output_table_buffer();
- l_text varchar2(4000);
- begin
- --Arrange
- ut3_tester_helper.run_helper.delete_buffer();
- l_input := rpad( '❤', l_max_len, 'a' );
- ut.expect( lengthb( l_input ) ).to_be_greater_than(l_max_len);
-
- --Act
- l_buffer.send_line(l_input);
- --Assert
- select text into l_text from table(ut3_tester_helper.run_helper.ut_output_buffer_tmp);
- ut.expect(lengthb(l_text)).to_be_less_or_equal(l_max_len);
- end;
-
- procedure text_buffer_send_clob_multib is
- l_input clob;
- l_max_len integer := ut3_develop.ut_utils.gc_max_storage_varchar2_len;
- l_buffer ut3_develop.ut_output_buffer_base := ut3_develop.ut_output_table_buffer();
- l_text varchar2(4000);
- begin
- --Arrange
- ut3_tester_helper.run_helper.delete_buffer();
- l_input := rpad( '❤', l_max_len, 'a' );
- ut.expect( ut3_develop.ut_utils.lengthb_clob( l_input ) ).to_be_greater_than(l_max_len);
-
- --Act
- l_buffer.send_clob(l_input);
- --Assert
- select text into l_text from table(ut3_tester_helper.run_helper.ut_output_buffer_tmp);
- ut.expect(lengthb(l_text)).to_be_less_or_equal(l_max_len);
- end;
-
- procedure concurrent_calls_do_not_cause_exception is
- l_consumer_buffer_instance ut3_develop.ut_output_buffer_base;
- l_shared_output_id raw(32) := sys_guid();
- begin
- ut3_tester_helper.run_helper.run_as_job('declare x ut3_develop.ut_output_buffer_base; begin x := ut3_develop.ut_output_table_buffer(a_output_id => '''||l_shared_output_id||'''); end;');
- dbms_session.sleep(0.5);
- l_consumer_buffer_instance := ut3_develop.ut_output_table_buffer(a_output_id => l_shared_output_id);
- end;
-
- procedure table_buffer_reads_from_writer is
- begin
- reads_lines_from_writer(ut3_develop.ut_output_table_buffer());
- end;
-
- procedure clob_buffer_reads_from_writer is
- begin
- reads_lines_from_writer(ut3_develop.ut_output_clob_table_buffer());
- end;
-
- procedure bulk_buffer_reads_from_writer is
- begin
- reads_lines_from_writer(ut3_develop.ut_output_bulk_buffer());
- end;
-
- procedure reader_stops_when_writer_ends is
- l_buffer ut3_develop.ut_output_buffer_base := ut3_develop.ut_output_table_buffer();
- l_lines ut3_develop.ut_varchar2_rows;
- l_start timestamp;
- l_duration interval day to second;
- begin
- --Arrange - writer keeps the lock for a while after sending and its session ends without calling close()
- start_writer(
- l_buffer,
- q'[l_buffer.lock_buffer();
- l_buffer.send_line('line 1');
- dbms_session.sleep(0.5);]'
- );
- wait_for_writer_lock(l_buffer);
- l_start := localtimestamp;
- --Act
- begin
- select to_char(text) bulk collect into l_lines
- from table(l_buffer.get_lines(a_initial_timeout => 1, a_timeout_sec => 2));
- exception
- when others then
- ut.fail('Reader did not stop after writer session ended: '||sqlerrm);
- end;
- l_duration := localtimestamp - l_start;
- --Assert
- ut.expect(anydata.convertCollection(l_lines)).to_equal(anydata.convertCollection(ut3_develop.ut_varchar2_rows('line 1')));
- ut.expect(l_buffer.get_lock_status(), 'Writer lock released by session end').to_equal(0);
- ut.expect(l_duration, 'Reader waited for writer session to end').to_be_greater_or_equal(interval '0.3' second);
- end;
-
- procedure reader_times_out_on_idle_writer is
- l_buffer ut3_develop.ut_output_buffer_base := ut3_develop.ut_output_table_buffer();
- l_count integer;
- begin
- --Arrange - writer holds the lock without sending data until the reader gives up
- start_writer(
- l_buffer,
- q'[l_buffer.lock_buffer();
- l_buffer.send_line('line 1');]'
- ||gc_wait_for_reader_to_finish||q'[
- l_buffer.close();]'
- );
- wait_for_writer_lock(l_buffer);
- --Act
- begin
- select count(1) into l_count from table(l_buffer.get_lines(a_initial_timeout => 1, a_timeout_sec => 1));
- ut.fail('Expected a timeout exception but nothing was raised');
- exception
- when others then
- --Assert
- ut.expect(dbms_utility.format_error_stack()).to_match('ORA'||ut3_develop.ut_utils.gc_out_buffer_timeout);
- end;
- end;
-
- procedure second_writer_cannot_lock is
- l_buffer ut3_develop.ut_output_buffer_base := ut3_develop.ut_output_table_buffer();
- begin
- --Arrange - writer holds the lock until the test is done
- start_writer(
- l_buffer,
- q'[l_buffer.lock_buffer();]'
- ||gc_wait_for_reader_to_finish||q'[
- l_buffer.close();]'
- );
- wait_for_writer_lock(l_buffer);
- --Act
- begin
- l_buffer.lock_buffer();
- l_buffer.close();
- ut.fail('Expected lock_buffer to fail but it succeeded');
- exception
- when others then
- --Assert
- ut.expect(sqlerrm).to_be_like('%Cannot allocate lock for output buffer of reporter%');
- end;
- --Cleanup - let the writer finish
- l_buffer.remove_buffer_info();
- end;
-
-end test_output_buffer;
-/
diff --git a/test/ut3_tester/core/test_output_buffer.pks b/test/ut3_tester/core/test_output_buffer.pks
deleted file mode 100644
index 1b5a04762..000000000
--- a/test/ut3_tester/core/test_output_buffer.pks
+++ /dev/null
@@ -1,71 +0,0 @@
-create or replace package test_output_buffer is
-
- --%suite(output_buffer)
- --%suitepath(utplsql.ut3_tester.core)
-
-
- --%context(Buffer is read in a different session than buffer write)
-
- --%test(Text buffer reader waits beyond initial timeout for writer holding the lock and reads all lines)
- procedure table_buffer_reads_from_writer;
-
- --%test(Clob buffer reader waits beyond initial timeout for writer holding the lock and reads all lines)
- procedure clob_buffer_reads_from_writer;
-
- --%test(Bulk buffer reader waits beyond initial timeout for writer holding the lock and reads all lines)
- procedure bulk_buffer_reads_from_writer;
-
- --%test(Reader stops when writer session ends without closing the buffer)
- procedure reader_stops_when_writer_ends;
-
- --%test(Reader times out when writer holds the lock and sends no data)
- procedure reader_times_out_on_idle_writer;
-
- --%test(Writer cannot lock buffer that is locked by another session)
- procedure second_writer_cannot_lock;
-
- --%endcontext
-
- --%context(Read and write within the same session)
-
-
- --%test(Receives a line from buffer table and deletes)
- procedure test_receive;
-
- --%test(Waits specified time for producer to lock the buffer )
- --%throws(-20218)
- procedure test_wait_for_producer;
-
- --%test(Does not send line if null text given)
- procedure test_doesnt_send_on_null_text;
-
- --%test(Does not send line if null text given for multiline case)
- procedure test_doesnt_send_on_null_elem;
-
- --%test(Sends a line into buffer table)
- procedure test_send_line;
-
- --%test(Waits For The Data To Appear For Specified Time)
- procedure test_waiting_for_data;
-
- --%test(Purges text buffer data older than one day and leaves the rest)
- procedure test_purge_text_buffer;
-
- --%test(Purges clob buffer data older than one day and leaves the rest)
- procedure test_purge_clob_buffer;
-
- --%test(Successfully sends multibyte long line into text buffer)
- procedure text_buffer_send_multibyte;
-
- --%test(Successfully sends multibyte long clob line into text buffer)
- procedure text_buffer_send_clob_multib;
-
- --%beforetest(ut3_tester_helper.run_helper.slow_down_insert_into_table_buffer)
- --%aftertest(ut3_tester_helper.run_helper.cleanup_slow_down_insert_into_table_buffer)
- --%test(concurrent calls to init() procedure do not cause errors - Issue #985)
- procedure concurrent_calls_do_not_cause_exception;
-
- --%endcontext
-
-end test_output_buffer;
-/
diff --git a/test/ut3_tester/core/test_suite_builder.pkb b/test/ut3_tester/core/test_suite_builder.pkb
deleted file mode 100644
index 15aac2d01..000000000
--- a/test/ut3_tester/core/test_suite_builder.pkb
+++ /dev/null
@@ -1,1972 +0,0 @@
-create or replace package body test_suite_builder is
-
- function invoke_builder_for_annotations(
- a_annotations ut3_develop.ut_annotations,
- a_package_name varchar2 := 'TEST_SUITE_BUILDER_PACKAGE'
- ) return clob is
- l_suites ut3_develop.ut_suite_items;
- l_suite ut3_develop.ut_logical_suite;
- l_cursor sys_refcursor;
- l_type_cursor sys_refcursor;
- l_ctx dbms_xmlgen.ctxhandle;
- l_xml xmltype;
- begin
- open l_cursor for select value(x) from table(
- ut3_develop.ut_annotated_objects(
- ut3_develop.ut_annotated_object('UT3_TESTER', a_package_name, 'PACKAGE', systimestamp, a_annotations)
- ) ) x;
-
- l_suites := ut3_develop.ut_suite_manager.build_suites_from_annotations(
- a_owner_name => 'UT3_TESTER',
- a_annotated_objects => l_cursor,
- a_path => null,
- a_object_name => a_package_name
- );
- l_suite := treat( l_suites(l_suites.first) as ut3_develop.ut_logical_suite);
-
- open l_type_cursor for select l_suite as "UT_LOGICAL_SUITE" from dual;
- l_ctx := dbms_xmlgen.newcontext(l_type_cursor);
- dbms_xmlgen.setNullHandling(l_ctx, dbms_xmlgen.empty_tag);
- l_xml := dbms_xmlgen.getxmltype(l_ctx);
-
- select deletexml(
- l_xml,
- '//RESULTS_COUNT|//START_TIME|//END_TIME|//RESULT|//ASSOCIATED_EVENT_NAME' ||
- '|//TRANSACTION_INVALIDATORS|//ERROR_BACKTRACE|//ERROR_STACK|//SERVEROUTPUT'
- )
- into l_xml
- from dual;
-
- return l_xml.getClobVal();
- end;
-
- procedure no_suite_description is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite',null, null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_match(
- 'UT3_TESTERsome_packagesome_package()?\s*some_package'
- );
- end;
-
- procedure suite_description_from_suite is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Some description', null),
- ut3_develop.ut_annotation(2, 'suite','Another description', null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%some_packageSome description%'
- );
- end;
-
- procedure suitepath_from_non_empty_path is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite',null, null),
- ut3_develop.ut_annotation(2, 'suitepath','org.utplsql.some', null),
- ut3_develop.ut_annotation(3, 'suitepath','dummy.utplsql.some', null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%org.utplsql.some%'
- );
- end;
-
- procedure suite_descr_from_displayname is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Some description', null),
- ut3_develop.ut_annotation(2, 'suite','Another description', null),
- ut3_develop.ut_annotation(3, 'displayname','New description', null),
- ut3_develop.ut_annotation(4, 'displayname','Newest description', null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%some_packageNew description%'
- );
- end;
-
- procedure rollback_type_valid is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite',null, null),
- ut3_develop.ut_annotation(2, 'rollback','manual', null),
- ut3_develop.ut_annotation(3, 'rollback','bad', null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%'||ut3_develop.ut_utils.gc_rollback_manual||'%'
- );
- end;
-
- procedure rollback_type_duplicated is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite',null, null),
- ut3_develop.ut_annotation(2, 'rollback','manual', null),
- ut3_develop.ut_annotation(3, 'rollback','bad', null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%%"--%rollback"%%UT3_TESTER.SOME_PACKAGE%3%%'
- );
- end;
-
- procedure suite_annot_duplicated is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','Cool', null),
- ut3_develop.ut_annotation(8, 'suite','bad', null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%Cool%%"--%suite"%UT3_TESTER.SOME_PACKAGE%line 8%%'
- );
- end;
-
- procedure test_annotation is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','Cool', null),
- ut3_develop.ut_annotation(8, 'test','Some test', 'test_procedure')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%' ||
- '%test_procedureSome testsome_package.test_procedure' ||
- '%%'
- );
- end;
-
- procedure test_annot_duplicated is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','Cool', null),
- ut3_develop.ut_annotation(8, 'test','Some test', 'test_procedure'),
- ut3_develop.ut_annotation(9, 'test','Dup', 'test_procedure')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%Cool%%"--%test"%UT3_TESTER.SOME_PACKAGE.TEST_PROCEDURE%line 9%%'
- );
- end;
-
- procedure beforeall_annot_duplicated is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','Cool', null),
- ut3_develop.ut_annotation(8, 'beforeall', null, 'test_procedure'),
- ut3_develop.ut_annotation(9, 'beforeall', null, 'test_procedure')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%Cool%%"--%beforeall"%UT3_TESTER.SOME_PACKAGE.TEST_PROCEDURE%line 9%%'
- );
- end;
-
- procedure beforeeach_annot_duplicated is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','Cool', null),
- ut3_develop.ut_annotation(8, 'beforeeach', null, 'test_procedure'),
- ut3_develop.ut_annotation(9, 'beforeeach', null, 'test_procedure')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%Cool%%"--%beforeeach"%UT3_TESTER.SOME_PACKAGE.TEST_PROCEDURE%line 9%%'
- );
- end;
-
- procedure afterall_annot_duplicated is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','Cool', null),
- ut3_develop.ut_annotation(8, 'afterall', null, 'test_procedure'),
- ut3_develop.ut_annotation(9, 'afterall', null, 'test_procedure')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%Cool%%"--%afterall"%UT3_TESTER.SOME_PACKAGE.TEST_PROCEDURE%line 9%%'
- );
- end;
-
- procedure aftereach_annot_duplicated is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','Cool', null),
- ut3_develop.ut_annotation(8, 'aftereach', null, 'test_procedure'),
- ut3_develop.ut_annotation(9, 'aftereach', null, 'test_procedure')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%Cool%%"--%aftereach"%UT3_TESTER.SOME_PACKAGE.TEST_PROCEDURE%line 9%%'
- );
- end;
-
- procedure suitepath_annot_duplicated is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','Cool', null),
- ut3_develop.ut_annotation(3, 'suitepath','dummy.utplsql.some', null),
- ut3_develop.ut_annotation(4, 'suitepath','org.utplsql.some', null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%%"--%suitepath"%line 4%%'
- );
- end;
-
- procedure displayname_annot_duplicated is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','Cool', null),
- ut3_develop.ut_annotation(4, 'displayname','New description', null),
- ut3_develop.ut_annotation(5, 'displayname','Newest description', null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%%"--%displayname"%line 5%%'
- );
- end;
-
- procedure suitepath_annot_empty is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(3, 'suitepath',null, null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%%"--%suitepath" annotation requires a non-empty parameter value.%%'
- );
- end;
-
- procedure suitepath_annot_invalid_path is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(2, 'suitepath','path with spaces', null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%%Invalid path value in annotation "--%suitepath(path with spaces)"%%'
- );
- end;
-
- procedure displayname_annot_empty is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(3, 'displayname',null, null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%%"--%displayname" annotation requires a non-empty parameter value.%%'
- );
- end;
-
- procedure rollback_type_empty is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(3, 'rollback',null, null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%%"--%rollback" annotation requires one of values as parameter:%%'
- );
- end;
-
- procedure rollback_type_invalid is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(2, 'rollback','bad', null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%%"--%rollback" annotation requires one of values as parameter: "auto" or "manual". Annotation ignored.%%'
- );
- end;
-
- procedure multiple_before_after is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(2, 'beforeall',null, 'first_before_all'),
- ut3_develop.ut_annotation(3, 'beforeall',null, 'another_before_all'),
- ut3_develop.ut_annotation(4, 'beforeeach',null, 'first_before_each'),
- ut3_develop.ut_annotation(5, 'beforeeach',null, 'another_before_each'),
- ut3_develop.ut_annotation(6, 'aftereach',null, 'first_after_each'),
- ut3_develop.ut_annotation(7, 'aftereach',null, 'another_after_each'),
- ut3_develop.ut_annotation(8, 'afterall',null, 'first_after_all'),
- ut3_develop.ut_annotation(9, 'afterall',null, 'another_after_all'),
- ut3_develop.ut_annotation(14, 'test','A test', 'some_test'),
- ut3_develop.ut_annotation(15, 'beforetest','before_test_proc', 'some_test'),
- ut3_develop.ut_annotation(16, 'beforetest','before_test_proc2', 'some_test'),
- ut3_develop.ut_annotation(18, 'aftertest','after_test_proc', 'some_test'),
- ut3_develop.ut_annotation(20, 'aftertest','after_test_proc2', 'some_test')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%%some_package%some_test' ||
- '%' ||
- '%some_packagefirst_before_each' ||
- '%some_packageanother_before_each' ||
- '%' ||
- '%' ||
- '%some_packagebefore_test_proc' ||
- '%some_packagebefore_test_proc2' ||
- '%' ||
- '%' ||
- '%some_packageafter_test_proc' ||
- '%some_packageafter_test_proc2' ||
- '%' ||
- '%' ||
- '%some_packagefirst_after_each' ||
- '%some_packageanother_after_each' ||
- '%' ||
- '%' ||
- '%' ||
- '%some_packagefirst_before_all' ||
- '%some_packageanother_before_all' ||
- '%' ||
- '%' ||
- '%some_packagefirst_after_all' ||
- '%some_packageanother_after_all' ||
- '%%'
- );
- end;
-
- procedure multiple_standalone_bef_aft is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(2, 'beforeall', 'some_package.first_before_all',null),
- ut3_develop.ut_annotation(3, 'beforeall', 'different_package.another_before_all',null),
- ut3_develop.ut_annotation(4, 'beforeeach', 'first_before_each',null),
- ut3_develop.ut_annotation(5, 'beforeeach', 'different_owner.different_package.another_before_each',null),
- ut3_develop.ut_annotation(6, 'aftereach', 'first_after_each',null),
- ut3_develop.ut_annotation(7, 'aftereach', 'another_after_each,different_owner.different_package.one_more_after_each',null),
- ut3_develop.ut_annotation(8, 'afterall', 'first_after_all',null),
- ut3_develop.ut_annotation(9, 'afterall', 'another_after_all',null),
- ut3_develop.ut_annotation(14, 'test','A test', 'some_test'),
- ut3_develop.ut_annotation(15, 'beforetest','before_test_proc', 'some_test'),
- ut3_develop.ut_annotation(16, 'beforetest','before_test_proc2', 'some_test'),
- ut3_develop.ut_annotation(18, 'aftertest','after_test_proc', 'some_test'),
- ut3_develop.ut_annotation(20, 'aftertest','after_test_proc2', 'some_test')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%%some_package%some_test' ||
- '%' ||
- '%some_packagefirst_before_each' ||
- '%different_ownerdifferent_packageanother_before_each' ||
- '%' ||
- '%' ||
- '%some_packagebefore_test_proc' ||
- '%some_packagebefore_test_proc2' ||
- '%' ||
- '%' ||
- '%some_packageafter_test_proc' ||
- '%some_packageafter_test_proc2' ||
- '%' ||
- '%' ||
- '%some_packagefirst_after_each' ||
- '%some_packageanother_after_each' ||
- '%different_ownerdifferent_packageone_more_after_each' ||
- '%' ||
- '%' ||
- '%' ||
- '%some_packagefirst_before_all' ||
- '%different_packageanother_before_all' ||
- '%' ||
- '%' ||
- '%some_packagefirst_after_all' ||
- '%some_packageanother_after_all' ||
- '%%'
- );
- end;
-
- procedure before_after_on_single_proc is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(2, 'beforeall',null, 'do_stuff'),
- ut3_develop.ut_annotation(3, 'beforeeach',null, 'do_stuff'),
- ut3_develop.ut_annotation(4, 'aftereach',null, 'do_stuff'),
- ut3_develop.ut_annotation(5, 'afterall',null, 'do_stuff'),
- ut3_develop.ut_annotation(6, 'test','A test', 'some_test')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%%some_package%some_test' ||
- '%' ||
- '%some_packagedo_stuff' ||
- '%' ||
- '%' ||
- '%some_packagedo_stuff' ||
- '%' ||
- '%' ||
- '%' ||
- '%some_packagedo_stuff' ||
- '%' ||
- '%' ||
- '%some_packagedo_stuff' ||
- '%%'
- );
- end;
-
- procedure multiple_mixed_bef_aft is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(2, 'beforeall', null,'first_before_all'),
- ut3_develop.ut_annotation(3, 'beforeall', 'different_package.another_before_all',null),
- ut3_develop.ut_annotation(4, 'beforeeach', 'first_before_each',null),
- ut3_develop.ut_annotation(5, 'beforeeach', 'different_owner.different_package.another_before_each',null),
- ut3_develop.ut_annotation(6, 'aftereach', null, 'first_after_each'),
- ut3_develop.ut_annotation(7, 'aftereach', 'another_after_each,different_owner.different_package.one_more_after_each',null),
- ut3_develop.ut_annotation(8, 'afterall', 'first_after_all',null),
- ut3_develop.ut_annotation(9, 'afterall', 'another_after_all',null),
- ut3_develop.ut_annotation(14, 'test','A test', 'some_test'),
- ut3_develop.ut_annotation(15, 'beforetest','before_test_proc', 'some_test'),
- ut3_develop.ut_annotation(16, 'beforetest','before_test_proc2', 'some_test'),
- ut3_develop.ut_annotation(18, 'aftertest','after_test_proc', 'some_test'),
- ut3_develop.ut_annotation(20, 'aftertest','after_test_proc2', 'some_test'),
- ut3_develop.ut_annotation(21, 'beforeall', null,'last_before_all'),
- ut3_develop.ut_annotation(22, 'aftereach', null, 'last_after_each'),
- ut3_develop.ut_annotation(23, 'afterall', null, 'last_after_all')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%%some_package%some_test' ||
- '%' ||
- '%some_packagefirst_before_each' ||
- '%different_ownerdifferent_packageanother_before_each' ||
- '%' ||
- '%' ||
- '%some_packagebefore_test_proc' ||
- '%some_packagebefore_test_proc2' ||
- '%' ||
- '%' ||
- '%some_packageafter_test_proc' ||
- '%some_packageafter_test_proc2' ||
- '%' ||
- '%' ||
- '%some_packagefirst_after_each' ||
- '%some_packageanother_after_each' ||
- '%different_ownerdifferent_packageone_more_after_each' ||
- '%some_packagelast_after_each' ||
- '%' ||
- '%' ||
- '%' ||
- '%some_packagefirst_before_all' ||
- '%different_packageanother_before_all' ||
- '%some_packagelast_before_all' ||
- '%' ||
- '%' ||
- '%some_packagefirst_after_all' ||
- '%some_packageanother_after_all' ||
- '%some_packagelast_after_all' ||
- '%%'
- );
- end;
-
-
- procedure before_after_mixed_with_test is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(2, 'beforeall',null, 'do_stuff'),
- ut3_develop.ut_annotation(3, 'beforeeach',null, 'do_stuff'),
- ut3_develop.ut_annotation(4, 'aftereach',null, 'do_stuff'),
- ut3_develop.ut_annotation(5, 'afterall',null, 'do_stuff'),
- ut3_develop.ut_annotation(6, 'test','A test', 'do_stuff')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_match('(.*)()(.*)(Annotation "--%beforeall")(.*)(line 2)(.*)()(.*)', 'n');
- ut.expect(l_actual).to_match('(.*)()(.*)(Annotation "--%beforeeach")(.*)(line 3)(.*)()(.*)', 'n');
- ut.expect(l_actual).to_match('(.*)()(.*)(Annotation "--%aftereach")(.*)(line 4)(.*)()(.*)', 'n');
- ut.expect(l_actual).to_match('(.*)()(.*)(Annotation "--%afterall" cannot be used with "--%test". Annotation ignored.)'
- ||'(.*)(at package "UT3_TESTER.SOME_PACKAGE.DO_STUFF", line 5)(.*)()(.*)', 'n');
- ut.expect(l_actual).not_to_be_like('%%');
- ut.expect(l_actual).not_to_be_like('%%');
- ut.expect(l_actual).not_to_be_like('%%');
- ut.expect(l_actual).not_to_be_like('%%');
- end;
-
- procedure suite_from_context is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(2, 'beforeall',null, 'suite_level_beforeall'),
- ut3_develop.ut_annotation(3, 'test','In suite', 'suite_level_test'),
- ut3_develop.ut_annotation(4, 'context','A context', null),
- ut3_develop.ut_annotation(5, 'name','a_context', null),
- ut3_develop.ut_annotation(6, 'beforeall',null, 'context_setup'),
- ut3_develop.ut_annotation(7, 'test', 'In context', 'test_in_a_context'),
- ut3_develop.ut_annotation(8, 'endcontext',null, null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- ''||
- '' ||
- '%' ||
- '%' ||
- '' ||
- '%suite_level_testIn suitesome_package.suite_level_test' ||
- '%' ||
- '' ||
- '%a_contextA contextsome_package.a_context' ||
- '%' ||
- '' ||
- '%test_in_a_contextIn contextsome_package.a_context.test_in_a_context' ||
- '%' ||
- '' ||
- '' ||
- '%some_packagecontext_setup' ||
- '%' ||
- '' ||
- '' ||
- '' ||
- '' ||
- '%some_packagesuite_level_beforeall' ||
- '%' ||
- '' ||
- ''||
- ''
- );
- end;
-
- procedure nested_contexts is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation( 1, 'suite','Cool', null),
- ut3_develop.ut_annotation( 2, 'beforeall',null, 'suite_level_beforeall'),
- ut3_develop.ut_annotation( 3, 'test','In suite', 'suite_level_test'),
- ut3_develop.ut_annotation( 4, 'context','A context', null),
- ut3_develop.ut_annotation( 5, 'name','a_context', null),
- ut3_develop.ut_annotation( 6, 'beforeall',null, 'context_setup'),
- ut3_develop.ut_annotation( 7, 'test', 'First test in context', 'first_test_in_a_context'),
- ut3_develop.ut_annotation( 8, 'context','A nested context', null),
- ut3_develop.ut_annotation( 9, 'name','a_nested_context', null),
- ut3_develop.ut_annotation(10, 'beforeall',null, 'nested_context_setup'),
- ut3_develop.ut_annotation(11, 'test', 'Test in nested context', 'test_in_nested_context'),
- ut3_develop.ut_annotation(12, 'endcontext',null, null),
- ut3_develop.ut_annotation(13, 'context',null, null),
- ut3_develop.ut_annotation(14, 'name','nested_context_2', null),
- ut3_develop.ut_annotation(15, 'test', 'Test in nested context', 'test_in_nested_context_2'),
- ut3_develop.ut_annotation(16, 'context','a_nested_context_3', null),
- ut3_develop.ut_annotation(17, 'test', 'Test in nested context', 'test_in_nested_context_3'),
- ut3_develop.ut_annotation(18, 'endcontext',null, null),
- ut3_develop.ut_annotation(19, 'endcontext',null, null),
- ut3_develop.ut_annotation(20, 'test', 'Second test in context', 'second_test_in_a_context'),
- ut3_develop.ut_annotation(21, 'endcontext',null, null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- ''||
- '' ||
- '%' ||
- '%' ||
- '' ||
- '%suite_level_testIn suitesome_package.suite_level_test' ||
- '%' ||
- '' ||
- '%a_contextA contextsome_package.a_context' ||
- '%' ||
- '' ||
- '%first_test_in_a_contextFirst test in contextsome_package.a_context.first_test_in_a_context' ||
- '%' ||
- '' ||
- '%a_nested_contextA nested contextsome_package.a_context.a_nested_context' ||
- '%' ||
- '' ||
- '%test_in_nested_contextTest in nested contextsome_package.a_context.a_nested_context.test_in_nested_context' ||
- '%' ||
- '' ||
- '' ||
- '%some_packagenested_context_setup' ||
- '%' ||
- '%' ||
- '' ||
- '%nested_context_2nested_context_2some_package.a_context.nested_context_2' ||
- '%' ||
- '' ||
- '%test_in_nested_context_2Test in nested contextsome_package.a_context.nested_context_2.test_in_nested_context_2' ||
- '%' ||
- '' ||
- '%nested_context_#1a_nested_context_3some_package.a_context.nested_context_2.nested_context_#1' ||
- '%' ||
- '' ||
- '%test_in_nested_context_3Test in nested contextsome_package.a_context.nested_context_2.nested_context_#1.test_in_nested_context_3' ||
- '%' ||
- '' ||
- '' ||
- '%' ||
- '' ||
- '' ||
- '%' ||
- '' ||
- '%second_test_in_a_contextSecond test in contextsome_package.a_context.second_test_in_a_context' ||
- '%' ||
- '' ||
- '' ||
- '%some_packagecontext_setup' ||
- '%' ||
- '' ||
- '' ||
- '' ||
- '' ||
- '%some_packagesuite_level_beforeall' ||
- '%' ||
- '' ||
- ''||
- ''
- );
- end;
-
- procedure nested_contexts_2 is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation( 1, 'suite','Cool', null),
- ut3_develop.ut_annotation( 2, 'suitepath','path', null),
- ut3_develop.ut_annotation( 3, 'context','Level 1', null),
- ut3_develop.ut_annotation( 4, 'name','context_1', null),
- ut3_develop.ut_annotation( 5, 'context','Level 1.1', null),
- ut3_develop.ut_annotation( 6, 'name','context_1_1', null),
- ut3_develop.ut_annotation( 7, 'test', 'Test 1.1.1', 'test_1_1_1'),
- ut3_develop.ut_annotation( 8, 'test', 'Test 1.1.2', 'test_1_1_2'),
- ut3_develop.ut_annotation( 9, 'endcontext', null, null),
- ut3_develop.ut_annotation(10, 'endcontext', null, null),
- ut3_develop.ut_annotation(11, 'context','Level 2', null),
- ut3_develop.ut_annotation(12, 'name','context_2', null),
- ut3_develop.ut_annotation(13, 'test', 'Test 2.1', 'test_2_1'),
- ut3_develop.ut_annotation(14, 'endcontext',null, null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- ''||
- '' ||
- '%%' ||
- '' ||
- '%context_1Level 1path.some_package.context_1' ||
- '%' ||
- '' ||
- '%context_1_1Level 1.1path.some_package.context_1.context_1_1' ||
- '%' ||
- '' ||
- '%test_1_1_1Test 1.1.1path.some_package.context_1.context_1_1.test_1_1_1' ||
- '%' ||
- '' ||
- '%test_1_1_2Test 1.1.2path.some_package.context_1.context_1_1.test_1_1_2' ||
- '%' ||
- '' ||
- '%' ||
- '%' ||
- '' ||
- '%' ||
- '%' ||
- '%'||
- ''
- );
- -- Test both contexts separately due to ordering
- ut.expect(l_actual).to_be_like(
- ''||
- '' ||
- '%%' ||
- '' ||
- '%context_2Level 2path.some_package.context_2' ||
- '%' ||
- '' ||
- '%test_2_1Test 2.1path.some_package.context_2.test_2_1' ||
- '%' ||
- '%' ||
- '%' ||
- '%' ||
- '%'||
- ''
- );
- end;
-
-
- procedure before_after_in_context is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite', 'Cool', null),
- ut3_develop.ut_annotation(2, 'test', 'In suite', 'suite_level_test'),
- ut3_develop.ut_annotation(3, 'context', 'A context', null),
- ut3_develop.ut_annotation(4, 'beforeall', 'context_beforeall', null),
- ut3_develop.ut_annotation(5, 'beforeeach', null, 'context_beforeeach'),
- ut3_develop.ut_annotation(6, 'test', 'In context', 'test_in_a_context'),
- ut3_develop.ut_annotation(7, 'aftereach', 'context_aftereach' ,null),
- ut3_develop.ut_annotation(8, 'afterall', null, 'context_afterall'),
- ut3_develop.ut_annotation(9, 'endcontext', null, null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- ''||
- '' ||
- '%' ||
- '%' ||
- '%suite_level_test' ||
- '%%suite_level_test%' ||
- '%' ||
- '%' ||
- '%nested_context_#1A contextsome_package.nested_context_#1' ||
- '%' ||
- '%' ||
- '%test_in_a_context' ||
- '%%context_beforeeach%' ||
- '%%test_in_a_context%' ||
- '%%context_aftereach%' ||
- '%' ||
- '%' ||
- '%%context_beforeall%' ||
- '%%context_afterall%' ||
- '%' ||
- '%' ||
- '%'||
- ''
- );
- ut.expect(l_actual).not_to_be_like('%%%%%%');
- ut.expect(l_actual).not_to_be_like('%%%%%%');
- ut.expect(l_actual).not_to_be_like('%%%%%%');
- ut.expect(l_actual).not_to_be_like('%%%%%%');
- end;
-
- procedure before_after_out_of_context is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(2, 'beforeall',null, 'suite_level_beforeall'),
- ut3_develop.ut_annotation(3, 'beforeeach',null, 'suite_level_beforeeach'),
- ut3_develop.ut_annotation(4, 'test','In suite', 'suite_level_test'),
- ut3_develop.ut_annotation(5, 'context',null, null),
- ut3_develop.ut_annotation(6, 'test', 'In context', 'test_in_a_context'),
- ut3_develop.ut_annotation(7, 'endcontext',null, null),
- ut3_develop.ut_annotation(8, 'aftereach',null, 'suite_level_aftereach'),
- ut3_develop.ut_annotation(9, 'afterall',null, 'suite_level_afterall')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- ''||
- '' ||
- '%' ||
- '%' ||
- '%suite_level_test' ||
- '%%suite_level_beforeeach%' ||
- '%%suite_level_test%' ||
- '%%suite_level_aftereach%' ||
- '%' ||
- '%' ||
- '%nested_context_#1nested_context_#1some_package.nested_context_#1' ||
- '%' ||
- '%' ||
- '%test_in_a_context' ||
- '%%suite_level_beforeeach%' ||
- '%%test_in_a_context%' ||
- '%%suite_level_aftereach%' ||
- '%' ||
- '%' ||
- '%' ||
- '%' ||
- '%%suite_level_beforeall%' ||
- '%%suite_level_afterall%' ||
- '%'||
- ''
- );
- ut.expect(l_actual).not_to_be_like('%%%%%%');
- ut.expect(l_actual).not_to_be_like('%%%%%%');
- end;
-
- procedure context_without_endcontext is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(2, 'beforeall',null, 'suite_level_beforeall'),
- ut3_develop.ut_annotation(3, 'test','In suite', 'suite_level_test'),
- ut3_develop.ut_annotation(4, 'context','Some context', null),
- ut3_develop.ut_annotation(5, 'name','a_context', null),
- ut3_develop.ut_annotation(6, 'beforeall',null, 'context_setup'),
- ut3_develop.ut_annotation(7, 'test', 'In context', 'test_in_a_context')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%Missing "--\%endcontext" annotation for a "--\%context" annotation. The end of package is considered end of context.%at package "UT3_TESTER.SOME_PACKAGE", line 4%'
- ,'\'
- );
- ut.expect(l_actual).to_be_like(
- ''||
- '' ||
- '%' ||
- '%' ||
- '%suite_level_testIn suitesome_package.suite_level_test' ||
- '%' ||
- '%' ||
- '%a_contextSome contextsome_package.a_context' ||
- '%' ||
- '' ||
- '%test_in_a_contextIn contextsome_package.a_context.test_in_a_context' ||
- '%' ||
- '' ||
- '' ||
- '%some_packagecontext_setup' ||
- '%' ||
- '%' ||
- '' ||
- '' ||
- '%some_packagesuite_level_beforeall' ||
- '%' ||
- '' ||
- ''||
- ''
- );
- end;
-
- procedure endcontext_without_context is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(2, 'beforeall',null, 'suite_level_beforeall'),
- ut3_develop.ut_annotation(3, 'test','In suite', 'suite_level_test'),
- ut3_develop.ut_annotation(4, 'context','A context', null),
- ut3_develop.ut_annotation(5, 'name','a_context', null),
- ut3_develop.ut_annotation(6, 'beforeall',null, 'context_setup'),
- ut3_develop.ut_annotation(7, 'test', 'In context', 'test_in_a_context'),
- ut3_develop.ut_annotation(8, 'endcontext',null, null),
- ut3_develop.ut_annotation(9, 'endcontext',null, null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%Extra "--\%endcontext" annotation found. Cannot find corresponding "--\%context". Annotation ignored.%at package "UT3_TESTER.SOME_PACKAGE", line 9%'
- ,'\'
- );
- ut.expect(l_actual).to_be_like(
- ''||
- '' ||
- '%' ||
- '' ||
- '%suite_level_testIn suitesome_package.suite_level_test' ||
- '%' ||
- '' ||
- '%a_contextA contextsome_package.a_context' ||
- '%' ||
- '' ||
- '%test_in_a_contextIn contextsome_package.a_context.test_in_a_context' ||
- '%' ||
- '' ||
- '' ||
- '%some_packagecontext_setup' ||
- '%' ||
- '' ||
- '' ||
- '' ||
- '' ||
- '%some_packagesuite_level_beforeall' ||
- '%' ||
- '' ||
- ''||
- ''
- );
- end;
-
- procedure duplicate_context_name is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(2, 'beforeall',null, 'suite_level_beforeall'),
- ut3_develop.ut_annotation(3, 'test','In suite', 'suite_level_test'),
- ut3_develop.ut_annotation(4, 'context','A context', null),
- ut3_develop.ut_annotation(5, 'name','a_context', null),
- ut3_develop.ut_annotation(6, 'beforeall',null, 'context_setup'),
- ut3_develop.ut_annotation(7, 'test', 'In context', 'test_in_a_context'),
- ut3_develop.ut_annotation(8, 'endcontext',null, null),
- ut3_develop.ut_annotation(9, 'context','A context', null),
- ut3_develop.ut_annotation(10, 'name','a_context', null),
- ut3_develop.ut_annotation(11, 'beforeall',null, 'setup_in_duplicated_context'),
- ut3_develop.ut_annotation(12, 'test', 'In duplicated context', 'test_in_duplicated_context'),
- ut3_develop.ut_annotation(13, 'endcontext',null, null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%Context name "a_context" already used in this scope. Name must be unique. Using fallback name nested_context_#2.%%'
- ,'\'
- );
- ut.expect(l_actual).to_be_like(
- ''||
- '' ||
- '%' ||
- '' ||
- '%suite_level_testIn suitesome_package.suite_level_test' ||
- '%' ||
- '' ||
- '%a_contextA contextsome_package.a_context' ||
- '%' ||
- '' ||
- '%test_in_a_contextIn contextsome_package.a_context.test_in_a_context' ||
- '%' ||
- '' ||
- '' ||
- '%some_packagecontext_setup' ||
- '%' ||
- '' ||
- '' ||
- '' ||
- '%nested_context_#2A contextsome_package.nested_context_#2' ||
- '%' ||
- '' ||
- '%test_in_duplicated_contextIn duplicated contextsome_package.nested_context_#2.test_in_duplicated_context' ||
- '%' ||
- '' ||
- '' ||
- '%some_packagesetup_in_duplicated_context' ||
- '%' ||
- '' ||
- '' ||
- '' ||
- '' ||
- '%some_packagesuite_level_beforeall' ||
- '%' ||
- '' ||
- ''||
- ''
- );
- end;
-
- procedure hard_stop_in_ctx_name is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- l_bad_name varchar2(100);
- begin
- --Arrange
- l_bad_name := 'ctx_with_dot.in_it';
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(4, 'context',null, null),
- ut3_develop.ut_annotation(5, 'name',l_bad_name, null),
- ut3_develop.ut_annotation(7, 'test', 'In context', 'test_in_a_context'),
- ut3_develop.ut_annotation(13, 'endcontext',null, null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%Invalid value "'||l_bad_name||'" for context name. Context name ignored and fallback to auto-name "nested_context_#1"%'
- );
- ut.expect(l_actual).to_be_like(
- ''||
- '' ||
- '%' ||
- '' ||
- '%nested_context_#1nested_context_#1some_package.nested_context_#1' ||
- '%' ||
- '' ||
- '%test_in_a_contextIn contextsome_package.nested_context_#1.test_in_a_context' ||
- '%' ||
- '%' ||
- '%' ||
- '%' ||
- ''||
- ''
- );
- end;
-
- procedure name_with_spaces_invalid is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- l_bad_name varchar2(100);
- begin
- --Arrange
- l_bad_name := 'context name with spaces';
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(4, 'context',null, null),
- ut3_develop.ut_annotation(5, 'name',l_bad_name, null),
- ut3_develop.ut_annotation(7, 'test', 'In context', 'test_in_a_context'),
- ut3_develop.ut_annotation(13, 'endcontext',null, null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%Invalid value "'||l_bad_name||'" for context name. Context name ignored and fallback to auto-name "nested_context_#1"%'
- );
- ut.expect(l_actual).to_be_like(
- ''||
- '' ||
- '%' ||
- '' ||
- '%nested_context_#1nested_context_#1some_package.nested_context_#1' ||
- '%' ||
- '' ||
- '%test_in_a_contextIn contextsome_package.nested_context_#1.test_in_a_context' ||
- '%' ||
- '%' ||
- '%' ||
- '%' ||
- ''||
- ''
- );
- end;
-
- procedure duplicate_name_annotation is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(4, 'context','A context', null),
- ut3_develop.ut_annotation(5, 'name','a_context_name', null),
- ut3_develop.ut_annotation(6, 'name','a_newer_context_name', null),
- ut3_develop.ut_annotation(7, 'test', 'In context', 'test_in_a_context'),
- ut3_develop.ut_annotation(8, 'endcontext',null, null),
- ut3_develop.ut_annotation(12, 'test', 'In suite', 'suite_level_test')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%Duplicate annotation "--%name". Annotation ignored.%%'
- ,'\'
- );
- ut.expect(l_actual).to_be_like(
- ''||
- '' ||
- '%' ||
- '' ||
- '%a_context_nameA contextsome_package.a_context_name' ||
- '%' ||
- '' ||
- '%test_in_a_contextIn contextsome_package.a_context_name.test_in_a_context' ||
- '%' ||
- '' ||
- '' ||
- '' ||
- '' ||
- '' ||
- '%suite_level_testIn suitesome_package.suite_level_test' ||
- '%' ||
- '' ||
- '' ||
- '' ||
- ''||
- ''
- );
- end;
-
- procedure name_outside_of_context is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(3, 'name','a_context_name', null),
- ut3_develop.ut_annotation(4, 'context','A context', null),
- ut3_develop.ut_annotation(7, 'test', 'In context', 'test_in_a_context'),
- ut3_develop.ut_annotation(8, 'endcontext',null, null),
- ut3_develop.ut_annotation(12, 'test', 'In suite', 'suite_level_test')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%%'
- ,'\'
- );
- ut.expect(l_actual).to_be_like(
- ''||
- '' ||
- '%' ||
- '' ||
- '%nested_context_#1A contextsome_package.nested_context_#1' ||
- '%' ||
- '' ||
- '%test_in_a_contextIn contextsome_package.nested_context_#1.test_in_a_context' ||
- '%' ||
- '' ||
- '' ||
- '' ||
- '' ||
- '' ||
- '%suite_level_testIn suitesome_package.suite_level_test' ||
- '%' ||
- '' ||
- '' ||
- '' ||
- ''||
- ''
- );
- end;
-
- procedure name_empty_value is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(4, 'context','A context', null),
- ut3_develop.ut_annotation(5, 'name',null, null),
- ut3_develop.ut_annotation(7, 'test', 'In context', 'test_in_a_context'),
- ut3_develop.ut_annotation(8, 'endcontext',null, null),
- ut3_develop.ut_annotation(12, 'test', 'In suite', 'suite_level_test')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%%'
- ,'\'
- );
- ut.expect(l_actual).to_be_like(
- ''||
- '' ||
- '%' ||
- '' ||
- '%nested_context_#1A contextsome_package.nested_context_#1' ||
- '%' ||
- '' ||
- '%test_in_a_contextIn contextsome_package.nested_context_#1.test_in_a_context' ||
- '%' ||
- '' ||
- '' ||
- '' ||
- '' ||
- '' ||
- '%suite_level_testIn suitesome_package.suite_level_test' ||
- '%' ||
- '' ||
- '' ||
- '' ||
- ''||
- ''
- );
- end;
-
- procedure multiple_contexts is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(4, 'context','A context', null),
- ut3_develop.ut_annotation(6, 'test', 'In context1', 'test_in_a_context1'),
- ut3_develop.ut_annotation(7, 'endcontext',null, null),
- ut3_develop.ut_annotation(8, 'context','A context', null),
- ut3_develop.ut_annotation(10, 'test', 'In context2', 'test_in_a_context2'),
- ut3_develop.ut_annotation(11, 'endcontext',null, null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%%'
- ,'\'
- );
- ut.expect(l_actual).to_be_like(
- ''||
- '' ||
- '%' ||
- '' ||
- '%nested_context_#1A contextsome_package.nested_context_#1' ||
- '%' ||
- '' ||
- '%test_in_a_context1In context1some_package.nested_context_#1.test_in_a_context1' ||
- '%' ||
- '' ||
- '' ||
- '' ||
- '' ||
- '' ||
- '%nested_context_#2A contextsome_package.nested_context_#2' ||
- '%' ||
- '' ||
- '%test_in_a_context2In context2some_package.nested_context_#2.test_in_a_context2' ||
- '%' ||
- '' ||
- '' ||
- '' ||
- '' ||
- '' ||
- '' ||
- '' ||
- ''||
- ''
- );
- end;
-
- procedure context_name_case_insensitive is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(2, 'beforeall',null, 'suite_level_beforeall'),
- ut3_develop.ut_annotation(3, 'test','In suite', 'suite_level_test'),
- ut3_develop.ut_annotation(4, 'context','A context', null),
- ut3_develop.ut_annotation(5, 'name','a_Context', null),
- ut3_develop.ut_annotation(6, 'beforeall',null, 'context_setup'),
- ut3_develop.ut_annotation(7, 'test', 'In context', 'test_in_a_context'),
- ut3_develop.ut_annotation(8, 'endcontext',null, null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- ''||
- '' ||
- '%' ||
- '%' ||
- '' ||
- '%suite_level_testIn suitesome_package.suite_level_test' ||
- '%' ||
- '' ||
- '%a_contextA contextsome_package.a_context' ||
- '%' ||
- '' ||
- '%test_in_a_contextIn contextsome_package.a_context.test_in_a_context' ||
- '%' ||
- '' ||
- '' ||
- '%some_packagecontext_setup' ||
- '%' ||
- '' ||
- '' ||
- '' ||
- '' ||
- '%some_packagesuite_level_beforeall' ||
- '%' ||
- '' ||
- ''||
- ''
- );
- end;
-
- procedure throws_value_empty is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(3, 'test','A test with empty throws annotation', 'A_TEST_PROCEDURE'),
- ut3_develop.ut_annotation(3, 'throws',null, 'A_TEST_PROCEDURE')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%%"--%throws" annotation requires a parameter. Annotation ignored.%%'
- );
- end;
-
-
- procedure before_aftertest_multi is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(14, 'test','A test', 'some_test'),
- ut3_develop.ut_annotation(15, 'beforetest','before_test_proc', 'some_test'),
- ut3_develop.ut_annotation(16, 'beforetest','before_test_proc2', 'some_test'),
- ut3_develop.ut_annotation(18, 'aftertest','after_test_proc', 'some_test'),
- ut3_develop.ut_annotation(20, 'aftertest','after_test_proc2', 'some_test')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%%some_package%some_test' ||
- '%' ||
- '%some_packagebefore_test_proc' ||
- '%some_packagebefore_test_proc2' ||
- '%' ||
- '%' ||
- '%some_packageafter_test_proc' ||
- '%some_packageafter_test_proc2' ||
- '%' ||
- '%%'
- );
- end;
-
- procedure before_aftertest_twice is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(14, 'test','A test', 'some_test'),
- ut3_develop.ut_annotation(15, 'beforetest','before_test_proc, before_test_proc2', 'some_test'),
- ut3_develop.ut_annotation(16, 'beforetest','before_test_proc3', 'some_test'),
- ut3_develop.ut_annotation(18, 'aftertest','after_test_proc,after_test_proc2', 'some_test'),
- ut3_develop.ut_annotation(20, 'aftertest','after_test_proc3', 'some_test')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%%some_package%some_test' ||
- '%' ||
- '%some_packagebefore_test_proc' ||
- '%some_packagebefore_test_proc2' ||
- '%some_packagebefore_test_proc3' ||
- '%' ||
- '%' ||
- '%some_packageafter_test_proc' ||
- '%some_packageafter_test_proc2' ||
- '%some_packageafter_test_proc3' ||
- '%' ||
- '%%'
- );
- end;
-
- procedure before_aftertest_pkg_proc is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(14, 'test','A test', 'some_test'),
- ut3_develop.ut_annotation(15, 'beforetest','external_package.before_test_proc', 'some_test'),
- ut3_develop.ut_annotation(18, 'aftertest','external_package.after_test_proc', 'some_test')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%%some_package%some_test' ||
- '%' ||
- '%external_packagebefore_test_proc' ||
- '%' ||
- '%' ||
- '%external_packageafter_test_proc' ||
- '%' ||
- '%%'
- );
- end;
-
- procedure before_aftertest_mixed_syntax is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(14, 'test','A test', 'some_test'),
- ut3_develop.ut_annotation(15, 'beforetest','external_package.before_test_proc, before_test_proc2', 'some_test'),
- ut3_develop.ut_annotation(18, 'aftertest','external_package.after_test_proc, after_test_proc2', 'some_test')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%%some_package%some_test' ||
- '%' ||
- '%external_packagebefore_test_proc' ||
- '%some_packagebefore_test_proc2' ||
- '%' ||
- '%' ||
- '%external_packageafter_test_proc' ||
- '%some_packageafter_test_proc2' ||
- '%' ||
- '%%'
- );
- end;
-
- procedure test_annotation_ordering is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(4, 'test','B test', 'b_test'),
- ut3_develop.ut_annotation(10, 'test','Z test', 'z_test'),
- ut3_develop.ut_annotation(14, 'test','A test', 'a_test')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%%some_package%b_test' ||
- '%%'||
- '%%some_package%z_test' ||
- '%%'||
- '%%some_package%a_test' ||
- '%%'
- );
- end;
-
- procedure test_bad_procedure_annotation is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(2, 'bad_procedure_annotation',null, 'some_procedure'),
- ut3_develop.ut_annotation(6, 'test','A test', 'do_stuff')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_match('(.*)(Unsupported annotation "--%bad_procedure_annotation"\. Annotation ignored\.)(.*)( line 2)(.*)', 'n');
- end;
-
- procedure test_bad_package_annotation is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(1, 'suite','Cool', null),
- ut3_develop.ut_annotation(17, 'bad_package_annotation',null, null),
- ut3_develop.ut_annotation(24, 'test','A test', 'do_stuff')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_match('(.*)(Unsupported annotation "--%bad_package_annotation"\. Annotation ignored\.)(.*)( line 17)(.*)', 'n');
- end;
-
- procedure test_tag_annotation is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','testsuite', null),
- ut3_develop.ut_annotation(8, 'test','Some test', 'test_procedure'),
- ut3_develop.ut_annotation(9, 'tags','testtag', 'test_procedure')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%' ||
- '%test_procedureSome testsome_package.test_procedure' ||
- '%testtag%'||
- '%%'
- );
-
- end;
-
- procedure suite_tag_annotation is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','testsuite', null),
- ut3_develop.ut_annotation(3, 'tags','suitetag', null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%' ||
- '%some_packagetestsuitesome_package' ||
- '%suitetag%'||
- '%%'
- );
-
- end;
-
- procedure test_tags_annotation is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','testsuite', null),
- ut3_develop.ut_annotation(8, 'test','Some test', 'test_procedure'),
- ut3_develop.ut_annotation(9, 'tags','testtag,testtag2,testtag3', 'test_procedure')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%' ||
- '%test_procedureSome testsome_package.test_procedure' ||
- '%testtagtesttag2testtag3%'||
- '%%'
- );
-
- end;
-
- procedure suite_tags_annotation is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','testsuite', null),
- ut3_develop.ut_annotation(3, 'tags','suitetag,suitetag1,suitetag2', null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%' ||
- '%some_packagetestsuitesome_package' ||
- '%suitetagsuitetag1suitetag2%'||
- '%%'
- );
-
- end;
-
- procedure test_2line_tags_annotation is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','testsuite', null),
- ut3_develop.ut_annotation(8, 'test','Some test', 'test_procedure'),
- ut3_develop.ut_annotation(9, 'tags','testtag', 'test_procedure'),
- ut3_develop.ut_annotation(10, 'tags','testtag2', 'test_procedure')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%' ||
- '%test_procedureSome testsome_package.test_procedure' ||
- '%testtagtesttag2%'||
- '%%'
- );
-
- end;
-
- procedure suite_2line_tags_annotation is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','testsuite', null),
- ut3_develop.ut_annotation(3, 'tags','suitetag', null),
- ut3_develop.ut_annotation(4, 'tags','suitetag1', null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%' ||
- '%some_packagetestsuitesome_package' ||
- '%suitetagsuitetag1%'||
- '%%'
- );
-
- end;
-
- procedure test_empty_tag is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','testsuite', null),
- ut3_develop.ut_annotation(8, 'test','Some test', 'test_procedure'),
- ut3_develop.ut_annotation(9, 'tags',null, 'test_procedure')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%%"--%tags" annotation requires a tag value populated. Annotation ignored.%%'||
- '%%'
- );
-
- end;
-
- procedure suite_empty_tag is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','testsuite', null),
- ut3_develop.ut_annotation(3, 'tags',null, null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%"--%tags" annotation requires a tag value populated. Annotation ignored.%%'||
- '%%'
- );
-
- end;
-
- procedure test_duplicate_tag is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','testsuite', null),
- ut3_develop.ut_annotation(8, 'test','Some test', 'test_procedure'),
- ut3_develop.ut_annotation(9, 'tags','testtag,testtag1,testtag', 'test_procedure'),
- ut3_develop.ut_annotation(10, 'tags',' testtag,testtag1,testtag2', 'test_procedure')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%' ||
- '%test_procedureSome testsome_package.test_procedure' ||
- '%testtagtesttag1testtag2%'||
- '%%'
- );
-
- end;
-
- procedure suite_duplicate_tag is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','testsuite', null),
- ut3_develop.ut_annotation(3, 'tags','suitetag,suitetag1,suitetag', null),
- ut3_develop.ut_annotation(4, 'tags',' suitetag1,suitetag2', null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%' ||
- '%some_packagetestsuitesome_package' ||
- '%suitetagsuitetag1suitetag2%'||
- '%%'
- );
-
- end;
-
- procedure test_empty_tag_between is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','testsuite', null),
- ut3_develop.ut_annotation(8, 'test','Some test', 'test_procedure'),
- ut3_develop.ut_annotation(9, 'tags','testtag,, ,testtag1', 'test_procedure')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%' ||
- '%test_procedureSome testsome_package.test_procedure' ||
- '%testtagtesttag1%'||
- '%%'
- );
-
- end;
-
- procedure suite_empty_tag_between is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','testsuite', null),
- ut3_develop.ut_annotation(3, 'tags','suitetag,, ,suitetag1', null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%' ||
- '%some_packagetestsuitesome_package' ||
- '%suitetagsuitetag1%'||
- '%%'
- );
-
- end;
-
- procedure test_special_char_tag is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','testsuite', null),
- ut3_develop.ut_annotation(8, 'test','Some test', 'test_procedure'),
- ut3_develop.ut_annotation(9, 'tags','#?$%^&*!|\/@][', 'test_procedure')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%' ||
- '%test_procedureSome testsome_package.test_procedure' ||
- '%#?$%^&*!|\/@][%'||
- '%%'
- );
-
- end;
-
- procedure suite_special_char_tag is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','testsuite', null),
- ut3_develop.ut_annotation(3, 'tags','#?$%^&*!|\/@][', null)
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%' ||
- '%some_packagetestsuitesome_package' ||
- '%#?$%^&*!|\/@][%'||
- '%%'
- );
-
- end;
-
- procedure test_spaces_in_tag is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','testsuite', null),
- ut3_develop.ut_annotation(3, 'tags',' good_tag , bad tag , good-tag ', null),
- ut3_develop.ut_annotation(8, 'test','Some test', 'test_procedure'),
- ut3_develop.ut_annotation(9, 'tags',' good_tag , bad tag , good-tag ', 'test_procedure')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%good_taggood-tag%'||
- 'good_taggood-tag%'
- );
- ut.expect(l_actual).to_be_like(
- '%Invalid value "bad tag" for "--%tags" annotation.'||
- ' See documentation for details on valid tag values. Annotation value ignored.' ||
- '%at package "UT3_TESTER.SOME_PACKAGE", line 3%'
- );
- ut.expect(l_actual).to_be_like(
- '%Invalid value "bad tag" for "--%tags" annotation.'||
- ' See documentation for details on valid tag values. Annotation value ignored.' ||
- '%at package "UT3_TESTER.SOME_PACKAGE.TEST_PROCEDURE", line 9%'
- );
- end;
-
- procedure test_minus_in_tag is
- l_actual clob;
- l_annotations ut3_develop.ut_annotations;
- begin
- --Arrange
- l_annotations := ut3_develop.ut_annotations(
- ut3_develop.ut_annotation(2, 'suite','testsuite', null),
- ut3_develop.ut_annotation(3, 'tags',' good_tag , -invalid_tag , good-tag ', null),
- ut3_develop.ut_annotation(8, 'test','Some test', 'test_procedure'),
- ut3_develop.ut_annotation(9, 'tags',' good_tag , -invalid_tag , good-tag ', 'test_procedure')
- );
- --Act
- l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
- --Assert
- ut.expect(l_actual).to_be_like(
- '%good_taggood-tag%'||
- 'good_taggood-tag%'
- );
- ut.expect(l_actual).to_be_like(
- '%Invalid value "-invalid_tag" for "--%tags" annotation.'||
- ' See documentation for details on valid tag values. Annotation value ignored.' ||
- '%at package "UT3_TESTER.SOME_PACKAGE", line 3%'
- );
- ut.expect(l_actual).to_be_like(
- '%Invalid value "-invalid_tag" for "--%tags" annotation.'||
- ' See documentation for details on valid tag values. Annotation value ignored.' ||
- '%at package "UT3_TESTER.SOME_PACKAGE.TEST_PROCEDURE", line 9%'
- );
- end;
-
-end test_suite_builder;
-/
diff --git a/test/ut3_tester/core/test_suite_builder.pks b/test/ut3_tester/core/test_suite_builder.pks
deleted file mode 100644
index 09ff3c0b3..000000000
--- a/test/ut3_tester/core/test_suite_builder.pks
+++ /dev/null
@@ -1,248 +0,0 @@
-create or replace package test_suite_builder is
- --%suite(suite_builder)
- --%suitepath(utplsql.ut3_tester.core)
-
- --%context(--%suite annotation)
- --%name(suite)
-
- --%test(Sets suite name from package name and leaves description empty)
- procedure no_suite_description;
-
- --%test(Sets suite description using first --%suite annotation)
- procedure suite_description_from_suite;
-
- --%test(Gives warning if more than one --%suite annotation used)
- procedure suite_annot_duplicated;
-
- --%endcontext
-
- --%context(--%displayname annotation)
-
- --%test(Overrides suite description using first --%displayname annotation)
- procedure suite_descr_from_displayname;
-
- --%test(Gives warning if more than one --%displayname annotation used)
- procedure displayname_annot_duplicated;
-
- --%test(Gives warning if --%displayname annotation has no value)
- procedure displayname_annot_empty;
-
- --%endcontext
-
- --%context(--%test annotation)
-
- --%test(Creates a test item for procedure annotated with --%test annotation)
- procedure test_annotation;
-
- --%test(Gives warning if more than one --%test annotation used)
- procedure test_annot_duplicated;
-
- --%test(Is added to suite according to annotation order in package spec)
- procedure test_annotation_ordering;
-
- --%endcontext
-
- --%context(--%suitepath annotation)
-
- --%test(Sets suite path using first --%suitepath annotation)
- procedure suitepath_from_non_empty_path;
-
- --%test(Gives warning if more than one --%suitepath annotation used)
- procedure suitepath_annot_duplicated;
-
- --%test(Gives warning if --%suitepath annotation has no value)
- procedure suitepath_annot_empty;
-
- --%test(Gives warning if --%suitepath annotation has invalid value)
- procedure suitepath_annot_invalid_path;
-
- --%endcontext
-
- --%context--%rollback annotation)
-
- --%test(Sets rollback type using first --%rollback annotation)
- procedure rollback_type_valid;
-
- --%test(Gives warning if more than one --%rollback annotation used)
- procedure rollback_type_duplicated;
-
- --%test(Gives warning if --%rollback annotation has no value)
- procedure rollback_type_empty;
-
- --%test(Gives warning if --%rollback annotation has invalid value)
- procedure rollback_type_invalid;
-
- --%endcontext
-
- --%context(--%before/after all/each annotations)
-
- --%test(Supports multiple before/after all/each procedure level definitions)
- procedure multiple_before_after;
-
- --%test(Supports multiple before/after all/each standalone level definitions)
- procedure multiple_standalone_bef_aft;
-
- --%test(Supports mixing before/after all/each annotations on single procedure)
- procedure before_after_on_single_proc;
-
- --%test(Supports mixed before/after all/each as standalone and procedure level definitions)
- procedure multiple_mixed_bef_aft;
-
- --%test(Gives warning if more than one --%beforeall annotation used on procedure)
- procedure beforeall_annot_duplicated;
-
- --%test(Gives warning if more than one --%beforeeach annotation used on procedure)
- procedure beforeeach_annot_duplicated;
-
- --%test(Gives warning if more than one --%afterall annotation used on procedure)
- procedure afterall_annot_duplicated;
-
- --%test(Gives warning if more than one --%aftereach annotation used on procedure)
- procedure aftereach_annot_duplicated;
-
- --%test(Gives warning on before/after all/each annotations mixed with test)
- procedure before_after_mixed_with_test;
-
- --%endcontext
-
- --%context(--%context annotation)
- --%name(context)
-
- --%test(Creates nested suite for content between context/endcontext annotations)
- procedure suite_from_context;
-
- --%test(Creates nested contexts inside a context)
- procedure nested_contexts;
-
- --%test(Creates multiple nested contexts inside a context)
- procedure nested_contexts_2;
-
- --%test(Associates before/after all/each to tests in context only)
- procedure before_after_in_context;
-
- --%test(Propagates beforeeach/aftereach to context)
- procedure before_after_out_of_context;
-
- --%test(Gives warning when endcontext is missing)
- procedure context_without_endcontext;
-
- --%test(Gives warning if --%endcontext is missing a preceding --%context)
- procedure endcontext_without_context;
-
- --%test(Gives warning when two contexts have the same name and falls back to default context name)
- procedure duplicate_context_name;
-
- --%endcontext
-
- --%context(--%name annotation)
-
- --%test(Falls back to default context name and gives warning when context name contains "." character)
- procedure hard_stop_in_ctx_name;
-
- --%test(Falls back to default context name and gives warning when name contains spaces)
- procedure name_with_spaces_invalid;
-
- --%test(Raises warning when more than one name annotation used)
- procedure duplicate_name_annotation;
-
- --%test(Is ignored when used outside of context - no warning given)
- procedure name_outside_of_context;
-
- --%test(Is ignored when name value is empty)
- procedure name_empty_value;
-
- --%test(Is applied to corresponding context when multiple contexts used)
- procedure multiple_contexts;
-
- --%test(Context name is case insensitive)
- procedure context_name_case_insensitive;
-
- --%endcontext
-
- --%context(--%throws annotation)
-
- --%test(Gives warning if --%throws annotation has no value)
- procedure throws_value_empty;
-
- --%endcontext
-
- --%context(--%beforetest/aftertest annotation)
-
- --%test(Supports multiple occurrences of beforetest/aftertest for a test)
- procedure before_aftertest_multi;
-
- --%test(Supports same procedure defined twice)
- procedure before_aftertest_twice;
-
- --%test(Supports beforetest from external package)
- procedure before_aftertest_pkg_proc;
-
- --%test(Supports mix of procedure and package.procedure)
- procedure before_aftertest_mixed_syntax;
-
- --%endcontext
-
- --%context(--%bad_annotation)
-
- --%test(Gives warning when unknown procedure level annotation passed)
- procedure test_bad_procedure_annotation;
-
- --%test(Gives warning when unknown package level annotation passed)
- procedure test_bad_package_annotation;
-
- --%endcontext
-
- --%context(--%tag_annotation)
-
- --%test(Build suite test with tag)
- procedure test_tag_annotation;
-
- --%test(Build suite with tag)
- procedure suite_tag_annotation;
-
- --%test(Build suite test with three tags)
- procedure test_tags_annotation;
-
- --%test(Build suite with three tags)
- procedure suite_tags_annotation;
-
- --%test(Build suite test with two line tag annotation)
- procedure test_2line_tags_annotation;
-
- --%test(Build suite with two line tag annotation)
- procedure suite_2line_tags_annotation;
-
- --%test(Build suite test with empty line tag annotation)
- procedure test_empty_tag;
-
- --%test(Build suite with empty line tag annotation)
- procedure suite_empty_tag;
-
- --%test(Build suite test with duplicate tag annotation)
- procedure test_duplicate_tag;
-
- --%test(Build suite with duplicate tag annotation)
- procedure suite_duplicate_tag;
-
- --%test(Build suite test with empty between tag annotation)
- procedure test_empty_tag_between;
-
- --%test(Build suite with empty between tag annotation)
- procedure suite_empty_tag_between;
-
- --%test(Build suite test with special char tag annotation)
- procedure test_special_char_tag;
-
- --%test(Build suite with special char tag annotation)
- procedure suite_special_char_tag;
-
- --%test(Raise warning and ignore tag with spaces in tag name)
- procedure test_spaces_in_tag;
-
- --%test(Raise warning and ignore tag starting ith '-')
- procedure test_minus_in_tag;
-
- --%endcontext
-
-end test_suite_builder;
-/
diff --git a/test/ut3_tester/core/test_suite_manager.pkb b/test/ut3_tester/core/test_suite_manager.pkb
deleted file mode 100644
index 8ab9b96d9..000000000
--- a/test/ut3_tester/core/test_suite_manager.pkb
+++ /dev/null
@@ -1,2378 +0,0 @@
-create or replace package body test_suite_manager is
-
- ex_obj_doesnt_exist exception;
- pragma exception_init(ex_obj_doesnt_exist, -04043);
-
- procedure create_dummy_long_test_package is
- begin
- ut3_tester_helper.run_helper.create_dummy_long_test_package();
- end;
-
- procedure drop_dummy_long_test_package is
- begin
- ut3_tester_helper.run_helper.drop_dummy_long_test_package();
- end;
-
- procedure compile_dummy_packages is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace package test_package_1 is
-
- --%suite
- --%displayname(test_package_1)
- --%suitepath(tests)
- --%rollback(manual)
-
- gv_glob_val number;
-
- --%beforeeach
- procedure global_setup;
-
- --%aftereach
- procedure global_teardown;
-
- --%test
- --%displayname(Test1 from test package 1)
- procedure test1;
-
- --%test(Test2 from test package 1)
- --%beforetest(test2_setup)
- --%aftertest(test2_teardown)
- procedure test2;
-
- procedure test2_setup;
-
- procedure test2_teardown;
-
-end test_package_1;]';
-
- execute immediate q'[create or replace package body test_package_1 is
- gv_var_1 number;
- gv_var_1_temp number;
-
- procedure global_setup is
- begin
- gv_var_1 := 1;
- gv_glob_val := 1;
- end;
-
- procedure global_teardown is
- begin
- gv_var_1 := 0;
- gv_glob_val := 0;
- end;
-
- procedure test1 is
- begin
- ut.expect(gv_var_1, 'Some expectation').to_equal(1);
- end;
-
- procedure test2 is
- begin
- ut.expect(gv_var_1, 'Some expectation').to_equal(2);
- end;
-
- procedure test2_setup is
- begin
- gv_var_1_temp := gv_var_1;
- gv_var_1 := 2;
- end;
-
- procedure test2_teardown is
- begin
- gv_var_1 := gv_var_1_temp;
- gv_var_1_temp := null;
- end;
-
-end test_package_1;]';
-
- execute immediate q'[create or replace package test_package_2 is
- --%suite
- --%suitepath(tests.test_package_1)
-
- gv_glob_val varchar2(1);
-
- --%beforeeach
- procedure global_setup;
-
- --%aftereach
- procedure global_teardown;
-
- --%test
- procedure test1;
-
- --%test
- --%beforetest(test2_setup)
- --%aftertest(test2_teardown)
- procedure test2;
-
- procedure test2_setup;
-
- procedure test2_teardown;
-
- --%beforeall
- procedure context_setup;
-
- --%test(Test in a context)
- procedure context_test;
-
- --%afterall
- procedure context_teardown;
-
-end test_package_2;]';
-
- execute immediate q'[create or replace package body test_package_2 is
- gv_var_1 varchar2(1);
- gv_var_1_temp varchar2(1);
-
- procedure global_setup is
- begin
- gv_var_1 := 'a';
- gv_glob_val := 'z';
- end;
-
- procedure global_teardown is
- begin
- gv_var_1 := 'n';
- gv_glob_val := 'n';
- end;
-
- procedure test1 is
- begin
- ut.expect(gv_var_1).to_equal('a');
- end;
-
- procedure test2 is
- begin
- ut.expect(gv_var_1).to_equal('b');
- end;
-
- procedure test2_setup is
- begin
- gv_var_1_temp := gv_var_1;
- gv_var_1 := 'b';
- end;
-
- procedure test2_teardown is
- begin
- gv_var_1 := gv_var_1_temp;
- gv_var_1_temp := null;
- end;
-
- procedure context_setup is
- begin
- gv_var_1_temp := gv_var_1 || 'a';
- end;
-
- procedure context_test is
- begin
- ut.expect(gv_var_1_temp, 'Some expectation').to_equal('na');
- end;
-
- procedure context_teardown is
- begin
- gv_var_1_temp := null;
- end;
-
-end test_package_2;]';
-
- execute immediate q'[create or replace package test_package_3 is
- --%suite
- --%suitepath(tests2)
- --%rollback(auto)
-
- gv_glob_val number;
-
- --%beforeeach
- procedure global_setup;
-
- --%aftereach
- procedure global_teardown;
-
- --%test
- --%rollback(auto)
- procedure test1;
-
- --%test
- --%beforetest(test2_setup)
- --%aftertest(test2_teardown)
- procedure test2;
-
- procedure test2_setup;
-
- procedure test2_teardown;
-
- --%test
- --%disabled
- procedure disabled_test;
-
-end test_package_3;]';
-
- execute immediate q'[create or replace package body test_package_3 is
- gv_var_1 number;
- gv_var_1_temp number;
-
- procedure global_setup is
- begin
- gv_var_1 := 1;
- gv_glob_val := 1;
- end;
-
- procedure global_teardown is
- begin
- gv_var_1 := 0;
- gv_glob_val := 0;
- end;
-
- procedure test1 is
- begin
- ut.expect(gv_var_1).to_equal(1);
- end;
-
- procedure test2 is
- begin
- ut.expect(gv_var_1).to_equal(2);
- end;
-
- procedure test2_setup is
- begin
- gv_var_1_temp := gv_var_1;
- gv_var_1 := 2;
- end;
-
- procedure test2_teardown is
- begin
- gv_var_1 := gv_var_1_temp;
- gv_var_1_temp := null;
- end;
-
- procedure disabled_test is
- begin
- null;
- end;
-
-end test_package_3;]';
-
- execute immediate q'[create or replace package test_package_with_ctx is
-
- --%suite(test_package_with_ctx)
-
- gv_glob_val number;
-
- --%context(Some context description)
- --%name(some_context)
-
- --%test
- --%displayname(Test1 from test package 1)
- procedure test1;
-
- --%endcontext
-
-end test_package_with_ctx;]';
-
- execute immediate q'[create or replace package body test_package_with_ctx is
-
- procedure test1 is
- begin
- null;
- end;
-
-end test_package_with_ctx;]';
-
- execute immediate q'[create or replace package test1_frontwildcard is
-
- --%suite
- --%displayname(test1_frontwildcard)
- --%suitepath(front_wildcard)
- --%rollback(manual)
-
- --%test
- --%displayname(Test1 from test test1_frontwildcard)
- procedure first_test;
-
- --%test
- --%displayname(Test2 from test test1_frontwildcard)
- procedure second_test;
-
-end test1_frontwildcard;]';
-
- execute immediate q'[create or replace package body test1_frontwildcard is
-
- procedure first_test is
- begin
- ut.expect(1).to_equal(1);
- end;
-
- procedure second_test is
- begin
- ut.expect(1).to_equal(2);
- end;
-
-end test1_frontwildcard;]';
-
- execute immediate q'[create or replace package test2_frontwildcard is
-
- --%suite
- --%displayname(test2_frontwildcard)
- --%suitepath(front_wildcard)
- --%rollback(manual)
-
- --%test
- --%displayname(Test1 from test package test2_frontwildcard)
- procedure first_test;
-
-end test2_frontwildcard;]';
-
- execute immediate q'[create or replace package body test2_frontwildcard is
-
- procedure first_test is
- begin
- ut.expect(1).to_equal(1);
- end;
-
-end test2_frontwildcard;]';
-
- execute immediate q'[create or replace package middle_test1_wildcard is
-
- --%suite
- --%displayname(middle_test1_wildcard)
- --%suitepath(wild_middle_card)
- --%rollback(manual)
-
- --%test
- --%displayname(Test1 from test middle_test1_wildcard)
- procedure middle_first_test;
-
- --%test
- --%displayname(Test2 from test middle_test1_wildcard)
- procedure middle_second_test;
-
-end middle_test1_wildcard;]';
-
- execute immediate q'[create or replace package body middle_test1_wildcard is
-
- procedure middle_first_test is
- begin
- ut.expect(1).to_equal(1);
- end;
-
- procedure middle_second_test is
- begin
- ut.expect(1).to_equal(2);
- end;
-
-end middle_test1_wildcard;]';
-
- execute immediate q'[create or replace package middle_test2_wildcard is
-
- --%suite
- --%displayname(middle_test2_wildcard)
- --%suitepath(wild_middle_card)
- --%rollback(manual)
-
- --%test
- --%displayname(Test1 from test package middle_test2_wildcard)
- procedure middle_first_test;
-
-end middle_test2_wildcard;]';
-
- execute immediate q'[create or replace package body middle_test2_wildcard is
-
- procedure middle_first_test is
- begin
- ut.expect(1).to_equal(1);
- end;
-
-end middle_test2_wildcard;]';
-
- execute immediate q'[create or replace package test1_multi_wildcard is
-
- --%suite
- --%displayname(test1_multi_wildcard)
- --%suitepath(wildcard_multi_asterisks)
- --%rollback(manual)
-
- --%test
- --%displayname(Test1 from test test1_multi_wildcard)
- procedure first_multi_test1;
-
- --%test
- --%displayname(Test2 from test test1_multi_wildcard)
- procedure second_multi_test2;
-
-end test1_multi_wildcard;]';
-
- execute immediate q'[create or replace package body test1_multi_wildcard is
-
- procedure first_multi_test1 is
- begin
- ut.expect(1).to_equal(1);
- end;
-
- procedure second_multi_test2 is
- begin
- ut.expect(1).to_equal(2);
- end;
-
-end test1_multi_wildcard;]';
-
- execute immediate q'[create or replace package test2_multi_wildcard is
-
- --%suite
- --%displayname(test2_multi_wildcard)
- --%suitepath(wildcard_multi_asterisks)
- --%rollback(manual)
-
- --%test
- --%displayname(Test1 from test package test2_multi_wildcard)
- procedure first_multi_test1;
-
-end test2_multi_wildcard;]';
-
- execute immediate q'[create or replace package body test2_multi_wildcard is
-
- procedure first_multi_test1 is
- begin
- ut.expect(1).to_equal(1);
- end;
-
-end test2_multi_wildcard;]';
-
- end;
-
- procedure drop_dummy_packages is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package test_package_1';
- execute immediate 'drop package test_package_2';
- execute immediate 'drop package test_package_3';
- execute immediate 'drop package test_package_with_ctx';
- execute immediate 'drop package test1_frontwildcard';
- execute immediate 'drop package test2_frontwildcard';
- execute immediate 'drop package middle_test1_wildcard';
- execute immediate 'drop package middle_test2_wildcard';
- execute immediate 'drop package test1_multi_wildcard';
- execute immediate 'drop package test2_multi_wildcard';
- end;
-
- procedure test_schema_run is
- c_path constant varchar2(100) := sys_context('USERENV', 'CURRENT_USER');
- l_objects_to_run ut3_develop.ut_suite_items := ut3_develop.ut_suite_items();
- l_all_objects_to_run ut3_develop.ut_suite_items;
-
- l_test0_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test2_suite ut3_develop.ut_logical_suite;
- begin
- --Act
- l_all_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- for i in 1..l_all_objects_to_run.count loop
- if l_all_objects_to_run(i).name in ('tests', 'tests2') then
- l_objects_to_run.extend;
- l_objects_to_run(l_objects_to_run.last) := l_all_objects_to_run(i);
- end if;
- end loop;
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(2);
-
- for i in 1 .. 2 loop
- l_test0_suite := treat(l_objects_to_run(i) as ut3_develop.ut_logical_suite);
- ut.expect(l_test0_suite.name in ('tests', 'tests2')).to_be_true;
-
- l_test1_suite := treat(l_test0_suite.items(1) as ut3_develop.ut_logical_suite);
-
- case l_test0_suite.name
- when 'tests' then
- ut.expect(l_test1_suite.name).to_equal('test_package_1');
- ut.expect(l_test1_suite.items.count).to_equal(3);
- ut.expect(l_test1_suite.rollback_type).to_equal(ut3_develop.ut_utils.gc_rollback_manual);
- l_test2_suite := treat(l_test1_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test2_suite.name).to_equal('test_package_2');
- ut.expect(l_test2_suite.items.count).to_equal(3);
- ut.expect(l_test2_suite.rollback_type).to_equal(ut3_develop.ut_utils.gc_rollback_manual);
- when 'tests2' then
- ut.expect(l_test1_suite.name).to_equal('test_package_3');
- ut.expect(l_test1_suite.items.count).to_equal(3);
- end case;
-
- end loop;
-
- end;
-
- function count_tests(a_items ut3_develop.ut_suite_items) return integer is
- l_count integer := 0;
- begin
- for i in 1 .. a_items.count loop
- if a_items(i) is of (ut3_develop.ut_test) then
- l_count := l_count + 1;
- else
- l_count := l_count + count_tests(treat(a_items(i) as ut3_develop.ut_logical_suite).items);
- end if;
- end loop;
- return l_count;
- end;
-
- procedure test_overlapping_paths is
- c_owner varchar2(128) := sys_context('USERENV', 'CURRENT_USER');
- l_expected_items ut3_develop.ut_suite_items;
- l_objects_to_run ut3_develop.ut_suite_items;
- begin
- --Arrange
- l_expected_items := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_owner||':tests'));
- --Act - the packages are part of the suitepath
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(
- ut3_develop.ut_varchar2_list(c_owner||':tests', c_owner||'.test_package_1', c_owner||'.test_package_2')
- );
- --Assert
- ut.expect(count_tests(l_expected_items)).to_be_greater_than(0);
- ut.expect(l_objects_to_run.count).to_equal(1);
- ut.expect(count_tests(l_objects_to_run)).to_equal(count_tests(l_expected_items));
- end;
-
- procedure test_top2_by_name is
- c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||'.test_package_2';
- l_objects_to_run ut3_develop.ut_suite_items;
-
- l_test0_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test2_suite ut3_develop.ut_logical_suite;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test0_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test0_suite.name).to_equal('tests');
- ut.expect(l_test0_suite.items.count).to_equal(1);
- l_test1_suite := treat(l_test0_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test1_suite.name).to_equal('test_package_1');
- ut.expect(l_test1_suite.items.count).to_equal(1);
- ut.expect(l_test1_suite.rollback_type).to_equal(ut3_develop.ut_utils.gc_rollback_manual);
- l_test2_suite := treat(l_test1_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test2_suite.name).to_equal('test_package_2');
- ut.expect(l_test2_suite.rollback_type).to_equal(ut3_develop.ut_utils.gc_rollback_manual);
- ut.expect(l_test2_suite.items.count).to_equal(3);
- end;
-
- procedure test_top2_bt_name_cur_user is
- c_path varchar2(100) := 'test_package_2';
- l_objects_to_run ut3_develop.ut_suite_items;
-
- l_test0_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test2_suite ut3_develop.ut_logical_suite;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test0_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test0_suite.name).to_equal('tests');
- ut.expect(l_test0_suite.items.count).to_equal(1);
- l_test1_suite := treat(l_test0_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test1_suite.name).to_equal('test_package_1');
- ut.expect(l_test1_suite.items.count).to_equal(1);
- ut.expect(l_test1_suite.rollback_type).to_equal(ut3_develop.ut_utils.gc_rollback_manual);
- l_test2_suite := treat(l_test1_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test2_suite.name).to_equal('test_package_2');
- ut.expect(l_test2_suite.rollback_type).to_equal(ut3_develop.ut_utils.gc_rollback_manual);
- ut.expect(l_test2_suite.items.count).to_equal(3);
- end;
-
- procedure test_by_path_to_subsuite is
- c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||':tests.test_package_1.test_package_2';
- l_objects_to_run ut3_develop.ut_suite_items;
-
- l_test0_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test2_suite ut3_develop.ut_logical_suite;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test0_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test0_suite.name).to_equal('tests');
- ut.expect(l_test0_suite.items.count).to_equal(1);
- l_test1_suite := treat(l_test0_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test1_suite.name).to_equal('test_package_1');
- ut.expect(l_test1_suite.items.count).to_equal(1);
- l_test2_suite := treat(l_test1_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test2_suite.name).to_equal('test_package_2');
- ut.expect(l_test2_suite.items.count).to_equal(3);
- end;
-
- procedure test_by_path_to_subsuite_cu is
- c_path varchar2(100) := ':tests.test_package_1.test_package_2';
- l_objects_to_run ut3_develop.ut_suite_items;
-
- l_test0_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test2_suite ut3_develop.ut_logical_suite;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test0_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test0_suite.name).to_equal('tests');
- ut.expect(l_test0_suite.items.count).to_equal(1);
- l_test1_suite := treat(l_test0_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test1_suite.name).to_equal('test_package_1');
- ut.expect(l_test1_suite.items.count).to_equal(1);
- l_test2_suite := treat(l_test1_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test2_suite.name).to_equal('test_package_2');
- ut.expect(l_test2_suite.items.count).to_equal(3);
- end;
-
- procedure test_subsute_proc_by_path is
- c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||':tests.test_package_1.test_package_2.test2';
- l_objects_to_run ut3_develop.ut_suite_items;
-
- l_test0_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test2_suite ut3_develop.ut_logical_suite;
- l_test_proc ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test0_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test0_suite.name).to_equal('tests');
- ut.expect(l_test0_suite.items.count).to_equal(1);
- l_test1_suite := treat(l_test0_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test1_suite.name).to_equal('test_package_1');
- ut.expect(l_test1_suite.rollback_type).to_equal(ut3_develop.ut_utils.gc_rollback_manual);
- ut.expect(l_test1_suite.items.count).to_equal(1);
- l_test2_suite := treat(l_test1_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test2_suite.name).to_equal('test_package_2');
- ut.expect(l_test2_suite.rollback_type).to_equal(ut3_develop.ut_utils.gc_rollback_manual);
- ut.expect(l_test2_suite.items.count).to_equal(1);
-
- l_test_proc := treat(l_test2_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test_proc.name).to_equal('test2');
- ut.expect(l_test_proc.rollback_type).to_equal(ut3_develop.ut_utils.gc_rollback_manual);
- ut.expect(l_test_proc.before_test_list.count).to_be_greater_than(0);
- ut.expect(l_test_proc.after_test_list.count).to_be_greater_than(0);
-
- end;
-
- procedure test_subsute_proc_by_path_cu is
- c_path varchar2(100) := ':tests.test_package_1.test_package_2.test2';
- l_objects_to_run ut3_develop.ut_suite_items;
-
- l_test0_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test2_suite ut3_develop.ut_logical_suite;
- l_test_proc ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test0_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test0_suite.name).to_equal('tests');
- ut.expect(l_test0_suite.items.count).to_equal(1);
- l_test1_suite := treat(l_test0_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test1_suite.name).to_equal('test_package_1');
- ut.expect(l_test1_suite.items.count).to_equal(1);
- l_test2_suite := treat(l_test1_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test2_suite.name).to_equal('test_package_2');
- ut.expect(l_test2_suite.items.count).to_equal(1);
-
- l_test_proc := treat(l_test2_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test_proc.name).to_equal('test2');
- ut.expect(l_test_proc.before_test_list.count).to_be_greater_than(0);
- ut.expect(l_test_proc.after_test_list.count).to_be_greater_than(0);
- end;
-
- procedure test_top_pack_by_name is
- c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||'.test_package_1';
- l_objects_to_run ut3_develop.ut_suite_items;
-
- l_test0_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_suite;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test0_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test0_suite.name).to_equal('tests');
- ut.expect(l_test0_suite.items.count).to_equal(1);
- l_test1_suite := treat(l_test0_suite.items(1) as ut3_develop.ut_suite);
-
- ut.expect(l_test1_suite.name).to_equal('test_package_1');
- ut.expect(l_test1_suite.items.count).to_equal(2);
-
- ut.expect(l_test1_suite.items(1).name).to_equal('test1');
- ut.expect(l_test1_suite.items(1).description).to_equal('Test1 from test package 1');
- ut.expect(treat(l_test1_suite.items(1) as ut3_develop.ut_test).before_test_list.count).to_equal(0);
- ut.expect(treat(l_test1_suite.items(1) as ut3_develop.ut_test).after_test_list.count).to_equal(0);
- ut.expect(treat(l_test1_suite.items(1) as ut3_develop.ut_test).before_each_list.count).to_be_greater_than(0);
- ut.expect(treat(l_test1_suite.items(1) as ut3_develop.ut_test).disabled_flag).to_equal(0);
-
- ut.expect(l_test1_suite.items(2).name).to_equal('test2');
- ut.expect(l_test1_suite.items(2).description).to_equal('Test2 from test package 1');
- ut.expect(treat(l_test1_suite.items(2) as ut3_develop.ut_test).before_test_list.count).to_be_greater_than(0);
- ut.expect(treat(l_test1_suite.items(2) as ut3_develop.ut_test).after_test_list.count).to_be_greater_than(0);
- ut.expect(treat(l_test1_suite.items(2) as ut3_develop.ut_test).before_each_list.count).to_be_greater_than(0);
- ut.expect(treat(l_test1_suite.items(2) as ut3_develop.ut_test).disabled_flag).to_equal(0);
-
- end;
-
- procedure test_top_pack_by_name_cu is
- c_path varchar2(100) := 'test_package_1';
- l_objects_to_run ut3_develop.ut_suite_items;
-
- l_test0_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_suite;
- l_test2_suite ut3_develop.ut_suite;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test0_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test0_suite.name).to_equal('tests');
- ut.expect(l_test0_suite.items.count).to_equal(1);
- l_test1_suite := treat(l_test0_suite.items(1) as ut3_develop.ut_suite);
-
- ut.expect(l_test1_suite.name).to_equal('test_package_1');
- ut.expect(l_test1_suite.items.count).to_equal(2);
-
- ut.expect(l_test1_suite.items(1).name).to_equal('test1');
- ut.expect(l_test1_suite.items(1).description).to_equal('Test1 from test package 1');
- ut.expect(treat(l_test1_suite.items(1) as ut3_develop.ut_test).before_test_list.count).to_equal(0);
- ut.expect(treat(l_test1_suite.items(1) as ut3_develop.ut_test).after_test_list.count).to_equal(0);
- ut.expect(treat(l_test1_suite.items(1) as ut3_develop.ut_test).before_each_list.count).to_be_greater_than(0);
- ut.expect(treat(l_test1_suite.items(1) as ut3_develop.ut_test).disabled_flag).to_equal(0);
-
- ut.expect(l_test1_suite.items(2).name).to_equal('test2');
- ut.expect(l_test1_suite.items(2).description).to_equal('Test2 from test package 1');
- ut.expect(treat(l_test1_suite.items(2) as ut3_develop.ut_test).before_test_list.count).to_be_greater_than(0);
- ut.expect(treat(l_test1_suite.items(2) as ut3_develop.ut_test).after_test_list.count).to_be_greater_than(0);
- ut.expect(treat(l_test1_suite.items(2) as ut3_develop.ut_test).before_each_list.count).to_be_greater_than(0);
- ut.expect(treat(l_test1_suite.items(2) as ut3_develop.ut_test).disabled_flag).to_equal(0);
-
- end;
-
- procedure test_top_pack_by_path is
- c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||':tests';
- l_objects_to_run ut3_develop.ut_suite_items;
-
- l_test0_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test2_suite ut3_develop.ut_logical_suite;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test0_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test0_suite.name).to_equal('tests');
- ut.expect(l_test0_suite.items.count).to_equal(1);
- l_test1_suite := treat(l_test0_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test1_suite.name).to_equal('test_package_1');
- ut.expect(l_test1_suite.items.count).to_equal(3);
- l_test2_suite := treat(l_test1_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test2_suite.name).to_equal('test_package_2');
- ut.expect(l_test2_suite.items.count).to_equal(3);
- end;
-
- procedure test_top_pack_by_path_cu is
- c_path varchar2(100) := ':tests';
- l_objects_to_run ut3_develop.ut_suite_items;
-
- l_test0_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test2_suite ut3_develop.ut_logical_suite;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test0_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test0_suite.name).to_equal('tests');
- ut.expect(l_test0_suite.items.count).to_equal(1);
- l_test1_suite := treat(l_test0_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test1_suite.name).to_equal('test_package_1');
- ut.expect(l_test1_suite.items.count).to_equal(3);
- l_test2_suite := treat(l_test1_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test2_suite.name).to_equal('test_package_2');
- ut.expect(l_test2_suite.items.count).to_equal(3);
- end;
-
- procedure test_top_pck_proc_by_path is
- c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||':tests.test_package_1.test2';
- l_objects_to_run ut3_develop.ut_suite_items;
-
- l_test0_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test2_suite ut3_develop.ut_logical_suite;
- l_test_proc ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test0_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test0_suite.name).to_equal('tests');
- ut.expect(l_test0_suite.items.count).to_equal(1);
- l_test1_suite := treat(l_test0_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test1_suite.name).to_equal('test_package_1');
- ut.expect(l_test1_suite.items.count).to_equal(1);
- l_test_proc := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
-
- ut.expect(l_test_proc.name).to_equal('test2');
- ut.expect(l_test_proc.description).to_equal('Test2 from test package 1');
- ut.expect(l_test_proc.before_test_list.count).to_be_greater_than(0);
- ut.expect(l_test_proc.after_test_list.count).to_be_greater_than(0);
- end;
-
- procedure test_top_pck_proc_by_path_cu is
- c_path varchar2(100) := ':tests.test_package_1.test2';
- l_objects_to_run ut3_develop.ut_suite_items;
-
- l_test0_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test2_suite ut3_develop.ut_logical_suite;
- l_test_proc ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test0_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test0_suite.name).to_equal('tests');
- ut.expect(l_test0_suite.items.count).to_equal(1);
- l_test1_suite := treat(l_test0_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test1_suite.name).to_equal('test_package_1');
- ut.expect(l_test1_suite.items.count).to_equal(1);
- l_test_proc := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
-
- ut.expect(l_test_proc.name).to_equal('test2');
- ut.expect(l_test_proc.description).to_equal('Test2 from test package 1');
- ut.expect(l_test_proc.before_test_list.count).to_be_greater_than(0);
- ut.expect(l_test_proc.after_test_list.count).to_be_greater_than(0);
- end;
-
- procedure test_top_pkc_proc_by_name is
- c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||'.test_package_1.test2';
- l_objects_to_run ut3_develop.ut_suite_items;
-
- l_test0_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test_proc ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test0_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test0_suite.name).to_equal('tests');
- ut.expect(l_test0_suite.items.count).to_equal(1);
- l_test1_suite := treat(l_test0_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test1_suite.name).to_equal('test_package_1');
- ut.expect(l_test1_suite.items.count).to_equal(1);
-
- l_test_proc := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test_proc.name).to_equal('test2');
- ut.expect(l_test_proc.before_test_list.count).to_be_greater_than(0);
- ut.expect(l_test_proc.after_test_list.count).to_be_greater_than(0);
- end;
-
- procedure test_top_pkc_proc_by_name_cu is
- c_path varchar2(100) := 'test_package_1.test2';
- l_objects_to_run ut3_develop.ut_suite_items;
-
- l_test0_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test_proc ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test0_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test0_suite.name).to_equal('tests');
- ut.expect(l_test0_suite.items.count).to_equal(1);
- l_test1_suite := treat(l_test0_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test1_suite.name).to_equal('test_package_1');
- ut.expect(l_test1_suite.items.count).to_equal(1);
-
- l_test_proc := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test_proc.name).to_equal('test2');
- ut.expect(l_test_proc.before_test_list.count).to_be_greater_than(0);
- ut.expect(l_test_proc.after_test_list.count).to_be_greater_than(0);
- end;
-
- procedure test_top_pkc_nosub_by_name is
- c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||'.test_package_3';
- l_objects_to_run ut3_develop.ut_suite_items;
-
- l_test0_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test1 ut3_develop.ut_test;
- l_test3 ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test0_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test0_suite.name).to_equal('tests2');
- ut.expect(l_test0_suite.items.count).to_equal(1);
- l_test1_suite := treat(l_test0_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test1_suite.name).to_equal('test_package_3');
- ut.expect(l_test1_suite.items.count).to_equal(3);
-
- l_test1 := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test1.name).to_equal('test1');
- ut.expect(l_test1.DISABLED_FLAG).to_equal(0);
-
- l_test3 := treat(l_test1_suite.items(3) as ut3_develop.ut_test);
- ut.expect(l_test3.name).to_equal('disabled_test');
- ut.expect(l_test3.DISABLED_FLAG).to_equal(1);
- end;
-
- procedure test_top_pkc_nosub_by_name_cu is
- c_path varchar2(100) := 'test_package_3';
- l_objects_to_run ut3_develop.ut_suite_items;
-
- l_test0_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test1 ut3_develop.ut_test;
- l_test3 ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test0_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test0_suite.name).to_equal('tests2');
- ut.expect(l_test0_suite.items.count).to_equal(1);
- l_test1_suite := treat(l_test0_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test1_suite.name).to_equal('test_package_3');
- ut.expect(l_test1_suite.items.count).to_equal(3);
-
- l_test1 := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test1.name).to_equal('test1');
- ut.expect(l_test1.DISABLED_FLAG).to_equal(0);
-
- l_test3 := treat(l_test1_suite.items(3) as ut3_develop.ut_test);
- ut.expect(l_test3.name).to_equal('disabled_test');
- ut.expect(l_test3.DISABLED_FLAG).to_equal(1);
- end;
-
- procedure test_top_subpck_by_path is
- c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||':tests2.test_package_3';
- l_objects_to_run ut3_develop.ut_suite_items;
-
- l_test0_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test1 ut3_develop.ut_test;
- l_test3 ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test0_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test0_suite.name).to_equal('tests2');
- ut.expect(l_test0_suite.items.count).to_equal(1);
- l_test1_suite := treat(l_test0_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test1_suite.name).to_equal('test_package_3');
- ut.expect(l_test1_suite.items.count).to_equal(3);
-
- l_test1 := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test1.name).to_equal('test1');
- ut.expect(l_test1.DISABLED_FLAG).to_equal(0);
-
- l_test3 := treat(l_test1_suite.items(3) as ut3_develop.ut_test);
- ut.expect(l_test3.name).to_equal('disabled_test');
- ut.expect(l_test3.DISABLED_FLAG).to_equal(1);
- end;
-
- procedure test_top_subpck_by_path_cu is
- c_path varchar2(100) := ':tests2.test_package_3';
- l_objects_to_run ut3_develop.ut_suite_items;
-
- l_test0_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test1 ut3_develop.ut_test;
- l_test3 ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test0_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test0_suite.name).to_equal('tests2');
- ut.expect(l_test0_suite.items.count).to_equal(1);
- l_test1_suite := treat(l_test0_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test1_suite.name).to_equal('test_package_3');
- ut.expect(l_test1_suite.items.count).to_equal(3);
-
- l_test1 := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test1.name).to_equal('test1');
- ut.expect(l_test1.DISABLED_FLAG).to_equal(0);
-
- l_test3 := treat(l_test1_suite.items(3) as ut3_develop.ut_test);
- ut.expect(l_test3.name).to_equal('disabled_test');
- ut.expect(l_test3.DISABLED_FLAG).to_equal(1);
- end;
-
- procedure test_search_invalid_pck is
- l_objects_to_run ut3_develop.ut_suite_items;
- begin
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list('failing_invalid_spec'));
-
- ut3_develop.ut.expect(l_objects_to_run.count).to_be_greater_than(0);
- ut3_develop.ut.expect(l_objects_to_run(l_objects_to_run.first).object_name).to_equal('failing_invalid_spec');
- end;
-
- procedure compile_invalid_package is
- ex_compilation_error exception;
- pragma exception_init(ex_compilation_error,-24344);
- pragma autonomous_transaction;
- begin
- begin
- execute immediate q'[create or replace package failing_invalid_spec as
- --%suite
- gv_glob_val non_existing_table.id%type := 0;
-
- --%beforeall
- procedure before_all;
- --%test
- procedure test1;
- --%test
- procedure test2;
-end;]';
- exception when ex_compilation_error then null;
- end;
- begin
- execute immediate q'[create or replace package body failing_invalid_spec as
- procedure before_all is begin gv_glob_val := 1; end;
- procedure test1 is begin ut.expect(1).to_equal(1); end;
- procedure test2 is begin ut.expect(1).to_equal(1); end;
-end;]';
- exception when ex_compilation_error then null;
- end;
- end;
- procedure drop_invalid_package is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package failing_invalid_spec';
- end;
-
- procedure test_search_nonexisting_pck is
- l_objects_to_run ut3_develop.ut_suite_items;
- begin
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list('ut3_develop.failing_non_existing'));
- ut.fail('Non existing package did not raise exception');
- exception
- when others then
- ut.expect(sqlerrm).to_be_like('%failing_non_existing%');
- end;
-
- procedure test_search_nonex_pck_wild is
- l_objects_to_run ut3_develop.ut_suite_items;
- begin
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list('ut3_develop.failing_non_*'));
- ut.fail('Non existing package did not raise exception');
- exception
- when others then
- ut.expect(sqlerrm).to_be_like('%failing_non_*%');
- end;
-
- procedure test_search_nonex_prc_wild is
- l_objects_to_run ut3_develop.ut_suite_items;
- begin
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list('ut3_tester.test_package_1.nonexist*'));
- ut.fail('Non existing package did not raise exception');
- exception
- when others then
- ut.expect(sqlerrm).to_be_like('%nonexist*%');
- end;
-
- procedure test_search_nonex_path_wild is
- l_objects_to_run ut3_develop.ut_suite_items;
- begin
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list('ut3_develop:failing_non_*'));
- ut.fail('Non existing path did not raise exception');
- exception
- when others then
- ut.expect(sqlerrm).to_be_like('%:failing_non_*%');
- end;
-
- procedure test_search_nonexist_sch_pck is
- l_objects_to_run ut3_develop.ut_suite_items;
- begin
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list('failing_non_existing'));
- ut.fail('Non existing package without schema did not raise exception');
- exception
- when others then
- ut.expect(sqlerrm).to_be_like('%ORA-44001: invalid schema%');
- end;
-
- procedure test_desc_with_comma is
- l_objects_to_run ut3_develop.ut_suite_items;
- l_suite ut3_develop.ut_suite;
- l_test ut3_develop.ut_test;
- begin
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list('tst_package_to_be_dropped'));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
-
- l_suite := treat(l_objects_to_run(1) as ut3_develop.ut_suite);
-
- ut.expect(l_suite.name).to_equal('tst_package_to_be_dropped');
- ut.expect(l_suite.description).to_equal('A suite description, though with comma, is assigned by suite_manager');
- ut.expect(l_suite.items.count).to_equal(2);
-
- l_test := treat(l_suite.items(1) as ut3_develop.ut_test);
-
- ut.expect(l_test.name).to_equal('test1');
- ut.expect(l_test.description).to_equal('A test description, though with comma, is assigned by suite_manager');
-
--- l_test := treat(l_suite.items(2) as ut3_develop.ut_test);
---
--- ut.expect(l_test.name).to_equal('test2');
--- ut.expect(l_test.description).to_equal('A test description, though with comma, is assigned by suite_manager');
-
- end;
- procedure setup_desc_with_comma is
- pragma autonomous_transaction;
- begin
- execute immediate 'create or replace package tst_package_to_be_dropped as
- --%suite(A suite description, though with comma, is assigned by suite_manager)
-
- --%test(A test description, though with comma, is assigned by suite_manager)
- procedure test1;
-
- --%test
- --%displayname(A test description, though with comma, is assigned by suite_manager)
- procedure test2;
-end;';
-
- execute immediate 'create or replace package body tst_package_to_be_dropped as
- procedure test1 is begin ut.expect(1).to_equal(1); end;
- procedure test2 is begin ut.expect(1).to_equal(1); end;
-end;';
- end;
- procedure clean_desc_with_comma is
- pragma autonomous_transaction;
- begin
- begin
- execute immediate 'drop package tst_package_to_be_dropped';
- exception
- when ex_obj_doesnt_exist then
- null;
- end;
- end;
-
- procedure test_inv_cache_on_drop is
- l_test_report ut3_develop.ut_varchar2_list;
- begin
-
- select * bulk collect into l_test_report from table(ut3_develop.ut.run(sys_context('USERENV', 'CURRENT_USER')||'.tst_package_to_be_dropped'));
-
- -- drop package
- clean_inv_cache_on_drop;
-
- begin
- select * bulk collect into l_test_report from table(ut3_develop.ut.run(sys_context('USERENV', 'CURRENT_USER') || '.tst_package_to_be_dropped'));
- ut.fail('Cache not invalidated on package drop');
- exception
- when others then
- ut.expect(sqlerrm).to_be_like('%tst_package_to_be_dropped%does not exist%');
- end;
-
- end;
- procedure setup_inv_cache_on_drop is
- pragma autonomous_transaction;
- begin
- execute immediate 'create or replace package tst_package_to_be_dropped as
- --%suite
-
- --%test
- procedure test1;
-end;';
-
- execute immediate 'create or replace package body tst_package_to_be_dropped as
- procedure test1 is begin ut.expect(1).to_equal(1); end;
- procedure test2 is begin ut.expect(1).to_equal(1); end;
-end;';
- end;
-
- procedure clean_inv_cache_on_drop is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package tst_package_to_be_dropped';
- exception
- when ex_obj_doesnt_exist then
- null;
- end;
-
- procedure test_inv_pck_bodies is
- l_test_report ut3_develop.ut_varchar2_list;
- begin
-
- select * bulk collect into l_test_report from table(ut3_develop.ut.run(sys_context('USERENV', 'CURRENT_USER')||'.test_dependencies', a_support_info => 0));
-
- ut.expect(l_test_report(l_test_report.count-1)).to_be_like('1 test_, 0 failed, 0 errored, 0 disabled, 0 warning(s)');
- --execute immediate 'select * from table(ut3_develop.ut.run(''UT3_DEVELOP.test_dependencies'', ut3_develop.utplsql_test_reporter()))' into l_result;
-
--- ut.expect(l_result).to_equal(ut3_develop.ut_utils.gc_success);
- end;
- procedure setup_inv_pck_bodies is
- pragma autonomous_transaction;
- begin
- execute immediate 'create table test_dependency_table (id integer)';
- execute immediate 'create or replace package test_dependencies as
- -- %suite
-
- -- %test
- procedure dependant;
-end;';
- execute immediate 'create or replace package body test_dependencies as
- gc_dependant_variable test_dependency_table.id%type;
- procedure dependant is begin null; end;
-end;';
-
- execute immediate 'alter table test_dependency_table modify id number';
-
- end;
- procedure clean_inv_pck_bodies is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop table test_dependency_table';
- execute immediate 'drop package test_dependencies';
- end;
-
- procedure test_pck_with_dollar is
- l_objects_to_run ut3_develop.ut_suite_items;
- l_suite ut3_develop.ut_suite;
- begin
- --act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list('tst_package_with$dollar'));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
-
- l_suite := treat(l_objects_to_run(1) as ut3_develop.ut_suite);
- ut.expect(l_suite.name).to_equal('tst_package_with$dollar');
- end;
- procedure setup_pck_with_dollar is
- pragma autonomous_transaction;
- begin
- execute immediate 'create or replace package tst_package_with$dollar as
- --%suite
-
- --%test
- procedure test1;
-end;';
-
- execute immediate 'create or replace package body tst_package_with$dollar as
- procedure test1 is begin ut.expect(1).to_equal(1); end;
- procedure test2 is begin ut.expect(1).to_equal(1); end;
-end;';
- end;
- procedure clean_pck_with_dollar is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package tst_package_with$dollar';
- end;
-
-
- procedure test_pck_with_hash is
- l_objects_to_run ut3_develop.ut_suite_items;
- l_suite ut3_develop.ut_suite;
- begin
- --act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list('tst_package_with#hash'));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
-
- l_suite := treat(l_objects_to_run(1) as ut3_develop.ut_suite);
- ut.expect(l_suite.name).to_equal('tst_package_with#hash');
- end;
- procedure setup_pck_with_hash is
- pragma autonomous_transaction;
- begin
- execute immediate 'create or replace package tst_package_with#hash as
- --%suite
-
- --%test
- procedure test1;
-end;';
-
- execute immediate 'create or replace package body tst_package_with#hash as
- procedure test1 is begin ut.expect(1).to_equal(1); end;
- procedure test2 is begin ut.expect(1).to_equal(1); end;
-end;';
- end;
- procedure clean_pck_with_hash is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package tst_package_with#hash';
- end;
-
-
- procedure test_test_with_dollar is
- l_objects_to_run ut3_develop.ut_suite_items;
- l_suite ut3_develop.ut_suite;
- l_test ut3_develop.ut_test;
- begin
- --act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list('tst_package_with_dollar_test.test$1'));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
-
- l_suite := treat(l_objects_to_run(1) as ut3_develop.ut_suite);
-
- ut.expect(l_suite.name).to_equal('tst_package_with_dollar_test');
- ut.expect(l_suite.items.count).to_equal(1);
-
- l_test := treat(l_suite.items(1) as ut3_develop.ut_test);
-
- ut.expect(l_test.name).to_equal('test$1');
-
- end;
- procedure setup_test_with_dollar is
- pragma autonomous_transaction;
- begin
- execute immediate 'create or replace package tst_package_with_dollar_test as
- --%suite
-
- --%test
- procedure test$1;
-end;';
-
- execute immediate 'create or replace package body tst_package_with_dollar_test as
- procedure test$1 is begin ut.expect(1).to_equal(1); end;
-end;';
- end;
- procedure clean_test_with_dollar is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package tst_package_with_dollar_test';
- end;
-
- procedure test_test_with_hash is
- l_objects_to_run ut3_develop.ut_suite_items;
- l_suite ut3_develop.ut_suite;
- l_test ut3_develop.ut_test;
- begin
- --act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list('tst_package_with_hash_test.test#1'));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
-
- l_suite := treat(l_objects_to_run(1) as ut3_develop.ut_suite);
-
- ut.expect(l_suite.name).to_equal('tst_package_with_hash_test');
- ut.expect(l_suite.items.count).to_equal(1);
-
- l_test := treat(l_suite.items(1) as ut3_develop.ut_test);
-
- ut.expect(l_test.name).to_equal('test#1');
-
- end;
- procedure setup_test_with_hash is
- pragma autonomous_transaction;
- begin
- execute immediate 'create or replace package tst_package_with_hash_test as
- --%suite
-
- --%test
- procedure test#1;
-end;';
-
- execute immediate 'create or replace package body tst_package_with_hash_test as
- procedure test#1 is begin ut.expect(1).to_equal(1); end;
-end;';
- end;
- procedure clean_test_with_hash is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package tst_package_with_hash_test';
- end;
-
- procedure test_empty_suite_path is
- l_objects_to_run ut3_develop.ut_suite_items;
- l_suite ut3_develop.ut_suite;
- begin
-
- --act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list('tst_empty_suite_path'));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
-
- l_suite := treat(l_objects_to_run(1) as ut3_develop.ut_suite);
-
- ut.expect(l_suite.name).to_equal('tst_empty_suite_path');
- end;
-
- procedure setup_empty_suite_path is
- pragma autonomous_transaction;
- begin
- execute immediate 'create or replace package tst_empty_suite_path as
- --%suite
- --%suitepath
-
- --%test
- procedure test1;
-end;';
- execute immediate 'create or replace package body tst_empty_suite_path as
- procedure test1 is begin ut.expect(1).to_equal(1); end;
-end;';
- end;
-
- procedure clean_empty_suite_path is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package tst_empty_suite_path';
- end;
-
- procedure test_pck_with_same_path is
- l_objects_to_run ut3_develop.ut_suite_items;
- l_suite1 ut3_develop.ut_logical_suite;
- l_suite2 ut3_develop.ut_logical_suite;
- l_suite3 ut3_develop.ut_suite;
- begin
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(':test1.test2$.test_package_same_1'));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
-
- l_suite1 := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_suite1.name).to_equal('test1');
- ut.expect(l_suite1.items.count).to_equal(1);
-
- l_suite2 := treat(l_suite1.items(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_suite2.name).to_equal('test2$');
- ut.expect(l_suite2.items.count).to_equal(1);
-
- l_suite3 := treat(l_suite2.items(1) as ut3_develop.ut_suite);
- ut.expect(l_suite3.name).to_equal('test_package_same_1');
- end;
-
- procedure setup_pck_with_same_path is
- pragma autonomous_transaction;
- begin
- execute immediate 'create or replace package test_package_same_1 as
- --%suite
- --%suitepath(test1.test2$)
-
- --%test
- procedure test1;
-end;';
- execute immediate 'create or replace package body test_package_same_1 as
- procedure test1 is begin null; end;
-end;';
- execute immediate 'create or replace package test_package_same_1_a as
- --%suite
- --%suitepath(test1.test2$)
-
- --%test
- procedure test1;
-end;';
- execute immediate 'create or replace package body test_package_same_1_a as
- procedure test1 is begin null; end;
-end;';
- end;
-
- procedure clean_pck_with_same_path is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package test_package_same_1';
- execute immediate 'drop package test_package_same_1_a';
- end;
-
- procedure setup_disabled_pck is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace package test_disabled_floating as
- --%suite
-
- --%test
- procedure test1;
-
- --%disabled
-
- --%test
- procedure test2;
-
-end;]';
- end;
-
- procedure clean_disabled_pck is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package test_disabled_floating';
- end;
-
- procedure disable_suite_floating_annot is
- l_objects_to_run ut3_develop.ut_suite_items;
- l_suite ut3_develop.ut_suite;
- begin
- --Arrange
- setup_disabled_pck;
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list('test_disabled_floating'));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_suite := treat(l_objects_to_run(1) as ut3_develop.ut_suite);
- ut.expect(l_suite.name).to_equal('test_disabled_floating');
- ut.expect(l_suite.get_disabled_flag()).to_be_true();
-
- clean_disabled_pck;
- end;
-
- procedure pck_proc_in_ctx_by_name is
- c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||'.test_package_with_ctx.test1';
- l_objects_to_run ut3_develop.ut_suite_items;
-
- l_test_suite ut3_develop.ut_logical_suite;
- l_ctx_suite ut3_develop.ut_logical_suite;
- l_test_proc ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
-
- l_test_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_test_suite.name).to_equal('test_package_with_ctx');
- ut.expect(l_test_suite.items.count).to_equal(1);
-
- l_ctx_suite := treat(l_test_suite.items(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_ctx_suite.name).to_equal('some_context');
- ut.expect(l_ctx_suite.description).to_equal('Some context description');
- ut.expect(l_ctx_suite.items.count).to_equal(1);
-
- l_test_proc := treat(l_ctx_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test_proc.name).to_equal('test1');
- end;
-
- procedure pck_proc_in_ctx_by_path is
- c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||':test_package_with_ctx.some_context.test1';
- l_objects_to_run ut3_develop.ut_suite_items;
-
- l_test_suite ut3_develop.ut_logical_suite;
- l_ctx_suite ut3_develop.ut_logical_suite;
- l_test_proc ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
-
- l_test_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_test_suite.name).to_equal('test_package_with_ctx');
- ut.expect(l_test_suite.items.count).to_equal(1);
-
- l_ctx_suite := treat(l_test_suite.items(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_ctx_suite.name).to_equal('some_context');
- ut.expect(l_ctx_suite.description).to_equal('Some context description');
- ut.expect(l_ctx_suite.items.count).to_equal(1);
-
- l_test_proc := treat(l_ctx_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test_proc.name).to_equal('test1');
- end;
-
- procedure test_get_schema_ut_packages is
- l_expected ut3_develop.ut_object_names;
- l_actual ut3_develop.ut_object_names;
- begin
- l_expected := ut3_develop.ut_object_names(
- ut3_develop.ut_object_name('UT3_DEVELOP','SOME_TEST_PACKAGE')
- );
- l_actual := ut3_tester_helper.run_helper.get_schema_ut_packages('UT3_DEVELOP');
-
- ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
- end;
-
- procedure create_ut3_suite is
- begin
- ut3_tester_helper.run_helper.create_ut3_suite();
- end;
-
- procedure drop_ut3_suite is
- pragma autonomous_transaction;
- begin
- ut3_tester_helper.run_helper.drop_ut3_suite();
- end;
-
- procedure add_new_long_test_package is
- l_actual ut3_develop.ut_object_names;
- l_expected_message varchar2(500);
- begin
- l_expected_message := q'[ORA-20217: 'Suitepath exceeds 1000 CHAR on: UT3_DEVELOP.DUMMY_LONG_TEST_PACKAGE,UT3_DEVELOP.DUMMY_LONG_TEST_PACKAGE1'%]';
- l_actual := ut3_tester_helper.run_helper.get_schema_ut_packages('UT3_DEVELOP');
- ut.fail('Expected exception for suitpaths over 1k for two packages');
- exception
- when others then
- ut.expect(dbms_utility.format_error_stack()).to_be_like(l_expected_message);
- ut.expect(SQLCODE).to_equal(ut3_develop.ut_utils.gc_value_too_large);
- end;
-
- procedure setup_remove_annot_test is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace package test_removing_annotation as
- --%suite
-
- --%test
- procedure test1;
-
- --%test
- procedure test2;
-
-end;]';
- end;
-
- procedure remove_annot_from_test is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace package test_removing_annotation as
-
- procedure test1;
-
- procedure test2;
-
-end;]';
- end;
-
- procedure rem_one_annot_test is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace package test_removing_annotation as
- --%suite
-
- procedure test1;
-
- --%test
- procedure test2;
-
-end;]';
- execute immediate q'[create or replace package body test_removing_annotation as
-
- procedure test1 is
- begin
- ut.expect(1).to_equal(1);
- end;
-
- procedure test2 is
- begin
- ut.expect(1).to_equal(1);
- end;
-
-end;]';
- end;
-
- procedure clean_remove_annot_test is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package test_removing_annotation';
- end;
-
- procedure test_rem_cache_on_create is
- l_test_report ut3_develop.ut_varchar2_list;
- begin
-
- select * bulk collect into l_test_report from table(ut3_develop.ut.run(sys_context('USERENV', 'CURRENT_USER')||'.test_removing_annotation'));
-
- -- drop all tests
- remove_annot_from_test;
-
- begin
- select * bulk collect into l_test_report from table(ut3_develop.ut.run(sys_context('USERENV', 'CURRENT_USER') || '.test_removing_annotation'));
- ut.fail('Expected exception ORA-20204 was not raised');
- exception
- when others then
- ut.expect(sqlerrm).to_be_like('%ORA-20204: Suite package ut3_tester.test_removing_annotation does not exist%');
- end;
-
- end;
-
- procedure test_rem_cache_on_crt_anno is
- l_test_report ut3_develop.ut_varchar2_list;
- l_results clob;
- begin
-
- select * bulk collect into l_test_report from table(ut3_develop.ut.run(sys_context('USERENV', 'CURRENT_USER')||'.test_removing_annotation'));
-
- -- drop single test
- rem_one_annot_test;
- ut3_develop.ut.run(sys_context('USERENV', 'CURRENT_USER')|| '.test_removing_annotation',a_reporter => ut3_develop.ut_documentation_reporter() );
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).to_be_like( '%1 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)%' );
-
- end;
-
- procedure test_wild_card_obj_name is
- c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||'.test_package_*';
- l_objects_to_run ut3_develop.ut_suite_items;
- l_test_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test2_suite ut3_develop.ut_logical_suite;
- l_ctx_suite ut3_develop.ut_logical_suite;
- l_test_proc ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(3);
-
-
- for i in 1 .. 3 loop
- l_test_suite := treat(l_objects_to_run(i) as ut3_develop.ut_logical_suite);
- ut.expect(l_test_suite.name in ('test_package_with_ctx','tests', 'tests2')).to_be_true;
-
- case l_test_suite.name
- when 'test_package_with_ctx' then
- ut.expect(l_test_suite.items.count).to_equal(1);
- l_ctx_suite:= treat(l_test_suite.items(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_ctx_suite.name).to_equal('some_context');
- ut.expect(l_ctx_suite.description).to_equal('Some context description');
- ut.expect(l_ctx_suite.items.count).to_equal(1);
- l_test_proc := treat(l_ctx_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test_proc.name).to_equal('test1');
- when 'tests' then
- l_test1_suite := treat(l_test_suite.items(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_test1_suite.name).to_equal('test_package_1');
- ut.expect(l_test1_suite.items.count).to_equal(3);
- ut.expect(l_test1_suite.rollback_type).to_equal(ut3_develop.ut_utils.gc_rollback_manual);
- l_test2_suite := treat(l_test1_suite.items(1) as ut3_develop.ut_logical_suite);
-
- ut.expect(l_test2_suite.name).to_equal('test_package_2');
- ut.expect(l_test2_suite.items.count).to_equal(3);
- ut.expect(l_test2_suite.rollback_type).to_equal(ut3_develop.ut_utils.gc_rollback_manual);
- when 'tests2' then
- l_test1_suite := treat(l_test_suite.items(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_test1_suite.name).to_equal('test_package_3');
- ut.expect(l_test1_suite.items.count).to_equal(3);
- end case;
-
- end loop;
-
- end;
-
- procedure test_wild_card_prc_name is
- c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||'.test_package_1.test*';
- l_objects_to_run ut3_develop.ut_suite_items;
- l_test_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test1_proc ut3_develop.ut_test;
- l_test2_proc ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_test_suite.name).to_equal('tests');
-
- l_test1_suite := treat(l_test_suite.items(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_test1_suite.name).to_equal('test_package_1');
- ut.expect(l_test1_suite.items.count).to_equal(2);
-
- l_test1_proc := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test1_proc.name).to_equal('test1');
-
- l_test2_proc := treat(l_test1_suite.items(2) as ut3_develop.ut_test);
- ut.expect(l_test2_proc.name).to_equal('test2');
- end;
-
- procedure test_wild_card_path_name is
- c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||':tests*';
- l_objects_to_run ut3_develop.ut_suite_items;
- l_test_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test2_suite ut3_develop.ut_logical_suite;
- l_ctx_suite ut3_develop.ut_logical_suite;
- l_test_proc ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(2);
-
-
- for i in 1 .. 2 loop
- l_test_suite := treat(l_objects_to_run(i) as ut3_develop.ut_logical_suite);
- ut.expect(l_test_suite.name in ('tests', 'tests2')).to_be_true;
-
- case l_test_suite.name
- when 'tests' then
- l_test1_suite := treat(l_test_suite.items(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_test1_suite.name).to_equal('test_package_1');
- ut.expect(l_test1_suite.items.count).to_equal(3);
-
- for i in 1 ..3 loop
- case l_test1_suite.items(i).self_type
- when 'UT_SUITE' then
- l_test2_suite := treat(l_test1_suite.items(i) as ut3_develop.ut_logical_suite);
- ut.expect(l_test2_suite.name).to_equal('test_package_2');
- ut.expect(l_test2_suite.items.count).to_equal(3);
-
- l_test_proc := treat(l_test2_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test_proc.name in ('test1', 'test2','context_test')).to_be_true;
-
- l_test_proc := treat(l_test2_suite.items(2) as ut3_develop.ut_test);
- ut.expect(l_test_proc.name in ('test1', 'test2','context_test')).to_be_true;
-
- l_test_proc := treat(l_test2_suite.items(3) as ut3_develop.ut_test);
- ut.expect(l_test_proc.name in ('test1', 'test2','context_test')).to_be_true;
-
- when 'UT_TEST' then
- l_test_proc := treat(l_test1_suite.items(i) as ut3_develop.ut_test);
- ut.expect(l_test_proc.name in ('test1', 'test2')).to_be_true;
- end case;
- end loop;
- when 'tests2' then
- ut.expect(l_test_suite.items.count).to_equal(1);
- l_test1_suite := treat(l_test_suite.items(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_test1_suite.name).to_equal('test_package_3');
- ut.expect(l_test1_suite.items.count).to_equal(3);
- for i in 1 .. 3 loop
- l_test_proc := treat(l_test1_suite.items(i) as ut3_develop.ut_test);
- ut.expect(l_test_proc.name in ('test1', 'test2','disabled_test')).to_be_true;
- end loop;
- end case;
-
- end loop;
-
- end;
-
- procedure test_wild_card_front_obj_name is
- c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||'.*_frontwildcard';
- l_objects_to_run ut3_develop.ut_suite_items;
- l_test_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test1_proc ut3_develop.ut_test;
- l_test2_proc ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_test_suite.name).to_equal('front_wildcard');
- ut.expect(l_test_suite.items.count).to_equal(2);
-
- for i in 1 .. 2 loop
- l_test1_suite := treat(l_test_suite.items(i) as ut3_develop.ut_logical_suite);
- case l_test1_suite.name
- when 'test1_frontwildcard' then
- ut.expect(l_test1_suite.items.count).to_equal(2);
- l_test1_proc := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test1_proc.name).to_equal('first_test');
- l_test2_proc := treat(l_test1_suite.items(2) as ut3_develop.ut_test);
- ut.expect(l_test2_proc.name).to_equal('second_test');
- when 'test2_frontwildcard' then
- ut.expect(l_test1_suite.items.count).to_equal(1);
- l_test1_proc := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test1_proc.name).to_equal('first_test');
- end case;
-
- end loop;
- end;
-
- procedure test_wild_card_front_prc_name is
- c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||'.test1_frontwildcard.*_test';
- l_objects_to_run ut3_develop.ut_suite_items;
- l_test_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test1_proc ut3_develop.ut_test;
- l_test2_proc ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_test_suite.name).to_equal('front_wildcard');
-
- l_test1_suite := treat(l_test_suite.items(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_test1_suite.name).to_equal('test1_frontwildcard');
- ut.expect(l_test1_suite.items.count).to_equal(2);
-
- l_test1_proc := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test1_proc.name).to_equal('first_test');
-
- l_test2_proc := treat(l_test1_suite.items(2) as ut3_develop.ut_test);
- ut.expect(l_test2_proc.name).to_equal('second_test');
- end;
-
- procedure test_wild_card_front_path_name is
- c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||':*_wildcard';
- l_objects_to_run ut3_develop.ut_suite_items;
- l_test_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test1_proc ut3_develop.ut_test;
- l_test2_proc ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_test_suite.name).to_equal('front_wildcard');
- ut.expect(l_test_suite.items.count).to_equal(2);
-
- for i in 1 .. 2 loop
- l_test1_suite := treat(l_test_suite.items(i) as ut3_develop.ut_logical_suite);
- case l_test1_suite.name
- when 'test1_frontwildcard' then
- ut.expect(l_test1_suite.items.count).to_equal(2);
- l_test1_proc := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test1_proc.name).to_equal('first_test');
- l_test2_proc := treat(l_test1_suite.items(2) as ut3_develop.ut_test);
- ut.expect(l_test2_proc.name).to_equal('second_test');
- when 'test2_frontwildcard' then
- ut.expect(l_test1_suite.items.count).to_equal(1);
- l_test1_proc := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test1_proc.name).to_equal('first_test');
- end case;
-
- end loop;
- end;
-
- procedure test_wild_card_mid_obj_name is
- c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||'.middle_*_wildcard';
- l_objects_to_run ut3_develop.ut_suite_items;
- l_test_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test1_proc ut3_develop.ut_test;
- l_test2_proc ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_test_suite.name).to_equal('wild_middle_card');
- ut.expect(l_test_suite.items.count).to_equal(2);
-
- for i in 1 .. 2 loop
- l_test1_suite := treat(l_test_suite.items(i) as ut3_develop.ut_logical_suite);
- case l_test1_suite.name
- when 'middle_test1_wildcard' then
- ut.expect(l_test1_suite.items.count).to_equal(2);
- l_test1_proc := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test1_proc.name).to_equal('middle_first_test');
- l_test2_proc := treat(l_test1_suite.items(2) as ut3_develop.ut_test);
- ut.expect(l_test2_proc.name).to_equal('middle_second_test');
- when 'middle_test2_wildcard' then
- ut.expect(l_test1_suite.items.count).to_equal(1);
- l_test1_proc := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test1_proc.name).to_equal('middle_first_test');
- end case;
-
- end loop;
- end;
-
- procedure test_wild_card_mid_prc_name is
- c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||'.middle_test1_wildcard.middle_*_test';
- l_objects_to_run ut3_develop.ut_suite_items;
- l_test_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test1_proc ut3_develop.ut_test;
- l_test2_proc ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_test_suite.name).to_equal('wild_middle_card');
-
- l_test1_suite := treat(l_test_suite.items(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_test1_suite.name).to_equal('middle_test1_wildcard');
- ut.expect(l_test1_suite.items.count).to_equal(2);
-
- l_test1_proc := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test1_proc.name).to_equal('middle_first_test');
-
- l_test2_proc := treat(l_test1_suite.items(2) as ut3_develop.ut_test);
- ut.expect(l_test2_proc.name).to_equal('middle_second_test');
- end;
-
- procedure test_wild_card_mid_path_name is
- c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||':wild_*card';
- l_objects_to_run ut3_develop.ut_suite_items;
- l_test_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test1_proc ut3_develop.ut_test;
- l_test2_proc ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_test_suite.name).to_equal('wild_middle_card');
- ut.expect(l_test_suite.items.count).to_equal(2);
-
- for i in 1 .. 2 loop
- l_test1_suite := treat(l_test_suite.items(i) as ut3_develop.ut_logical_suite);
- case l_test1_suite.name
- when 'middle_test1_wildcard' then
- ut.expect(l_test1_suite.items.count).to_equal(2);
- l_test1_proc := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test1_proc.name).to_equal('middle_first_test');
- l_test2_proc := treat(l_test1_suite.items(2) as ut3_develop.ut_test);
- ut.expect(l_test2_proc.name).to_equal('middle_second_test');
- when 'middle_test2_wildcard' then
- ut.expect(l_test1_suite.items.count).to_equal(1);
- l_test1_proc := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test1_proc.name).to_equal('middle_first_test');
- end case;
-
- end loop;
- end;
-
- procedure test_wild_card_mul_obj_name is
- c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||'.*_multi_*card';
- l_objects_to_run ut3_develop.ut_suite_items;
- l_test_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test1_proc ut3_develop.ut_test;
- l_test2_proc ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_test_suite.name).to_equal('wildcard_multi_asterisks');
- ut.expect(l_test_suite.items.count).to_equal(2);
-
- for i in 1 .. 2 loop
- l_test1_suite := treat(l_test_suite.items(i) as ut3_develop.ut_logical_suite);
- case l_test1_suite.name
- when 'test1_multi_wildcard' then
- ut.expect(l_test1_suite.items.count).to_equal(2);
- l_test1_proc := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test1_proc.name).to_equal('first_multi_test1');
- l_test2_proc := treat(l_test1_suite.items(2) as ut3_develop.ut_test);
- ut.expect(l_test2_proc.name).to_equal('second_multi_test2');
- when 'test2_multi_wildcard' then
- ut.expect(l_test1_suite.items.count).to_equal(1);
- l_test1_proc := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test1_proc.name).to_equal('first_multi_test1');
- end case;
-
- end loop;
- end;
-
- procedure test_wild_card_mul_prc_name is
- c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||'.test1_multi_wildcard.*_multi_*';
- l_objects_to_run ut3_develop.ut_suite_items;
- l_test_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test1_proc ut3_develop.ut_test;
- l_test2_proc ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_test_suite.name).to_equal('wildcard_multi_asterisks');
-
- l_test1_suite := treat(l_test_suite.items(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_test1_suite.name).to_equal('test1_multi_wildcard');
- ut.expect(l_test1_suite.items.count).to_equal(2);
-
- l_test1_proc := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test1_proc.name).to_equal('first_multi_test1');
-
- l_test2_proc := treat(l_test1_suite.items(2) as ut3_develop.ut_test);
- ut.expect(l_test2_proc.name).to_equal('second_multi_test2');
- end;
-
- procedure test_wild_card_mul_path_name is
- c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||':wild*_multi_*risks';
- l_objects_to_run ut3_develop.ut_suite_items;
- l_test_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test1_proc ut3_develop.ut_test;
- l_test2_proc ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_test_suite.name).to_equal('wildcard_multi_asterisks');
- ut.expect(l_test_suite.items.count).to_equal(2);
-
- for i in 1 .. 2 loop
- l_test1_suite := treat(l_test_suite.items(i) as ut3_develop.ut_logical_suite);
- case l_test1_suite.name
- when 'test1_multi_wildcard' then
- ut.expect(l_test1_suite.items.count).to_equal(2);
- l_test1_proc := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test1_proc.name).to_equal('first_multi_test1');
- l_test2_proc := treat(l_test1_suite.items(2) as ut3_develop.ut_test);
- ut.expect(l_test2_proc.name).to_equal('second_multi_test2');
- when 'test2_multi_wildcard' then
- ut.expect(l_test1_suite.items.count).to_equal(1);
- l_test1_proc := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test1_proc.name).to_equal('first_multi_test1');
- end case;
-
- end loop;
- end;
-
- procedure tst_wild_card_mul_lv_path_name is
- c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||':wild*_multi_*risks.*_multi_wildcard.*_multi_test1';
- l_objects_to_run ut3_develop.ut_suite_items;
- l_test_suite ut3_develop.ut_logical_suite;
- l_test1_suite ut3_develop.ut_logical_suite;
- l_test1_proc ut3_develop.ut_test;
- l_test2_proc ut3_develop.ut_test;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_path));
-
- --Assert
- ut.expect(l_objects_to_run.count).to_equal(1);
- l_test_suite := treat(l_objects_to_run(1) as ut3_develop.ut_logical_suite);
- ut.expect(l_test_suite.name).to_equal('wildcard_multi_asterisks');
- ut.expect(l_test_suite.items.count).to_equal(2);
-
- for i in 1 .. 2 loop
- l_test1_suite := treat(l_test_suite.items(i) as ut3_develop.ut_logical_suite);
- case l_test1_suite.name
- when 'test1_multi_wildcard' then
- ut.expect(l_test1_suite.items.count).to_equal(1);
- l_test1_proc := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test1_proc.name).to_equal('first_multi_test1');
- when 'test2_multi_wildcard' then
- ut.expect(l_test1_suite.items.count).to_equal(1);
- l_test1_proc := treat(l_test1_suite.items(1) as ut3_develop.ut_test);
- ut.expect(l_test1_proc.name).to_equal('first_multi_test1');
- end case;
-
- end loop;
- end;
-
- --%test(Path validation does not fail on Estonian NLS_SORT - fix #1252)
- /*
- Names that differ only where a "_" or "." is:
- tst_char_a / tstxchar_a, test_a / testxa, chars.sub_a / chars.subxa, chars.sub / chars_sub
- */
- procedure create_char_test_packages is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace package tst_char_a is
- --%suite
- --%suitepath(chars.sub_a)
-
- --%test
- procedure test_a;
-
- --%test
- procedure testxa;
- end;]';
- execute immediate q'[create or replace package tstxchar_a is
- --%suite
- --%suitepath(chars.subxa)
-
- --%test
- procedure test_a;
- end;]';
- execute immediate q'[create or replace package tst_char_b is
- --%suite
- --%suitepath(chars_sub)
-
- --%test
- procedure test_b;
- end;]';
- end;
-
- procedure drop_char_test_packages is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package tst_char_a';
- execute immediate 'drop package tstxchar_a';
- execute immediate 'drop package tst_char_b';
- end;
-
- --returns the paths of all tests, sorted and separated by commas
- function get_test_paths(a_items ut3_develop.ut_suite_items) return varchar2 is
- l_paths ut3_develop.ut_varchar2_list := ut3_develop.ut_varchar2_list();
- l_result varchar2(32767);
-
- procedure add_test_paths(a_suite_items ut3_develop.ut_suite_items) is
- begin
- for i in 1 .. a_suite_items.count loop
- if a_suite_items(i) is of (ut3_develop.ut_test) then
- l_paths.extend;
- l_paths(l_paths.last) := a_suite_items(i).path;
- else
- add_test_paths(treat(a_suite_items(i) as ut3_develop.ut_logical_suite).items);
- end if;
- end loop;
- end;
- begin
- add_test_paths(a_items);
- select listagg(column_value, ',') within group (order by column_value) into l_result from table(l_paths);
- return l_result;
- end;
-
- procedure underscore_in_package_name is
- l_objects_to_run ut3_develop.ut_suite_items;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(
- ut3_develop.ut_varchar2_list(sys_context('USERENV', 'CURRENT_USER')||'.tst_char_a')
- );
- --Assert
- ut.expect(get_test_paths(l_objects_to_run)).to_equal('chars.sub_a.tst_char_a.test_a,chars.sub_a.tst_char_a.testxa');
- end;
-
- procedure underscore_in_procedure_name is
- l_objects_to_run ut3_develop.ut_suite_items;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(
- ut3_develop.ut_varchar2_list(sys_context('USERENV', 'CURRENT_USER')||'.tst_char_a.test_a')
- );
- --Assert
- ut.expect(get_test_paths(l_objects_to_run)).to_equal('chars.sub_a.tst_char_a.test_a');
- end;
-
- procedure underscore_in_suitepath is
- l_objects_to_run ut3_develop.ut_suite_items;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(
- ut3_develop.ut_varchar2_list(sys_context('USERENV', 'CURRENT_USER')||':chars.sub_a')
- );
- --Assert
- ut.expect(get_test_paths(l_objects_to_run)).to_equal('chars.sub_a.tst_char_a.test_a,chars.sub_a.tst_char_a.testxa');
- end;
-
- procedure dot_in_suitepath_wildcard is
- l_objects_to_run ut3_develop.ut_suite_items;
- begin
- --Act
- l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(
- ut3_develop.ut_varchar2_list(sys_context('USERENV', 'CURRENT_USER')||':chars.sub*')
- );
- --Assert
- ut.expect(get_test_paths(l_objects_to_run)).to_equal(
- 'chars.sub_a.tst_char_a.test_a,chars.sub_a.tst_char_a.testxa,chars.subxa.tstxchar_a.test_a'
- );
- end;
-
- procedure path_validate_nls_sort is
- l_schema_names ut3_develop.ut_varchar2_rows;
- begin
- --Arrange
- execute immediate q'[alter session set nls_sort='estonian']';
- --Act
- l_schema_names := ut3_develop.ut_suite_manager.get_schema_names(ut3_develop.ut_varchar2_list('ut3'));
- --Asseert
- ut.expect(sqlcode).to_equal(0);
- end;
-
-
- procedure reset_nls_sort is
- begin
- execute immediate q'[alter session set nls_sort='binary']';
- end;
-end test_suite_manager;
-/
diff --git a/test/ut3_tester/core/test_suite_manager.pks b/test/ut3_tester/core/test_suite_manager.pks
deleted file mode 100644
index a7d3bcc20..000000000
--- a/test/ut3_tester/core/test_suite_manager.pks
+++ /dev/null
@@ -1,276 +0,0 @@
-create or replace package test_suite_manager is
-
- --%suite(suite_manager)
- --%suitepath(utplsql.ut3_tester.core)
-
-
- --%beforeall
- procedure compile_dummy_packages;
- --%afterall
- procedure drop_dummy_packages;
-
- --%test(Prepare Runner For The Schema)
- procedure test_schema_run;
-
- --%test(Prepare runner for the top 2 package by package user.package_name)
- procedure test_top2_by_name;
-
- --%test(Prepare runner includes each suite item once when given paths overlap)
- procedure test_overlapping_paths;
-
- --%test(Prepare runner for the top2 package by name cur user)
- procedure test_top2_bt_name_cur_user;
-
- --%test(Prepare runner for the subsuite by path)
- procedure test_by_path_to_subsuite;
-
- --%test(Prepare runner for the subsuite by path for current user)
- procedure test_by_path_to_subsuite_cu;
-
- --%test(Prepare runner for the subsuite proc only by path)
- procedure test_subsute_proc_by_path;
-
- --%test(Prepare runner for the subsuite proc only by path for current user)
- procedure test_subsute_proc_by_path_cu;
-
- --%test(Prepare runner for the top package by package name)
- procedure test_top_pack_by_name;
-
- --%test(Prepare runner for the top package by package name for current user)
- procedure test_top_pack_by_name_cu;
-
- --%test(Prepare runner for the top package by path)
- procedure test_top_pack_by_path;
-
- --%test(Prepare runner for the top package by path for current user)
- procedure test_top_pack_by_path_cu;
-
- --%test(Prepare runner for the top package procedure by path)
- procedure test_top_pck_proc_by_path;
-
- --%test(Prepare runner for the top package procedure by path for current user)
- procedure test_top_pck_proc_by_path_cu;
-
- --%test(Prepare runner for the top package procedure without sub-suites by package name)
- procedure test_top_pkc_proc_by_name;
-
- --%test(Prepare runner for the top package procedure without sub-suites by package name for current user)
- procedure test_top_pkc_proc_by_name_cu;
-
- --%test(Prepare runner for the top package without sub-suites by package name)
- procedure test_top_pkc_nosub_by_name;
-
- --%test(Prepare runner for the top package without sub-suites by package name for current user)
- procedure test_top_pkc_nosub_by_name_cu;
-
- --%test(Prepare runner for the suites package by path)
- procedure test_top_subpck_by_path;
-
- --%test(Prepare runner for the suites package by path for current user)
- procedure test_top_subpck_by_path_cu;
-
- --%test(Prepare runner for invalid package - it will add to suite but fail on exec )
- --%beforetest(compile_invalid_package)
- --%aftertest(drop_invalid_package)
- procedure test_search_invalid_pck;
- procedure compile_invalid_package;
- procedure drop_invalid_package;
-
- --%test(Prepare runner for nonexisting package with schema)
- procedure test_search_nonexisting_pck;
-
- --%test(Prepare runner for nonexisting package using wildcard filter)
- procedure test_search_nonex_pck_wild;
-
- --%test(Prepare runner for nonexisting procedure using wildcard filter)
- procedure test_search_nonex_prc_wild;
-
- --%test(Prepare runner for nonexisting path using wildcard filter)
- procedure test_search_nonex_path_wild;
-
- --%test(Prepare runner for nonexisting package without schema)
- procedure test_search_nonexist_sch_pck;
-
- --%test(Test description with comma)
- --%beforetest(setup_desc_with_comma)
- --%aftertest(clean_desc_with_comma)
- procedure test_desc_with_comma;
- procedure setup_desc_with_comma;
- procedure clean_desc_with_comma;
-
- --%test(Invalidate cache on package drop)
- --%beforetest(setup_inv_cache_on_drop)
- --%aftertest(clean_inv_cache_on_drop)
- procedure test_inv_cache_on_drop;
- procedure setup_inv_cache_on_drop;
- procedure clean_inv_cache_on_drop;
-
- --%test(Includes Invalid Package Bodies In The Run)
- --%beforetest(setup_inv_pck_bodies)
- --%aftertest(clean_inv_pck_bodies)
- procedure test_inv_pck_bodies;
- procedure setup_inv_pck_bodies;
- procedure clean_inv_pck_bodies;
-
- --%test(Package With Dollar Sign)
- --%beforetest(setup_pck_with_dollar)
- --%aftertest(clean_pck_with_dollar)
- procedure test_pck_with_dollar;
- procedure setup_pck_with_dollar;
- procedure clean_pck_with_dollar;
-
- --%test(Package With Hash Sign)
- --%beforetest(setup_pck_with_hash)
- --%aftertest(clean_pck_with_hash)
- procedure test_pck_with_hash;
- procedure setup_pck_with_hash;
- procedure clean_pck_with_hash;
-
- --%test(Package with test with dollar sign)
- --%beforetest(setup_test_with_dollar)
- --%aftertest(clean_test_with_dollar)
- procedure test_test_with_dollar;
- procedure setup_test_with_dollar;
- procedure clean_test_with_dollar;
-
- --%test(Package with test with hash sign)
- --%beforetest(setup_test_with_hash)
- --%aftertest(clean_test_with_hash)
- procedure test_test_with_hash;
- procedure setup_test_with_hash;
- procedure clean_test_with_hash;
-
-
- --%test(Setup suite with empty suitepath)
- --%beforetest(setup_empty_suite_path)
- --%aftertest(clean_empty_suite_path)
- procedure test_empty_suite_path;
- procedure setup_empty_suite_path;
- procedure clean_empty_suite_path;
-
- --%test(only the defined in suitepath suite/test is executed if multiple similarly named test suites exist in the context differed only by comment)
- --%beforetest(setup_pck_with_same_path)
- --%aftertest(clean_pck_with_same_path)
- procedure test_pck_with_same_path;
- procedure setup_pck_with_same_path;
- procedure clean_pck_with_same_path;
-
- --%test(Whole suite gets disabled with floating annotation)
- procedure disable_suite_floating_annot;
-
- --%test(Prepare runner for a package procedure inside context)
- procedure pck_proc_in_ctx_by_name;
-
- --%test(Prepare runner for a package procedure inside context by path)
- procedure pck_proc_in_ctx_by_path;
-
- --%context(get_schema_ut_packages)
-
- --%test(returns list of all unit test packages in given schema excluding packages that are not suites)
- --%beforetest(create_ut3_suite)
- --%aftertest(drop_ut3_suite)
- procedure test_get_schema_ut_packages;
- procedure create_ut3_suite;
- procedure drop_ut3_suite;
-
- --%endcontext
-
- --%test(Adds suitepath to cache over 1k characters long)
- --%beforetest(create_dummy_long_test_package)
- --%aftertest(drop_dummy_long_test_package)
- procedure add_new_long_test_package;
- procedure create_dummy_long_test_package;
- procedure drop_dummy_long_test_package;
-
-
- procedure setup_remove_annot_test;
- procedure clean_remove_annot_test;
-
- --%test(Remove cache on package create or replace when all annotations removed)
- --%beforetest(setup_remove_annot_test)
- --%aftertest(clean_remove_annot_test)
- procedure test_rem_cache_on_create;
-
-
- --%test(Remove cache on package create or replace when single annotation removed)
- --%beforetest(setup_remove_annot_test)
- --%aftertest(clean_remove_annot_test)
- procedure test_rem_cache_on_crt_anno;
-
- --%context(wildcard_filters)
-
- --%test(Execute test_packages using a object_name with wildcard at the end )
- procedure test_wild_card_obj_name;
-
- --%test(Execute test_packages using a procedure name with wildcard at the end)
- procedure test_wild_card_prc_name;
-
- --%test(Execute test_packages using a path name with wildcard at the end)
- procedure test_wild_card_path_name;
-
- --%test(Execute test_packages using a object_name with wildcard in the front)
- procedure test_wild_card_front_obj_name;
-
- --%test(Execute test_packages using a procedure name with wildcard in the front)
- procedure test_wild_card_front_prc_name;
-
- --%test(Execute test_packages using a path name with wildcard in the front)
- procedure test_wild_card_front_path_name;
-
- --%test(Execute test_packages using a object_name with wildcard in the middle)
- procedure test_wild_card_mid_obj_name;
-
- --%test(Execute test_packages using a procedure name with wildcard in the middle)
- procedure test_wild_card_mid_prc_name;
-
- --%test(Execute test_packages using a path name with wildcard in the middle)
- procedure test_wild_card_mid_path_name;
-
- --%test(Execute test_packages using a object_name with multiple wildcards)
- procedure test_wild_card_mul_obj_name;
-
- --%test(Execute test_packages using a procedure name with multiple wildcards)
- procedure test_wild_card_mul_prc_name;
-
- --%test(Execute test_packages using a path name with multiple wildcards)
- procedure test_wild_card_mul_path_name;
-
- --%test(Execute test_packages using a path name with multiple wildcards on different level)
- procedure tst_wild_card_mul_lv_path_name;
-
- --%endcontext
-
- --%context(literal_characters)
- --%displayname(Characters other than * in a path match only themselves)
-
- --%beforeall
- procedure create_char_test_packages;
- --%afterall
- procedure drop_char_test_packages;
-
- --%test(Underscore in a package name is not a wildcard)
- procedure underscore_in_package_name;
-
- --%test(Underscore in a procedure name is not a wildcard)
- procedure underscore_in_procedure_name;
-
- --%test(Underscore in a suitepath is not a wildcard)
- procedure underscore_in_suitepath;
-
- --%test(Dot in a suitepath with a wildcard is not a wildcard)
- procedure dot_in_suitepath_wildcard;
-
- --%endcontext
-
- --%context(paths validation)
-
- --%test(Path validation does not fail on Estonian NLS_SORT - fix #1252)
- --%aftertest(reset_nls_sort)
- procedure path_validate_nls_sort;
-
- procedure reset_nls_sort;
-
- --%endcontext
-
-end test_suite_manager;
-/
diff --git a/test/ut3_tester/core/test_ut_executable.pkb b/test/ut3_tester/core/test_ut_executable.pkb
deleted file mode 100644
index e27a2e432..000000000
--- a/test/ut3_tester/core/test_ut_executable.pkb
+++ /dev/null
@@ -1,78 +0,0 @@
-create or replace package body test_ut_executable is
-
- g_dbms_output_text varchar2(30) := 'Some output from procedure';
-
- procedure exec_schema_package_proc is
- l_executable ut3_develop.ut_executable;
- l_test ut3_develop.ut_test;
- l_result boolean;
- begin
- --Arrange
- l_test := ut3_develop.ut_test(a_object_name => 'test_ut_executable',a_name => 'test_ut_executable', a_line_no=> 1);
- l_executable := ut3_develop.ut_executable_test( null, 'test_ut_executable', 'passing_proc', ut3_develop.ut_utils.gc_test_execute );
- --Act
- l_result := l_executable.do_execute(l_test);
- --Assert
- ut.expect(l_result).to_be_true;
- ut.expect(l_executable.serveroutput).to_be_null;
- ut.expect(l_executable.get_error_stack_trace()).to_be_null;
- end;
-
- procedure exec_package_proc_output is
- l_executable ut3_develop.ut_executable;
- l_test ut3_develop.ut_test;
- l_result boolean;
- begin
- --Arrange
- l_test := ut3_develop.ut_test(a_object_owner => 'ut3_tester', a_object_name => 'test_ut_executable',a_name => 'test_ut_executable', a_line_no=> 1);
- l_executable := ut3_develop.ut_executable_test( a_owner => 'ut3_tester', a_package => 'test_ut_executable',
- a_procedure_name => 'output_proc', a_executable_type => ut3_develop.ut_utils.gc_test_execute );
- --Act
- l_result := l_executable.do_execute(l_test);
- --Assert
- ut.expect(l_result).to_be_true;
- ut.expect(l_executable.serveroutput).to_equal(to_clob(g_dbms_output_text||chr(10)));
- ut.expect(l_executable.get_error_stack_trace()).to_be_null;
- end;
-
- procedure exec_failing_proc is
- l_executable ut3_develop.ut_executable;
- l_test ut3_develop.ut_test;
- l_result boolean;
- begin
- --Arrange
- l_test := ut3_develop.ut_test(a_object_owner => 'ut3_tester', a_object_name => 'test_ut_executable',a_name => 'test_ut_executable', a_line_no=> 1);
- l_executable := ut3_develop.ut_executable_test( 'ut3_tester', 'test_ut_executable', 'throwing_proc', ut3_develop.ut_utils.gc_test_execute );
- --Act
- l_result := l_executable.do_execute(l_test);
- --Assert
- ut.expect(l_result).to_be_false;
- ut.expect(l_executable.serveroutput).to_be_null;
- ut.expect(l_executable.get_error_stack_trace()).to_be_like('ORA-06501: PL/SQL: program error%');
- end;
-
- procedure form_name is
- begin
- ut.expect(ut3_develop.ut_executable_test( user, ' package ', 'proc', null ).form_name()).to_equal(user||'.package.proc');
- ut.expect(ut3_develop.ut_executable_test( null, 'package', ' proc ', null ).form_name()).to_equal('package.proc');
- ut.expect(ut3_develop.ut_executable_test( null, 'proc', null, null ).form_name()).to_equal('proc');
- ut.expect(ut3_develop.ut_executable_test( ' '||user||' ', 'proc', null, null ).form_name()).to_equal(user||'.proc');
- end;
-
- procedure passing_proc is
- begin
- null;
- end;
-
- procedure output_proc is
- begin
- dbms_output.put_line('Some output from procedure');
- end;
-
- procedure throwing_proc is
- begin
- raise program_error;
- end;
-
-end;
-/
diff --git a/test/ut3_tester/core/test_ut_executable.pks b/test/ut3_tester/core/test_ut_executable.pks
deleted file mode 100644
index 882f0f209..000000000
--- a/test/ut3_tester/core/test_ut_executable.pks
+++ /dev/null
@@ -1,33 +0,0 @@
-create or replace package test_ut_executable is
-
- --%suite(ut_executable)
- --%suitepath(utplsql.ut3_tester.core)
-
- --%context(do_execute)
-
- --%test(Executes procedure in current schema when user was not provided)
- procedure exec_schema_package_proc;
-
- --%test(Executes procedure and saves dbms_output)
- procedure exec_package_proc_output;
-
- --%test(Executes a procedure raising exception, saves dbms_output and exception stack trace)
- procedure exec_failing_proc;
-
- --%endcontext
-
- --%context(form_name)
-
- --%test(Builds a name for the executable test)
- procedure form_name;
-
- --%endcontext
-
- procedure passing_proc;
-
- procedure output_proc;
-
- procedure throwing_proc;
-
-end;
-/
diff --git a/test/ut3_tester/core/test_ut_metadata.pkb b/test/ut3_tester/core/test_ut_metadata.pkb
deleted file mode 100644
index 905f31081..000000000
--- a/test/ut3_tester/core/test_ut_metadata.pkb
+++ /dev/null
@@ -1,109 +0,0 @@
-create or replace package body test_ut_metadata is
-
- c_cr constant varchar2(1) := chr(13);
- c_lf constant varchar2(2) := chr(10);
- c_crlf constant varchar2(2) := chr(13)||chr(10);
-
- c_pks_lf constant varchar2(1000) :=
- 'create or replace package test_package1 is'||c_lf
- ||' procedure test_max_length;'||c_lf
- ||'end;'
- ;
- c_pkg_lf constant varchar2(20000) :=
- q'[create or replace package body test_package1 is]'||c_lf
- ||q'[ procedure test_max_length is]'||c_lf
- ||q'[ begin]'||c_lf
- ||q'[ /* long comment over 4000 characters 1]'||rpad('*', 8000, '*')||'*/'||c_lf
- ||substrb(q'[ /* long comment 3999 and linebreak]'||rpad('*', 4000, '*'), 1, 3997)||'*/'||c_lf
- ||q'[ dbms_output.put_line('test_max_length called.');]'||c_lf
- ||q'[ end;]'||c_lf
- ||q'[ end;]'
- ;
-
- procedure test_over_varchar2_limit_trim_first_4000_lf
- is
- l_actual varchar2(32767);
- l_expect varchar2(32767);
- begin
- l_expect := trim(substrb(q'[ /* long comment over 4000 characters 1]'||rpad('*', 8000, '*')||'*/'||c_lf, 1, 4000));
- l_actual := ut3_develop.ut_metadata.get_source_definition_line('UT3_TESTER', 'TEST_PACKAGE1', 4);
- ut.expect(l_actual).to_equal(l_expect);
-
- l_expect := trim(substrb(q'[ /* long comment 3999 and linebreak]'||rpad('*', 4000, '*'), 1, 3997)||'*/'||c_lf);
- l_actual := ut3_develop.ut_metadata.get_source_definition_line('UT3_TESTER', 'TEST_PACKAGE1', 5);
- ut.expect(l_actual).to_equal(l_expect);
-
- l_expect := 'dbms_output.put_line(''test_max_length called.'');'||c_lf;
- l_actual := ut3_develop.ut_metadata.get_source_definition_line('UT3_TESTER', 'TEST_PACKAGE1', 6);
- ut.expect(l_actual).to_equal(l_expect);
- end;
-
- procedure test_over_varchar2_limit_trim_first_4000_crlf is
- l_actual varchar2(32767);
- l_expect varchar2(32767);
- begin
- l_expect := trim(substrb(q'[ /* long comment over 4000 characters 1]'||rpad('*', 8000, '*')||'*/'||c_crlf, 1, 4000));
- l_actual := ut3_develop.ut_metadata.get_source_definition_line('UT3_TESTER', 'TEST_PACKAGE1', 4);
- ut.expect(l_actual).to_equal(l_expect);
-
- l_expect := trim(substrb(q'[ /* long comment 3999 and linebreak]'||rpad('*', 4000, '*'), 1, 3997)||'*/'||c_cr);
- l_actual := ut3_develop.ut_metadata.get_source_definition_line('UT3_TESTER', 'TEST_PACKAGE1', 5);
- ut.expect(l_actual).to_equal(l_expect);
-
- l_expect := 'dbms_output.put_line(''test_max_length called.'');'||c_crlf;
- l_actual := ut3_develop.ut_metadata.get_source_definition_line('UT3_TESTER', 'TEST_PACKAGE1', 6);
- ut.expect(l_actual).to_equal(l_expect);
- end;
-
- procedure test_over_varchar2_limit_trim_first_4000_cr
- is
- l_actual varchar2(32767);
- l_expect varchar2(32767);
- begin
- l_expect := trim(substrb(q'[ /* long comment over 4000 characters 1]'||rpad('*', 8000, '*')||'*/'||c_cr, 1, 4000));
- l_actual := ut3_develop.ut_metadata.get_source_definition_line('UT3_TESTER', 'TEST_PACKAGE1', 4);
- ut.expect(l_actual).to_equal(l_expect);
-
- l_expect := trim(substrb(q'[ /* long comment 3999 and linebreak]'||rpad('*', 4000, '*'), 1, 3997)||'*/'||c_cr);
- l_actual := ut3_develop.ut_metadata.get_source_definition_line('UT3_TESTER', 'TEST_PACKAGE1', 5);
- ut.expect(l_actual).to_equal(l_expect);
-
- l_expect := 'ut.expect(l_actual).to_equal(l_expect);'||c_cr;
- l_actual := ut3_develop.ut_metadata.get_source_definition_line('UT3_TESTER', 'TEST_PACKAGE1', 6);
- ut.expect(l_actual).to_equal(l_expect);
- end;
-
- procedure clear_cache is
- begin
- ut3_develop.ut_metadata.reset_source_definition_cache();
- end;
-
- procedure drop_test_package is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package test_package1';
- end;
-
- procedure create_test_package_lf is
- pragma autonomous_transaction;
- begin
- execute immediate c_pks_lf;
- execute immediate c_pkg_lf;
- end;
-
- procedure create_test_package_crlf is
- pragma autonomous_transaction;
- begin
- execute immediate replace(c_pks_lf, c_lf, c_crlf);
- execute immediate replace(c_pkg_lf, c_lf, c_crlf);
- end;
-
- procedure create_test_package_cr is
- pragma autonomous_transaction;
- begin
- execute immediate replace(c_pks_lf, c_lf, c_cr);
- execute immediate replace(c_pkg_lf, c_lf, c_cr);
- end;
-
-end;
-/
\ No newline at end of file
diff --git a/test/ut3_tester/core/test_ut_metadata.pks b/test/ut3_tester/core/test_ut_metadata.pks
deleted file mode 100644
index b4a1d601c..000000000
--- a/test/ut3_tester/core/test_ut_metadata.pks
+++ /dev/null
@@ -1,34 +0,0 @@
-create or replace package test_ut_metadata is
- --%suite(ut_metadata)
- --%suitepath(utplsql.ut3_tester.core)
-
- --%context(get_source_definition_line)
-
- --%test(source line over 4000 limit is trimmed to first 4000 [linebreeak lf])
- --%beforetest(create_test_package_lf)
- procedure test_over_varchar2_limit_trim_first_4000_lf;
-
- --%test(source line over 4000 limit is trimmed to first 4000 [linebreeak:crlf])
- --%beforetest(create_test_package_crlf)
- procedure test_over_varchar2_limit_trim_first_4000_crlf;
-
- --%disabled(PLS-00103 occurs when execute immediate CR package)
- --%test(source line over 4000 limit is trimmed to first 4000 [linebreeak cr])
- --%beforetest(create_test_package_cr)
- procedure test_over_varchar2_limit_trim_first_4000_cr;
-
- --%beforeeach
- procedure clear_cache;
- --%aftereach
- procedure drop_test_package;
-
- procedure create_test_package_lf;
-
- procedure create_test_package_crlf;
-
- procedure create_test_package_cr;
-
- --%endcontext
-
-end;
-/
\ No newline at end of file
diff --git a/test/ut3_tester/core/test_ut_suite.pkb b/test/ut3_tester/core/test_ut_suite.pkb
deleted file mode 100644
index 7cb9121f6..000000000
--- a/test/ut3_tester/core/test_ut_suite.pkb
+++ /dev/null
@@ -1,164 +0,0 @@
-create or replace package body test_ut_suite is
-
- procedure cleanup_package_state is
- begin
- ut3_tester_helper.ut_example_tests.g_number := null;
- end;
-
- procedure create_trans_control is
- begin
- ut3_tester_helper.run_helper.create_trans_control;
- end;
-
- procedure drop_trans_control is
- begin
- ut3_tester_helper.run_helper.drop_trans_control;
- end;
-
- procedure disabled_suite is
- l_suite ut3_develop.ut_suite;
- begin
- --Arrange
- l_suite := ut3_develop.ut_suite(a_object_owner => 'ut3_tester_helper', a_object_name => 'UT_EXAMPLE_TESTS', a_line_no=> 1);
- l_suite.path := 'ut3_tester_helper.ut_example_tests';
- l_suite.disabled_flag := ut3_develop.ut_utils.boolean_to_int(true);
- l_suite.before_all_list := ut3_develop.ut_executables(ut3_develop.ut_executable('ut3_tester_helper', 'UT_EXAMPLE_TESTS', 'set_g_number_0', ut3_develop.ut_utils.gc_before_all));
- l_suite.after_all_list := ut3_develop.ut_executables(ut3_develop.ut_executable('ut3_tester_helper', 'UT_EXAMPLE_TESTS', 'add_1_to_g_number', ut3_develop.ut_utils.gc_before_all));
- l_suite.items.extend;
- l_suite.items(l_suite.items.last) := ut3_develop.ut_test(a_object_owner => 'ut3_tester_helper', a_object_name => 'UT_EXAMPLE_TESTS',a_name => 'add_1_to_g_number', a_line_no=> 1);
- l_suite.items.extend;
- l_suite.items(l_suite.items.last) := ut3_develop.ut_test(a_object_owner => 'ut3_tester_helper', a_object_name => 'UT_EXAMPLE_TESTS',a_name => 'add_1_to_g_number', a_line_no=> 1);
- --Act
- l_suite.do_execute();
- --Assert
- ut.expect(ut3_tester_helper.ut_example_tests.g_number).to_be_null;
- ut.expect(l_suite.result).to_equal(ut3_develop.ut_utils.gc_disabled);
- ut.expect(l_suite.results_count.disabled_count).to_equal(2);
- ut.expect(l_suite.results_count.warnings_count).to_equal(0);
- ut.expect(l_suite.results_count.success_count).to_equal(0);
- ut.expect(l_suite.results_count.failure_count).to_equal(0);
- ut.expect(l_suite.results_count.errored_count).to_equal(0);
- end;
-
- procedure beforeall_errors is
- l_suite ut3_develop.ut_suite;
- begin
- --Arrange
- l_suite := ut3_develop.ut_suite(a_object_owner => 'ut3_tester_helper', a_object_name => 'UT_EXAMPLE_TESTS', a_line_no=> 1);
- l_suite.path := 'ut3_tester_helper.ut_example_tests';
- l_suite.before_all_list := ut3_develop.ut_executables(ut3_develop.ut_executable('ut3_tester_helper', 'UT_EXAMPLE_TESTS', 'failing_procedure', ut3_develop.ut_utils.gc_before_all));
- l_suite.items.extend;
- l_suite.items(l_suite.items.last) := ut3_develop.ut_test(a_object_owner => 'ut3_tester_helper',a_object_name => 'UT_EXAMPLE_TESTS',a_name => 'set_g_number_0', a_line_no=> 1);
- --Act
- l_suite.do_execute();
- --Assert
- ut.expect(ut3_tester_helper.ut_example_tests.g_number).to_be_null;
- ut.expect(l_suite.result).to_equal(ut3_develop.ut_utils.gc_error);
- ut.expect(l_suite.results_count.disabled_count).to_equal(0);
- ut.expect(l_suite.results_count.warnings_count).to_equal(0);
- ut.expect(l_suite.results_count.success_count).to_equal(0);
- ut.expect(l_suite.results_count.failure_count).to_equal(0);
- ut.expect(l_suite.results_count.errored_count).to_equal(1);
- end;
-
- procedure aftereall_errors is
- l_suite ut3_develop.ut_suite;
- begin
- --Arrange
- l_suite := ut3_develop.ut_suite(a_object_owner => 'ut3_tester_helper', a_object_name => 'UT_EXAMPLE_TESTS', a_line_no=> 1);
- l_suite.path := 'ut3_tester_helper.ut_example_tests';
- l_suite.after_all_list := ut3_develop.ut_executables(ut3_develop.ut_executable('ut3_tester_helper', 'UT_EXAMPLE_TESTS', 'failing_procedure', ut3_develop.ut_utils.gc_after_all));
-
- l_suite.items.extend;
- l_suite.items(l_suite.items.last) := ut3_develop.ut_test(a_object_owner => 'ut3_tester_helper', a_object_name => 'UT_EXAMPLE_TESTS',a_name => 'set_g_number_0', a_line_no=> 1);
- l_suite.items.extend;
- l_suite.items(l_suite.items.last) := ut3_develop.ut_test(a_object_owner => 'ut3_tester_helper', a_object_name => 'UT_EXAMPLE_TESTS',a_name => 'add_1_to_g_number', a_line_no=> 1);
- --Act
- l_suite.do_execute();
- --Assert
- ut.expect(ut3_tester_helper.ut_example_tests.g_number).to_equal(1);
- ut.expect(l_suite.result).to_equal(ut3_develop.ut_utils.gc_success);
- ut.expect(l_suite.results_count.disabled_count).to_equal(0);
- ut.expect(l_suite.results_count.warnings_count).to_equal(1);
- ut.expect(l_suite.results_count.success_count).to_equal(2);
- ut.expect(l_suite.results_count.failure_count).to_equal(0);
- ut.expect(l_suite.results_count.errored_count).to_equal(0);
- end;
-
- procedure package_without_body is
- l_suite ut3_develop.ut_suite;
- begin
- l_suite := ut3_develop.ut_suite(a_object_owner => USER, a_object_name => 'UT_WITHOUT_BODY', a_line_no=> 1);
- l_suite.path := 'UT_WITHOUT_BODY';
- l_suite.items.extend;
- l_suite.items(l_suite.items.last) := ut3_develop.ut_test(a_object_name => 'ut_without_body',a_name => 'test1', a_line_no=> 1);
- --Act
- l_suite.do_execute();
- --Assert
- ut.expect(l_suite.result).to_equal(ut3_develop.ut_utils.gc_error);
- end;
-
- procedure package_with_invalid_body is
- l_suite ut3_develop.ut_suite;
- begin
- l_suite := ut3_develop.ut_suite(a_object_owner => USER, a_object_name => 'UT_WITH_INVALID_BODY', a_line_no=> 1);
- l_suite.path := 'UT_WITH_INVALID_BODY';
- l_suite.items.extend;
- l_suite.items(l_suite.items.last) := ut3_develop.ut_test(a_object_name => 'ut_with_invalid_body',a_name => 'test1', a_line_no=> 1);
- --Act
- l_suite.do_execute();
- --Assert
- ut.expect(l_suite.result).to_equal(ut3_develop.ut_utils.gc_error);
- end;
-
- procedure rollback_auto is
- l_suite ut3_develop.ut_suite;
- begin
- --Arrange
- execute immediate 'delete from ut3_tester_helper.ut$test_table';
- l_suite := ut3_develop.ut_suite(a_object_owner => USER, a_object_name => 'UT_TRANSACTION_CONTROL', a_line_no=> 1);
- l_suite.path := 'ut3_tester_helper.ut_transaction_control';
- l_suite.before_all_list := ut3_develop.ut_executables(ut3_develop.ut_executable(USER, 'UT_TRANSACTION_CONTROL', 'setup', ut3_develop.ut_utils.gc_before_all));
- l_suite.items.extend;
- l_suite.items(l_suite.items.last) := ut3_develop.ut_test(a_object_owner => USER, a_object_name => 'ut_transaction_control',a_name => 'test', a_line_no=> 1);
- l_suite.set_rollback_type(ut3_develop.ut_utils.gc_rollback_auto);
-
- --Act
- l_suite.do_execute();
-
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_value(q'[ut3_tester_helper.ut_transaction_control.count_rows('t')]')).to_equal(0);
- ut.expect(ut3_tester_helper.main_helper.get_value(q'[ut3_tester_helper.ut_transaction_control.count_rows('s')]')).to_equal(0);
- end;
-
- procedure rollback_auto_on_failure is
- begin
- ut3_tester_helper.run_helper.test_rollback_type('test_failure', ut3_develop.ut_utils.gc_rollback_auto, equal(0) );
- end;
-
- procedure rollback_manual is
- begin
- ut3_tester_helper.run_helper.test_rollback_type('test', ut3_develop.ut_utils.gc_rollback_manual, be_greater_than(0) );
- end;
-
- procedure rollback_manual_on_failure is
- begin
- ut3_tester_helper.run_helper.test_rollback_type('test_failure', ut3_develop.ut_utils.gc_rollback_manual, be_greater_than(0) );
- end;
-
- procedure trim_transaction_invalidators is
- l_suite ut3_develop.ut_suite;
- begin
- --arrange
- l_suite := ut3_develop.ut_suite(a_object_owner => USER, a_object_name => 'UT_EXAMPLE_TESTS', a_line_no=> 1);
- for i in 1 .. 100 loop
- l_suite.add_transaction_invalidator('schema_name.package_name.procedure_name'||i);
- end loop;
- --Act
- l_suite.rollback_to_savepoint('dummy_savepoint');
- --Assert
- ut.expect(l_suite.warnings.count).to_equal(1);
- end;
-
-end;
-/
\ No newline at end of file
diff --git a/test/ut3_tester/core/test_ut_suite.pks b/test/ut3_tester/core/test_ut_suite.pks
deleted file mode 100644
index 385d00fc7..000000000
--- a/test/ut3_tester/core/test_ut_suite.pks
+++ /dev/null
@@ -1,51 +0,0 @@
-create or replace package test_ut_suite is
-
- --%suite(ut_suite)
- --%suitepath(utplsql.ut3_tester.core)
-
- --%beforeeach
- procedure cleanup_package_state;
-
- --%test(Disabled flag skips tests execution in suite)
- procedure disabled_suite;
-
- --%test(Marks each test as errored if beforeall raises exception)
- procedure beforeall_errors;
-
- --%test(Reports warnings for each test if afterall raises exception)
- procedure aftereall_errors;
-
- --%beforetest(ut3_tester_helper.run_helper.package_no_body)
- --%aftertest(ut3_tester_helper.run_helper.drop_package_no_body)
- --%test(Fails all tests in package when package has no body)
- procedure package_without_body;
-
- --%test(Fails all tests in package when package body is invalid)
- procedure package_with_invalid_body;
-
- --%context( rollback_test )
-
- --%beforeall
- procedure create_trans_control;
- --%afterall
- procedure drop_trans_control;
-
- --%test(Performs automatic rollback after a suite)
- procedure rollback_auto;
-
- --%test(Performs automatic rollback after a suite even if test fails)
- procedure rollback_auto_on_failure;
-
- --%test(rollback(manual) - disables automatic rollback after a suite)
- procedure rollback_manual;
-
- --%test(rollback(manual) - disables automatic rollback after a suite even if test fails)
- procedure rollback_manual_on_failure;
-
- --%endcontext
-
- --%test(Transaction invalidators list is trimmed in warnings when too long)
- procedure trim_transaction_invalidators;
-
-end;
-/
diff --git a/test/ut3_tester/core/test_ut_suite_tag_filter.pkb b/test/ut3_tester/core/test_ut_suite_tag_filter.pkb
deleted file mode 100644
index 34af60549..000000000
--- a/test/ut3_tester/core/test_ut_suite_tag_filter.pkb
+++ /dev/null
@@ -1,356 +0,0 @@
-create or replace package body test_ut_suite_tag_filter is
-
- procedure test_conversion_to_rpn is
- l_postfix ut3_develop.ut_varchar2_list;
- l_postfix_string varchar2(4000);
- l_input_token ut3_develop.ut_varchar2_list;
- begin
- l_input_token := ut3_develop.ut_suite_tag_filter.tokenize_tags_string('A');
- l_postfix := ut3_develop.ut_suite_tag_filter.shunt_logical_expression(l_input_token);
- l_postfix_string := ut3_develop.ut_utils.table_to_clob(l_postfix,'');
- ut.expect(l_postfix_string).to_equal('A');
-
- l_input_token := ut3_develop.ut_suite_tag_filter.tokenize_tags_string('A|B');
- l_postfix := ut3_develop.ut_suite_tag_filter.shunt_logical_expression(l_input_token);
- l_postfix_string := ut3_develop.ut_utils.table_to_clob(l_postfix,'');
- ut.expect(l_postfix_string).to_equal('AB|');
-
- l_input_token := ut3_develop.ut_suite_tag_filter.tokenize_tags_string('(a|b)|c&d');
- l_postfix := ut3_develop.ut_suite_tag_filter.shunt_logical_expression(l_input_token);
- l_postfix_string := ut3_develop.ut_utils.table_to_clob(l_postfix,'');
- ut.expect(l_postfix_string).to_equal('ab|cd&|');
-
- l_input_token := ut3_develop.ut_suite_tag_filter.tokenize_tags_string('!a|b');
- l_postfix := ut3_develop.ut_suite_tag_filter.shunt_logical_expression(l_input_token);
- l_postfix_string := ut3_develop.ut_utils.table_to_clob(l_postfix,'');
- ut.expect(l_postfix_string).to_equal('a!b|');
- end;
-
- procedure test_conversion_opr_by_opr is
- l_postfix ut3_develop.ut_varchar2_list;
- l_input_token ut3_develop.ut_varchar2_list;
- begin
- l_input_token := ut3_develop.ut_varchar2_list('A','B');
- l_postfix := ut3_develop.ut_suite_tag_filter.shunt_logical_expression(l_input_token);
- ut.fail('Expected exception but nothing was raised');
- end;
-
- procedure test_conversion_oprd_by_opd is
- l_postfix ut3_develop.ut_varchar2_list;
- l_input_token ut3_develop.ut_varchar2_list;
- begin
- l_input_token := ut3_develop.ut_varchar2_list('|','|');
- l_postfix := ut3_develop.ut_suite_tag_filter.shunt_logical_expression(l_input_token);
- ut.fail('Expected exception but nothing was raised');
- end;
-
- procedure test_conversion_lb_by_oper is
- l_postfix ut3_develop.ut_varchar2_list;
- l_input_token ut3_develop.ut_varchar2_list;
- begin
- l_input_token := ut3_develop.ut_varchar2_list('(','A','|','B',')','(');
- l_postfix := ut3_develop.ut_suite_tag_filter.shunt_logical_expression(l_input_token);
- ut.fail('Expected exception but nothing was raised');
- end;
-
- procedure test_conversion_rb_by_oprd is
- l_postfix ut3_develop.ut_varchar2_list;
- l_input_token ut3_develop.ut_varchar2_list;
- begin
- l_input_token := ut3_develop.ut_varchar2_list(')','A');
- l_postfix := ut3_develop.ut_suite_tag_filter.shunt_logical_expression(l_input_token);
- ut.fail('Expected exception but nothing was raised');
- end;
-
- procedure conversion_throws_when_lb_rb is
- l_postfix ut3_develop.ut_varchar2_list;
- l_input_token ut3_develop.ut_varchar2_list;
- begin
- l_input_token := ut3_develop.ut_varchar2_list('(',')');
- l_postfix := ut3_develop.ut_suite_tag_filter.shunt_logical_expression(l_input_token);
- ut.fail('Expected exception but nothing was raised');
- end;
-
- procedure conversion_throws_when_unmatched_rb is
- l_postfix ut3_develop.ut_varchar2_list;
- l_input_token ut3_develop.ut_varchar2_list;
- begin
- l_input_token := ut3_develop.ut_varchar2_list('(','a',')',')');
- l_postfix := ut3_develop.ut_suite_tag_filter.shunt_logical_expression(l_input_token);
- ut.fail('Expected exception but nothing was raised');
- end;
-
- procedure conversion_throws_when_empty is
- l_postfix ut3_develop.ut_varchar2_list;
- begin
- l_postfix := ut3_develop.ut_suite_tag_filter.shunt_logical_expression(ut3_develop.ut_varchar2_list());
- ut.fail('Expected exception but nothing was raised');
- end;
-
- procedure conversion_throws_when_trailing_opr is
- l_postfix ut3_develop.ut_varchar2_list;
- begin
- l_postfix := ut3_develop.ut_suite_tag_filter.shunt_logical_expression(ut3_develop.ut_varchar2_list('a','|'));
- ut.fail('Expected exception but nothing was raised');
- end;
-
- procedure tokenize_empty_string is
- begin
- ut.expect( ut3_develop.ut_suite_tag_filter.tokenize_tags_string(null).count ).to_equal(0);
- end;
-
- procedure is_matching_or_and_not is
- begin
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('test1', 'test1') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('test2', 'test1') ).to_equal(0);
-
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('test2', 'test1|test2') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('test3', 'test1|test2') ).to_equal(0);
-
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('test3', 'test1|!test2') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('test2', 'test1|!test2') ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('test1,test2', 'test1|!test2') ).to_equal(1);
-
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('test1', 'test1&!test2') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('test1,test2', 'test1&!test2') ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('test3', 'test1&!test2') ).to_equal(0);
- end;
-
- procedure is_matching_evaluates_tags is
- l_tags varchar2(100) := 'db,slow';
- begin
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(l_tags, 'slow') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(l_tags, 'fast') ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(l_tags, 'slow&db') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(l_tags, 'slow&!db') ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(l_tags, 'fast|db') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(l_tags, '!fast') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(l_tags, '(fast|slow)&!(db&fast)') ).to_equal(1);
- --legacy notation: "," is or, "-" is not
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(l_tags, 'fast,slow') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(l_tags, 'fast,-slow') ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(l_tags, 'none') ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(l_tags, 'any') ).to_equal(1);
- end;
-
- procedure is_matching_without_tags is
- begin
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(null, 'none') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(null, 'any') ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(null, '!slow') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(null, 'slow') ).to_equal(0);
- end;
-
- procedure is_matching_operator_precedence is
- begin
- --"&" binds stronger than "|"
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a', 'a|b&c') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('b', 'a|b&c') ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('b,c', 'a|b&c') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('c', 'b&c|a') ).to_equal(0);
- --brackets
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a', '(a|b)&c') ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a,c', '(a|b)&c') ).to_equal(1);
- --"!" binds stronger than "&"
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('b', '!a&b') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a,b', '!a&b') ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a', '!(a&b)') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a,b', '!(a&b)') ).to_equal(0);
- --double negation
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a', '!!a') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('b', '!!a') ).to_equal(0);
- end;
-
- procedure is_matching_none_and_any_combined is
- begin
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('slow', 'none|slow') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(null, 'none|slow') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('db', 'none|slow') ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('slow', '!none') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(null, '!none') ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(null, '!any') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('slow', 'any&!slow') ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('db', 'any&!slow') ).to_equal(1);
- end;
-
- procedure is_matching_is_case_sensitive is
- begin
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('Slow', 'slow') ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('slow', 'SLOW') ).to_equal(0);
- --upper case keywords are tags, not the none and any keywords
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(null, 'NONE') ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('slow', 'ANY') ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('ANY', 'ANY') ).to_equal(1);
- end;
-
- procedure is_matching_ignores_whitespace is
- c_tab constant varchar2(1) := chr(9);
- begin
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('db,slow', ' slow & db ') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('db,slow', ' ( fast | slow ) & ! db ') ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('db,slow', c_tab||'slow'||c_tab||'&'||c_tab||'db'||c_tab) ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('db,slow', 'slow'||c_tab||'&'||c_tab||'!'||c_tab||'db') ).to_equal(0);
- --legacy notation
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('db,slow', 'fast, slow') ).to_equal(1);
- end;
-
- procedure is_matching_empty_expression is
- c_tab constant varchar2(1) := chr(9);
- begin
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('slow', null) ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(null, null) ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('slow', ' ') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(null, ' ') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('slow', c_tab) ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(null, ' '||c_tab||' ') ).to_equal(1);
- end;
-
- procedure remove_whitespace_from_expression is
- c_tab constant varchar2(1) := chr(9);
- begin
- ut.expect( ut3_develop.ut_suite_tag_filter.remove_whitespace(null) ).to_be_null();
- ut.expect( ut3_develop.ut_suite_tag_filter.remove_whitespace(' ') ).to_be_null();
- ut.expect( ut3_develop.ut_suite_tag_filter.remove_whitespace(' '||c_tab||c_tab||' ') ).to_be_null();
- ut.expect( ut3_develop.ut_suite_tag_filter.remove_whitespace(' slow &'||c_tab||'db ') ).to_equal('slow&db');
- end;
-
- procedure is_matching_tag_with_quote is
- begin
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(q'[it's]', q'[it's]') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('slow', q'[slow&!it's]') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('slow', q'[it's]') ).to_equal(0);
- end;
-
- procedure is_matching_many_tags is
- c_tag_prefix constant varchar2(30) := 'a_long_tag_name_for_testing_';
- l_expression varchar2(32767);
- begin
- --80 tags of 31 characters, joined with "|": a condition with "member of" for each tag would be over 4000 characters
- for i in 1 .. 80 loop
- l_expression := l_expression || case when i > 1 then '|' end || c_tag_prefix || lpad(i, 3, '0');
- end loop;
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(c_tag_prefix||'080', l_expression) ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('slow,'||c_tag_prefix||'001', l_expression) ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('slow', l_expression) ).to_equal(0);
- end;
-
- procedure is_matching_null_tag_element is
- begin
- --'a,,b' has a null element, so "x member of" it is unknown (null) instead of false when x is not in the list
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a,,b', 'a') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a,,b', 'x') ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a,,b', '!x') ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a,,b', 'a|!x') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a,,b', 'a&!x') ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a,,b', '!a&!x') ).to_equal(0);
- end;
-
- procedure is_matching_follows_expression_change is
- l_result integer;
- begin
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a', 'a') ).to_equal(1);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a', 'b') ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a', 'a') ).to_equal(1);
- begin
- l_result := ut3_develop.ut_suite_tag_filter.is_matching('a', 'a&');
- ut.fail('Expected exception but nothing was raised');
- exception
- when others then
- ut.expect( sqlcode ).to_equal( ut3_develop.ut_utils.gc_invalid_tag_expression );
- end;
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a', 'b') ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a', 'a') ).to_equal(1);
- end;
-
- procedure is_matching_invalid_expression is
- l_result integer;
- begin
- l_result := ut3_develop.ut_suite_tag_filter.is_matching('slow', 'slow&|db');
- end;
-
- procedure is_matching_incomplete_expression is
- --legacy notation turns ',' into an empty expression
- l_expressions ut3_develop.ut_varchar2_list := ut3_develop.ut_varchar2_list('slow|', 'slow&!', '!', '(slow', ',');
- l_result integer;
- begin
- for i in 1 .. l_expressions.count loop
- begin
- l_result := ut3_develop.ut_suite_tag_filter.is_matching('slow', l_expressions(i));
- ut.fail('Expected exception for tag expression "'||l_expressions(i)||'" but nothing was raised');
- exception
- when others then
- ut.expect( sqlcode, 'Tag expression "'||l_expressions(i)||'"' ).to_equal( ut3_develop.ut_utils.gc_invalid_tag_expression );
- end;
- end loop;
- end;
-
- procedure create_tags_suite is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace package test_tags_1324 as
- --%suite
- --%suitepath(some.path)
- --%tags(slow)
-
- --%context(tags_are_applied_in_contexts)
- --%tags(context_tag)
-
- --%test
- --%tags(test_tag)
- procedure create_new_mapping;
-
- --%endcontext
- end;]';
- execute immediate q'[create or replace package body test_tags_1324 as
- procedure create_new_mapping is begin null; end;
- end;]';
- end;
-
- procedure drop_tags_suite is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package test_tags_1324';
- end;
-
- procedure filtering_is_correctly_applied_to_all_items is
- l_paths ut3_develop.ut_path_items;
- l_suites ut3_develop.ut_suite_items;
- l_items ut3_develop.ut_suite_cache_rows;
- l_expected sys_refcursor;
- l_actual sys_refcursor;
-
- --suite items selected by the tag expression, without the logical suites "some" and "some.path"
- function get_items(a_tags varchar2) return ut3_develop.ut_suite_cache_rows is
- l_rows ut3_develop.ut_suite_cache_rows;
- l_result ut3_develop.ut_suite_cache_rows;
- begin
- l_rows := ut3_develop.ut_suite_cache_manager.get_suite_rows( l_paths, true, a_tags );
- select value(r) bulk collect into l_result from table(l_rows) r where r.self_type != 'UT_LOGICAL_SUITE';
- return l_result;
- end;
- begin
- --refresh the suite cache of the schema
- l_suites := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list('ut3_tester.test_tags_1324'));
- l_paths := ut3_develop.ut_suite_cache_manager.get_schema_paths(ut3_develop.ut_varchar2_list('ut3_tester.test_tags_1324'));
-
- l_items := get_items('slow');
- ut.expect( l_items.count ).to_equal(3);
-
- open l_expected for
- select 'some.path.test_tags_1324' as path from dual union all
- select 'some.path.test_tags_1324.nested_context_#1' from dual union all
- select 'some.path.test_tags_1324.nested_context_#1.create_new_mapping' from dual;
- open l_actual for select r.path from table( l_items ) r;
- ut.expect(l_actual).to_equal(l_expected).unordered();
-
- ut.expect( get_items('!slow').count ).to_equal(0);
- ut.expect( get_items('bad').count ).to_equal(0);
- ut.expect( get_items('!bad').count ).to_equal(3);
- ut.expect( get_items('!context_tag').count ).to_equal(0);
- ut.expect( get_items('context_tag').count ).to_equal(3);
- ut.expect( get_items('!test_tag').count ).to_equal(0);
- ut.expect( get_items('test_tag').count ).to_equal(3);
- end;
-
-end test_ut_suite_tag_filter;
-/
diff --git a/test/ut3_tester/core/test_ut_suite_tag_filter.pks b/test/ut3_tester/core/test_ut_suite_tag_filter.pks
deleted file mode 100644
index 92c8cc744..000000000
--- a/test/ut3_tester/core/test_ut_suite_tag_filter.pks
+++ /dev/null
@@ -1,103 +0,0 @@
-create or replace package test_ut_suite_tag_filter is
-
- --%suite(ut_suite_tag_filter)
- --%suitepath(utplsql.ut3_tester.core)
-
- --%context( Conversion to Reverse Polish Notation)
-
- --%test( Test conversion of expression into Reverse Polish Notation)
- procedure test_conversion_to_rpn;
-
- --%test( Operator is followed by operator)
- --%throws(ut3_develop.ut_utils.gc_invalid_tag_expression)
- procedure test_conversion_opr_by_opr;
-
- --%test( Operand is followed by operand)
- --%throws(ut3_develop.ut_utils.gc_invalid_tag_expression)
- procedure test_conversion_oprd_by_opd;
-
- --%test( Left Bracket is followed by operator)
- --%throws(ut3_develop.ut_utils.gc_invalid_tag_expression)
- procedure test_conversion_lb_by_oper;
-
- --%test( Right Bracket is followed by operand)
- --%throws(ut3_develop.ut_utils.gc_invalid_tag_expression)
- procedure test_conversion_rb_by_oprd;
-
- --%test(Conversion raises exception when empty brackets)
- --%throws(ut3_develop.ut_utils.gc_invalid_tag_expression)
- procedure conversion_throws_when_lb_rb;
-
- --%test(Conversion raises exception when a right bracket has no left bracket)
- --%throws(ut3_develop.ut_utils.gc_invalid_tag_expression)
- procedure conversion_throws_when_unmatched_rb;
-
- --%test(Conversion raises exception for an empty list of tokens)
- --%throws(ut3_develop.ut_utils.gc_invalid_tag_expression)
- procedure conversion_throws_when_empty;
-
- --%test(Conversion raises exception when the expression ends with an operator)
- --%throws(ut3_develop.ut_utils.gc_invalid_tag_expression)
- procedure conversion_throws_when_trailing_opr;
-
- --%test(Tokenizing an empty string returns no tokens)
- procedure tokenize_empty_string;
-
- --%endcontext
-
- --%test( Evaluates or, and and not in tag expressions)
- procedure is_matching_or_and_not;
-
- --%test( Evaluates tag expressions against a list of tags)
- procedure is_matching_evaluates_tags;
-
- --%test( Evaluates none and any for items without tags)
- procedure is_matching_without_tags;
-
- --%test( Applies operator precedence, brackets and double negation)
- procedure is_matching_operator_precedence;
-
- --%test( Combines none and any with other tags)
- procedure is_matching_none_and_any_combined;
-
- --%test( Compares tags and the none and any keywords case sensitively)
- procedure is_matching_is_case_sensitive;
-
- --%test( Ignores spaces and tabs in the tag expression)
- procedure is_matching_ignores_whitespace;
-
- --%test( Matches any tags when the tag expression is empty or made of spaces and tabs)
- procedure is_matching_empty_expression;
-
- --%test( Removes spaces and tabs from a tag expression, returning null for one made only of them)
- procedure remove_whitespace_from_expression;
-
- --%test( Evaluates a tag containing a quote)
- procedure is_matching_tag_with_quote;
-
- --%test( Evaluates an expression with many tags)
- procedure is_matching_many_tags;
-
- --%test( Follows three-valued logic for an empty element in the list of tags)
- procedure is_matching_null_tag_element;
-
- --%test( Evaluates the current expression after the expression changes or an invalid expression is given)
- procedure is_matching_follows_expression_change;
-
- --%test( Raises exception for an invalid tag expression)
- --%throws(ut3_develop.ut_utils.gc_invalid_tag_expression)
- procedure is_matching_invalid_expression;
-
- --%test( Raises exception for an incomplete tag expression)
- procedure is_matching_incomplete_expression;
-
- procedure create_tags_suite;
- procedure drop_tags_suite;
-
- --%test( Regression for issue #1324 - corect filtering by tags with suitepath and contexts)
- --%beforetest(create_tags_suite)
- --%aftertest(drop_tags_suite)
- procedure filtering_is_correctly_applied_to_all_items;
-
-end test_ut_suite_tag_filter;
-/
diff --git a/test/ut3_tester/core/test_ut_test.pkb b/test/ut3_tester/core/test_ut_test.pkb
deleted file mode 100644
index f6f59df08..000000000
--- a/test/ut3_tester/core/test_ut_test.pkb
+++ /dev/null
@@ -1,727 +0,0 @@
-create or replace package body test_ut_test is
-
- procedure cleanup_package_state is
- begin
- ut3_tester_helper.ut_example_tests.g_number := null;
- end;
-
- procedure disabled_test is
- l_suite ut3_develop.ut_suite;
- l_test ut3_develop.ut_test;
- begin
- --Arrange
- l_suite := ut3_develop.ut_suite(a_object_owner => 'ut3_tester_helper', a_object_name => 'ut_example_tests', a_line_no=> 1);
- l_suite.path := 'ut3_tester_helper.ut_example_tests';
- l_suite.before_all_list := ut3_develop.ut_executables(ut3_develop.ut_executable('ut3_tester_helper', 'ut_example_tests', 'set_g_number_0', ut3_develop.ut_utils.gc_before_all));
-
- l_suite.items.extend;
- l_suite.items(l_suite.items.last) := ut3_develop.ut_test(a_object_owner => 'ut3_tester_helper',a_object_name => 'ut_example_tests',a_name => 'add_1_to_g_number', a_line_no=> 1);
- l_suite.items.extend;
- l_suite.items(l_suite.items.last) := ut3_develop.ut_test(a_object_owner => 'ut3_tester_helper',a_object_name => 'ut_example_tests',a_name => 'add_1_to_g_number', a_line_no=> 2);
- l_suite.items(l_suite.items.last).disabled_flag := ut3_develop.ut_utils.boolean_to_int(true);
- --Act
- l_suite.do_execute();
- --Assert
- ut.expect(ut3_tester_helper.ut_example_tests.g_number).to_equal(1);
- ut.expect(l_suite.result).to_equal(ut3_develop.ut_utils.gc_success);
- ut.expect(l_suite.results_count.disabled_count).to_equal(1);
- ut.expect(l_suite.results_count.warnings_count).to_equal(0);
- ut.expect(l_suite.results_count.success_count).to_equal(1);
- ut.expect(l_suite.results_count.failure_count).to_equal(0);
- ut.expect(l_suite.results_count.errored_count).to_equal(0);
- end;
-
- procedure aftertest_errors is
- l_suite ut3_develop.ut_suite;
- l_test ut3_develop.ut_test;
- begin
- --Arrange
- l_suite := ut3_develop.ut_suite(a_object_owner => 'ut3_tester_helper', a_object_name => 'ut_example_tests', a_line_no=> 1);
- l_suite.path := 'ut3_tester_helper.ut_example_tests';
- l_suite.before_all_list := ut3_develop.ut_executables(ut3_develop.ut_executable('ut3_tester_helper', 'ut_example_tests', 'set_g_number_0', ut3_develop.ut_utils.gc_before_all));
-
- l_test := ut3_develop.ut_test(a_object_owner => 'ut3_tester_helper',a_object_name => 'ut_example_tests',a_name => 'add_1_to_g_number', a_line_no=> 1);
- l_test.before_test_list := ut3_develop.ut_executables(ut3_develop.ut_executable('ut3_tester_helper', 'ut_example_tests', 'add_1_to_g_number', ut3_develop.ut_utils.gc_before_test));
- l_test.after_test_list := ut3_develop.ut_executables(ut3_develop.ut_executable('ut3_tester_helper', 'ut_example_tests', 'failing_procedure', ut3_develop.ut_utils.gc_after_test));
- l_suite.items.extend;
- l_suite.items(l_suite.items.last) := l_test;
- l_suite.items.extend;
- l_suite.items(l_suite.items.last) := ut3_develop.ut_test(a_object_owner => 'ut3_tester_helper',a_object_name => 'ut_example_tests',a_name => 'add_1_to_g_number', a_line_no=> 1);
- --Act
- l_suite.do_execute();
- --Assert
- ut.expect(ut3_tester_helper.ut_example_tests.g_number).to_equal(3);
- ut.expect(l_suite.result).to_equal(ut3_develop.ut_utils.gc_error);
- ut.expect(l_suite.results_count.disabled_count).to_equal(0);
- ut.expect(l_suite.results_count.warnings_count).to_equal(0);
- ut.expect(l_suite.results_count.success_count).to_equal(1);
- ut.expect(l_suite.results_count.failure_count).to_equal(0);
- ut.expect(l_suite.results_count.errored_count).to_equal(1);
- end;
-
- procedure aftereach_errors is
- l_suite ut3_develop.ut_suite;
- l_test ut3_develop.ut_test;
- begin
- --Arrange
- l_suite := ut3_develop.ut_suite(a_object_owner => 'ut3_tester_helper', a_object_name => 'ut_example_tests', a_line_no=> 1);
- l_suite.before_all_list := ut3_develop.ut_executables(ut3_develop.ut_executable('ut3_tester_helper', 'ut_example_tests', 'set_g_number_0', ut3_develop.ut_utils.gc_before_all));
- l_test := ut3_develop.ut_test(a_object_owner => 'ut3_tester_helper',a_object_name => 'ut_example_tests',a_name => 'add_1_to_g_number', a_line_no=> 1);
- l_test.before_each_list := ut3_develop.ut_executables(ut3_develop.ut_executable('ut3_tester_helper', 'ut_example_tests', 'add_1_to_g_number', ut3_develop.ut_utils.gc_before_each));
- l_test.after_each_list := ut3_develop.ut_executables(ut3_develop.ut_executable('ut3_tester_helper', 'ut_example_tests', 'failing_procedure', ut3_develop.ut_utils.gc_after_each));
- l_suite.items.extend;
- l_suite.items(l_suite.items.last) := l_test;
- l_suite.items.extend;
- l_suite.items(l_suite.items.last) := ut3_develop.ut_test(a_object_owner => 'ut3_tester_helper',a_object_name => 'ut_example_tests',a_name => 'add_1_to_g_number', a_line_no=> 1);
- --Act
- l_suite.do_execute();
- --Assert
- ut.expect(ut3_tester_helper.ut_example_tests.g_number).to_equal(3);
- ut.expect(l_suite.result).to_equal(ut3_develop.ut_utils.gc_error);
- ut.expect(l_suite.results_count.disabled_count).to_equal(0);
- ut.expect(l_suite.results_count.warnings_count).to_equal(0);
- ut.expect(l_suite.results_count.success_count).to_equal(1);
- ut.expect(l_suite.results_count.failure_count).to_equal(0);
- ut.expect(l_suite.results_count.errored_count).to_equal(1);
- end;
-
- procedure beforetest_errors is
- l_suite ut3_develop.ut_suite;
- l_test ut3_develop.ut_test;
- begin
- --Arrange
- l_suite := ut3_develop.ut_suite(a_object_owner => 'ut3_tester_helper', a_object_name => 'ut_example_tests', a_line_no=> 1);
- l_suite.before_all_list := ut3_develop.ut_executables(ut3_develop.ut_executable('ut3_tester_helper', 'ut_example_tests', 'set_g_number_0', ut3_develop.ut_utils.gc_before_all));
- l_test := ut3_develop.ut_test(a_object_owner =>'ut3_tester_helper',a_object_name => 'ut_example_tests',a_name => 'add_1_to_g_number', a_line_no=> 1);
- l_test.before_test_list := ut3_develop.ut_executables(ut3_develop.ut_executable('ut3_tester_helper', 'ut_example_tests', 'failing_procedure', ut3_develop.ut_utils.gc_before_test));
- l_test.after_test_list := ut3_develop.ut_executables(ut3_develop.ut_executable('ut3_tester_helper', 'ut_example_tests', 'add_1_to_g_number', ut3_develop.ut_utils.gc_after_test));
- l_suite.items.extend;
- l_suite.items(l_suite.items.last) := l_test;
- l_suite.items.extend;
- l_suite.items(l_suite.items.last) := ut3_develop.ut_test(a_object_owner =>'ut3_tester_helper',a_object_name => 'ut_example_tests',a_name => 'add_1_to_g_number', a_line_no=> 1);
- --Act
- l_suite.do_execute();
- --Assert
- ut.expect(ut3_tester_helper.ut_example_tests.g_number).to_equal(2);
- ut.expect(l_suite.result).to_equal(ut3_develop.ut_utils.gc_error);
- ut.expect(l_suite.results_count.disabled_count).to_equal(0);
- ut.expect(l_suite.results_count.warnings_count).to_equal(0);
- ut.expect(l_suite.results_count.success_count).to_equal(1);
- ut.expect(l_suite.results_count.failure_count).to_equal(0);
- ut.expect(l_suite.results_count.errored_count).to_equal(1);
- end;
-
- procedure beforeeach_errors is
- l_suite ut3_develop.ut_suite;
- l_test ut3_develop.ut_test;
- begin
- --Arrange
- l_suite := ut3_develop.ut_suite(a_object_owner => 'ut3_tester_helper', a_object_name => 'ut_example_tests', a_line_no=> 1);
- l_suite.before_all_list := ut3_develop.ut_executables(ut3_develop.ut_executable('ut3_tester_helper', 'ut_example_tests', 'set_g_number_0', ut3_develop.ut_utils.gc_before_all));
- l_test := ut3_develop.ut_test(a_object_owner => 'ut3_tester_helper',a_object_name => 'ut_example_tests',a_name => 'add_1_to_g_number', a_line_no=> 1);
- l_test.before_each_list := ut3_develop.ut_executables(ut3_develop.ut_executable('ut3_tester_helper', 'ut_example_tests', 'failing_procedure', ut3_develop.ut_utils.gc_before_each));
- l_test.after_each_list := ut3_develop.ut_executables(ut3_develop.ut_executable('ut3_tester_helper', 'ut_example_tests', 'add_1_to_g_number', ut3_develop.ut_utils.gc_after_each));
- l_suite.items.extend;
- l_suite.items(l_suite.items.last) := l_test;
- l_suite.items.extend;
- l_suite.items(l_suite.items.last) := ut3_develop.ut_test(a_object_owner => 'ut3_tester_helper',a_object_name => 'ut_example_tests',a_name => 'add_1_to_g_number', a_line_no=> 1);
- --Act
- l_suite.do_execute();
- --Assert
- ut.expect(ut3_tester_helper.ut_example_tests.g_number).to_equal(2);
- ut.expect(l_suite.result).to_equal(ut3_develop.ut_utils.gc_error);
- ut.expect(l_suite.results_count.disabled_count).to_equal(0);
- ut.expect(l_suite.results_count.warnings_count).to_equal(0);
- ut.expect(l_suite.results_count.success_count).to_equal(1);
- ut.expect(l_suite.results_count.failure_count).to_equal(0);
- ut.expect(l_suite.results_count.errored_count).to_equal(1);
- end;
-
- procedure after_each_executed is
- --Arrange
- l_test ut3_develop.ut_test := ut3_develop.ut_test(
- a_object_owner => 'ut3_tester_helper',
- a_object_name => 'ut_example_tests',
- a_name => 'set_g_number_0',
- a_line_no => null
- );
- begin
- l_test.after_each_list := ut3_develop.ut_executables(
- ut3_develop.ut_executable(
- 'ut3_tester_helper',
- 'ut_example_tests',
- 'add_1_to_g_number',
- ut3_develop.ut_utils.gc_after_each
- )
- );
- --Act
- l_test.do_execute();
- --Assert
- ut.expect(l_test.result).to_equal(ut3_develop.ut_utils.gc_success);
- ut.expect(ut3_tester_helper.ut_example_tests.g_number).to_equal(1);
- end;
-
- procedure after_each_proc_name_invalid is
- --Arrange
- l_test ut3_develop.ut_test := ut3_develop.ut_test(
- a_object_owner => 'ut3_tester_helper',
- a_object_name => 'ut_example_tests',
- a_name => 'set_g_number_0',
- a_line_no => null
- );
- begin
- l_test.after_each_list := ut3_develop.ut_executables(
- ut3_develop.ut_executable('ut3_tester_helper', 'ut_example_tests', 'invalid setup name', ut3_develop.ut_utils.gc_after_each)
- );
- --Act
- l_test.do_execute();
- --Assert
- ut.expect(l_test.result).to_equal(ut3_develop.ut_utils.gc_error);
- ut.expect(ut3_tester_helper.ut_example_tests.g_number).to_equal(0);
- end;
-
- procedure after_each_procedure_name_null is
- --Arrange
- l_test ut3_develop.ut_test := ut3_develop.ut_test(
- a_object_owner => 'ut3_tester_helper',
- a_object_name => 'ut_example_tests',
- a_name => 'set_g_number_0',
- a_line_no => null
- );
- begin
- l_test.after_each_list := ut3_develop.ut_executables(
- ut3_develop.ut_executable('ut3_tester_helper', 'ut_example_tests', null, ut3_develop.ut_utils.gc_after_each)
- );
- --Act
- l_test.do_execute();
- --Assert
- ut.expect(l_test.result).to_equal(ut3_develop.ut_utils.gc_error);
- ut.expect(ut3_tester_helper.ut_example_tests.g_number).to_equal(0);
- end;
-
- procedure create_app_info_package is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace package ut_output_tests
- as
- --%suite
-
- gv_before_all_client_info varchar2(200);
- gv_before_each_client_info varchar2(200);
- gv_before_test_client_info varchar2(200);
- gv_after_test_client_info varchar2(200);
- gv_after_each_client_info varchar2(200);
- gv_after_all_client_info varchar2(200);
-
- --%test
- --%beforetest(before_test)
- --%aftertest(after_test)
- procedure the_test;
-
- --%beforeall
- procedure beforeall;
-
- --%beforeeach
- procedure beforeeach;
-
- procedure before_test;
- procedure after_test;
-
- --%aftereach
- procedure aftereach;
-
- --%afterall
- procedure afterall;
-
- end;]';
- execute immediate q'[create or replace package body ut_output_tests
- as
-
- procedure the_test
- as
- l_module_name varchar2(4000);
- l_action_name varchar2(4000);
- l_client_info varchar2(4000);
- begin
- --Generate empty output
- dbms_output.put_line('');
- ut.expect(1,'Test 1 Should Pass').to_equal(1);
- dbms_application_info.read_module(module_name => l_module_name, action_name => l_action_name);
- dbms_application_info.read_client_info(l_client_info);
- ut.expect(l_module_name).to_equal('utPLSQL');
- ut.expect(l_action_name).to_be_like('ut_output_tests');
- ut.expect(l_client_info).to_be_like('the_test');
- end;
-
- procedure beforeall is
- begin
- dbms_application_info.read_client_info(gv_before_all_client_info);
- end;
-
- procedure beforeeach is
- begin
- dbms_application_info.read_client_info(gv_before_each_client_info);
- end;
-
- procedure before_test is
- begin
- dbms_application_info.read_client_info(gv_before_test_client_info);
- end;
- procedure after_test is
- begin
- dbms_application_info.read_client_info(gv_after_test_client_info);
- end;
-
- procedure aftereach is
- begin
- dbms_application_info.read_client_info(gv_after_each_client_info);
- end;
-
- procedure afterall is
- begin
- dbms_application_info.read_client_info(gv_after_all_client_info);
- end;
-
- end;]';
- end;
-
- procedure drop_app_info_package is
- pragma autonomous_transaction;
- begin
- execute immediate q'[drop package ut_output_tests]';
- end;
-
- procedure application_info_on_execution is
- l_output_data ut3_develop.ut_varchar2_list;
- l_output clob;
- function get_test_value(a_variable_name varchar2) return varchar2 is
- l_result varchar2(4000);
- begin
- execute immediate 'begin :i := ut_output_tests.'||a_variable_name||'; end;' using out l_result;
- return l_result;
- end;
- begin
- --act
- select * bulk collect into l_output_data
- from table(ut3_develop.ut.run('ut_output_tests'));
- l_output := ut3_develop.ut_utils.table_to_clob(l_output_data);
- --assert
-
- ut.expect(get_test_value('gv_before_all_client_info')).to_equal('beforeall');
- ut.expect(get_test_value('gv_before_each_client_info')).to_equal('beforeeach');
- ut.expect(get_test_value('gv_before_test_client_info')).to_equal('before_test');
- ut.expect(get_test_value('gv_after_test_client_info')).to_equal('after_test');
- ut.expect(get_test_value('gv_after_each_client_info')).to_equal('aftereach');
- ut.expect(get_test_value('gv_after_all_client_info')).to_equal('afterall');
- ut.expect(l_output).to_be_like('%0 failed, 0 errored, 0 disabled, 0 warning(s)%');
- end;
-
- procedure before_each_executed is
- --Arrange
- l_test ut3_develop.ut_test := ut3_develop.ut_test(
- a_object_owner => 'ut3_tester_helper',
- a_object_name => 'ut_example_tests',
- a_name => 'add_1_to_g_number',
- a_line_no => null
- );
- begin
- l_test.before_each_list := ut3_develop.ut_executables(ut3_develop.ut_executable('ut3_tester_helper', 'ut_example_tests', 'set_g_number_0', ut3_develop.ut_utils.gc_before_each));
- --Act
- l_test.do_execute();
- --Assert
- ut.expect(l_test.result).to_equal(ut3_develop.ut_utils.gc_success);
- ut.expect(ut3_tester_helper.ut_example_tests.g_number).to_equal(1);
- end;
-
-
- procedure before_each_proc_name_invalid is
- --Arrange
- l_test ut3_develop.ut_test := ut3_develop.ut_test(
- a_object_owner => 'ut3_tester_helper',
- a_object_name => 'ut_example_tests',
- a_name => 'set_g_number_0',
- a_line_no => null
- );
- begin
- l_test.before_each_list := ut3_develop.ut_executables(
- ut3_develop.ut_executable('ut3_tester_helper', 'ut_example_tests', 'invalid setup name', ut3_develop.ut_utils.gc_before_each)
- );
- --Act
- l_test.do_execute();
- --Assert
- ut.expect(l_test.result).to_equal(ut3_develop.ut_utils.gc_error);
- ut.expect(ut3_tester_helper.ut_example_tests.g_number).to_be_null;
- end;
-
- procedure before_each_proc_name_null is
- --Arrange
- l_test ut3_develop.ut_test := ut3_develop.ut_test(
- a_object_owner => 'ut3_tester_helper',
- a_object_name => 'ut_example_tests',
- a_name => 'set_g_number_0',
- a_line_no => null
- );
- begin
- l_test.before_each_list := ut3_develop.ut_executables(
- ut3_develop.ut_executable('ut3_tester_helper', 'ut_example_tests', null, ut3_develop.ut_utils.gc_before_each)
- );
- --Act
- l_test.do_execute();
- --Assert
- ut.expect(l_test.result).to_equal(ut3_develop.ut_utils.gc_error);
- ut.expect(ut3_tester_helper.ut_example_tests.g_number).to_be_null;
- end;
-
- procedure ignore_savepoint_exception is
- pragma autonomous_transaction;
- --Arrange
- l_test ut3_develop.ut_test := ut3_develop.ut_test(
- a_object_owner => 'ut3_tester_helper',
- a_object_name => 'ut_example_tests',
- a_name => 'ut_commit_test',
- a_line_no => null
- );
- begin
- l_test.rollback_type := ut3_develop.ut_utils.gc_rollback_auto;
- --Act
- l_test.do_execute();
- --Assert
- ut.expect(l_test.result).to_equal(ut3_develop.ut_utils.gc_success);
- end;
-
- procedure owner_name_invalid is
- --Arrange
- l_test ut3_develop.ut_test := ut3_develop.ut_test(
- a_object_owner => 'invalid owner name',
- a_object_name => 'ut_example_tests',
- a_name => 'set_g_number_0',
- a_line_no => null
- );
- begin
- --Act
- l_test.do_execute();
- --Assert
- ut.expect(l_test.result).to_equal(ut3_develop.ut_utils.gc_error);
- end;
-
- procedure create_synonym is
- begin
- ut3_tester_helper.ut_example_tests.create_synonym;
- end;
-
- procedure drop_synonym is
- begin
- ut3_tester_helper.ut_example_tests.drop_synonym;
- end;
-
- procedure owner_name_null is
- --Arrange
- l_test ut3_develop.ut_test := ut3_develop.ut_test(
- a_object_name => 'ut_example_tests',
- a_name => 'set_g_number_0',
- a_line_no => null
- );
- begin
- --Act
- l_test.do_execute();
- --Assert
- ut.expect(l_test.result).to_equal(ut3_develop.ut_utils.gc_success);
- ut.expect(ut3_tester_helper.ut_example_tests.g_number).to_equal(0);
- end;
-
- procedure create_invalid_package is
- pragma autonomous_transaction;
- begin
- execute immediate 'create or replace package invalid_package is
- v_variable non_existing_type;
- procedure ut_exampletest;
- end;';
- exception when others then
- null;
- end;
-
- procedure drop_invalid_package is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package invalid_package';
- exception when others then
- null;
- end;
-
- procedure package_in_invalid_state is
- --Arrange
- l_test ut3_develop.ut_test := ut3_develop.ut_test(
- a_object_name => 'invalid_package',
- a_name => 'ut_exampletest',
- a_line_no => null
- );
- begin
- --Act
- l_test.do_execute();
- --Assert
- ut.expect(l_test.result).to_equal(ut3_develop.ut_utils.gc_error);
- end;
-
- procedure package_name_invalid is
- --Arrange
- l_test ut3_develop.ut_test := ut3_develop.ut_test(
- a_object_name => 'invalid package name',
- a_name => 'set_g_number_0',
- a_line_no => null
- );
- begin
- --Act
- l_test.do_execute();
- --Assert
- ut.expect(l_test.result).to_equal(ut3_develop.ut_utils.gc_error);
- end;
-
- procedure package_name_null is
- --Arrange
- l_test ut3_develop.ut_test := ut3_develop.ut_test(
- a_object_name => null,
- a_name => 'set_g_number_0',
- a_line_no => null
- );
- begin
- --Act
- l_test.do_execute();
- --Assert
- ut.expect(l_test.result).to_equal(ut3_develop.ut_utils.gc_error);
- end;
-
- procedure procedure_name_invalid is
- --Arrange
- l_test ut3_develop.ut_test := ut3_develop.ut_test(
- a_object_owner => 'ut3_tester_helper',
- a_object_name => 'ut_example_tests',
- a_name => 'invalid procedure name',
- a_line_no => null
- );
- begin
- --Act
- l_test.do_execute();
- --Assert
- ut.expect(l_test.result).to_equal(ut3_develop.ut_utils.gc_error);
- end;
-
- procedure procedure_name_null is
- --Arrange
- l_test ut3_develop.ut_test := ut3_develop.ut_test(
- a_object_owner => 'ut3_tester_helper',
- a_object_name => 'ut_example_tests',
- a_name => null,
- a_line_no => null
- );
- begin
- --Act
- l_test.do_execute();
- --Assert
- ut.expect(l_test.result).to_equal(ut3_develop.ut_utils.gc_error);
- end;
-
- procedure before_test_executed is
- --Arrange
- l_test ut3_develop.ut_test := ut3_develop.ut_test(
- a_object_owner => 'ut3_tester_helper',
- a_object_name => 'ut_example_tests',
- a_name => 'add_1_to_g_number',
- a_line_no => null
- );
- begin
- l_test.before_test_list := ut3_develop.ut_executables(ut3_develop.ut_executable('ut3_tester_helper', 'ut_example_tests', 'set_g_number_0', ut3_develop.ut_utils.gc_before_test));
- --Act
- l_test.do_execute();
- --Assert
- ut.expect(l_test.result).to_equal(ut3_develop.ut_utils.gc_success);
- ut.expect(ut3_tester_helper.ut_example_tests.g_number).to_equal(1);
- end;
-
- procedure before_test_proc_name_invalid is
- --Arrange
- l_test ut3_develop.ut_test := ut3_develop.ut_test(
- a_object_owner => 'ut3_tester_helper',
- a_object_name => 'ut_example_tests',
- a_name => 'set_g_number_0',
- a_line_no => null
- );
- begin
- l_test.before_test_list := ut3_develop.ut_executables(
- ut3_develop.ut_executable('ut3_tester_helper', 'ut_example_tests', 'invalid setup name', ut3_develop.ut_utils.gc_before_test)
- );
- --Act
- l_test.do_execute();
- --Assert
- ut.expect(l_test.result).to_equal(ut3_develop.ut_utils.gc_error);
- ut.expect(ut3_tester_helper.ut_example_tests.g_number).to_be_null;
- end;
-
- procedure before_test_proc_name_null is
- --Arrange
- l_test ut3_develop.ut_test := ut3_develop.ut_test(
- a_object_owner => 'ut3_tester_helper',
- a_object_name => 'ut_example_tests',
- a_name => 'set_g_number_0',
- a_line_no => null
- );
- begin
- l_test.before_test_list := ut3_develop.ut_executables(
- ut3_develop.ut_executable('ut3_tester_helper', 'ut_example_tests', null, ut3_develop.ut_utils.gc_before_test)
- );
- --Act
- l_test.do_execute();
- --Assert
- ut.expect(l_test.result).to_equal(ut3_develop.ut_utils.gc_error);
- ut.expect(ut3_tester_helper.ut_example_tests.g_number).to_be_null;
- end;
-
- procedure after_test_executed is
- --Arrange
- l_test ut3_develop.ut_test := ut3_develop.ut_test(
- a_object_owner => 'ut3_tester_helper',
- a_object_name => 'ut_example_tests',
- a_name => 'set_g_number_0',
- a_line_no => null
- );
- begin
- l_test.after_test_list := ut3_develop.ut_executables(ut3_develop.ut_executable('ut3_tester_helper', 'ut_example_tests', 'add_1_to_g_number', ut3_develop.ut_utils.gc_after_test));
- --Act
- l_test.do_execute();
- --Assert
- ut.expect(l_test.result).to_equal(ut3_develop.ut_utils.gc_success);
- ut.expect(ut3_tester_helper.ut_example_tests.g_number).to_equal(1);
- end;
-
- procedure after_test_proce_name_invalid is
- --Arrange
- l_test ut3_develop.ut_test := ut3_develop.ut_test(
- a_object_owner => 'ut3_tester_helper',
- a_object_name => 'ut_example_tests',
- a_name => 'set_g_number_0',
- a_line_no => null
- );
- begin
- l_test.after_test_list := ut3_develop.ut_executables(
- ut3_develop.ut_executable('ut3_tester_helper', 'ut_example_tests', 'invalid procedure name', ut3_develop.ut_utils.gc_after_test)
- );
- --Act
- l_test.do_execute();
- --Assert
- ut.expect(l_test.result).to_equal(ut3_develop.ut_utils.gc_error);
- ut.expect(ut3_tester_helper.ut_example_tests.g_number).to_equal(0);
- end;
-
- procedure after_test_proc_name_null is
- --Arrange
- l_test ut3_develop.ut_test := ut3_develop.ut_test(
- a_object_owner => 'ut3_tester_helper',
- a_object_name => 'ut_example_tests',
- a_name => 'set_g_number_0',
- a_line_no => null
- );
- begin
- l_test.after_test_list := ut3_develop.ut_executables(
- ut3_develop.ut_executable('ut3_tester_helper', 'ut_example_tests', null, ut3_develop.ut_utils.gc_after_test)
- );
- --Act
- l_test.do_execute();
- --Assert
- ut.expect(l_test.result).to_equal(ut3_develop.ut_utils.gc_error);
- ut.expect(ut3_tester_helper.ut_example_tests.g_number).to_equal(0);
- end;
-
- procedure create_output_package is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace package ut_output_tests
- as
- --%suite
-
- --%beforeeach
- procedure beforeeach;
-
- --%aftereach
- procedure aftereach;
-
- --%test
- --%beforetest(beforetest)
- --%aftertest(aftertest)
- procedure ut_passing_test;
-
- procedure beforetest;
-
- procedure aftertest;
-
- --%beforeall
- procedure beforeall;
- --%afterall
- procedure afterall;
-
- end;]';
- execute immediate q'[create or replace package body ut_output_tests
- as
-
- procedure beforetest is
- begin
- dbms_output.put_line('');
- end;
-
- procedure aftertest is
- begin
- dbms_output.put_line('');
- end;
-
- procedure beforeeach is
- begin
- dbms_output.put_line('');
- end;
-
- procedure aftereach is
- begin
- dbms_output.put_line('');
- end;
-
- procedure ut_passing_test is
- begin
- dbms_output.put_line('');
- ut.expect(1,'Test 1 Should Pass').to_equal(1);
- end;
-
- procedure beforeall is
- begin
- dbms_output.put_line('');
- end;
-
- procedure afterall is
- begin
- dbms_output.put_line('');
- end;
-
- end;]';
- exception when others then
- null;
- end;
-
- procedure drop_output_package is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package ut_output_tests';
- exception when others then
- null;
- end;
-
- procedure test_output_gathering is
- l_output_data ut3_develop.ut_varchar2_list;
- l_output clob;
- begin
- select * bulk collect into l_output_data
- from table(ut3_develop.ut.run('ut_output_tests'));
- l_output := ut3_develop.ut_utils.table_to_clob(l_output_data);
- ut.expect(l_output).to_be_like(
- '%%%%%%%%1 tests, 0 failed, 0 errored%'
- );
- end;
-
-
-end;
-/
diff --git a/test/ut3_tester/core/test_ut_test.pks b/test/ut3_tester/core/test_ut_test.pks
deleted file mode 100644
index caf75eb6c..000000000
--- a/test/ut3_tester/core/test_ut_test.pks
+++ /dev/null
@@ -1,101 +0,0 @@
-create or replace package test_ut_test is
-
- --%suite(ut_test)
- --%suitepath(utplsql.ut3_tester.core)
-
- --%beforeeach
- procedure cleanup_package_state;
-
- --%test(Disabled flag for a test skips the tests execution in suite)
- procedure disabled_test;
-
- --%test(Marks test as errored if aftertest raises exception)
- procedure aftertest_errors;
-
- --%test(Marks each test as errored if aftereach raises exception)
- procedure aftereach_errors;
-
- --%test(Marks test as errored if beforetest raises exception)
- procedure beforetest_errors;
-
- --%test(Marks each test as errored if beforeeach raises exception)
- procedure beforeeach_errors;
-
-
- --%context(executables in test)
-
- --%test(Executes aftereach procedure)
- procedure after_each_executed;
-
- --%test(Fails test when aftereach procedure name invalid)
- procedure after_each_proc_name_invalid;
- --%test(Fails test when aftereach procedure name null)
- procedure after_each_procedure_name_null;
-
- procedure create_app_info_package;
- procedure drop_app_info_package;
- --%beforetest(create_app_info_package)
- --%aftertest(drop_app_info_package)
- --%test(Sets application_info on execution of individual items)
- procedure application_info_on_execution;
-
- --%test(Executes beforeeach procedure)
- procedure before_each_executed;
- --%test(Fails test when beforeeach procedure name invalid)
- procedure before_each_proc_name_invalid;
- --%test(Fails test when beforeeach procedure name null)
- procedure before_each_proc_name_null;
- --%test(Does not raise exception when rollback to savepoint fails)
- procedure ignore_savepoint_exception;
- --%test(Fails when owner name invalid)
- procedure owner_name_invalid;
-
-
- procedure create_synonym;
- procedure drop_synonym;
-
- --%test(Runs test as current schema when owner name null)
- --%beforetest(create_synonym)
- --%aftertest(drop_synonym)
- procedure owner_name_null;
-
- procedure create_invalid_package;
- procedure drop_invalid_package;
- --%beforetest(create_app_info_package)
- --%aftertest(drop_app_info_package)
- --%test(Fails the test that references package with compilation errors)
- procedure package_in_invalid_state;
- --%test(Fails the test when package name is invalid)
- procedure package_name_invalid;
- --%test(Fails the test when package name is null)
- procedure package_name_null;
- --%test(Fails the test when procedure name invalid)
- procedure procedure_name_invalid;
- --%test(Fails the test when procedure name null)
- procedure procedure_name_null;
-
-
- --%test(Executes befroretest procedure)
- procedure before_test_executed;
- --%test(Fails test when befroretest procedure name invalid)
- procedure before_test_proc_name_invalid;
- --%test(Fails test when befroretest procedure name is null)
- procedure before_test_proc_name_null;
- --%test(Executes aftertest procedure)
- procedure after_test_executed;
- --%test(Fails test when aftertest procedure name invalid)
- procedure after_test_proce_name_invalid;
- --%test(Fails test when aftertest procedure name is null)
- procedure after_test_proc_name_null;
-
- procedure create_output_package;
- procedure drop_output_package;
- --%beforetest(create_output_package)
- --%aftertest(drop_output_package)
- --%test(Test output gathering)
- procedure test_output_gathering;
-
- --%endcontext
-
-end;
-/
diff --git a/test/ut3_tester/core/test_ut_utils.pkb b/test/ut3_tester/core/test_ut_utils.pkb
deleted file mode 100644
index d46835f66..000000000
--- a/test/ut3_tester/core/test_ut_utils.pkb
+++ /dev/null
@@ -1,516 +0,0 @@
-create or replace package body test_ut_utils is
-
- gv_nls_value nls_session_parameters.value%type;
-
- gc_delimiter varchar2(1) := get_numeric_delimiter();
-
- function get_numeric_delimiter return varchar2 is
- l_result varchar2(1);
- begin
- select substr(value, 1, 1) into l_result from nls_session_parameters t where t.parameter = 'NLS_NUMERIC_CHARACTERS';
- return l_result;
- end;
-
- function clob_to_blob(p_clob clob) return blob is
- l_blob blob;
- l_dest_offset integer := 1;
- l_source_offset integer := 1;
- l_lang_context integer := dbms_lob.default_lang_ctx;
- l_warning integer := dbms_lob.warn_inconvertible_char;
- begin
- dbms_lob.createtemporary(l_blob, true);
- dbms_lob.converttoblob(
- dest_lob =>l_blob,
- src_clob =>p_clob,
- amount =>DBMS_LOB.LOBMAXSIZE,
- dest_offset =>l_dest_offset,
- src_offset =>l_source_offset,
- blob_csid =>DBMS_LOB.DEFAULT_CSID,
- lang_context=>l_lang_context,
- warning =>l_warning
- );
- return l_blob;
- end;
-
-
- procedure common_clob_to_table_exec(p_clob varchar2, p_delimiter varchar2, p_expected_list ut3_develop.ut_varchar2_list, p_limit number) is
- begin
- execute immediate 'declare
- l_clob clob := '''||p_clob||''';
- l_delimiter varchar2(1) := '''||p_delimiter||''';
- l_expected ut3_develop.ut_varchar2_list := :p_expected_list;
- l_result ut3_develop.ut_varchar2_list;
- l_limit integer := '||p_limit||q'[;
- l_result_str varchar2(32767);
- l_errors integer := 0;
- function compare_element(a_element_id integer, a_expected ut3_develop.ut_varchar2_list, a_actual ut3_develop.ut_varchar2_list) return integer is
- begin
- if a_expected.exists(a_element_id) and a_actual.exists(a_element_id) then
- if a_expected(a_element_id) = a_actual(a_element_id) or a_expected(a_element_id) is null and a_actual(a_element_id) is null then
- return 0;
- else
- dbms_output.put('a_expected('||a_element_id||')='||a_expected(a_element_id)||' | a_actual('||a_element_id||')='||a_actual(a_element_id));
- end if;
- end if;
- if not a_expected.exists(a_element_id) then
- dbms_output.put('a_expected('||a_element_id||') does not exist ');
- end if;
- if not a_actual.exists(a_element_id) then
- dbms_output.put('a_actual('||a_element_id||') does not exist ');
- end if;
- dbms_output.put_line(null);
- return 1;
- end;
-begin
---Act
- select column_value bulk collect into l_result from table( ut3_develop.ut_utils.clob_to_table(l_clob, l_limit, l_delimiter) );
- for i in 1 .. l_result.count loop
- l_result_str := l_result_str||''''||l_result(i)||''''||l_delimiter;
- end loop;
- l_result_str := rtrim(l_result_str,l_delimiter);
---Assert
- for i in 1 .. greatest(l_expected.count, l_result.count) loop
- l_errors := l_errors + compare_element(i, l_expected, l_result);
- end loop;
- ut.expect(l_errors).to_equal(0);
-end;]' using p_expected_list;
- end;
-
- procedure test_clob_to_table is
- begin
- common_clob_to_table_exec('a,b,c,d', ',', ut3_develop.ut_varchar2_list('a','b','c','d'), 1000);
- common_clob_to_table_exec( '', ',', ut3_develop.ut_varchar2_list(), 1000);
- common_clob_to_table_exec( '1,b,c,d', '', ut3_develop.ut_varchar2_list('1,b,','c,d'), 4);
- common_clob_to_table_exec( 'abcdefg,hijk,axa,a', ',', ut3_develop.ut_varchar2_list('abc','def','g','hij','k','axa','a'), 3);
- common_clob_to_table_exec( ',a,,c,d,', ',', ut3_develop.ut_varchar2_list('','a','','c','d',''), 1000);
- end;
-
- procedure test_test_result_to_char is
- begin
- ut.expect(ut3_develop.ut_utils.test_result_to_char(-1),'test unknown').to_equal('Unknown(-1)');
- ut.expect(ut3_develop.ut_utils.test_result_to_char(null),'test unknown').to_equal('Unknown(NULL)');
- ut.expect(ut3_develop.ut_utils.test_result_to_char(ut3_develop.ut_utils.gc_success),'test unknown').to_equal(ut3_develop.ut_utils.gc_success_char);
- end;
-
- procedure to_string_emptyblob is
- begin
- ut.expect(ut3_develop.ut_data_value_blob(empty_blob()).to_string()).to_equal('EMPTY');
- end;
-
- procedure to_string_emptyclob is
- begin
- ut.expect(ut3_develop.ut_data_value_clob(empty_clob()).to_string()).to_equal('EMPTY');
- end;
-
- procedure to_string_nullblob is
- begin
- ut.expect(ut3_develop.ut_data_value_blob(null).to_string()).to_equal('NULL');
- end;
-
- procedure to_string_nullclob is
- begin
- ut.expect(ut3_develop.ut_data_value_clob(null).to_string()).to_equal('NULL');
- end;
-
- procedure to_string_nulldate is
- begin
- ut.expect(ut3_develop.ut_data_value_date(null).to_string()).to_equal('NULL');
- end;
-
- procedure to_string_nullnumber is
- begin
- ut.expect(ut3_develop.ut_data_value_number(null).to_string()).to_equal('NULL');
- end;
-
- procedure to_string_nulltimestamp is
- begin
- ut.expect(ut3_develop.ut_data_value_timestamp(null).to_string()).to_equal('NULL');
- end;
-
- procedure to_string_nulltimestamp_ltz is
- begin
- ut.expect(ut3_develop.ut_data_value_timestamp_ltz(null).to_string()).to_equal('NULL');
- end;
-
- procedure to_string_nulltimestamp_tz is
- begin
- ut.expect(ut3_develop.ut_data_value_timestamp_tz(null).to_string()).to_equal('NULL');
- end;
-
- procedure to_string_nullvarchar2 is
- begin
- ut.expect(ut3_develop.ut_data_value_varchar2(null).to_string()).to_equal('NULL');
- end;
-
- procedure to_string_blob is
- l_text varchar2(32767) := 'A test char';
- l_value blob := utl_raw.cast_to_raw(l_text);
- l_expected varchar2(32767) := ''''||rawtohex(l_value)||'''';
- begin
- ut.expect(ut3_develop.ut_data_value_blob(l_value).to_string()).to_equal(l_expected);
- end;
-
- procedure to_string_clob is
- l_value clob := 'A test char';
- l_expected varchar2(32767) := ''''||l_value||'''';
- begin
- ut.expect(ut3_develop.ut_data_value_clob(l_value).to_string()).to_equal(l_expected);
- end;
-
- procedure to_string_date is
- l_value date := to_date('2016-12-31 23:59:59', 'yyyy-mm-dd hh24:mi:ss');
- l_expected varchar2(100) := ' 2016-12-31T23:59:59';
- begin
- ut.expect(ut3_develop.ut_data_value_date(l_value).to_string()).to_equal(l_expected);
- end;
-
- procedure to_string_timestamp is
- l_value timestamp(9) := to_timestamp('2016-12-31 23:59:59.123456789', 'yyyy-mm-dd hh24:mi:ss.ff');
- l_expected varchar2(100) := ' 2016-12-31T23:59:59'||gc_delimiter||'123456789';
- begin
- ut.expect(ut3_develop.ut_data_value_timestamp(l_value).to_string()).to_equal(l_expected);
- end;
-
- procedure to_string_timestamp_ltz is
- l_value timestamp(9) with local time zone := to_timestamp('2016-12-31 23:59:59.123456789', 'yyyy-mm-dd hh24:mi:ss.ff');
- l_expected varchar2(100) := ' 2016-12-31T23:59:59'||gc_delimiter||'123456789';
- begin
- ut.expect(ut3_develop.ut_data_value_timestamp_ltz(l_value).to_string()).to_equal(l_expected);
- end;
-
- procedure to_string_timestamp_tz is
- l_value timestamp(9) with time zone := to_timestamp_tz('2016-12-31 23:59:59.123456789 -8:00', 'yyyy-mm-dd hh24:mi:ss.ff tzh:tzm');
- l_expected varchar2(100) := ' 2016-12-31T23:59:59'||gc_delimiter||'123456789 -08:00';
- begin
- ut.expect(ut3_develop.ut_data_value_timestamp_tz(l_value).to_string()).to_equal(l_expected);
- end;
-
- procedure to_string_varchar2 is
- l_value varchar2(20) := 'A test char';
- l_expected varchar2(100) := ''''||l_value||'''';
- begin
- ut.expect(ut3_develop.ut_data_value_varchar2(l_value).to_string()).to_equal(l_expected);
- end;
-
- procedure to_string_verybigblob is
- l_text clob := lpad('A test char',32767,'1')||lpad('1',32767,'1');
- l_value blob;
- begin
- l_value := clob_to_blob(l_text);
- ut.expect(length(ut3_develop.ut_data_value_blob(l_value).to_string())).to_equal(ut3_develop.ut_utils.gc_max_output_string_length);
- ut.expect(ut3_develop.ut_data_value_blob(l_value).to_string()).to_be_like('%'||ut3_develop.ut_utils.gc_more_data_string);
- end;
-
- procedure to_string_verybigclob is
- l_value clob := lpad('A test char',32767,'1')||lpad('1',32767,'1');
- begin
- ut.expect(length(ut3_develop.ut_data_value_clob(l_value).to_string())).to_equal(ut3_develop.ut_utils.gc_max_output_string_length);
- ut.expect(ut3_develop.ut_data_value_clob(l_value).to_string()).to_be_like('%'||ut3_develop.ut_utils.gc_more_data_string);
- end;
-
- procedure to_string_verybignumber is
- l_value number := 1234567890123456789012345678901234567890;
- l_expected varchar2(100) := '1234567890123456789012345678901234567890';
- begin
- ut.expect(ut3_develop.ut_data_value_number(l_value).to_string()).to_equal(l_expected);
- end;
-
- procedure to_string_verybigvarchar2 is
- l_value varchar2(32767) := lpad('A test char',32767,'1');
- l_result varchar2(32767);
- begin
- ut.expect(length(ut3_develop.ut_data_value_varchar2(l_value).to_string())).to_equal(ut3_develop.ut_utils.gc_max_output_string_length);
- ut.expect(ut3_develop.ut_data_value_varchar2(l_value).to_string()).to_be_like('%'||ut3_develop.ut_utils.gc_more_data_string);
- end;
-
- procedure to_string_verysmallnumber is
- l_value number := 0.123456789012345678901234567890123456789;
- l_expected varchar2(100) := gc_delimiter||'123456789012345678901234567890123456789';
- begin
- ut.expect(ut3_develop.ut_data_value_number(l_value).to_string()).to_equal(l_expected);
- end;
-
- procedure test_table_to_clob is
- procedure exec_table_to_clob(a_list ut3_develop.ut_varchar2_list, a_delimiter varchar2, a_expected clob) is
- l_result clob;
- begin
- l_result := ut3_develop.ut_utils.table_to_clob(a_list, a_delimiter);
-
- ut.expect(l_result).to_equal(a_expected, a_nulls_are_equal => true);
- end;
- begin
- exec_table_to_clob(null, ',', '');
- exec_table_to_clob(ut3_develop.ut_varchar2_list(), ',', '');
- exec_table_to_clob(ut3_develop.ut_varchar2_list('a', 'b', 'c', 'd'), ',', 'a,b,c,d');
- exec_table_to_clob(ut3_develop.ut_varchar2_list('1,b,', 'c,d'), ',', '1,b,,c,d');
- exec_table_to_clob(ut3_develop.ut_varchar2_list('', 'a', '', 'c', 'd', ''), ',', ',a,,c,d,');
- end;
-
- procedure test_append_with_multibyte is
- l_lines sys.dbms_preprocessor.source_lines_t;
- l_result clob;
- begin
- l_lines := sys.dbms_preprocessor.get_post_processed_source(
- object_type => 'PACKAGE',
- schema_name => sys_context('USERENV', 'CURRENT_USER'),
- object_name => 'TST_CHARS'
- );
-
- for i in 1..l_lines.count loop
- l_result := null;
- ut3_develop.ut_utils.append_to_clob(l_result, l_lines(i));
-
- --Assert
- ut.expect(dbms_lob.getlength(l_result),'Error for index '||i).to_equal(dbms_lob.getlength(l_lines(i)));
- end loop;
- end;
-
- procedure setup_append_with_multibyte is
- pragma autonomous_transaction;
- begin
- select value into gv_nls_value from nls_session_parameters where parameter = 'NLS_DATE_LANGUAGE';
- execute immediate 'alter session set nls_date_language=ENGLISH';
- execute immediate 'create or replace package tst_chars as
--- 2) Status of the process = 😡PE😡 with no linked data
-end;';
- execute immediate 'alter session set nls_date_language=RUSSIAN';
-
- end;
- procedure clean_append_with_multibyte is
- pragma autonomous_transaction;
- begin
- execute immediate 'alter session set nls_date_language='||gv_nls_value;
- execute immediate 'drop package tst_chars';
- end;
-
- procedure test_clob_to_table_multibyte is
- l_varchar2_byte_limit integer := 32767;
- l_workaround_byte_limit integer := 8191;
- l_singlebyte_string_max_size varchar2(32767 char) := rpad('x',l_varchar2_byte_limit,'x');
- l_twobyte_character char(1 char) := unistr('\00E4');
- l_clob_multibyte clob := l_twobyte_character||l_singlebyte_string_max_size; --here we have 32769(2+32767) bytes and 32768 chars
- l_expected ut3_develop.ut_varchar2_list := ut3_develop.ut_varchar2_list();
- l_result ut3_develop.ut_varchar2_list;
- begin
- l_expected.extend(1);
- l_expected(1) := l_twobyte_character||substr(l_singlebyte_string_max_size,1,l_workaround_byte_limit-1);
- --Act
- l_result := ut3_develop.ut_utils.clob_to_table(l_clob_multibyte);
- --Assert
- ut.expect(l_result(1)).to_equal(l_expected(1));
- end;
-
- procedure test_to_version_split is
- l_version ut3_develop.ut_utils.t_version;
- begin
- l_version := ut3_develop.ut_utils.to_version('v034.0.0456.0333');
- ut.expect(l_version.major).to_equal(34);
- ut.expect(l_version.minor).to_equal(0);
- ut.expect(l_version.bugfix).to_equal(456);
- ut.expect(l_version.build).to_equal(333);
- end;
-
- procedure test_trim_list_elements
- is
- l_list_to_be_equal ut3_develop.ut_varchar2_list := ut3_develop.ut_varchar2_list('hello', 'world', 'okay');
- l_list ut3_develop.ut_varchar2_list := ut3_develop.ut_varchar2_list(' hello ', chr(9)||'world ', 'okay');
- begin
- --Act
- l_list := ut3_develop.ut_utils.trim_list_elements(l_list);
- --Assert
- ut.expect(anydata.convertcollection(l_list)).to_equal(anydata.convertcollection(l_list_to_be_equal));
- end;
-
- procedure trim_list_elemts_null_collect
- is
- l_list_to_be_null ut3_develop.ut_varchar2_list;
- begin
- --Act
- l_list_to_be_null := ut3_develop.ut_utils.trim_list_elements(l_list_to_be_null);
- --Assert
- ut.expect(anydata.convertcollection(l_list_to_be_null)).to_be_null;
- end;
-
- procedure trim_list_elemts_empty_collect
- is
- l_list_to_be_empty ut3_develop.ut_varchar2_list := ut3_develop.ut_varchar2_list();
- begin
- --Act
- l_list_to_be_empty := ut3_develop.ut_utils.trim_list_elements(l_list_to_be_empty);
- --Assert
- ut.expect(anydata.convertcollection(l_list_to_be_empty)).to_be_empty;
- end;
-
- procedure test_filter_list
- is
- l_list_to_be_equal ut3_develop.ut_varchar2_list := ut3_develop.ut_varchar2_list('-12458', '8956', '789');
- l_list ut3_develop.ut_varchar2_list := ut3_develop.ut_varchar2_list('-12458', '8956', 'okay', null,'458963', '789');
- begin
- --Act
- l_list := ut3_develop.ut_utils.filter_list(l_list, '^-?[[:digit:]]{1,5}$');
- --Assert
- ut.expect(anydata.convertcollection(l_list)).to_equal(anydata.convertcollection(l_list_to_be_equal));
- end;
-
- procedure filter_list_null_collection
- is
- l_list_to_be_null ut3_develop.ut_varchar2_list;
- begin
- --Act
- l_list_to_be_null := ut3_develop.ut_utils.filter_list(l_list_to_be_null, '^-?[[:digit:]]{1,5}$');
- --Assert
- ut.expect(anydata.convertcollection(l_list_to_be_null)).to_be_null;
- end;
-
- procedure filter_list_empty_collection
- is
- l_list_to_be_empty ut3_develop.ut_varchar2_list := ut3_develop.ut_varchar2_list();
- begin
- --Act
- l_list_to_be_empty := ut3_develop.ut_utils.filter_list(l_list_to_be_empty, '^-?[[:digit:]]{1,5}$');
- --Assert
- ut.expect(anydata.convertcollection(l_list_to_be_empty)).to_be_empty;
- end;
-
- procedure replace_multiline_comments
- is
- l_source clob;
- l_actual dbms_preprocessor.source_lines_t;
- l_expected dbms_preprocessor.source_lines_t;
- begin
- --Arrange
- l_source := q'[
-create or replace package dummy as
-
- -- single line comment with disabled /* multi-line comment */
- gv_text0 varchar2(200) := q'{/* multi-line comment
- in escaped q'multi-line
- string*/}';
- gv_text1 varchar2(200) := '/* multi-line comment in a string*/';
- gv_text2 varchar2(200) := '/* multi-line comment
- in a multi-line
- string*/';
- -- ignored start of multi-line comment with multi-byte text ☺ /*
- -- ignored end of multi-line comment with multi-byte text ☺ */
- /* multi-line comment
- with
- multi-byte characters ☺☺☺
- in it */
- gv_text3 varchar2(200) := 'some text'; /* multiline comment*/ --followed by single-line comment
- /* multi-line comment in one line*/
- gv_text4 varchar2(200) := q'{/* multi-line comment
- in escaped q'multi-line
- string*/}';
-end;
-]';
-
- --Act
- l_actual := ut3_develop.ut_utils.replace_multiline_comments(
- ut3_tester_helper.main_helper.make_source( ut3_develop.ut_utils.clob_to_table(l_source) )
- );
-
- --Assert
- l_expected := ut3_tester_helper.main_helper.make_source( ut3_develop.ut_utils.clob_to_table( q'[
-create or replace package dummy as
-
- -- single line comment with disabled /* multi-line comment */
- gv_text0 varchar2(200) := q'{/* multi-line comment
- in escaped q'multi-line
- string*/}';
- gv_text1 varchar2(200) := '/* multi-line comment in a string*/';
- gv_text2 varchar2(200) := '/* multi-line comment
- in a multi-line
- string*/';
- -- ignored start of multi-line comment with multi-byte text ☺ /*
- -- ignored end of multi-line comment with multi-byte text ☺ */
- ]'||q'[
-
-
-
- gv_text3 varchar2(200) := 'some text'; --followed by single-line comment
- ]'||q'[
- gv_text4 varchar2(200) := q'{/* multi-line comment
- in escaped q'multi-line
- string*/}';
-end;
-]' ) );
- --Act
- ut.expect(ut3_tester_helper.main_helper.lines_to_str(l_actual)).to_equal(ut3_tester_helper.main_helper.lines_to_str(l_expected));
- end;
-
- procedure int_conv_ds_sec is
- l_expected varchar2(100) := '1 second';
- l_actual varchar2(200) := ut3_develop.ut_utils.interval_to_text(interval '1' second);
- begin
- ut.expect(l_expected).to_equal(l_actual);
- end;
-
- procedure int_conv_ds_minute is
- l_expected varchar2(100) := '1 minute';
- l_actual varchar2(200) := ut3_develop.ut_utils.interval_to_text(interval '1' minute);
- begin
- ut.expect(l_expected).to_equal(l_actual);
- end;
-
- procedure int_conv_ds_hour is
- l_expected varchar2(100) := '1 hour';
- l_actual varchar2(200) := ut3_develop.ut_utils.interval_to_text(interval '1' hour);
- begin
- ut.expect(l_expected).to_equal(l_actual);
- end;
-
- procedure int_conv_ds_day is
- l_expected varchar2(100) := '1 day';
- l_actual varchar2(200) := ut3_develop.ut_utils.interval_to_text(interval '1' day);
- begin
- ut.expect(l_expected).to_equal(l_actual);
- end;
-
- procedure int_conv_ds_date is
- l_expected varchar2(100) := '2 days 3 hours 4 minutes 11.333 seconds';
- l_actual varchar2(200) := ut3_develop.ut_utils.interval_to_text(INTERVAL '2 3:04:11.333' DAY TO SECOND);
- begin
- ut.expect(l_expected).to_equal(l_actual);
- end;
-
- procedure int_conv_ym_year is
- l_expected varchar2(100) := '1 year';
- l_actual varchar2(200) := ut3_develop.ut_utils.interval_to_text(interval '1' year);
- begin
- ut.expect(l_expected).to_equal(l_actual);
- end;
-
- procedure int_conv_ym_month is
- l_expected varchar2(100) := '1 month';
- l_actual varchar2(200) := ut3_develop.ut_utils.interval_to_text(interval '1' month);
- begin
- ut.expect(l_expected).to_equal(l_actual);
- end;
-
- procedure int_conv_ym_date is
- l_expected varchar2(100) := '1 year 2 months';
- l_actual varchar2(200) := ut3_develop.ut_utils.interval_to_text(INTERVAL '1-2' YEAR TO MONTH);
- begin
- ut.expect(l_expected).to_equal(l_actual);
- end;
-
- procedure convert_collection_multibyte is
- l_input ut3_develop.ut_varchar2_list;
- l_max_len integer := ut3_develop.ut_utils.gc_max_storage_varchar2_len;
- begin
- --Arrange
- l_input := ut3_develop.ut_varchar2_list( rpad( '❤', l_max_len, 'a' ) );
- ut.expect( lengthb( l_input( 1 ) ) ).to_be_greater_than(l_max_len);
-
- --Act
- ut.expect( lengthb( ut3_develop.ut_utils.convert_collection(l_input)(1) ) ).to_be_less_or_equal(l_max_len);
- end;
-
- procedure lengthb_gives_length_in_bytes is
- l_clob clob;
- begin
- l_clob := '❤';
- ut.expect(ut3_develop.ut_utils.lengthb_clob(l_clob)).to_be_greater_than(1);
- end;
-end test_ut_utils;
-/
diff --git a/test/ut3_tester/core/test_ut_utils.pks b/test/ut3_tester/core/test_ut_utils.pks
deleted file mode 100644
index 82145f908..000000000
--- a/test/ut3_tester/core/test_ut_utils.pks
+++ /dev/null
@@ -1,165 +0,0 @@
-create or replace package test_ut_utils is
-
- --%suite(ut_utils)
- --%suitepath(utplsql.ut3_tester.core)
-
- function get_numeric_delimiter return varchar2;
-
- --%test(clob_to_table - Converts a clob into ut_varchar2_list using specified delimiter)
- procedure test_clob_to_table;
-
- --%test(test_result_to_char - Converts numeric test result to character representation)
- procedure test_test_result_to_char;
-
-
- --%context(to_string)
-
- --%test(Returns 'EMPTY' string for NULL BLOB)
- procedure to_string_emptyblob;
-
- --%test(Returns 'EMPTY' string for NULL CLOB)
- procedure to_string_emptyclob;
-
- --%test(Returns 'NULL' string for NULL BLOB)
- procedure to_string_nullblob;
-
- --%test(Returns 'NULL' string for NULL CLOB)
- procedure to_string_nullclob;
-
- --%test(Returns 'NULL' string for NULL date)
- procedure to_string_nulldate;
-
- --%test(Returns 'NULL' string for NULL number)
- procedure to_string_nullnumber;
-
- --%test(Returns 'NULL' string for NULL timestamp)
- procedure to_string_nulltimestamp;
-
- --%test(Returns 'NULL' string for NULL timestamp with local timezone)
- procedure to_string_nulltimestamp_ltz;
-
- --%test(Returns 'NULL' string for NULL timestamp with timezone)
- procedure to_string_nulltimestamp_tz;
-
- --%test(Returns 'NULL' string for NULL varchar)
- procedure to_string_nullvarchar2;
-
- --%test(Returns string representation of BLOB)
- procedure to_string_blob;
-
- --%test(Returns string representation of CLOB)
- procedure to_string_clob;
-
- --%test(Returns string representation of date)
- procedure to_string_date;
-
- --%test(Returns string representation of timestamp)
- procedure to_string_timestamp;
-
- --%test(Returns string representation of timestamp with local timezone)
- procedure to_string_timestamp_ltz;
-
- --%test(Returns string representation of timestamp with timezone)
- procedure to_string_timestamp_tz;
-
- --%test(Returns varchar value)
- procedure to_string_varchar2;
-
- --%test(Returns BLOB trimmed to 4000 chars with trailing [...])
- procedure to_string_verybigblob;
-
---%test(Returns CLOB trimmed to 4000 chars with trailing [...])
- procedure to_string_verybigclob;
-
- --%test(Returns string representation of large number)
- procedure to_string_verybignumber;
-
- --%test(Returns varchar2 trimmed to 4000 chars with trailing [...])
- procedure to_string_verybigvarchar2;
-
- --%test(Returns string representation of small number)
- procedure to_string_verysmallnumber;
-
- --%endcontext
-
- --%test(table_to_clob - converts ut_varchar2_list into a CLOB value)
- procedure test_table_to_clob;
-
- --%test(append_to_clob - adds multibyte varchar to CLOB)
- --%beforetest(setup_append_with_multibyte)
- --%aftertest(clean_append_with_multibyte)
- procedure test_append_with_multibyte;
- procedure setup_append_with_multibyte;
- procedure clean_append_with_multibyte;
-
- --%test(clob_to_table - converts multibyte CLOB to ut_varchar2_list)
- procedure test_clob_to_table_multibyte;
-
- --%test(to_version - splits version string into individual version components)
- procedure test_to_version_split;
-
- --%context(trim_list_elements)
-
- --%test(Trims the elements of a collection)
- procedure test_trim_list_elements;
-
- --%test(Trim list elements with null collection)
- procedure trim_list_elemts_null_collect;
-
- --%test(Trim list elements with empty collection)
- procedure trim_list_elemts_empty_collect;
-
- --%endcontext
-
- --%context(filter_list)
-
- --%test(Filters the collection's elements)
- procedure test_filter_list;
-
- --%test(Filter list elements with null collection)
- procedure filter_list_null_collection;
-
- --%test(Filter list elements with empty collection)
- procedure filter_list_empty_collection;
-
- --%endcontext
-
- --%test(replace_multiline_comments - replaces multi-line comments with empty lines)
- procedure replace_multiline_comments;
-
- --%context(interval_converter_to_strin)
-
- --%test(returns text representation of interval day to second for 1 second interval)
- procedure int_conv_ds_sec;
-
- --%test(returns text representation of interval day to second for 1 minute interval)
- procedure int_conv_ds_minute;
-
- --%test(returns text representation of interval day to second for 1 hour interval)
- procedure int_conv_ds_hour;
-
- --%test(returns text representation of interval day to second for 1 day interval)
- procedure int_conv_ds_day;
-
- --%test(returns text representation of interval day to second for combination interval)
- procedure int_conv_ds_date;
-
- --%test(returns text representation of interval year to month for 1 year interval)
- procedure int_conv_ym_year;
-
- --%test(returns text representation of interval year to month for 1 month interval)
- procedure int_conv_ym_month;
-
- --%test(returns text representation of interval year to month for custom interval)
- procedure int_conv_ym_date;
-
- --%endcontext
-
- --%test(convert_collection does not fail on multibyte strings - Issue #1245 )
- procedure convert_collection_multibyte;
-
- --%test(lengthb returns length of a CLOB in bytes )
- procedure lengthb_gives_length_in_bytes;
-
-end test_ut_utils;
-/
diff --git a/test/ut3_tester_helper/annotation_cache_helper.pkb b/test/ut3_tester_helper/annotation_cache_helper.pkb
deleted file mode 100644
index 63e20159d..000000000
--- a/test/ut3_tester_helper/annotation_cache_helper.pkb
+++ /dev/null
@@ -1,250 +0,0 @@
-create or replace package body annotation_cache_helper as
-
- procedure setup_two_suites is
- pragma autonomous_transaction;
- begin
- execute immediate
- 'create or replace package ut3_cache_test_owner.granted_test_suite authid definer is
- --%suite
-
- --%test
- procedure test1;
- --%test
- procedure test2;
- end;';
-
- execute immediate
- 'create or replace package body ut3_cache_test_owner.granted_test_suite is
- procedure test1 is begin ut3_develop.ut.expect( 1 ).to_equal( 1 ); end;
- procedure test2 is begin ut3_develop.ut.expect( 1 ).to_equal( 1 ); end;
- end;';
- execute immediate
- 'create or replace package ut3_cache_test_owner.not_granted_test_suite authid definer is
- --%suite
-
- --%test
- procedure test1;
- --%test
- procedure test2;
- end;';
- execute immediate
- 'create or replace package body ut3_cache_test_owner.not_granted_test_suite is
- procedure test1 is begin ut3_develop.ut.expect( 1 ).to_equal( 1 ); end;
- procedure test2 is begin ut3_develop.ut.expect( 1 ).to_equal( 1 ); end;
- end;';
-
- execute immediate
- 'grant execute on ut3_cache_test_owner.granted_test_suite to
- ut3_execute_any_proc_user, ut3_select_any_table_user, ut3_select_catalog_user, ut3_no_extra_priv_user';
- end;
-
- procedure revoke_granted_suite is
- pragma autonomous_transaction;
- begin
- execute immediate
- 'revoke execute on ut3_cache_test_owner.granted_test_suite from
- ut3_execute_any_proc_user, ut3_select_any_table_user, ut3_select_catalog_user, ut3_no_extra_priv_user';
- exception
- when others then
- null;
- end;
-
-
- procedure add_new_suite is
- pragma autonomous_transaction;
- begin
- execute immediate
- 'create or replace package ut3_cache_test_owner.new_suite authid definer is
- --%suite
-
- --%test
- procedure test1;
- --%test
- procedure test2;
- end;';
-
- execute immediate
- 'create or replace package body ut3_cache_test_owner.new_suite is
- procedure test1 is begin ut3_develop.ut.expect( 1 ).to_equal( 1 ); end;
- procedure test2 is begin ut3_develop.ut.expect( 1 ).to_equal( 1 ); end;
- end;';
- execute immediate
- 'grant execute on ut3_cache_test_owner.new_suite to
- ut3_execute_any_proc_user, ut3_select_any_table_user, ut3_select_catalog_user, ut3_no_extra_priv_user';
- end;
-
- procedure cleanup_two_suites is
- pragma autonomous_transaction;
- begin
- begin
- execute immediate 'drop package ut3_cache_test_owner.not_granted_test_suite';
- exception
- when others then
- null;
- end;
- begin
- execute immediate 'drop package ut3_cache_test_owner.granted_test_suite';
- exception
- when others then
- null;
- end;
- end;
-
- /*
- Suites spread across packages, only child_suite is granted:
- parent_suite package parent_suite, not granted, tagged parent_tag
- parent_suite.child_suite package child_suite, granted
- hidden_path.sub.lone_suite package lone_suite, not granted, below logical suites hidden_path and hidden_path.sub
- */
- procedure setup_suite_hierarchy is
- pragma autonomous_transaction;
- begin
- execute immediate
- 'create or replace package ut3_cache_test_owner.parent_suite authid definer is
- --%suite
- --%tags(parent_tag)
-
- --%test
- procedure parent_test;
- end;';
- execute immediate
- 'create or replace package body ut3_cache_test_owner.parent_suite is
- procedure parent_test is begin ut3_develop.ut.expect( 1 ).to_equal( 1 ); end;
- end;';
- execute immediate
- 'create or replace package ut3_cache_test_owner.child_suite authid definer is
- --%suite
- --%suitepath(parent_suite)
-
- --%test
- procedure child_test;
- end;';
- execute immediate
- 'create or replace package body ut3_cache_test_owner.child_suite is
- procedure child_test is begin ut3_develop.ut.expect( 1 ).to_equal( 1 ); end;
- end;';
- execute immediate
- 'create or replace package ut3_cache_test_owner.lone_suite authid definer is
- --%suite
- --%suitepath(hidden_path.sub)
-
- --%test
- procedure lone_test;
- end;';
- execute immediate
- 'create or replace package body ut3_cache_test_owner.lone_suite is
- procedure lone_test is begin ut3_develop.ut.expect( 1 ).to_equal( 1 ); end;
- end;';
- execute immediate 'grant execute on ut3_cache_test_owner.child_suite to ut3_no_extra_priv_user';
- end;
-
- procedure cleanup_suite_hierarchy is
- pragma autonomous_transaction;
- begin
- for i in ( select column_value as package_name from table(ut3_develop.ut_varchar2_list('parent_suite','child_suite','lone_suite')) ) loop
- begin
- execute immediate 'drop package ut3_cache_test_owner.'||i.package_name;
- exception
- when others then
- null;
- end;
- end loop;
- end;
-
- procedure cleanup_new_suite is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package ut3_cache_test_owner.new_suite';
- exception
- when others then
- null;
- end;
-
- procedure purge_annotation_cache is
- begin
- ut3_develop.ut_runner.purge_cache( 'UT3_CACHE_TEST_OWNER' );
- end;
-
-
- procedure disable_ddl_trigger is
- pragma autonomous_transaction;
- begin
- execute immediate 'alter trigger ut3_develop.ut_trigger_annotation_parsing disable';
- execute immediate 'begin ut3_develop.ut_trigger_check.is_alive( ); end;';
- end;
-
- procedure enable_ddl_trigger is
- pragma autonomous_transaction;
- begin
- execute immediate 'alter trigger ut3_develop.ut_trigger_annotation_parsing enable';
- end;
-
- procedure create_run_function_for_user(a_user varchar2) is
- pragma autonomous_transaction;
- begin
- execute immediate
- 'create or replace function ' || a_user || '.call_ut_run(a_path varchar2 := ''ut3_cache_test_owner'', a_tags varchar2 := null) return clob is
- l_data ut3_develop.ut_varchar2_list;
- l_results clob;
- begin
- select * bulk collect into l_data from table (ut3_develop.ut.run( a_path, a_tags => a_tags ));
- return ut3_tester_helper.main_helper.table_to_clob( l_data );
- end;
- ';
- execute immediate 'grant execute on ' || a_user || '.call_ut_run to public ';
- execute immediate
- 'create or replace function ' || a_user || '.call_suites_info return clob is
- l_data ut3_develop.ut_varchar2_list;
- begin
- select i.item_type || '' '' || i.path
- bulk collect into l_data
- from table (ut3_develop.ut_runner.get_suites_info( ''UT3_CACHE_TEST_OWNER'' )) i
- order by i.path;
- return ut3_tester_helper.main_helper.table_to_clob( l_data );
- end;
- ';
- execute immediate 'grant execute on ' || a_user || '.call_suites_info to public ';
- end;
-
- procedure drop_run_function_for_user(a_user varchar2) is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop function ' || a_user || '.call_ut_run';
- execute immediate 'drop function ' || a_user || '.call_suites_info';
- end;
-
- procedure create_run_function_for_users is
- begin
- create_run_function_for_user( 'ut3_no_extra_priv_user' );
- create_run_function_for_user( 'ut3_select_catalog_user' );
- create_run_function_for_user( 'ut3_select_any_table_user' );
- create_run_function_for_user( 'ut3_execute_any_proc_user' );
- create_run_function_for_user( 'ut3_cache_test_owner' );
- create_run_function_for_user( 'ut3_develop' );
- end;
-
- procedure drop_run_function_for_users is
- begin
- drop_run_function_for_user( 'ut3_no_extra_priv_user' );
- drop_run_function_for_user( 'ut3_select_catalog_user' );
- drop_run_function_for_user( 'ut3_select_any_table_user' );
- drop_run_function_for_user( 'ut3_execute_any_proc_user' );
- drop_run_function_for_user( 'ut3_cache_test_owner' );
- drop_run_function_for_user( 'ut3_develop' );
- end;
-
- function run_tests_as(a_user varchar2, a_path varchar2 := 'ut3_cache_test_owner', a_tags varchar2 := null) return clob is
- l_results clob;
- begin
- execute immediate 'begin :x := '||a_user||'.call_ut_run(:a_path, :a_tags); end;' using out l_results, a_path, a_tags;
- return l_results;
- end;
-
- function get_suites_info_as(a_user varchar2) return clob is
- l_results clob;
- begin
- execute immediate 'begin :x := '||a_user||'.call_suites_info; end;' using out l_results;
- return l_results;
- end;
-end;
-/
\ No newline at end of file
diff --git a/test/ut3_tester_helper/annotation_cache_helper.pks b/test/ut3_tester_helper/annotation_cache_helper.pks
deleted file mode 100644
index 88b82d872..000000000
--- a/test/ut3_tester_helper/annotation_cache_helper.pks
+++ /dev/null
@@ -1,25 +0,0 @@
-create or replace package annotation_cache_helper as
-
- procedure setup_two_suites;
- procedure add_new_suite;
- procedure revoke_granted_suite;
-
- procedure cleanup_two_suites;
- procedure cleanup_new_suite;
-
- procedure purge_annotation_cache;
-
- procedure disable_ddl_trigger;
- procedure enable_ddl_trigger;
-
- procedure setup_suite_hierarchy;
- procedure cleanup_suite_hierarchy;
-
- procedure create_run_function_for_users;
- procedure drop_run_function_for_users;
-
- function run_tests_as(a_user varchar2, a_path varchar2 := 'ut3_cache_test_owner', a_tags varchar2 := null) return clob;
- function get_suites_info_as(a_user varchar2) return clob;
-
-end;
-/
\ No newline at end of file
diff --git a/test/ut3_tester_helper/coverage_helper.pkb b/test/ut3_tester_helper/coverage_helper.pkb
deleted file mode 100644
index 8c978d046..000000000
--- a/test/ut3_tester_helper/coverage_helper.pkb
+++ /dev/null
@@ -1,564 +0,0 @@
-create or replace package body coverage_helper is
-
- g_job_no integer := 0;
-
- function covered_package_name return varchar2 is
- begin
- return 'dummy_coverage_package_with_an_amazingly_long_name_that_you_would_not_think_of_in_real_life_project_because_its_simply_too_long';
- end;
-
- function substitute_covered_package( a_text varchar2, a_substitution varchar2 ) return varchar2 is
- begin
- return replace( replace( a_text, a_substitution, covered_package_name() ), upper(a_substitution), upper(covered_package_name()) );
- end;
-
- procedure set_develop_mode is
- begin
- ut3_develop.ut_coverage.set_develop_mode(true);
- end;
-
-
- procedure create_dummy_coverage is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace package ut3_develop.]'||covered_package_name||q'[ is
- procedure do_stuff(i_input in number);
- end;]';
-
- execute immediate q'[create or replace package body ut3_develop.]'||covered_package_name||q'[ is
- procedure do_stuff(i_input in number) is
- begin
- if i_input = 2 then dbms_output.put_line('should not get here'); elsif i_input = 1 then dbms_output.put_line('should get here');
- else
- dbms_output.put_line('should not get here');
- end if;
- end;
- end;]';
-
- execute immediate q'[create or replace package ut3_develop.some_other_package is
- procedure do_stuff(i_input in number);
- end;]';
-
- execute immediate q'[create or replace package body ut3_develop.some_other_package is
- procedure do_stuff(i_input in number) is
- begin
- if i_input = 2 then dbms_output.put_line('should not get here'); elsif i_input = 1 then dbms_output.put_line('should get here');
- else
- dbms_output.put_line('should not get here');
- end if;
- end;
- end;]';
-
- execute immediate q'[create or replace package ut3_develop.test_dummy_coverage is
- --%suite(dummy coverage test)
- --%suitepath(coverage_testing)
-
- --%test
- procedure test_do_stuff;
-
- --%test
- procedure zero_coverage;
- end;]';
-
- execute immediate q'[create or replace package body ut3_develop.test_dummy_coverage is
- procedure test_do_stuff is
- begin
- ]'||covered_package_name||q'[.do_stuff(1);
- ut.expect(1).to_equal(1);
- end;
- procedure zero_coverage is
- begin
- null;
- end;
- end;]';
-
- end;
-
- procedure drop_dummy_coverage is
- pragma autonomous_transaction;
- begin
- begin execute immediate q'[drop package ut3_develop.test_dummy_coverage]'; exception when others then null; end;
- begin execute immediate q'[drop package ut3_develop.some_other_package]'; exception when others then null; end;
- begin execute immediate q'[drop package ut3_develop.]'||covered_package_name; exception when others then null; end;
- end;
-
-
- procedure create_dummy_coverage_1 is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace package ut3_develop.dummy_coverage_1 is
- procedure do_stuff;
- end;]';
-
- execute immediate q'[create or replace package body ut3_develop.dummy_coverage_1 is
- procedure do_stuff is
- begin
- if 1 = 2 then
- dbms_output.put_line('should not get here');
- else
- dbms_output.put_line('should get here');
- end if;
- end;
- end;]';
-
- execute immediate q'[create or replace package ut3_develop.test_dummy_coverage_1 is
- --%suite(dummy coverage test 1)
- --%suitepath(coverage_testing)
-
- --%test
- procedure test_do_stuff;
- end;]';
-
- execute immediate q'[create or replace package body ut3_develop.test_dummy_coverage_1 is
- procedure test_do_stuff is
- begin
- dummy_coverage_1.do_stuff;
- end;
-
- end;]';
- end;
-
- procedure drop_dummy_coverage_1 is
- pragma autonomous_transaction;
- begin
- begin execute immediate q'[drop package ut3_develop.dummy_coverage_1]'; exception when others then null; end;
- begin execute immediate q'[drop package ut3_develop.test_dummy_coverage_1]'; exception when others then null; end;
- end;
-
- procedure create_cov_with_dbms_stats is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create table ut3_develop.table_to_test_stats as select * from user_objects]';
-
- execute immediate q'[create or replace package ut3_develop.stats is
- procedure gather;
- end;]';
-
- execute immediate q'[create or replace package body ut3_develop.stats is
- procedure gather is
- begin
- dbms_Stats.gather_table_stats('UT3_DEVELOP','TABLE_TO_TEST_STATS');
- end;
- end;]';
-
- execute immediate q'[create or replace package ut3_develop.test_stats is
- --%suite(stats gathering coverage test)
- --%suitepath(coverage_testing)
-
- --%test
- procedure test_stats_gather;
-
- end;]';
-
- execute immediate q'[create or replace package body ut3_develop.test_stats is
- procedure test_stats_gather is
- begin
- stats.gather;
- ut.expect(1).to_equal(1);
- end;
- end;]';
-
- end;
-
- procedure create_regex_dummy_for_schema(p_schema in varchar2) is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace package ]'||p_schema||q'[.regex_dummy_cov is
- procedure do_stuff(i_input in number);
- end;]';
-
- execute immediate q'[create or replace package body ]'||p_schema||q'[.regex_dummy_cov is
- procedure do_stuff(i_input in number) is
- begin
- if i_input = 2 then dbms_output.put_line('should not get here'); elsif i_input = 1 then dbms_output.put_line('should get here');
- else
- dbms_output.put_line('should not get here');
- end if;
- end;
- end;]';
-
- execute immediate q'[create or replace package ]'||p_schema||q'[.test_regex_dummy_cov is
- --%suite(dummy coverage test)
- --%suitepath(coverage_testing)
-
- --%test
- procedure test_do_stuff;
-
- --%test
- procedure zero_coverage;
- end;]';
-
- execute immediate q'[create or replace package body ]'||p_schema||q'[.test_regex_dummy_cov is
- procedure test_do_stuff is
- begin
- regex_dummy_cov.do_stuff(1);
- ut.expect(1).to_equal(1);
- end;
- procedure zero_coverage is
- begin
- null;
- end;
- end;]';
- end;
-
- procedure create_regex_dummy_obj is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace package ut3_develop.regex123_dummy_cov is
- procedure do_stuff(i_input in number);
- end;]';
-
- execute immediate q'[create or replace package body ut3_develop.regex123_dummy_cov is
- procedure do_stuff(i_input in number) is
- begin
- if i_input = 2 then dbms_output.put_line('should not get here'); elsif i_input = 1 then dbms_output.put_line('should get here');
- else
- dbms_output.put_line('should not get here');
- end if;
- end;
- end;]';
-
- execute immediate q'[create or replace package ut3_develop.test_regex123_dummy_cov is
- --%suite(dummy coverage test)
- --%suitepath(coverage_testing)
-
- --%test
- procedure test_do_stuff;
-
- --%test
- procedure zero_coverage;
- end;]';
-
- execute immediate q'[create or replace package body ut3_develop.test_regex123_dummy_cov is
- procedure test_do_stuff is
- begin
- regex123_dummy_cov.do_stuff(1);
- ut.expect(1).to_equal(1);
- end;
- procedure zero_coverage is
- begin
- null;
- end;
- end;]';
- end;
-
- procedure create_regex_dummy_cov is
- begin
- create_regex_dummy_for_schema('ut3_develop');
- create_regex_dummy_for_schema('ut3_tester_helper');
- create_regex_dummy_obj;
- end;
-
- procedure drop_regex_dummy_cov is
- pragma autonomous_transaction;
- begin
- begin execute immediate q'[drop package ut3_develop.regex_dummy_cov]'; exception when others then null; end;
- begin execute immediate q'[drop package ut3_develop.test_regex_dummy_cov]'; exception when others then null; end;
- begin execute immediate q'[drop package ut3_tester_helper.regex_dummy_cov]'; exception when others then null; end;
- begin execute immediate q'[drop package ut3_tester_helper.test_regex_dummy_cov]'; exception when others then null; end;
- begin execute immediate q'[drop package ut3_develop.regex123_dummy_cov]'; exception when others then null; end;
- begin execute immediate q'[drop package ut3_develop.test_regex123_dummy_cov]'; exception when others then null; end;
- end;
-
-
- procedure drop_cov_with_dbms_stats is
- pragma autonomous_transaction;
- begin
- begin execute immediate q'[drop package ut3_develop.test_stats]'; exception when others then null; end;
- begin execute immediate q'[drop package ut3_develop.stats]'; exception when others then null; end;
- begin execute immediate q'[drop table ut3_develop.table_to_test_stats]'; exception when others then null; end;
- end;
-
-
- procedure run_standalone_coverage(a_coverage_run_id raw, a_input integer) is
- begin
- ut3_develop.ut_runner.coverage_start(a_coverage_run_id);
- execute immediate 'begin ut3_develop.'||covered_package_name||'.do_stuff(:a_input); end;' using in a_input;
- ut3_develop.ut_runner.coverage_stop();
- end;
-
- function get_job_status(a_job_name varchar2, a_job_started_after timestamp with time zone) return user_scheduler_job_run_details%rowtype is
- l_result user_scheduler_job_run_details%rowtype;
- begin
- begin
- select * into l_result
- from user_scheduler_job_run_details
- where job_name = upper(a_job_name)
- and req_start_date >= a_job_started_after;
- exception
- when no_data_found then
- null;
- end;
- return l_result;
- end;
-
- procedure run_job_and_wait_for_finish(a_job_action varchar2) is
- l_job_run_info user_scheduler_job_run_details%rowtype;
- l_job_name varchar2(30);
- l_timestamp timestamp with time zone := current_timestamp;
- i integer := 0;
- pragma autonomous_transaction;
- begin
- g_job_no := g_job_no + 1;
- l_job_name := 'utPLSQL_selftest_job_'||g_job_no;
- dbms_session.sleep(0.15);
- dbms_scheduler.create_job(
- job_name => l_job_name,
- job_type => 'PLSQL_BLOCK',
- job_action => a_job_action,
- start_date => l_timestamp,
- enabled => TRUE,
- auto_drop => TRUE,
- comments => 'one-time-job'
- );
- while (l_job_run_info.status is null or l_job_run_info.status not in ('SUCCEEDED','FAILED')) and i < 6000 loop
- l_job_run_info := get_job_status( l_job_name, l_timestamp );
- dbms_session.sleep(0.1);
- i := i + 1;
- end loop;
- commit;
- if nvl(l_job_run_info.status,'null') <> 'SUCCEEDED' then
- raise_application_error(-20000, 'Scheduler job '''||l_job_name||''', status='''||l_job_run_info.status||'''. Additional info: '||l_job_run_info.additional_info);
- end if;
- end;
-
- procedure run_coverage_job(a_coverage_run_id raw, a_input integer) is
- begin
- run_job_and_wait_for_finish(
- 'begin coverage_helper.run_standalone_coverage('''||a_coverage_run_id||''', '||a_input||'); end;'
- );
- end;
-
- procedure create_test_results_table is
- pragma autonomous_transaction;
- e_exists exception;
- pragma exception_init ( e_exists, -955 );
- begin
- execute immediate 'create table test_results (id integer, text varchar2(4000))';
- exception
- when e_exists then
- null;
- end;
-
- procedure drop_test_results_table is
- pragma autonomous_transaction;
- e_not_exists exception;
- pragma exception_init ( e_not_exists, -942 );
- begin
- execute immediate 'drop table test_results';
- exception
- when e_not_exists then
- null;
- end;
-
- function run_code_as_job( a_plsql_block varchar2 ) return clob is
- l_result_clob clob;
- pragma autonomous_transaction;
- begin
- run_job_and_wait_for_finish( a_plsql_block );
- dbms_session.sleep(0.1);
- execute immediate q'[
- declare
- l_results ut3_develop.ut_varchar2_list;
- begin
- select text
- bulk collect into l_results
- from test_results
- order by id;
- delete from test_results;
- commit;
- :clob_results := ut3_tester_helper.main_helper.table_to_clob(l_results);
- end;
- ]'
- using out l_result_clob;
-
- return l_result_clob;
- end;
-
- procedure copy_coverage_data_to_ut3(a_coverage_run_id raw) is
- pragma autonomous_transaction;
- l_current_coverage_run_id raw(32) := hextoraw(sys_context('UT3_INFO','COVERAGE_RUN_ID'));
- begin
- insert into ut3.ut_coverage_runs(coverage_run_id, line_coverage_id, block_coverage_id)
- select l_current_coverage_run_id, -line_coverage_id, -block_coverage_id
- from ut3_develop.ut_coverage_runs
- where coverage_run_id = a_coverage_run_id;
-
- insert into ut3.plsql_profiler_runs(runid, related_run, run_owner, run_date, run_comment, run_total_time, run_system_info, run_comment1, spare1)
- select -runid, related_run, run_owner, run_date, run_comment, run_total_time, run_system_info, run_comment1, spare1
- from ut3_develop.plsql_profiler_runs c
- join ut3_develop.ut_coverage_runs r
- on r.line_coverage_id = c.runid
- where r.coverage_run_id = a_coverage_run_id;
-
- insert into ut3.plsql_profiler_units(runid, unit_number, unit_type, unit_owner, unit_name, unit_timestamp, total_time, spare1, spare2)
- select -runid, unit_number, unit_type, unit_owner, unit_name, unit_timestamp, total_time, spare1, spare2
- from ut3_develop.plsql_profiler_units c
- join ut3_develop.ut_coverage_runs r
- on r.line_coverage_id = c.runid
- where r.coverage_run_id = a_coverage_run_id;
-
- insert into ut3.plsql_profiler_data(runid, unit_number, line#, total_occur, total_time, min_time, max_time, spare1, spare2, spare3, spare4)
- select -runid, unit_number, line#, total_occur, total_time, min_time, max_time, spare1, spare2, spare3, spare4
- from ut3_develop.plsql_profiler_data c
- join ut3_develop.ut_coverage_runs r
- on r.line_coverage_id = c.runid
- where r.coverage_run_id = a_coverage_run_id;
-
- insert into ut3.dbmspcc_runs(run_id, run_comment, run_owner, run_timestamp)
- select -run_id, run_comment, run_owner, run_timestamp
- from ut3_develop.dbmspcc_runs c
- join ut3_develop.ut_coverage_runs r
- on r.block_coverage_id = c.run_id
- where r.coverage_run_id = a_coverage_run_id;
-
- insert into ut3.dbmspcc_units(run_id, object_id, owner, name, type, last_ddl_time)
- select -run_id, object_id, owner, name, type, last_ddl_time
- from ut3_develop.dbmspcc_units c
- join ut3_develop.ut_coverage_runs r
- on r.block_coverage_id = c.run_id
- where r.coverage_run_id = a_coverage_run_id;
-
- insert into ut3.dbmspcc_blocks(run_id, object_id, block, line, col, covered, not_feasible)
- select -run_id, object_id, block, line, col, covered, not_feasible
- from ut3_develop.dbmspcc_blocks c
- join ut3_develop.ut_coverage_runs r
- on r.block_coverage_id = c.run_id
- where r.coverage_run_id = a_coverage_run_id;
-
- commit;
- end;
-
- function gather_coverage_on_coverage( a_cov_options varchar2) return clob is
- pragma autonomous_transaction;
- l_plsql_block varchar2(32767);
- l_result_clob clob;
- l_coverage_id raw(32) := sys_guid();
- begin
- l_plsql_block := q'[
- declare
- l_coverage_options ut3_develop.ut_coverage_options;
- l_coverage_run_id raw(32) := ']'||rawtohex(l_coverage_id)||q'[';
- l_result ut3_develop.ut_coverage.t_coverage;
- begin
- ut3_develop.ut_runner.coverage_start(l_coverage_run_id);
- ut3_develop.ut_coverage.set_develop_mode(a_develop_mode => true);
- l_coverage_options := {a_cov_options};
- l_result := ut3_develop.ut_coverage.get_coverage_data(l_coverage_options);
- ut3_develop.ut_coverage.set_develop_mode(a_develop_mode => false);
- ut3_develop.ut_runner.coverage_stop();
- insert into test_results select rownum, owner||'.'||name from ut3_develop.ut_coverage_sources_tmp;
- commit;
- end;]';
- l_plsql_block := replace(l_plsql_block,'{a_cov_options}',a_cov_options);
- run_job_and_wait_for_finish( l_plsql_block );
- execute immediate q'[
- declare
- l_results ut3_develop.ut_varchar2_list;
- begin
- select text
- bulk collect into l_results
- from test_results
- order by id;
- delete from test_results;
- commit;
- :clob_results := ut3_tester_helper.main_helper.table_to_clob(l_results);
- end;
- ]'
- using out l_result_clob;
- copy_coverage_data_to_ut3(l_coverage_id);
- return l_result_clob;
- end;
-
- function run_tests_as_job( a_run_command varchar2 ) return clob is
- l_plsql_block varchar2(32767);
- l_result_clob clob;
- l_coverage_id raw(32) := sys_guid();
- begin
- l_plsql_block := q'[
- declare
- x dbms_output.chararr;
- i integer := 100000;
- begin
-/*
- execute immediate 'alter session set statistics_level=all';
- dbms_hprof.start_profiling(
- location => 'PLSHPROF_DIR'
- , filename => 'profiler_utPLSQL_run_]'||rawtohex(l_coverage_id)||q'[.txt'
- );
-*/
- ut3_develop.ut_runner.coverage_start(']'||rawtohex(l_coverage_id)||q'[');
- ut3_develop.ut_coverage.set_develop_mode(a_develop_mode => true);
- --gather coverage on the command executed
- begin {a_run_command}; end;
- dbms_output.get_lines(x,i);
- ut3_develop.ut_coverage.set_develop_mode(a_develop_mode => false);
- ut3_develop.ut_runner.coverage_stop();
- --get the actual results of the command gathering the coverage
- insert into test_results select rownum as id, x.* from table( {a_run_command} ) x;
- commit;
-/*
- dbms_hprof.stop_profiling;
-*/
- end;]';
- l_plsql_block := replace(l_plsql_block,'{a_run_command}',a_run_command);
- l_result_clob := run_code_as_job( l_plsql_block );
- copy_coverage_data_to_ut3(l_coverage_id);
- return l_result_clob;
- end;
-
- procedure create_dup_object_name is
- pragma autonomous_transaction;
- begin
- execute immediate 'create table ut3_develop.test_table(id integer)';
- execute immediate q'[
- create or replace trigger ut3_develop.duplicate_name
- before insert on ut3_develop.test_table
- begin
-
- dbms_output.put_line('A');
- end;
- ]';
- execute immediate q'[
- create or replace package ut3_develop.duplicate_name is
- procedure some_procedure;
- end;
- ]';
- execute immediate q'[
- create or replace package body ut3_develop.duplicate_name is
- procedure some_procedure is
- begin
- insert into test_table(id) values(1);
- end;
- end;
- ]';
- execute immediate q'[
- create or replace package ut3_develop.test_duplicate_name is
- --%suite
-
- --%test
- procedure run_duplicate_name;
- end;
- ]';
- execute immediate q'[
- create or replace package body ut3_develop.test_duplicate_name is
- procedure run_duplicate_name is
- l_actual sys_refcursor;
- begin
- ut3_develop.duplicate_name.some_procedure;
- ut.expect(l_actual).to_have_count(1);
- end;
- end;
- ]';
- end;
-
- procedure drop_dup_object_name is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop table ut3_develop.test_table';
- execute immediate 'drop package ut3_develop.duplicate_name';
- execute immediate 'drop package ut3_develop.test_duplicate_name';
- end;
-
-end;
-/
diff --git a/test/ut3_tester_helper/coverage_helper.pks b/test/ut3_tester_helper/coverage_helper.pks
deleted file mode 100644
index d6a57a143..000000000
--- a/test/ut3_tester_helper/coverage_helper.pks
+++ /dev/null
@@ -1,34 +0,0 @@
-create or replace package coverage_helper is
-
- function covered_package_name return varchar2;
-
- function substitute_covered_package( a_text varchar2, a_substitution varchar2 := '{p}' ) return varchar2;
-
- procedure set_develop_mode;
-
- procedure create_dummy_coverage;
- procedure drop_dummy_coverage;
-
- procedure create_dummy_coverage_1;
- procedure drop_dummy_coverage_1;
-
- procedure create_regex_dummy_cov;
- procedure drop_regex_dummy_cov;
-
- procedure create_cov_with_dbms_stats;
- procedure drop_cov_with_dbms_stats;
-
- procedure run_standalone_coverage(a_coverage_run_id raw, a_input integer);
- procedure run_coverage_job(a_coverage_run_id raw, a_input integer);
-
- function gather_coverage_on_coverage( a_cov_options varchar2) return clob;
- function run_tests_as_job( a_run_command varchar2 ) return clob;
- function run_code_as_job( a_plsql_block varchar2 ) return clob;
- procedure create_test_results_table;
- procedure drop_test_results_table;
-
- procedure drop_dup_object_name;
- procedure create_dup_object_name;
-
-end;
-/
diff --git a/test/ut3_tester_helper/expectations_helper.pkb b/test/ut3_tester_helper/expectations_helper.pkb
deleted file mode 100644
index c5c1f379f..000000000
--- a/test/ut3_tester_helper/expectations_helper.pkb
+++ /dev/null
@@ -1,57 +0,0 @@
-create or replace package body expectations_helper is
-
- function unary_expectation_block(
- a_matcher_name varchar2,
- a_data_type varchar2,
- a_data_value varchar2
- ) return varchar2 is
- l_execute varchar2(32000);
- begin
- l_execute := '
- declare
- l_expected '||a_data_type||' := '||a_data_value||';
- begin
- --act - execute the expectation
- ut3_develop.ut.expect(l_expected).'||a_matcher_name||'();
- end;';
- return l_execute;
- end;
-
- function unary_expectation_object_block(
- a_matcher_name varchar2,
- a_object_name varchar2,
- a_object_value varchar2,
- a_object_type varchar2
- ) return varchar2 is
- begin
- return '
- declare
- l_object '||a_object_name||' := '||a_object_value||';
- begin
- ut3_develop.ut.expect(anydata.convert'||a_object_type||'(l_object)).'||a_matcher_name||'();
- end;';
- end;
-
- function binary_expectation_block(
- a_matcher_name varchar2,
- a_actual_data_type varchar2,
- a_actual_data varchar2,
- a_expected_data_type varchar2,
- a_expected_data varchar2
- ) return varchar2
- is
- l_execute varchar2(32000);
- begin
- l_execute := '
- declare
- l_actual '||a_actual_data_type||' := '||a_actual_data||';
- l_expected '||a_expected_data_type||' := '||a_expected_data||';
- begin
- --act - execute the expectation
- ut3_develop.ut.expect( l_actual ).'||a_matcher_name||'(l_expected);
- end;';
- return l_execute;
- end;
-
-end;
-/
diff --git a/test/ut3_tester_helper/expectations_helper.pks b/test/ut3_tester_helper/expectations_helper.pks
deleted file mode 100644
index 9c1d54333..000000000
--- a/test/ut3_tester_helper/expectations_helper.pks
+++ /dev/null
@@ -1,25 +0,0 @@
-create or replace package expectations_helper is
-
- function unary_expectation_block(
- a_matcher_name varchar2,
- a_data_type varchar2,
- a_data_value varchar2
- ) return varchar2;
-
- function unary_expectation_object_block(
- a_matcher_name varchar2,
- a_object_name varchar2,
- a_object_value varchar2,
- a_object_type varchar2
- ) return varchar2;
-
- function binary_expectation_block(
- a_matcher_name varchar2,
- a_actual_data_type varchar2,
- a_actual_data varchar2,
- a_expected_data_type varchar2,
- a_expected_data varchar2
- ) return varchar2;
-
-end;
-/
diff --git a/test/ut3_tester_helper/main_helper.pkb b/test/ut3_tester_helper/main_helper.pkb
deleted file mode 100644
index f60ce796c..000000000
--- a/test/ut3_tester_helper/main_helper.pkb
+++ /dev/null
@@ -1,178 +0,0 @@
-create or replace package body main_helper is
-
- function get_dbms_output_as_clob return clob is
- l_status number;
- l_line varchar2(32767);
- l_result clob;
- begin
-
- dbms_output.get_line(line => l_line, status => l_status);
- if l_status != 1 then
- dbms_lob.createtemporary(l_result, true, dur => dbms_lob.session);
- end if;
- while l_status != 1 loop
- if l_line is not null then
- ut3_develop.ut_utils.append_to_clob(l_result, l_line||chr(10));
- end if;
- dbms_output.get_line(line => l_line, status => l_status);
- end loop;
- return l_result;
- end;
-
- procedure execute_autonomous(a_sql varchar2) is
- pragma autonomous_transaction;
- begin
- if a_sql is not null then
- execute immediate a_sql;
- end if;
- commit;
- end;
-
- function run_test(a_path varchar2) return clob is
- l_lines ut3_develop.ut_varchar2_list;
- begin
- select * bulk collect into l_lines from table(ut3_develop.ut.run(a_path));
- return ut3_develop.ut_utils.table_to_clob(l_lines);
- end;
-
- function get_value(a_variable varchar2) return integer is
- l_glob_val integer;
- begin
- execute immediate 'begin :l_glob_val := '||a_variable||'; end;' using out l_glob_val;
- return l_glob_val;
- end;
-
- function get_failed_expectations return ut3_develop.ut_varchar2_list is
- l_expectations_result ut3_develop.ut_expectation_results := ut3_develop.ut_expectation_processor.get_failed_expectations();
- l_result ut3_develop.ut_varchar2_list := ut3_develop.ut_varchar2_list();
- begin
- for i in 1..l_expectations_result.count loop
- l_result := l_result multiset union l_expectations_result(i).get_result_lines();
- end loop;
- return l_result;
- end;
-
- function get_failed_expectations(a_pos in number) return varchar2 is
- l_result varchar2(32767) := ut3_develop.ut_expectation_processor.get_failed_expectations()(a_pos).message;
- begin
- return l_result;
- end;
-
- function failed_expectations_data return anydata is
- begin
- return anydata.convertCollection(ut3_develop.ut_expectation_processor.get_failed_expectations());
- end;
-
- function get_failed_expectations_num return number is
- l_num_failed number;
- l_results ut3_develop.ut_expectation_results := ut3_develop.ut_expectation_processor.get_failed_expectations();
- begin
- l_num_failed := l_results.count;
- return l_num_failed;
- end;
-
- procedure clear_expectations is
- begin
- ut3_develop.ut_expectation_processor.clear_expectations();
- end;
-
- function table_to_clob(a_results in ut3_develop.ut_varchar2_list) return clob is
- begin
- return ut3_develop.ut_utils.table_to_clob(a_results);
- end;
-
- function get_warnings return ut3_develop.ut_varchar2_rows is
- begin
- return ut3_develop.ut_expectation_processor.get_warnings();
- end;
-
- procedure reset_nulls_equal is
- begin
- ut3_develop.ut_expectation_processor.nulls_Are_equal(ut3_develop.ut_expectation_processor.gc_default_nulls_are_equal);
- end;
-
- procedure nulls_are_equal(a_nulls_equal boolean := true) is
- begin
- ut3_develop.ut_expectation_processor.nulls_Are_equal(a_nulls_equal);
- end;
-
- procedure cleanup_annotation_cache is
- pragma autonomous_transaction;
- begin
- delete from ut3_develop.ut_annotation_cache_info
- where object_owner = 'UT3_TESTER' and object_type = 'PACKAGE' and object_name in ('DUMMY_PACKAGE','DUMMY_TEST_PACKAGE');
- commit;
- end;
-
- procedure create_parse_proc_as_ut3_user is
- pragma autonomous_transaction;
- begin
- execute immediate q'[
- create or replace procedure ut3_user.parse_annotations is
- begin
- ut3_develop.ut_runner.rebuild_annotation_cache('UT3_TESTER','PACKAGE');
- end;]';
- end;
-
- procedure drop_parse_proc_as_ut3_user is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop procedure ut3_user.parse_annotations';
- end;
-
- procedure parse_dummy_test_as_ut3_user is
- pragma autonomous_transaction;
- begin
- execute immediate 'begin ut3_user.parse_annotations; end;';
- end;
-
- procedure append_to_list(a_list in out nocopy ut3_develop.ut_varchar2_list, a_item varchar2) is
- begin
- ut3_develop.ut_utils.append_to_list(a_list,a_item);
- end;
-
- procedure append_to_list(a_list in out nocopy ut3_develop.ut_varchar2_rows, a_item varchar2) is
- begin
- ut3_develop.ut_utils.append_to_list(a_list,a_item);
- end;
-
- procedure append_to_list(a_list in out nocopy ut3_develop.ut_varchar2_rows, a_item clob) is
- begin
- ut3_develop.ut_utils.append_to_list(a_list,a_item);
- end;
-
- procedure append_to_list(a_list in out nocopy ut3_develop.ut_varchar2_rows, a_items ut3_develop.ut_varchar2_rows) is
- begin
- ut3_develop.ut_utils.append_to_list(a_list,a_items);
- end;
-
- procedure set_ut_run_context is
- begin
- ut3_develop.ut_session_context.set_context('RUN_PATHS',' ');
- end;
-
- procedure clear_ut_run_context is
- begin
- ut3_develop.ut_session_context.clear_all_context;
- end;
-
- function lines_to_str(a_lines dbms_preprocessor.source_lines_t) return varchar2 is
- l_result varchar2(32767);
- begin
- for i in 1 .. a_lines.count loop
- l_result := l_result || a_lines(i);
- end loop;
- return l_result;
- end;
-
- function make_source(a_lines ut3_develop.ut_varchar2_list) return dbms_preprocessor.source_lines_t is
- l_result dbms_preprocessor.source_lines_t;
- begin
- for i in 1 .. a_lines.count loop
- l_result(i) := a_lines(i);
- end loop;
- return l_result;
- end;
-
-end;
-/
diff --git a/test/ut3_tester_helper/main_helper.pks b/test/ut3_tester_helper/main_helper.pks
deleted file mode 100644
index 71575e145..000000000
--- a/test/ut3_tester_helper/main_helper.pks
+++ /dev/null
@@ -1,55 +0,0 @@
-create or replace package main_helper is
-
- gc_success number := ut3_develop.ut_utils.gc_success;
- gc_failure number := ut3_develop.ut_utils.gc_failure;
-
- procedure execute_autonomous(a_sql varchar2);
-
- function run_test(a_path varchar2) return clob;
-
- function get_value(a_variable varchar2) return integer;
-
- function get_dbms_output_as_clob return clob;
-
- function get_failed_expectations return ut3_develop.ut_varchar2_list;
-
- function get_failed_expectations(a_pos in number) return varchar2;
-
- function get_failed_expectations_num return number;
-
- procedure clear_expectations;
-
- function table_to_clob(a_results in ut3_develop.ut_varchar2_list) return clob;
-
- function get_warnings return ut3_develop.ut_varchar2_rows;
-
- procedure reset_nulls_equal;
-
- procedure nulls_are_equal(a_nulls_equal boolean := true);
-
- procedure cleanup_annotation_cache;
-
- procedure create_parse_proc_as_ut3_user;
-
- procedure drop_parse_proc_as_ut3_user;
-
- procedure parse_dummy_test_as_ut3_user;
-
- procedure append_to_list(a_list in out nocopy ut3_develop.ut_varchar2_list, a_item varchar2);
-
- procedure append_to_list(a_list in out nocopy ut3_develop.ut_varchar2_rows, a_item varchar2);
-
- procedure append_to_list(a_list in out nocopy ut3_develop.ut_varchar2_rows, a_item clob);
-
- procedure append_to_list(a_list in out nocopy ut3_develop.ut_varchar2_rows, a_items ut3_develop.ut_varchar2_rows);
-
- procedure set_ut_run_context;
-
- procedure clear_ut_run_context;
-
- function lines_to_str(a_lines dbms_preprocessor.source_lines_t) return varchar2;
-
- function make_source(a_lines ut3_develop.ut_varchar2_list) return dbms_preprocessor.source_lines_t;
-
-end;
-/
diff --git a/test/ut3_tester_helper/other_dummy_object.tps b/test/ut3_tester_helper/other_dummy_object.tps
deleted file mode 100644
index 7453d5dcf..000000000
--- a/test/ut3_tester_helper/other_dummy_object.tps
+++ /dev/null
@@ -1,16 +0,0 @@
-declare
- l_exists integer;
-begin
- select count(1) into l_exists from user_types where type_name = 'OTHER_DUMMY_OBJECT';
- if l_exists > 0 then
- execute immediate 'drop type other_dummy_object force';
- end if;
-end;
-/
-
-create or replace type other_dummy_object as object (
- id number,
- "name" varchar2(30),
- "Value" varchar2(30)
-)
-/
diff --git a/test/ut3_tester_helper/run_helper.pkb b/test/ut3_tester_helper/run_helper.pkb
deleted file mode 100644
index 6bd88bfa8..000000000
--- a/test/ut3_tester_helper/run_helper.pkb
+++ /dev/null
@@ -1,986 +0,0 @@
-create or replace package body run_helper is
-
- procedure setup_cache_objects is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace package ut3_user.dummy_test_package as
- --%suite(dummy_test_suite)
- --%suitepath(some.path)
- --%rollback(manual)
-
- --%test(dummy_test)
- --%beforetest(some_procedure)
- procedure some_dummy_test_procedure;
- end;]';
- execute immediate q'[create or replace procedure ut3_user.dummy_test_procedure as
- --%some_annotation(some_text)
- --%rollback(manual)
- begin
- null;
- end;]';
- execute immediate q'[create or replace procedure ut3_tester_helper.dummy_test_procedure as
- --%some_annotation(some_text)
- --%rollback(manual)
- begin
- null;
- end;]';
-
- execute immediate q'[grant execute on ut3_tester_helper.dummy_test_procedure to public]';
-
- execute immediate q'[create or replace package ut3_user.bad_test_package as
- --%rollback(manual)
- --%test(dummy_test)
- procedure some_dummy_test_procedure;
- end;]';
- end;
-
- procedure setup_cache_objectstag is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace package ut3_user.dummy_test_package as
- --%suite(dummy_test_suite)
- --%suitepath(some.path)
- --%tags(dummy)
- --%rollback(manual)
-
- --%test(dummy_test)
- --%tags(testtag)
- --%beforetest(some_procedure)
- procedure some_dummy_test_procedure;
- end;]';
- execute immediate q'[create or replace procedure ut3_user.dummy_test_procedure as
- --%some_annotation(some_text)
- --%rollback(manual)
- begin
- null;
- end;]';
- execute immediate q'[create or replace procedure ut3_tester_helper.dummy_test_procedure as
- --%some_annotation(some_text)
- --%rollback(manual)
- begin
- null;
- end;]';
-
- execute immediate q'[grant execute on ut3_tester_helper.dummy_test_procedure to public]';
- end;
-
- procedure setup_cache_twotags is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace package ut3_user.dummy_test_package as
- --%suite(dummy_test_suite)
- --%tags(suitetag1,suitetag2)
- --%rollback(manual)
-
- --%test(dummy_test)
- --%tags(testtag1,testtag2)
- --%beforetest(some_procedure)
- procedure some_dummy_test_procedure;
- end;]';
- execute immediate q'[create or replace procedure ut3_user.dummy_test_procedure as
- --%some_annotation(some_text)
- --%rollback(manual)
- begin
- null;
- end;]';
- execute immediate q'[create or replace procedure ut3_tester_helper.dummy_test_procedure as
- --%some_annotation(some_text)
- --%rollback(manual)
- begin
- null;
- end;]';
-
- execute immediate q'[grant execute on ut3_tester_helper.dummy_test_procedure to public]';
- end;
-
- procedure create_trans_control is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace package ut_transaction_control as
- function count_rows(a_val varchar2) return number;
- procedure setup;
- procedure test;
- procedure test_failure;
- end;]';
-
- execute immediate
- q'[create or replace package body ut_transaction_control
- as
-
- function count_rows(a_val varchar2) return number is
- l_cnt number;
- begin
- select count(*) into l_cnt from ut$test_table t where t.val = a_val;
- return l_cnt;
- end;
- procedure setup is begin
- insert into ut$test_table values ('s');
- end;
- procedure test is
- begin
- insert into ut$test_table values ('t');
- end;
- procedure test_failure is
- begin
- insert into ut$test_table values ('t');
- --raise no_data_found;
- raise_application_error(-20001,'Error');
- end;
- end;]';
-
- execute immediate 'grant execute on ut_transaction_control to public';
- end;
-
- procedure drop_trans_control is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package ut_transaction_control';
- end;
-
- procedure setup_cache is
- pragma autonomous_transaction;
- begin
- setup_cache_objects();
- ut3_develop.ut_annotation_manager.rebuild_annotation_cache('UT3_USER','PACKAGE');
- ut3_develop.ut_annotation_manager.rebuild_annotation_cache('UT3_USER','PROCEDURE');
- ut3_develop.ut_annotation_manager.rebuild_annotation_cache('UT3_TESTER_HELPER','PROCEDURE');
- end;
-
- procedure setup_cache_context_disabled is
- pragma autonomous_transaction;
- begin
- --the procedures that cleanup_cache drops
- setup_cache_objects();
- execute immediate q'[create or replace package ut3_user.dummy_test_package as
- --%suite(dummy_test_suite)
- --%suitepath(some.path)
-
- --%test(dummy_test)
- procedure some_dummy_test_procedure;
-
- --%context(dummy_context)
-
- --%test(disabled_test)
- --%disabled(not ready)
- procedure disabled_test_procedure;
-
- --%endcontext
- end;]';
- end;
-
- procedure cleanup_cache is
- pragma autonomous_transaction;
- begin
- delete from ut3_develop.ut_annotation_cache_info
- where object_type = 'PROCEDURE' and object_owner in ('UT3_USER','UT3_TESTER_HELPER')
- or object_type = 'PACKAGE' and object_owner = user and object_name = 'DUMMY_TEST_PACKAGE';
- execute immediate q'[drop package ut3_user.dummy_test_package]';
- execute immediate q'[drop procedure ut3_user.dummy_test_procedure]';
- execute immediate q'[drop procedure ut3_tester_helper.dummy_test_procedure]';
- end;
-
- procedure create_db_link is
- l_service_name varchar2(100);
- pragma autonomous_transaction;
- begin
- select global_name into l_service_name from global_name;
- execute immediate
- 'create public database link db_loopback connect to ut3_tester_helper identified by ut3
- using ''(DESCRIPTION=
- (ADDRESS=(PROTOCOL=TCP)
- (HOST='||sys_context('userenv','SERVER_HOST')||')
- (PORT=1521)
- )
- (CONNECT_DATA=(SERVICE_NAME='||l_service_name||')))''';
- end;
-
- procedure drop_db_link is
- begin
- execute immediate 'drop public database link db_loopback';
- exception
- when others then
- null;
- end;
-
- procedure db_link_setup is
- l_service_name varchar2(100);
- begin
- create_db_link;
- execute immediate q'[
- create or replace package ut3_user.test_db_link is
- --%suite
-
- --%test
- procedure runs_with_db_link;
- end;]';
-
- execute immediate q'[
- create or replace package body ut3_user.test_db_link is
- procedure runs_with_db_link is
- a_value integer;
- begin
- select 1 into a_value
- from dual@db_loopback;
- ut3_develop.ut.expect(a_value).to_be_null();
- end;
- end;]';
-
- end;
-
- procedure db_link_cleanup is
- begin
- drop_db_link;
- begin execute immediate 'drop package ut3_user.test_db_link'; exception when others then null; end;
- end;
-
- procedure create_suite_with_link is
- pragma autonomous_transaction;
- begin
- create_db_link;
- execute immediate 'create table tst(id number(18,0))';
- execute immediate q'[
- create or replace package test_distributed_savepoint is
- --%suite
- --%suitepath(alltests)
-
- --%beforeall
- procedure setup;
-
- --%test
- procedure test;
- end;]';
-
- execute immediate q'[
- create or replace package body test_distributed_savepoint is
-
- g_expected constant integer := 1;
-
- procedure setup is
- begin
- insert into tst@db_loopback values(g_expected);
- end;
-
- procedure test is
- l_actual integer := 0;
- begin
- select id into l_actual from tst@db_loopback;
-
- ut.expect(l_actual).to_equal(g_expected);
- end;
-
- end;]';
- execute immediate 'grant execute on test_distributed_savepoint to public';
- end;
-
- procedure drop_suite_with_link is
- pragma autonomous_transaction;
- begin
- drop_db_link;
- execute immediate 'drop table tst';
- execute immediate 'drop package test_distributed_savepoint';
- end;
-
- procedure create_ut3_user_tests is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace package test_package_1 is
- --%suite
- --%tags(suite1,helper)
- --%suitepath(tests)
- --%rollback(manual)
-
- --%test(Test1 from test package 1)
- --%tags(test1,suite1test1,subtest1)
- procedure test1;
-
- --%test(Test2 from test package 1)
- --%tags(test1,suite1test2)
- procedure test2;
-
- end test_package_1;
- ]';
- execute immediate q'[create or replace package body test_package_1 is
- procedure test1 is
- begin
- dbms_output.put_line('test_package_1.test1 executed');
- raise_application_error(-20111,'test');
- end;
- procedure test2 is
- begin
- dbms_output.put_line('test_package_1.test2 executed');
- end;
- end test_package_1;
- ]';
-
- execute immediate q'[create or replace package test_package_2 is
- --%suite
- --%tags(suite2,helper)
- --%suitepath(tests.test_package_1)
-
- --%test
- --%tags(test2,suite2test1,subtest2)
- procedure test1;
-
- --%test
- --%tags(suite2test2)
- procedure test2;
-
- end test_package_2;
- ]';
- execute immediate q'[create or replace package body test_package_2 is
- procedure test1 is
- begin
- dbms_output.put_line('test_package_2.test1 executed');
- end;
- procedure test2 is
- begin
- dbms_output.put_line('test_package_2.test2 executed');
- end;
- end test_package_2;
- ]';
-
- execute immediate q'[create or replace package test_package_3 is
- --%suite
- --%tags(suite3,helper)
- --%suitepath(tests2)
-
- --%test
- --%tags(test1suite3)
- procedure test1;
-
- --%test
- --%tags(test2suite3)
- procedure test2;
-
- end test_package_3;
- ]';
- execute immediate q'[create or replace package body test_package_3 is
- procedure test1 is
- begin
- dbms_output.put_line('test_package_3.test1 executed');
- end;
- procedure test2 is
- begin
- dbms_output.put_line('test_package_3.test2 executed');
- end;
- end test_package_3;
- ]';
-
- execute immediate q'[create or replace package test_tag_pkg_1 is
- --%suite
- --%tags(suite1,release_3_1_13,development,complex,end_to_end)
- --%suitepath(suite1)
- --%rollback(manual)
-
- --%test(Test1 from test_tag_pkg_1)
- --%tags(test1,development,fast)
- procedure test1;
-
- --%test(Test2 from test_tag_pkg_1)
- --%tags(test2,production,slow,patch_3_1_13)
- procedure test2;
-
- end test_tag_pkg_1;
- ]';
-
- execute immediate q'[create or replace package body test_tag_pkg_1 is
- procedure test1 is
- begin
- dbms_output.put_line('test_tag_pkg_1.test1 executed');
- end;
- procedure test2 is
- begin
- dbms_output.put_line('test_tag_pkg_1.test2 executed');
- end;
- end test_tag_pkg_1;
- ]';
-
- execute immediate q'[create or replace package test_tag_pkg_2 is
- --%suite
- --%tags(suite2,release_3_1_12,development,simple)
- --%suitepath(suite1.suite2)
- --%rollback(manual)
-
- --%test(Test3 from test_tag_pkg_2)
- --%tags(test3,development,fast)
- procedure test3;
-
- --%test(Test4 from test_tag_pkg_1)
- --%tags(test4,production,slow)
- procedure test4;
-
- end test_tag_pkg_2;
- ]';
-
- execute immediate q'[create or replace package body test_tag_pkg_2 is
- procedure test3 is
- begin
- dbms_output.put_line('test_tag_pkg_2.test3 executed');
- end;
- procedure test4 is
- begin
- dbms_output.put_line('test_tag_pkg_2.test4 executed');
- end;
- end test_tag_pkg_2;
- ]';
-
- execute immediate q'[create or replace package test_tag_pkg_3 is
- --%suite
- --%tags(suite3,release_3_1_13,production,simple,end_to_end)
- --%suitepath(suite3)
- --%rollback(manual)
-
- --%test(Test5 from test_tag_pkg_3)
- --%tags(test5,release_3_1_13,production,patch_3_1_13)
- procedure test5;
-
- --%test(Test6 from test_tag_pkg_3)
- --%tags(test6,development,patch_3_1_14)
- procedure test6;
-
- end test_tag_pkg_3;
- ]';
-
- execute immediate q'[create or replace package body test_tag_pkg_3 is
- procedure test5 is
- begin
- dbms_output.put_line('test_tag_pkg_3.test5 executed');
- end;
- procedure test6 is
- begin
- dbms_output.put_line('test_tag_pkg_3.test6 executed');
- end;
- end test_tag_pkg_3;
- ]';
-
- execute immediate q'[create or replace package suite1_level1_pkg is
-
- --%suite(suite1_level1)
- --%suitepath(any_none)
- --%rollback(manual)
-
- --%test(Test 1 from Suite1 on level 1)
- --%tags(suite1,level1,test1,test1_level1)
- procedure test1_level1;
-
- --%test(Test 2 from Suite1 on level 1)
- procedure test2_level1;
-
- end suite1_level1_pkg;
- ]';
-
- execute immediate q'[create or replace package body suite1_level1_pkg is
- procedure test1_level1 is
- begin
- dbms_output.put_line('suite1_level1_pkg.test1_level1 executed');
- end;
- procedure test2_level1 is
- begin
- dbms_output.put_line('suite1_level1_pkg.test2_level1 executed');
- end;
- end suite1_level1_pkg;
- ]';
-
- execute immediate q'[create or replace package suite1_1_level2_pkg is
-
- --%suite(suite1_1_level2)
- --%suitepath(any_none.suite1_level1)
- --%rollback(manual)
-
- --%test(Test 1 from Suite1_2 on level 2)
- --%tags(level2,test1,test1_level2)
- procedure suite1_1_test1_level2;
-
- --%test(Test 2 from Suite1_2 on level 2)
- procedure suite1_1_test2_level2;
-
- end suite1_1_level2_pkg;
- ]';
-
- execute immediate q'[create or replace package body suite1_1_level2_pkg is
- procedure suite1_1_test1_level2 is
- begin
- dbms_output.put_line('suite1_1_level2_pkg.suite1_1_test1_level2 executed');
- end;
- procedure suite1_1_test2_level2 is
- begin
- dbms_output.put_line('suite1_1_level2_pkg.suite1_1_test2_level2 executed');
- end;
- end suite1_1_level2_pkg;
- ]';
-
- execute immediate q'[create or replace package suite1_2_level2_pkg is
-
- --%suite(suite1_2_level2)
- --%tags(level2,suite1_2,suites)
- --%suitepath(any_none.suite1_level1)
- --%rollback(manual)
-
- --%test(Test 1 from Suite1_2 on level 2)
- procedure suite1_2_test1_level2;
-
- --%test(Test 2 from Suite1_2 on level 2)
- --%tags(level2,test2,test2_level2)
- procedure suite1_2_test2_level1;
-
- end suite1_2_level2_pkg;
- ]';
-
- execute immediate q'[create or replace package body suite1_2_level2_pkg is
- procedure suite1_2_test1_level2 is
- begin
- dbms_output.put_line('suite1_2_level2_pkg.suite1_2_test1_level2 executed');
- end;
- procedure suite1_2_test2_level1 is
- begin
- dbms_output.put_line('suite1_2_level2_pkg.suite1_2_test2_level1 executed');
- end;
- end suite1_2_level2_pkg;
- ]';
-
- execute immediate q'[create or replace package suite2_level1_pkg is
-
- --%suite(suite2_level1)
- --%tags(level1,suite2,suites)
- --%suitepath(any_none)
- --%rollback(manual)
-
- --%test(Test 1 from Suite1 on level 1)
- --%tags(suite2,level1,test1,test1_level1)
- procedure test1_level1;
-
- --%test(Test 2 from Suite1 on level 1)
- procedure test2_level1;
-
- end suite2_level1_pkg;
- ]';
-
- execute immediate q'[create or replace package body suite2_level1_pkg is
- procedure test1_level1 is
- begin
- dbms_output.put_line('suite2_level1_pkg.test1_level1 executed');
- end;
- procedure test2_level1 is
- begin
- dbms_output.put_line('suite2_level1_pkg.test2_level1 executed');
- end;
- end suite2_level1_pkg;
- ]';
-
- execute immediate q'[create or replace package suite2_2_level2_pkg is
-
- --%suite(suite2_2_level2)
- --%tags(level2,suite2_2,suites)
- --%suitepath(any_none.suite2_level1)
- --%rollback(manual)
-
- --%test(Test 1 from Suite2_2 on level 2)
- procedure suite2_2_test1_level2;
-
- --%test(Test 2 from Suite2_2 on level 2)
- --%tags(level2,test2,test2_level2)
- procedure suite2_2_test2_level2;
-
- end suite2_2_level2_pkg;
- ]';
-
- execute immediate q'[create or replace package body suite2_2_level2_pkg is
- procedure suite2_2_test1_level2 is
- begin
- dbms_output.put_line('suite2_2_level2_pkg.suite2_2_test1_level2 executed');
- end;
- procedure suite2_2_test2_level2 is
- begin
- dbms_output.put_line('suite2_2_level2_pkg.suite2_2_test2_level2 executed');
- end;
- end suite2_2_level2_pkg;
- ]';
-
-
- execute immediate q'[grant execute on test_package_1 to public]';
- execute immediate q'[grant execute on test_package_2 to public]';
- execute immediate q'[grant execute on test_package_3 to public]';
- execute immediate q'[grant execute on test_tag_pkg_1 to public]';
- execute immediate q'[grant execute on test_tag_pkg_2 to public]';
- execute immediate q'[grant execute on test_tag_pkg_3 to public]';
-
- execute immediate q'[grant execute on suite1_level1_pkg to public]';
- execute immediate q'[grant execute on suite1_1_level2_pkg to public]';
- execute immediate q'[grant execute on suite1_2_level2_pkg to public]';
- execute immediate q'[grant execute on suite2_level1_pkg to public]';
- execute immediate q'[grant execute on suite2_2_level2_pkg to public]';
- end;
-
- procedure drop_ut3_user_tests is
- pragma autonomous_transaction;
- begin
- execute immediate q'[drop package test_package_1]';
- execute immediate q'[drop package test_package_2]';
- execute immediate q'[drop package test_package_3]';
- execute immediate q'[drop package test_tag_pkg_1]';
- execute immediate q'[drop package test_tag_pkg_2]';
- execute immediate q'[drop package test_tag_pkg_3]';
-
- execute immediate q'[drop package suite2_2_level2_pkg]';
- execute immediate q'[drop package suite2_level1_pkg]';
- execute immediate q'[drop package suite1_2_level2_pkg]';
- execute immediate q'[drop package suite1_level1_pkg]';
- execute immediate q'[drop package suite1_1_level2_pkg]';
- end;
-
- procedure create_test_suite is
- pragma autonomous_transaction;
- begin
- ut3_tester_helper.run_helper.create_db_link;
- execute immediate q'[
- create or replace package stateful_package as
- function get_state return varchar2;
- end;
- ]';
- execute immediate q'[
- create or replace package body stateful_package as
- g_state varchar2(1) := 'A';
- function get_state return varchar2 is begin return g_state; end;
- end;
- ]';
- execute immediate q'[
- create or replace package test_stateful as
- --%suite
- --%suitepath(test_state)
-
- --%test
- --%beforetest(acquire_state_via_db_link,rebuild_stateful_package)
- procedure failing_stateful_test;
-
- procedure rebuild_stateful_package;
- procedure acquire_state_via_db_link;
-
- end;
- ]';
- execute immediate q'{
- create or replace package body test_stateful as
-
- procedure failing_stateful_test is
- begin
- ut3_develop.ut.expect(stateful_package.get_state@db_loopback).to_equal('abc');
- end;
-
- procedure rebuild_stateful_package is
- pragma autonomous_transaction;
- begin
- execute immediate q'[
- create or replace package body stateful_package as
- g_state varchar2(3) := 'abc';
- function get_state return varchar2 is begin return g_state; end;
- end;
- ]';
- end;
-
- procedure acquire_state_via_db_link is
- begin
- dbms_output.put_line('stateful_package.get_state@db_loopback='||stateful_package.get_state@db_loopback);
- end;
- end;
- }';
- execute immediate 'grant execute on test_stateful to public';
- end;
-
- procedure drop_test_suite is
- pragma autonomous_transaction;
- begin
- drop_db_link;
- execute immediate 'drop package stateful_package';
- execute immediate 'drop package test_stateful';
- end;
-
- procedure package_no_body is
- pragma autonomous_transaction;
- begin
- execute immediate 'create or replace package ut_without_body as
- procedure test1;
- end;';
- end;
-
- procedure drop_package_no_body is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package ut_without_body';
- end;
-
- procedure run(a_reporter ut3_develop.ut_reporter_base := null) is
- begin
- ut3_develop.ut.run(a_reporter);
- end;
-
- procedure run(a_path varchar2, a_reporter ut3_develop.ut_reporter_base := null) is
- begin
- ut3_develop.ut.run(a_path, a_reporter);
- end;
-
- procedure run(a_paths ut3_develop.ut_varchar2_list, a_reporter ut3_develop.ut_reporter_base := null) is
- begin
- ut3_develop.ut.run(a_paths, a_reporter);
- end;
-
- procedure run(a_paths ut3_develop.ut_varchar2_list, a_test_files ut3_develop.ut_varchar2_list, a_reporter ut3_develop.ut_reporter_base) is
- begin
- ut3_develop.ut.run(
- a_paths,
- a_reporter,
- a_source_files => ut3_develop.ut_varchar2_list(),
- a_test_files => a_test_files
- );
- end;
-
- function run(a_reporter ut3_develop.ut_reporter_base := null) return ut3_develop.ut_varchar2_list is
- l_results ut3_develop.ut_varchar2_list;
- begin
- select * bulk collect into l_results from table (ut3_develop.ut.run(a_reporter));
- return l_results;
- end;
-
- function run(a_paths ut3_develop.ut_varchar2_list, a_test_files ut3_develop.ut_varchar2_list, a_reporter ut3_develop.ut_reporter_base) return ut3_develop.ut_varchar2_list is
- l_results ut3_develop.ut_varchar2_list;
- begin
- select * bulk collect into l_results from table (
- ut3_develop.ut.run(
- a_paths,
- a_reporter, a_source_files => ut3_develop.ut_varchar2_list(),
- a_test_files => a_test_files
- ));
- return l_results;
- end;
-
- function run(a_path varchar2, a_reporter ut3_develop.ut_reporter_base := null)
- return ut3_develop.ut_varchar2_list is
- l_results ut3_develop.ut_varchar2_list;
- begin
- select * bulk collect into l_results from table (ut3_develop.ut.run(a_path, a_reporter));
- return l_results;
- end;
-
- function run(a_paths ut3_develop.ut_varchar2_list, a_reporter ut3_develop.ut_reporter_base := null)
- return ut3_develop.ut_varchar2_list is
- l_results ut3_develop.ut_varchar2_list;
- begin
- select * bulk collect into l_results from table (ut3_develop.ut.run(a_paths, a_reporter));
- return l_results;
- end;
-
- function run(a_test_files ut3_develop.ut_varchar2_list, a_reporter ut3_develop.ut_reporter_base)
- return ut3_develop.ut_varchar2_list is
- l_results ut3_develop.ut_varchar2_list;
- begin
- select * bulk collect into l_results from table (
- ut3_develop.ut.run(
- a_reporter, a_source_files => ut3_develop.ut_varchar2_list(),
- a_test_files => a_test_files
- ));
- return l_results;
- end;
-
- procedure run(a_reporter ut3_develop.ut_reporter_base := null,a_tags varchar2) is
- begin
- ut3_develop.ut.run(a_reporter,a_tags => a_tags);
- end;
-
- procedure run(a_path varchar2, a_reporter ut3_develop.ut_reporter_base := null,a_tags varchar2) is
- begin
- ut3_develop.ut.run(a_path, a_reporter,a_tags => a_tags);
- end;
-
- procedure run(a_paths ut3_develop.ut_varchar2_list, a_reporter ut3_develop.ut_reporter_base := null, a_tags varchar2) is
- begin
- ut3_develop.ut.run(a_paths, a_reporter,a_tags => a_tags);
- end;
-
- function run(a_reporter ut3_develop.ut_reporter_base := null,a_tags varchar2) return ut3_develop.ut_varchar2_list is
- l_results ut3_develop.ut_varchar2_list;
- begin
- select * bulk collect into l_results from table (ut3_develop.ut.run(a_reporter, a_tags => a_tags));
- return l_results;
- end;
-
- function run(a_path varchar2, a_reporter ut3_develop.ut_reporter_base := null, a_tags varchar2)
- return ut3_develop.ut_varchar2_list is
- l_results ut3_develop.ut_varchar2_list;
- begin
- select * bulk collect into l_results from table (ut3_develop.ut.run(a_path, a_reporter,a_tags => a_tags));
- return l_results;
- end;
-
- function run(a_paths ut3_develop.ut_varchar2_list, a_reporter ut3_develop.ut_reporter_base := null, a_tags varchar2)
- return ut3_develop.ut_varchar2_list is
- l_results ut3_develop.ut_varchar2_list;
- begin
- select * bulk collect into l_results from table (ut3_develop.ut.run(a_paths, a_reporter, a_tags => a_tags));
- return l_results;
- end;
-
- procedure test_rollback_type(a_procedure_name varchar2, a_rollback_type integer, a_expectation ut_matcher) is
- l_suite ut3_develop.ut_suite;
- begin
- --Arrange
- execute immediate 'delete from ut$test_table';
- l_suite := ut3_develop.ut_suite(a_object_owner => 'ut3_tester_helper', a_object_name => 'UT_TRANSACTION_CONTROL', a_line_no=> 1);
- l_suite.path := 'ut_transaction_control';
- l_suite.before_all_list := ut3_develop.ut_executables(ut3_develop.ut_executable('ut3_tester_helper', 'UT_TRANSACTION_CONTROL', 'setup', ut3_develop.ut_utils.gc_before_all));
- l_suite.items.extend;
- l_suite.items(l_suite.items.last) := ut3_develop.ut_test(a_object_owner => 'ut3_tester_helper', a_object_name => 'ut_transaction_control',a_name => a_procedure_name, a_line_no=> 1);
- l_suite.set_rollback_type(a_rollback_type);
-
- --Act
- l_suite.do_execute();
-
- --Assert
- ut.expect(main_helper.get_value(q'[ut_transaction_control.count_rows('t')]')).to_( a_expectation );
- ut.expect(main_helper.get_value(q'[ut_transaction_control.count_rows('s')]')).to_( a_expectation );
- end;
-
- procedure create_dummy_long_test_package is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace package ut3_develop.dummy_long_test_package as
-
- --%suitepath(verylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtext)
- --%suite(dummy_test_suite)
-
- --%test(dummy_test)
- procedure some_dummy_test_procedure;
- end;]';
-
- execute immediate q'[create or replace package ut3_develop.dummy_long_test_package1 as
-
- --%suitepath(verylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtextverylongtext)
- --%suite(dummy_test_suite1)
-
- --%test(dummy_test)
- procedure some_dummy_test_procedure;
- end;]';
- end;
-
- procedure drop_dummy_long_test_package is
- pragma autonomous_transaction;
- begin
- execute immediate q'[drop package ut3_develop.dummy_long_test_package]';
- execute immediate q'[drop package ut3_develop.dummy_long_test_package1]';
- end;
-
- procedure create_ut3_suite is
- pragma autonomous_transaction;
- begin
- execute immediate q'[
- create or replace package ut3_develop.some_test_package
- as
- --%suite
-
- --%test
- procedure some_test;
-
- end;]';
- execute immediate q'[
- create or replace package ut3_develop.package_that_is_not_a_test
- as
- --%parameter(a comment inside)
- --%parameters( description )
-
- --%test
- procedure some_test;
-
- end;]';
- end;
-
- procedure drop_ut3_suite is
- pragma autonomous_transaction;
- begin
- execute immediate q'[drop package ut3_develop.package_that_is_not_a_test]';
- execute immediate q'[drop package ut3_develop.some_test_package]';
- end;
-
- function get_schema_ut_packages(a_owner in varchar2) return ut3_develop.ut_object_names is
- begin
- return ut3_develop.ut_suite_manager.get_schema_ut_packages(ut3_develop.ut_varchar2_rows(a_owner), null);
- end;
-
- function ut_output_buffer_tmp return t_out_buff_tab pipelined is
- l_buffer_tab t_out_buff_tab;
- cursor get_buffer is
- select * from ut3_develop.ut_output_buffer_tmp;
- begin
- open get_buffer;
- fetch get_buffer bulk collect into l_buffer_tab;
- for idx in 1..l_buffer_tab.count loop
- pipe row(l_buffer_tab(idx));
- end loop;
- end;
-
- procedure delete_buffer is
- begin
- delete from ut3_develop.ut_output_buffer_tmp;
- end;
-
- function get_annotation_cache_info_cur(
- a_owner varchar2,
- a_type varchar2
- ) return sys_refcursor is
- l_result sys_refcursor;
- begin
- open l_result for
- select * from ut3_develop.ut_annotation_cache_info
- where object_owner = a_owner and object_type = a_type;
-
- return l_result;
- end;
-
- function get_annotation_cache_cursor(
- a_owner varchar2,
- a_type varchar2,
- a_name varchar2 := null
- ) return sys_refcursor is
- l_result sys_refcursor;
- begin
- open l_result for
- select *
- from ut3_develop.ut_annotation_cache_info i
- join ut3_develop.ut_annotation_cache c on c.cache_id = i.cache_id
- where object_owner = a_owner and object_type = a_type and object_name = nvl( a_name, object_name );
-
- return l_result;
- end;
-
- procedure slow_down_insert_into_table_buffer is
- pragma autonomous_transaction;
- begin
- execute immediate q'[
- create or replace trigger ut3_develop.slow_down_buffer_insert
- before insert on ut3_develop.ut_output_buffer_info_tmp
- begin
- dbms_session.sleep(1);
- end;]';
- end;
-
- procedure cleanup_slow_down_insert_into_table_buffer is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop trigger ut3_develop.slow_down_buffer_insert';
- exception when others then
- if sqlcode <> -4080 then raise; end if;
- end;
-
- procedure run_as_job(a_job_action varchar2) is
- l_job_name varchar2(50);
- l_timestamp timestamp with time zone := current_timestamp;
- pragma autonomous_transaction;
- begin
- l_job_name := 'utPLSQL__'||to_char(l_timestamp,'yyyymmddhh24missff');
- dbms_scheduler.create_job(
- job_name => l_job_name,
- job_type => 'PLSQL_BLOCK',
- job_action => a_job_action,
- start_date => l_timestamp,
- enabled => TRUE,
- auto_drop => TRUE
- );
- end;
-end;
-/
diff --git a/test/ut3_tester_helper/run_helper.pks b/test/ut3_tester_helper/run_helper.pks
deleted file mode 100644
index c46b99a3f..000000000
--- a/test/ut3_tester_helper/run_helper.pks
+++ /dev/null
@@ -1,84 +0,0 @@
-create or replace package run_helper is
-
- g_run_id integer;
-
- type t_out_buff_tab is table of ut3_develop.ut_output_buffer_tmp%rowtype;
-
- procedure setup_cache_objects;
- procedure setup_cache_objectstag;
- procedure setup_cache_twotags;
- procedure setup_cache_context_disabled;
- procedure setup_cache;
- procedure cleanup_cache;
- procedure create_db_link;
- procedure drop_db_link;
- procedure db_link_setup;
- procedure db_link_cleanup;
-
- procedure create_suite_with_link;
- procedure drop_suite_with_link;
-
- procedure create_ut3_user_tests;
- procedure drop_ut3_user_tests;
-
- procedure create_test_suite;
- procedure drop_test_suite;
- procedure package_no_body;
- procedure drop_package_no_body;
-
- procedure create_trans_control;
- procedure drop_trans_control;
-
- procedure run(a_reporter ut3_develop.ut_reporter_base := null);
- procedure run(a_path varchar2, a_reporter ut3_develop.ut_reporter_base := null);
- procedure run(a_paths ut3_develop.ut_varchar2_list, a_reporter ut3_develop.ut_reporter_base := null);
- procedure run(a_paths ut3_develop.ut_varchar2_list, a_test_files ut3_develop.ut_varchar2_list,
- a_reporter ut3_develop.ut_reporter_base);
- function run(a_reporter ut3_develop.ut_reporter_base := null) return ut3_develop.ut_varchar2_list;
- function run(a_paths ut3_develop.ut_varchar2_list, a_test_files ut3_develop.ut_varchar2_list,
- a_reporter ut3_develop.ut_reporter_base) return ut3_develop.ut_varchar2_list;
- function run(a_path varchar2, a_reporter ut3_develop.ut_reporter_base := null)
- return ut3_develop.ut_varchar2_list;
- function run(a_paths ut3_develop.ut_varchar2_list, a_reporter ut3_develop.ut_reporter_base := null)
- return ut3_develop.ut_varchar2_list;
- function run(a_test_files ut3_develop.ut_varchar2_list, a_reporter ut3_develop.ut_reporter_base)
- return ut3_develop.ut_varchar2_list;
-
- procedure run(a_reporter ut3_develop.ut_reporter_base := null,a_tags varchar2);
- procedure run(a_path varchar2, a_reporter ut3_develop.ut_reporter_base := null,a_tags varchar2);
- procedure run(a_paths ut3_develop.ut_varchar2_list, a_reporter ut3_develop.ut_reporter_base := null, a_tags varchar2);
- function run(a_reporter ut3_develop.ut_reporter_base := null,a_tags varchar2) return ut3_develop.ut_varchar2_list;
- function run(a_path varchar2, a_reporter ut3_develop.ut_reporter_base := null, a_tags varchar2)
- return ut3_develop.ut_varchar2_list;
- function run(a_paths ut3_develop.ut_varchar2_list, a_reporter ut3_develop.ut_reporter_base := null, a_tags varchar2)
- return ut3_develop.ut_varchar2_list;
-
- procedure test_rollback_type(a_procedure_name varchar2, a_rollback_type integer, a_expectation ut_matcher);
-
- procedure create_dummy_long_test_package;
- procedure drop_dummy_long_test_package;
- procedure create_ut3_suite;
- procedure drop_ut3_suite;
- function get_schema_ut_packages(a_owner in varchar2) return ut3_develop.ut_object_names;
-
- function ut_output_buffer_tmp return t_out_buff_tab pipelined;
- procedure delete_buffer;
-
- function get_annotation_cache_info_cur(
- a_owner varchar2,
- a_type varchar2
- ) return sys_refcursor;
-
- function get_annotation_cache_cursor(
- a_owner varchar2,
- a_type varchar2,
- a_name varchar2 := null
- ) return sys_refcursor;
-
- procedure slow_down_insert_into_table_buffer;
-
- procedure cleanup_slow_down_insert_into_table_buffer;
-
- procedure run_as_job(a_job_action varchar2);
-end;
-/
diff --git a/test/ut3_tester_helper/test_dummy_dble_nest_lst_obj.tps b/test/ut3_tester_helper/test_dummy_dble_nest_lst_obj.tps
deleted file mode 100644
index 5134fef21..000000000
--- a/test/ut3_tester_helper/test_dummy_dble_nest_lst_obj.tps
+++ /dev/null
@@ -1,17 +0,0 @@
-declare
- l_exists integer;
-begin
- select count(1) into l_exists from user_types where type_name = 'TEST_DUMMY_DBLE_NEST_LST_OBJ';
- if l_exists > 0 then
- execute immediate 'drop type test_dummy_dble_nest_lst_obj force';
- end if;
-end;
-/
-
-CREATE TYPE test_dummy_dble_nest_lst_obj AS OBJECT
-(
- some_number_id NUMBER,
- some_name VARCHAR2 (25),
- dummy_list test_dummy_double_nested_list
-);
-/
\ No newline at end of file
diff --git a/test/ut3_tester_helper/test_dummy_double_nested_list.tps b/test/ut3_tester_helper/test_dummy_double_nested_list.tps
deleted file mode 100644
index 625462824..000000000
--- a/test/ut3_tester_helper/test_dummy_double_nested_list.tps
+++ /dev/null
@@ -1,13 +0,0 @@
-declare
- l_exists integer;
-begin
- select count(1) into l_exists from user_types where type_name = 'TEST_DUMMY_DOUBLE_NESTED_LIST';
- if l_exists > 0 then
- execute immediate 'drop type test_dummy_double_nested_list force';
- end if;
-end;
-/
-
-CREATE TYPE test_dummy_double_nested_list AS
- TABLE OF test_dummy_nested_object_list;
-/
diff --git a/test/ut3_tester_helper/test_dummy_double_nested_object.tps b/test/ut3_tester_helper/test_dummy_double_nested_object.tps
deleted file mode 100644
index 8f74f7ecb..000000000
--- a/test/ut3_tester_helper/test_dummy_double_nested_object.tps
+++ /dev/null
@@ -1,15 +0,0 @@
-declare
- l_exists integer;
-begin
- select count(1) into l_exists from user_types where type_name = 'TEST_DUMMY_DOUBLE_NESTED_OBJ';
- if l_exists > 0 then
- execute immediate 'drop type test_dummy_double_nested_obj force';
- end if;
-end;
-/
-
-create or replace type test_dummy_double_nested_obj as object (
- first_double_nested_obj test_dummy_nested_object,
- "Value" varchar2(30)
-)
-/
\ No newline at end of file
diff --git a/test/ut3_tester_helper/test_dummy_nested_object.tps b/test/ut3_tester_helper/test_dummy_nested_object.tps
deleted file mode 100644
index 6aef3bef8..000000000
--- a/test/ut3_tester_helper/test_dummy_nested_object.tps
+++ /dev/null
@@ -1,15 +0,0 @@
-declare
- l_exists integer;
-begin
- select count(1) into l_exists from user_types where type_name = 'TEST_DUMMY_NESTED_OBJECT';
- if l_exists > 0 then
- execute immediate 'drop type test_dummy_nested_object force';
- end if;
-end;
-/
-
-create or replace type test_dummy_nested_object as object (
- first_nested_obj test_dummy_object,
- sec_nested_obj test_dummy_object
-)
-/
\ No newline at end of file
diff --git a/test/ut3_tester_helper/test_dummy_nested_object_list.tps b/test/ut3_tester_helper/test_dummy_nested_object_list.tps
deleted file mode 100644
index fd47b55bd..000000000
--- a/test/ut3_tester_helper/test_dummy_nested_object_list.tps
+++ /dev/null
@@ -1,15 +0,0 @@
-declare
- l_exists integer;
-begin
- select count(1) into l_exists from user_types where type_name = 'TEST_DUMMY_NESTED_OBJECT_LIST';
- if l_exists > 0 then
- execute immediate 'drop type test_dummy_nested_object_list force';
- end if;
-end;
-/
-
-create or replace type test_dummy_nested_object_list as object (
- first_nested_obj test_dummy_object_list,
- somename varchar2(50)
-)
-/
\ No newline at end of file
diff --git a/test/ut3_tester_helper/test_dummy_number.tps b/test/ut3_tester_helper/test_dummy_number.tps
deleted file mode 100644
index b6283c93b..000000000
--- a/test/ut3_tester_helper/test_dummy_number.tps
+++ /dev/null
@@ -1,14 +0,0 @@
-declare
- l_exists integer;
-begin
- select count(1) into l_exists from user_types where type_name = 'TEST_DUMMY_NUMBER';
- if l_exists > 0 then
- execute immediate 'drop type test_dummy_number force';
- end if;
-end;
-/
-
-create or replace type test_dummy_number as object (
- id number
-)
-/
diff --git a/test/ut3_tester_helper/test_dummy_object.tps b/test/ut3_tester_helper/test_dummy_object.tps
deleted file mode 100644
index 7f095fc0a..000000000
--- a/test/ut3_tester_helper/test_dummy_object.tps
+++ /dev/null
@@ -1,16 +0,0 @@
-declare
- l_exists integer;
-begin
- select count(1) into l_exists from user_types where type_name = 'TEST_DUMMY_OBJECT';
- if l_exists > 0 then
- execute immediate 'drop type test_dummy_object force';
- end if;
-end;
-/
-
-create or replace type test_dummy_object as object (
- id number,
- "name" varchar2(30),
- "Value" varchar2(30)
-)
-/
diff --git a/test/ut3_tester_helper/test_dummy_object_list.tps b/test/ut3_tester_helper/test_dummy_object_list.tps
deleted file mode 100644
index 849974da1..000000000
--- a/test/ut3_tester_helper/test_dummy_object_list.tps
+++ /dev/null
@@ -1,12 +0,0 @@
-declare
- l_exists integer;
-begin
- select count(1) into l_exists from user_types where type_name = 'TEST_DUMMY_OBJECT_LIST';
- if l_exists > 0 then
- execute immediate 'drop type test_dummy_object_list force';
- end if;
-end;
-/
-
-create or replace type test_dummy_object_list as table of test_dummy_object
-/
diff --git a/test/ut3_tester_helper/test_event_list.tps b/test/ut3_tester_helper/test_event_list.tps
deleted file mode 100644
index 8abf71b13..000000000
--- a/test/ut3_tester_helper/test_event_list.tps
+++ /dev/null
@@ -1,2 +0,0 @@
-create or replace type test_event_list as table of test_event_object;
-/
diff --git a/test/ut3_tester_helper/test_event_object.tps b/test/ut3_tester_helper/test_event_object.tps
deleted file mode 100644
index da458d2c2..000000000
--- a/test/ut3_tester_helper/test_event_object.tps
+++ /dev/null
@@ -1,15 +0,0 @@
-declare
- l_exists integer;
-begin
- select count(1) into l_exists from user_types where type_name = 'TEST_EVENT_OBJECT';
- if l_exists > 0 then
- execute immediate 'drop type test_event_object force';
- end if;
-end;
-/
-
-create or replace type test_event_object as object (
- event_type varchar2(1000),
- event_doc xmltype
-)
-/
\ No newline at end of file
diff --git a/test/ut3_tester_helper/test_nested_tab_varray.tps b/test/ut3_tester_helper/test_nested_tab_varray.tps
deleted file mode 100644
index 9f58d090e..000000000
--- a/test/ut3_tester_helper/test_nested_tab_varray.tps
+++ /dev/null
@@ -1,14 +0,0 @@
-declare
- l_exists integer;
-begin
- select count(1) into l_exists from user_types where type_name = 'TEST_NESTED_TAB_VARRAY';
- if l_exists > 0 then
- execute immediate 'drop type test_nested_tab_varray force';
- end if;
-end;
-/
-
-create or replace type test_nested_tab_varray as object (
- n_varray t_varray
-)
-/
diff --git a/test/ut3_tester_helper/test_tab_varchar2.tps b/test/ut3_tester_helper/test_tab_varchar2.tps
deleted file mode 100644
index 17086292a..000000000
--- a/test/ut3_tester_helper/test_tab_varchar2.tps
+++ /dev/null
@@ -1,12 +0,0 @@
-declare
- l_exists integer;
-begin
- select count(1) into l_exists from user_types where type_name = 'T_TAB_VARCHAR';
- if l_exists > 0 then
- execute immediate 'drop type t_tab_varchar force';
- end if;
-end;
-/
-
-create or replace type t_tab_varchar is table of varchar2(1)
-/
\ No newline at end of file
diff --git a/test/ut3_tester_helper/test_tab_varray.tps b/test/ut3_tester_helper/test_tab_varray.tps
deleted file mode 100644
index 3c684afca..000000000
--- a/test/ut3_tester_helper/test_tab_varray.tps
+++ /dev/null
@@ -1,13 +0,0 @@
-declare
- l_exists integer;
-begin
- select count(1) into l_exists from user_types where type_name = 'T_VARRAY';
- if l_exists > 0 then
- execute immediate 'drop type t_varray force';
- end if;
-end;
-/
-
-
-create or replace type t_varray is varray(1) of number
-/
\ No newline at end of file
diff --git a/test/ut3_tester_helper/ut_example_tests.pkb b/test/ut3_tester_helper/ut_example_tests.pkb
deleted file mode 100644
index 7e795d184..000000000
--- a/test/ut3_tester_helper/ut_example_tests.pkb
+++ /dev/null
@@ -1,36 +0,0 @@
-create or replace package body ut_example_tests
-as
- procedure create_synonym is
- pragma autonomous_transaction;
- begin
- execute immediate 'create or replace synonym ut3_tester.ut_example_tests for ut3_tester_helper.ut_example_tests';
- end;
-
- procedure drop_synonym is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop synonym ut3_tester.ut_example_tests';
- end;
-
- procedure set_g_number_0 as
- begin
- g_number := 0;
- end;
-
- procedure add_1_to_g_number as
- begin
- g_number := g_number + 1;
- end;
-
- procedure failing_procedure as
- begin
- g_number := 1 / 0;
- end;
-
- procedure ut_commit_test is
- begin
- commit;
- end;
-
-end;
-/
diff --git a/test/ut3_tester_helper/ut_example_tests.pks b/test/ut3_tester_helper/ut_example_tests.pks
deleted file mode 100644
index a62c02332..000000000
--- a/test/ut3_tester_helper/ut_example_tests.pks
+++ /dev/null
@@ -1,12 +0,0 @@
-create or replace package ut_example_tests is
- g_number number;
-
- procedure create_synonym;
- procedure drop_synonym;
-
- procedure set_g_number_0;
- procedure add_1_to_g_number;
- procedure failing_procedure;
- procedure ut_commit_test;
-end;
-/
diff --git a/test/ut3_tester_helper/ut_test_table.sql b/test/ut3_tester_helper/ut_test_table.sql
deleted file mode 100644
index c4832a10f..000000000
--- a/test/ut3_tester_helper/ut_test_table.sql
+++ /dev/null
@@ -1,12 +0,0 @@
-declare
- l_exists integer;
-begin
- select count(1) into l_exists from user_tables where table_name = 'UT$TEST_TABLE';
- if l_exists > 0 then
- execute immediate 'drop table ut$test_table';
- end if;
-end;
-/
-
-create table ut$test_table (val varchar2(1));
-grant select,insert,update,delete on ut$test_table to public;
diff --git a/test/ut3_user/api/test_ut_run.pkb b/test/ut3_user/api/test_ut_run.pkb
deleted file mode 100644
index 12ab6cdba..000000000
--- a/test/ut3_user/api/test_ut_run.pkb
+++ /dev/null
@@ -1,1802 +0,0 @@
-create or replace package body test_ut_run is
-
- gc_owner constant varchar2(250) := sys_context('userenv', 'current_schema');
- gc_module constant varchar2(32767) := 'test module';
- gc_action constant varchar2(32767) := 'test action';
- gc_client_info constant varchar2(32767) := 'test client info';
-
- g_context_test_results clob;
- g_timestamp timestamp;
-
- procedure clear_expectations is
- begin
- ut3_tester_helper.main_helper.clear_expectations();
- end;
-
- procedure create_ut3_user_tests is
- begin
- ut3_tester_helper.run_helper.create_ut3_user_tests();
- end;
-
- procedure drop_ut3_user_tests is
- begin
- ut3_tester_helper.run_helper.drop_ut3_user_tests();
- end;
-
- --a suite on suitepath "tests", as test_package_1 in ut3_tester_helper (see run_helper.create_ut3_user_tests)
- procedure create_test_suite_in_ut3_user is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace package test_suite_in_ut3_user is
- --%suite
- --%suitepath(tests)
-
- --%test
- procedure test1;
- end;]';
- execute immediate q'[create or replace package body test_suite_in_ut3_user is
- procedure test1 is
- begin
- dbms_output.put_line('test_suite_in_ut3_user.test1 executed');
- end;
- end;]';
- end;
-
- procedure drop_test_suite_in_ut3_user is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package test_suite_in_ut3_user';
- end;
-
- procedure run_groups_suites_by_schema is
- l_results clob;
- begin
- --Act - ut3_user:tests sorts between ut3_tester_helper:tests and ut3_tester_helper:tests2 by path
- l_results := ut3_tester_helper.main_helper.table_to_clob(
- ut3_tester_helper.run_helper.run(
- ut3_develop.ut_varchar2_list('ut3_user:tests', 'ut3_tester_helper:tests', 'ut3_tester_helper:tests2'),
- a_tags => null
- )
- );
- --Assert - UT3_TESTER_HELPER comes before UT3_USER
- ut.expect( l_results ).to_be_like( '%test_package_2.test1 executed%test_package_3.test1 executed%test_suite_in_ut3_user.test1 executed%' );
- end;
-
- procedure ut_version is
- begin
- ut.expect(ut3_develop.ut.version()).to_match('^v\d+\.\d+\.\d+\.\d+(-\w+)?$');
- end;
-
- procedure ut_fail is
- begin
- --Act
- ut3_develop.ut.fail('Testing failure message');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations(1))
- .to_be_like('%Testing failure message%');
- end;
-
- procedure run_proc_no_params is
- l_results clob;
- begin
- ut3_tester_helper.run_helper.run();
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).to_be_like( '%test_package_1%test_package_2%test_package_3%' );
- end;
-
- procedure run_proc_specific_reporter is
- l_results clob;
- begin
- --Act
- ut3_develop.ut.run('ut3_tester_helper',a_reporter => ut3_develop.ut_documentation_reporter() );
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).to_be_like( '%test_package_1%test_package_2%test_package_3%' );
- end;
-
- procedure run_proc_cov_file_list is
- l_results clob;
- begin
- --Act
- ut3_develop.ut.run(
- 'ut3_tester_helper',
- a_reporter => ut3_develop.ut_sonar_test_reporter(),
- a_source_files => ut3_develop.ut_varchar2_list(),
- a_test_files => ut3_develop.ut_varchar2_list('tests/ut3_tester_helper.test_package_1.pkb',
- 'tests/ut3_tester_helper.test_package_2.pkb',
- 'tests/ut3_tester_helper.test_package_3.pkb')
- );
-
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).to_be_like( '%tests/ut3_tester_helper.test_package_2.pkb'||
- '%tests/ut3_tester_helper.test_package_1.pkb'||
- '%tests/ut3_tester_helper.test_package_3.pkb%' );
- end;
-
- procedure run_proc_pkg_name is
- l_results clob;
- begin
- ut3_develop.ut.run('ut3_tester_helper.test_package_1');
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).to_be_like( '%test_package_1%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_2%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_3%' );
- end;
-
- procedure run_proc_pkg_name_file_list is
- l_results clob;
- begin
- ut3_develop.ut.run(
- 'ut3_tester_helper.test_package_3',
- ut3_develop.ut_sonar_test_reporter(), a_source_files => ut3_develop.ut_varchar2_list(),
- a_test_files => ut3_develop.ut_varchar2_list('tests/ut3_tester_helper.test_package_1.pkb',
- 'tests/ut3_tester_helper.test_package_2.pkb',
- 'tests/ut3_tester_helper.test_package_3.pkb')
- );
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).to_be_like( '%tests/ut3_tester_helper.test_package_3.pkb%' );
- ut.expect( l_results ).not_to_be_like( '%tests/ut3_tester_helper.test_package_1.pkb%' );
- ut.expect( l_results ).not_to_be_like( '%tests/ut3_tester_helper.test_package_2.pkb%' );
- end;
-
- procedure run_proc_path_list is
- l_results clob;
- begin
- ut3_tester_helper.run_helper.run(ut3_develop.ut_varchar2_list(':tests.test_package_1',':tests'));
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).to_be_like( '%test_package_1%' );
- ut.expect( l_results ).to_be_like( '%test_package_2%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_3%' );
- end;
-
- procedure run_proc_path_list_file_list is
- l_results clob;
- begin
- ut3_tester_helper.run_helper.run(
- a_paths => ut3_develop.ut_varchar2_list(':tests.test_package_1',':tests'),
- a_reporter => ut3_develop.ut_sonar_test_reporter(),
- a_test_files => ut3_develop.ut_varchar2_list('tests/ut3_tester_helper.test_package_1.pkb',
- 'tests/ut3_tester_helper.test_package_2.pkb',
- 'tests/ut3_tester_helper.test_package_3.pkb')
- );
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).to_be_like( '%tests/ut3_tester_helper.test_package_1.pkb%' );
- ut.expect( l_results ).to_be_like( '%tests/ut3_tester_helper.test_package_2.pkb%' );
- ut.expect( l_results ).not_to_be_like( '%tests/ut3_tester_helper.test_package_3.pkb%' );
- end;
-
- procedure run_proc_null_reporter is
- l_results clob;
- begin
- --Act
- ut3_develop.ut.run('ut3_tester_helper', cast(null as ut3_develop.ut_reporter_base));
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).to_be_like( '%tests%test_package_1%test_package_2%tests2%test_package_3%' );
- end;
-
- procedure run_proc_null_path is
- l_results clob;
- begin
- --Act
- ut3_tester_helper.run_helper.run(cast(null as varchar2));
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).to_be_like( '%test_package_1%test_package_2%test_package_3%' );
- end;
-
- procedure run_proc_null_path_list is
- l_results clob;
- l_paths ut3_develop.ut_varchar2_list;
- begin
- --Act
- ut3_tester_helper.run_helper.run(l_paths);
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).to_be_like( '%test_package_1%test_package_2%test_package_3%' );
- end;
-
- procedure run_proc_empty_path_list is
- l_results clob;
- begin
- --Act
- ut3_tester_helper.run_helper.run(ut3_develop.ut_varchar2_list());
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).to_be_like( '%test_package_1%test_package_2%test_package_3%' );
- end;
-
- procedure create_suite_with_commit is
- pragma autonomous_transaction;
- begin
- execute immediate 'create or replace package test_commit_warning is
- --%suite
- --%suitepath(ut.run.transaction)
-
- --%test
- procedure does_commit;
- end;';
- execute immediate 'create or replace package body test_commit_warning is
- procedure does_commit is
- begin
- ut3_develop.ut.expect(1).to_equal(1);
- commit;
- end;
- end;';
- end;
-
- procedure drop_suite_with_commit is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package test_commit_warning';
- end;
-
- procedure run_proc_warn_on_commit is
- l_results clob;
- begin
- ut3_develop.ut.run('test_commit_warning');
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- ut.expect(l_results).to_be_like(
- '%Unable to perform automatic rollback after test%'||
- 'An implicit or explicit commit/rollback occurred in procedures:%' ||
- 'does_commit%' ||
- 'Use the "--%rollback(manual)" annotation or remove commit/rollback/ddl statements that are causing the issue.%'
- );
- end;
-
- procedure create_failing_beforeall_suite is
- pragma autonomous_transaction;
- begin
- execute immediate 'create or replace package parent_suite is
- --%suite
- --%suitepath(ut.run.failing_setup)
-
- --%beforeall
- procedure failing_setup;
- end;';
- execute immediate 'create or replace package body parent_suite is
- procedure failing_setup is
- begin
- raise no_data_found;
- end;
- end;';
- execute immediate 'create or replace package child_suite is
- --%suite
- --%suitepath(ut.run.failing_setup.parent_suite.some_sub_suite)
-
- --%test
- procedure does_stuff;
- end;';
- execute immediate 'create or replace package body child_suite is
- procedure does_stuff is
- begin
- ut3_develop.ut.expect(1).to_equal(1);
- end;
- end;';
- end;
-
- procedure drop_failing_beforeall_suite is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package parent_suite';
- execute immediate 'drop package child_suite';
- end;
-
- procedure run_proc_fail_child_suites is
- l_results clob;
- begin
- ut3_develop.ut.run('child_suite');
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- ut.expect(l_results).to_be_like(
- '%1) does_stuff%' ||
- 'ORA-01403: no data found%' ||
- 'ORA-06512: at "UT3_USER.PARENT_SUITE%'
- );
- end;
-
- procedure transaction_setup is
- pragma autonomous_transaction;
- begin
- execute immediate 'create table transaction_test_table(message varchar2(100))';
- execute immediate 'create or replace package test_transaction is
- --%suite
-
- --%test
- procedure insert_row;
-
- --%test
- procedure insert_and_raise;
- end;
- ';
- execute immediate 'create or replace package body test_transaction is
- procedure insert_row is
- begin
- insert into transaction_test_table values (''2 - inside the test_transaction.insert_row test'');
- end;
- procedure insert_and_raise is
- begin
- insert into transaction_test_table values (''2 - inside the test_transaction.insert_row test'');
- raise no_data_found;
- end;
- end;
- ';
-
- end;
-
- procedure transaction_cleanup is
- pragma autonomous_transaction;
- begin
- begin
- execute immediate 'drop table transaction_test_table';
- exception
- when others then null;
- end;
- begin
- execute immediate 'drop package test_transaction';
- exception
- when others then null;
- end;
- end;
-
- procedure run_proc_keep_test_data is
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- l_results clob;
- begin
- --Arrange
- execute immediate '
- insert into transaction_test_table values (''1 - inside the test_ut_run.run_proc_keep_test_changes test'')';
-
- --Act
- ut3_develop.ut.run('test_transaction.insert_row', a_force_manual_rollback => true);
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
-
- --Assert
- open l_expected for
- select '1 - inside the test_ut_run.run_proc_keep_test_changes test' as message from dual
- union all
- select '2 - inside the test_transaction.insert_row test' from dual
- order by 1;
-
- open l_actual for 'select * from transaction_test_table order by 1';
-
- ut.expect( l_actual ).to_equal(l_expected);
- end;
-
- procedure run_proc_keep_test_data_raise is
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- l_results clob;
- begin
- --Arrange
- execute immediate '
- insert into transaction_test_table values (''1 - inside the test_ut_run.run_proc_keep_test_changes test'')';
-
- --Act
- ut3_develop.ut.run('test_transaction.insert_and_raise', a_force_manual_rollback => true);
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
-
- --Assert
- open l_expected for
- select '1 - inside the test_ut_run.run_proc_keep_test_changes test' as message from dual
- union all
- select '2 - inside the test_transaction.insert_row test' from dual
- order by 1;
-
- open l_actual for 'select * from transaction_test_table order by 1';
-
- ut.expect( l_actual ).to_equal(l_expected);
- end;
-
- procedure run_proc_discard_test_data is
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- l_results clob;
- begin
- --Arrange
- execute immediate '
- insert into transaction_test_table values (''1 - inside the test_ut_run.run_proc_keep_test_changes test'')';
-
- --Act
- ut3_develop.ut.run('test_transaction.insert_row');
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
-
- --Assert
- open l_expected for
- select '1 - inside the test_ut_run.run_proc_keep_test_changes test' as message from dual;
-
- open l_actual for 'select * from transaction_test_table order by 1';
-
- ut.expect( l_actual ).to_equal(l_expected);
- end;
-
- procedure run_func_no_params is
- l_results ut3_develop.ut_varchar2_list;
- begin
- l_results := ut3_tester_helper.run_helper.run();
- --Assert
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1%test_package_2%test_package_3%' );
- end;
-
- procedure run_func_specific_reporter is
- l_results ut3_develop.ut_varchar2_list;
- begin
- --Act
- l_results := ut3_tester_helper.run_helper.run(ut3_develop.ut_documentation_reporter());
- --Assert
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1%test_package_2%test_package_3%' );
- end;
-
- procedure run_func_cov_file_list is
- l_results ut3_develop.ut_varchar2_list;
- begin
- --Act
- select * bulk collect into l_results from table (
- ut3_develop.ut.run('ut3_tester_helper',
- ut3_develop.ut_sonar_test_reporter(),
- a_source_files => ut3_develop.ut_varchar2_list(),
- a_test_files => ut3_develop.ut_varchar2_list('tests/ut3_tester_helper.test_package_1.pkb',
- 'tests/ut3_tester_helper.test_package_2.pkb',
- 'tests/ut3_tester_helper.test_package_3.pkb')
- ));
- --Assert
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%tests/ut3_tester_helper.test_package_2.pkb%tests/ut3_tester_helper.test_package_1.pkb%tests/ut3_tester_helper.test_package_3.pkb%' );
- end;
-
- procedure run_func_pkg_name is
- l_results ut3_develop.ut_varchar2_list;
- begin
- select * bulk collect into l_results from table (ut3_develop.ut.run('ut3_tester_helper.test_package_1'));
- --Assert
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_2%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_3%' );
- end;
-
- procedure run_func_pkg_name_file_list is
- l_results ut3_develop.ut_varchar2_list;
- begin
- select * bulk collect into l_results from table (
- ut3_develop.ut.run('ut3_tester_helper.test_package_3',
- ut3_develop.ut_sonar_test_reporter(),
- a_source_files => ut3_develop.ut_varchar2_list(),
- a_test_files => ut3_develop.ut_varchar2_list('tests/ut3_tester_helper.test_package_1.pkb',
- 'tests/ut3_tester_helper.test_package_2.pkb',
- 'tests/ut3_tester_helper.test_package_3.pkb')
- ));
- --Assert
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%tests/ut3_tester_helper.test_package_3.pkb%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%tests/ut3_tester_helper.test_package_1.pkb%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%tests/ut3_tester_helper.test_package_2.pkb%' );
- end;
-
- procedure run_func_path_list is
- l_results ut3_develop.ut_varchar2_list;
- begin
- l_results := ut3_tester_helper.run_helper.run(ut3_develop.ut_varchar2_list(':tests.test_package_1',':tests'));
- --Assert
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_2%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_3%' );
- end;
-
- procedure run_func_path_list_file_list is
- l_results ut3_develop.ut_varchar2_list;
- begin
- l_results := ut3_tester_helper.run_helper.run(
- a_paths => ut3_develop.ut_varchar2_list(':tests.test_package_1',':tests'),
- a_reporter => ut3_develop.ut_sonar_test_reporter(),
- a_test_files => ut3_develop.ut_varchar2_list('tests/ut3_tester_helper.test_package_1.pkb',
- 'tests/ut3_tester_helper.test_package_2.pkb',
- 'tests/ut3_tester_helper.test_package_3.pkb')
- );
- --Assert
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%tests/ut3_tester_helper.test_package_1.pkb%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%tests/ut3_tester_helper.test_package_2.pkb%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%tests/ut3_tester_helper.test_package_3.pkb%' );
- end;
-
- procedure run_func_null_reporter is
- l_results ut3_develop.ut_varchar2_list;
- begin
- --Act
- select * bulk collect into l_results from table (ut3_develop.ut.run('ut3_tester_helper',cast(null as ut3_develop.ut_reporter_base)));
- --Assert
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%tests%test_package_1%test_package_2%tests2%test_package_3%' );
- end;
-
- procedure run_func_null_path is
- l_results ut3_develop.ut_varchar2_list;
- begin
- --Act
- l_results := ut3_tester_helper.run_helper.run(cast(null as varchar2));
- --Assert
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1%test_package_2%test_package_3%' );
- end;
-
- procedure run_func_null_path_list is
- l_results ut3_develop.ut_varchar2_list;
- l_paths ut3_develop.ut_varchar2_list;
- begin
- --Act
- l_results := ut3_tester_helper.run_helper.run(l_paths);
- --Assert
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1%test_package_2%test_package_3%' );
- end;
-
- procedure run_func_empty_path_list is
- l_results ut3_develop.ut_varchar2_list;
- begin
- --Act
- l_results := ut3_tester_helper.run_helper.run(ut3_develop.ut_varchar2_list());
- --Assert
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1%test_package_2%test_package_3%' );
- end;
-
- procedure run_func_cov_file_lst_null_rep is
- l_results ut3_develop.ut_varchar2_list;
- begin
- --Act
- l_results := ut3_tester_helper.run_helper.run(
- a_test_files => ut3_develop.ut_varchar2_list('tests/ut3_tester_helper.test_package_1.pkb',
- 'tests/ut3_tester_helper.test_package_2.pkb',
- 'tests/ut3_tester_helper.test_package_3.pkb'),
- a_reporter => cast(null as ut3_develop.ut_reporter_base));
- --Assert
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1%test_package_2%test_package_3%' );
- end;
-
- procedure run_func_empty_suite is
- l_results ut3_develop.ut_varchar2_list;
- l_expected varchar2(32767);
- pragma autonomous_transaction;
- begin
- --Arrange
- execute immediate q'[create or replace package empty_suite as
- -- %suite
-
- procedure not_a_test;
- end;]';
- execute immediate q'[create or replace package body empty_suite as
- procedure not_a_test is begin null; end;
- end;]';
- l_expected := '%empty_suite%0 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)%';
- --Act
- select * bulk collect into l_results from table(ut3_develop.ut.run('empty_suite'));
-
- --Assert
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( l_expected );
-
- --Cleanup
- execute immediate q'[drop package empty_suite]';
- end;
-
- procedure raise_in_invalid_state is
- l_results ut3_develop.ut_varchar2_list;
- l_expected varchar2(32767);
- begin
- --Arrange
- l_expected := 'test_state
- test_stateful
- failing_stateful_test [% sec] (FAILED - 1)%
-Failures:%
- 1) failing_stateful_test
- ORA-04068: existing state of packages (DB_LOOPBACK%) has been discarded
- ORA-04061: existing state of package body "%.STATEFUL_PACKAGE" has been invalidated
- ORA-04065: not executed, altered or dropped package body "%.STATEFUL_PACKAGE"%
- ORA-06512: at line 7%
-1 tests, 0 failed, 1 errored, 0 disabled, 0 warning(s)%';
-
- --Act
- select * bulk collect into l_results from table(ut3_develop.ut.run('ut3_tester_helper.test_stateful'));
-
- --Assert
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( l_expected );
- ut.fail('Expected exception but nothing was raised');
- exception
- when others then
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( l_expected );
- ut.expect(sqlcode).to_equal(-4068);
- end;
-
- procedure create_test_suite is
- begin
- ut3_tester_helper.run_helper.create_test_suite;
- end;
-
- procedure drop_test_suite is
- begin
- ut3_tester_helper.run_helper.drop_test_suite;
- end;
-
- procedure run_in_invalid_state is
- l_results ut3_develop.ut_varchar2_list;
- l_actual clob;
- l_expected varchar2(32767);
- begin
- select * bulk collect into l_results from table(ut3_develop.ut.run('failing_invalid_spec'));
-
- l_actual := ut3_tester_helper.main_helper.table_to_clob(l_results);
- ut.expect(l_actual).to_be_like('%Call params for % are not valid: package %FAILING_INVALID_SPEC% does not exist or is invalid.%');
-
- end;
-
- procedure compile_invalid_package is
- ex_compilation_error exception;
- pragma exception_init(ex_compilation_error,-24344);
- pragma autonomous_transaction;
- begin
- begin
- execute immediate q'[
- create or replace package failing_invalid_spec as
- --%suite
- gv_glob_val non_existing_table.id%type := 0;
-
- --%test
- procedure test1;
- end;]';
- exception when ex_compilation_error then null;
- end;
- begin
- execute immediate q'[
- create or replace package body failing_invalid_spec as
- procedure test1 is begin ut.expect(1).to_equal(1); end;
- end;]';
- exception when ex_compilation_error then null;
- end;
- end;
- procedure drop_invalid_package is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package failing_invalid_spec';
- end;
-
- procedure run_and_revalidate_specs is
- l_results ut3_develop.ut_varchar2_list;
- l_actual clob;
- l_is_invalid number;
- begin
- execute immediate q'[select count(1) from all_objects o where o.owner = :object_owner and o.object_type = 'PACKAGE'
- and o.status = 'INVALID' and o.object_name= :object_name]' into l_is_invalid
- using 'UT3_USER','INVALID_PCKAG_THAT_REVALIDATES';
-
- select * bulk collect into l_results from table(ut3_develop.ut.run('invalid_pckag_that_revalidates'));
-
- l_actual := ut3_tester_helper.main_helper.table_to_clob(l_results);
- ut.expect(1).to_equal(l_is_invalid);
- ut.expect(l_actual).to_be_like('%invalid_pckag_that_revalidates%invalidspecs [% sec]%
-%Finished in % seconds%
-%1 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)%');
-
- end;
-
- procedure generate_invalid_spec is
- ex_compilation_error exception;
- pragma exception_init(ex_compilation_error,-24344);
- pragma autonomous_transaction;
- begin
-
- execute immediate q'[
- create or replace package parent_specs as
- c_test constant varchar2(1) := 'Y';
- end;]';
-
- execute immediate q'[
- create or replace package invalid_pckag_that_revalidates as
- --%suite
- g_var varchar2(1) := parent_specs.c_test;
-
- --%test(invalidspecs)
- procedure test1;
- end;]';
-
- execute immediate q'[
- create or replace package body invalid_pckag_that_revalidates as
- procedure test1 is begin ut.expect('Y').to_equal(g_var); end;
- end;]';
-
- -- That should invalidate test package and we can then revers
- execute immediate q'[
- create or replace package parent_specs as
- c_test_error constant varchar2(1) := 'Y';
- end;]';
-
- execute immediate q'[
- create or replace package parent_specs as
- c_test constant varchar2(1) := 'Y';
- end;]';
-
- end;
- procedure drop_invalid_spec is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package invalid_pckag_that_revalidates';
- execute immediate 'drop package parent_specs';
- end;
-
- procedure run_and_report_warnings is
- l_results ut3_develop.ut_varchar2_list;
- l_actual clob;
- begin
-
- select * bulk collect into l_results from table(ut3_develop.ut.run('bad_annotations'));
- l_actual := ut3_tester_helper.main_helper.table_to_clob(l_results);
-
- ut.expect(l_actual).to_be_like('%Missing "--%endcontext" annotation for a "--%context" annotation. The end of package is considered end of context.%
-%1 tests, 0 failed, 0 errored, 0 disabled, 1 warning(s)%');
-
- end;
-
- procedure create_bad_annot is
- pragma autonomous_transaction;
- begin
- execute immediate q'[
- create or replace package bad_annotations as
- --%suite
-
- --%context
-
- --%test(invalidspecs)
- procedure test1;
-
- end;]';
-
- execute immediate q'[
- create or replace package body bad_annotations as
- procedure test1 is begin ut.expect(1).to_equal(1); end;
- end;]';
-
- end;
-
- procedure drop_bad_annot is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package bad_annotations';
- end;
-
- procedure create_suite_with_link is
- begin
- ut3_tester_helper.run_helper.create_suite_with_link;
- end;
-
- procedure drop_suite_with_link is
- begin
- ut3_tester_helper.run_helper.drop_suite_with_link;
- end;
-
- procedure savepoints_on_db_links is
- l_results clob;
- begin
- ut3_develop.ut.run('ut3_tester_helper.test_distributed_savepoint');
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- ut.expect(l_results).to_be_like('%1 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)%');
- end;
-
- procedure remove_time_from_results(a_results in out nocopy ut3_develop.ut_varchar2_list) is
- begin
- for i in 1 .. a_results.count loop
- a_results(i) := regexp_replace(a_results(i),'\[[0-9]*[\.,]?[0-9]+ sec\]','');
- a_results(i) := regexp_replace(a_results(i),'Finished in [0-9]*[\.,][0-9]+ seconds','');
- end loop;
- end;
-
- procedure run_schema_name_test is
- l_results ut3_develop.ut_varchar2_list;
- l_expected clob;
- begin
- select * bulk collect into l_results
- from table ( ut3_develop.ut.run( gc_owner||'.'||gc_owner ) );
- l_expected := '%1 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)%';
- ut.expect(ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( l_expected );
- end;
-
- procedure create_schema_name_package is
- pragma autonomous_transaction;
- begin
- execute immediate '
- create or replace package '||gc_owner||'.'||gc_owner||' as
- --%suite
-
- --%test
- procedure sample_test;
- end;';
-
- execute immediate '
- create or replace package body '||gc_owner||'.'||gc_owner||' as
- procedure sample_test is begin ut.expect(1).to_equal(1); end;
- end;';
-
- end;
-
- procedure drop_schema_name_package is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package '||gc_owner||'.'||gc_owner;
- end;
-
- procedure create_suites_with_path is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace package ut_abc is
- -- %suite
- -- %suitepath(main.abc)
-
- -- %test
- procedure ut_test_01;
- end ut_abc;]';
-
- execute immediate q'[create or replace package body ut_abc
- is
- procedure ut_test_01 as begin ut.expect(true).to_be_true(); end;
- end;]';
-
- execute immediate q'[create or replace package ut_abc_def
- is
- -- %suite
- -- %suitepath(main.abc_def)
-
- -- %test
- procedure ut_test_01;
- end ut_abc_def;]';
-
- execute immediate q'[create or replace package body ut_abc_def
- is
- procedure ut_test_01 as begin ut.expect(true).to_be_true(); end;
- end;]';
-
- end;
-
- procedure drop_suites_with_path is
- pragma autonomous_transaction;
- begin
- execute immediate q'[drop package ut_abc]';
- execute immediate q'[drop package ut_abc_def]';
- end;
-
- procedure run_suite_with_nls_sort is
- L_current_sort varchar2(2000);
- l_results ut3_develop.ut_varchar2_list;
- l_expected clob;
- begin
- --Arrange
- select value
- into l_current_sort
- from nls_session_parameters where parameter = 'NLS_SORT';
-
- execute immediate 'alter session set nls_sort=GERMAN';
-
- --Act
- select *
- bulk collect into l_results
- from table ( ut3_develop.ut.run( gc_owner||':main' ) );
- --Assert
- l_expected := q'[main%
- abc_def%
- ut_abc_def%
- ut_test_01%
- abc%
- ut_abc%
- ut_test_01%]';
- ut.expect(ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( l_expected );
-
- execute immediate 'alter session set nls_sort='||l_current_sort;
- end;
-
- procedure run_with_random_order is
- l_random_results ut3_develop.ut_varchar2_list;
- l_results ut3_develop.ut_varchar2_list;
- begin
- select * bulk collect into l_random_results
- from table ( ut3_develop.ut.run( 'ut3_tester_helper.test_package_1', a_random_test_order_seed => 123 ) )
- where trim(column_value) is not null and column_value not like 'Finished in %'
- and column_value not like '%Tests were executed with random order %';
-
- select * bulk collect into l_results
- from table ( ut3_develop.ut.run( 'ut3_tester_helper.test_package_1' ) )
- --TODO this condition should be removed once issues with unordered compare and 'blank text rows' are resolved.
- where trim(column_value) is not null and column_value not like 'Finished in %';
-
- remove_time_from_results(l_results);
- remove_time_from_results(l_random_results);
-
- ut.expect(anydata.convertCollection(l_random_results)).to_equal(anydata.convertCollection(l_results)).unordered();
- ut.expect(anydata.convertCollection(l_random_results)).not_to_equal(anydata.convertCollection(l_results));
- end;
-
- procedure run_and_report_random_ord_seed is
- l_actual ut3_develop.ut_varchar2_list;
- begin
- select * bulk collect into l_actual
- from table ( ut3_develop.ut.run( 'ut3_tester_helper.test_package_1', a_random_test_order_seed => 123456789 ) );
-
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_actual) ).to_be_like( q'[%Tests were executed with random order seed '123456789'.%]' );
- end;
-
- procedure run_with_random_order_seed is
- l_expected ut3_develop.ut_varchar2_list;
- l_actual ut3_develop.ut_varchar2_list;
- begin
-
- select * bulk collect into l_expected
- from table ( ut3_develop.ut.run( 'ut3_tester_helper.test_package_1', a_random_test_order_seed => 3 ) );
- select * bulk collect into l_actual
- from table ( ut3_develop.ut.run( 'ut3_tester_helper.test_package_1', a_random_test_order_seed => 3 ) );
-
- remove_time_from_results(l_actual);
- remove_time_from_results(l_expected);
- l_actual.delete(l_actual.count);
- l_expected.delete(l_expected.count);
-
- ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
- end;
-
- procedure run_proc_prints_support_info is
- begin
- ut3_develop.ut.run('ut3_tester_helper.test_package_1');
-
- ut.expect( ut3_tester_helper.main_helper.get_dbms_output_as_clob() ).to_be_like( '%' || reporters.gc_support_line || '%' );
- end;
-
- procedure run_proc_omits_support_info is
- begin
- ut3_develop.ut.run('ut3_tester_helper.test_package_1', a_support_info => false);
-
- ut.expect( ut3_tester_helper.main_helper.get_dbms_output_as_clob() ).not_to_be_like( '%' || reporters.gc_support_line || '%' );
- end;
-
- procedure run_func_prints_support_info is
- l_results ut3_develop.ut_varchar2_list;
- begin
- select * bulk collect into l_results
- from table ( ut3_develop.ut.run('ut3_tester_helper.test_package_1') );
-
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%' || reporters.gc_support_line || '%' );
- end;
-
- procedure run_func_omits_support_info is
- l_results ut3_develop.ut_varchar2_list;
- begin
- select * bulk collect into l_results
- from table ( ut3_develop.ut.run('ut3_tester_helper.test_package_1', a_support_info => 0) );
-
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%' || reporters.gc_support_line || '%' );
- end;
-
- procedure test_run_by_one_tag is
- l_results clob;
- begin
- ut3_tester_helper.run_helper.run(a_tags => 'suite1test1');
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).to_be_like( '%test_package_1%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_2%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_3%' );
- end;
-
- procedure suite_run_by_one_tag is
- l_results clob;
- begin
- ut3_tester_helper.run_helper.run(a_tags => 'suite2');
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).not_to_be_like( '%test_package_1.%executed%' );
- ut.expect( l_results ).to_be_like( '%test_package_1%' );
- ut.expect( l_results ).to_be_like( '%test_package_2%' );
- ut.expect( l_results ).to_be_like( '%test_package_2.%executed%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_3.%executed%' );
- end;
-
- procedure two_test_run_by_one_tag is
- l_results clob;
- begin
- ut3_tester_helper.run_helper.run(a_tags => 'test2');
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).not_to_be_like( '%test_package_1.%executed%' );
- ut.expect( l_results ).to_be_like( '%test_package_1%' );
- ut.expect( l_results ).to_be_like( '%test_package_2%' );
- ut.expect( l_results ).to_be_like( '%test_package_2.%executed%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_3.%executed%' );
- end;
-
- procedure all_suites_run_by_one_tag is
- l_results clob;
- begin
- ut3_tester_helper.run_helper.run(a_tags => 'helper');
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).to_be_like( '%test_package_1%' );
- ut.expect( l_results ).to_be_like( '%test_package_2%' );
- ut.expect( l_results ).to_be_like( '%test_package_3%' );
- end;
-
- procedure two_test_run_by_two_tags is
- l_results clob;
- begin
- ut3_tester_helper.run_helper.run(a_tags => 'subtest1|subtest2');
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).to_be_like( '%test_package_1%' );
- ut.expect( l_results ).to_be_like( '%test_package_2%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_1.test2%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_2.test2%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_3%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_3%' );
- end;
-
- procedure two_test_run_by_two_tags_leg is
- l_results clob;
- begin
- ut3_tester_helper.run_helper.run(a_tags => 'subtest1,subtest2');
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).to_be_like( '%test_package_1%' );
- ut.expect( l_results ).to_be_like( '%test_package_2%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_1.test2%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_2.test2%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_3%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_3%' );
- end;
-
- procedure suite_with_children_tag is
- l_results clob;
- begin
- ut3_tester_helper.run_helper.run(a_tags => 'suite1');
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).to_be_like( '%test_package_1%' );
- ut.expect( l_results ).to_be_like( '%test_package_2%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_3%' );
- end;
-
- procedure suite_with_tag_parent is
- l_results clob;
- begin
- ut3_tester_helper.run_helper.run(a_tags => 'suite2');
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).to_be_like( '%test_package_1%' );
- ut.expect( l_results ).to_be_like( '%test_package_2%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_3%' );
- end;
-
- procedure test_nonexists_tag is
- l_results clob;
- l_exp_message varchar2(4000);
- begin
- ut3_tester_helper.run_helper.run(a_tags => 'nonexisting');
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- ut.expect( l_results ).not_to_be_like( '%test_package_1%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_2%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_3%' );
- end;
-
- procedure test_duplicate_tag is
- l_results clob;
- begin
- ut3_tester_helper.run_helper.run(a_tags => 'suite1test1,suite1test1');
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).to_be_like( '%test_package_1%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_2%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_3%' );
- end;
-
- procedure suite_duplicate_tag is
- l_results clob;
- begin
- ut3_tester_helper.run_helper.run(a_tags => 'suite1,suite1');
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).to_be_like( '%test_package_1%' );
- ut.expect( l_results ).to_be_like( '%test_package_2%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_3%' );
- end;
-
- procedure run_proc_pkg_name_tag is
- l_results clob;
- begin
- ut3_develop.ut.run('ut3_tester_helper.test_package_1',a_tags => 'suite1test1');
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).to_be_like( '%test_package_1%' );
- ut.expect( l_results ).to_be_like( '%test_package_1.test1%executed%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_1.test2%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_2%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_3%' );
- end;
-
- procedure run_pkg_name_file_list_tag is
- l_results clob;
- begin
- ut3_develop.ut.run('ut3_tester_helper.test_package_1',a_tags => 'suite1test1');
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).to_be_like( '%test_package_1%' );
- ut.expect( l_results ).to_be_like( '%test_package_1.test1%executed%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_1.test2%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_2%' );
- ut.expect( l_results ).not_to_be_like( '%test_package_3%' );
- end;
-
- procedure run_proc_path_list_tag is
- l_results clob;
- begin
- ut3_develop.ut.run(
- 'ut3_tester_helper.test_package_1',
- ut3_develop.ut_sonar_test_reporter(), a_source_files => ut3_develop.ut_varchar2_list(),a_tags => 'suite1',
- a_test_files => ut3_develop.ut_varchar2_list('tests/ut3_tester_helper.test_package_1.pkb',
- 'tests/ut3_tester_helper.test_package_2.pkb',
- 'tests/ut3_tester_helper.test_package_3.pkb')
- );
- l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
- --Assert
- ut.expect( l_results ).to_be_like( '%tests/ut3_tester_helper.test_package_1.pkb%' );
- ut.expect( l_results ).not_to_be_like( '%tests/ut3_tester_helper.test_package_2.pkb%' );
- ut.expect( l_results ).not_to_be_like( '%tests/ut3_tester_helper.test_package_3.pkb%' );
- end;
-
- procedure tag_run_func_no_params is
- l_results ut3_develop.ut_varchar2_list;
- begin
- l_results := ut3_tester_helper.run_helper.run(a_tags => 'helper');
- --Assert
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1%test_package_2%test_package_3%' );
- end;
-
- procedure tag_run_func_pkg_name is
- l_results ut3_develop.ut_varchar2_list;
- begin
- select * bulk collect into l_results from table (ut3_develop.ut.run('ut3_tester_helper.test_package_1', a_tags => 'suite1test1'));
- --Assert
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1.test1%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_1.test2%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_2%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_3%' );
- end;
-
- procedure tag_run_func_path_list is
- l_results ut3_develop.ut_varchar2_list;
- begin
- l_results := ut3_tester_helper.run_helper.run(ut3_develop.ut_varchar2_list(':tests.test_package_1',':tests'),a_tags => 'suite1test1|suite2test1');
- --Assert
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_2%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1.test1%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_1.test2%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_2.test1%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_2.test2%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_3%' );
- end;
-
- procedure tag_run_func_path_list_leg is
- l_results ut3_develop.ut_varchar2_list;
- begin
- l_results := ut3_tester_helper.run_helper.run(ut3_develop.ut_varchar2_list(':tests.test_package_1',':tests'),a_tags => 'suite1test1,suite2test1');
- --Assert
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_2%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1.test1%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_1.test2%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_2.test1%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_2.test2%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_3%' );
- end;
-
- procedure tag_inc_exc_run_func_path_list is
- l_results ut3_develop.ut_varchar2_list;
- begin
- l_results := ut3_tester_helper.run_helper.run(ut3_develop.ut_varchar2_list(':tests.test_package_1',':tests'),a_tags => '(suite1test1|suite2test1)&!suite2');
- --Assert
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_2%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1.test1%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_1.test2%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_3%' );
- end;
-
- procedure tag_inc_exc_run_fun_pth_lst_lg is
- l_results ut3_develop.ut_varchar2_list;
- begin
- l_results := ut3_tester_helper.run_helper.run(ut3_develop.ut_varchar2_list(':tests.test_package_1',':tests'),a_tags => 'suite1test1,suite2test1,-suite2');
- --Assert
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_2%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1.test1%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_1.test2%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_3%' );
- end;
-
- procedure tag_exclude_run_func_path_list is
- l_results ut3_develop.ut_varchar2_list;
- begin
- l_results := ut3_tester_helper.run_helper.run(ut3_develop.ut_varchar2_list(':tests,:tests2'),a_tags => '!suite1test2&!suite2test1&!test1suite3');
- --Assert
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_2%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_3%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1.test1%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_1.test2%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_2.test1%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_2.test2%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_3.test1%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_3.test2%executed%' );
- end;
-
-procedure tag_exclude_run_fun_pth_lst_lg is
- l_results ut3_develop.ut_varchar2_list;
- begin
- l_results := ut3_tester_helper.run_helper.run(ut3_develop.ut_varchar2_list(':tests,:tests2'),a_tags => '-suite1test2,-suite2test1,-test1suite3');
- --Assert
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_2%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_3%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1.test1%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_1.test2%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_2.test1%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_2.test2%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_3.test1%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_3.test2%executed%' );
- end;
-
- procedure tag_include_exclude_run_func is
- l_results ut3_develop.ut_varchar2_list;
- begin
- l_results := ut3_tester_helper.run_helper.run(a_tags => '(suite1)&(!suite1test2&!suite2test1&!test1suite3)');
- --Assert
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_2%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_3%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1.test1%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_1.test2%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_2.test1%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_2.test2%executed%' );
- end;
-
- procedure tag_include_exclude_run_fun_lg is
- l_results ut3_develop.ut_varchar2_list;
- begin
- l_results := ut3_tester_helper.run_helper.run(a_tags => 'suite1,-suite1test2,-suite2test1,-test1suite3');
- --Assert
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_2%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_3%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1.test1%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_1.test2%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_2.test1%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_2.test2%executed%' );
- end;
-
- procedure tag_complex_expressions is
- l_results ut3_develop.ut_varchar2_list;
- begin
- l_results := ut3_tester_helper.run_helper.run(a_tags => 'release_3_1_13&(fast|simple)');
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_tag_pkg_3.test5 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_tag_pkg_3.test6 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_1.test1%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_1.test2%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_2.test3%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_2.test4%executed%' );
-
- l_results := ut3_tester_helper.run_helper.run(a_tags => 'release_3_1_13&(!patch_3_1_13&!patch_3_1_14)');
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_tag_pkg_1.test1 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_1.test2%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_2.test3%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_2.test4%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_3.test5%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_3.test6%executed%' );
-
- l_results := ut3_tester_helper.run_helper.run(a_tags => 'release_3_1_13&(patch_3_1_13&!slow)');
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_tag_pkg_3.test5 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_1.test1%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_1.test2%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_2.test3%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_2.test4%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_3.test6%executed%' );
-
- l_results := ut3_tester_helper.run_helper.run(a_tags => '(simple&end_to_end)|(development&fast)');
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_tag_pkg_1.test1 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_tag_pkg_2.test3 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_tag_pkg_3.test5 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_tag_pkg_3.test6 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_1.test2%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_2.test4%executed%' );
-
- l_results := ut3_tester_helper.run_helper.run(a_tags => '(!development&end_to_end)');
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_tag_pkg_3.test5 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_1.test1%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_1.test2%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_2.test3%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_2.test4%executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_3.test6%executed%' );
-
- l_results := ut3_tester_helper.run_helper.run(a_tags => 'any');
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%suite2_level1_pkg.test1_level1 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%suite2_level1_pkg.test2_level1 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%suite1_level1_pkg.test1_level1 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%suite2_2_level2_pkg.suite2_2_test1_level2 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%suite2_2_level2_pkg.suite2_2_test2_level2 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%suite1_2_level2_pkg.suite1_2_test1_level2 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%suite1_2_level2_pkg.suite1_2_test2_level1 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%suite1_1_level2_pkg.suite1_1_test1_level2 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%suite1_level1_pkg.test2_level1 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%suite1_1_level2_pkg.suite1_1_test2_level2 executed%' );
-
- l_results := ut3_tester_helper.run_helper.run(a_tags => 'none');
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%suite1_level1_pkg.test2_level1 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%suite1_1_level2_pkg.suite1_1_test2_level2 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%suite2_level1_pkg.test1_level1 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%suite2_level1_pkg.test2_level1 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%suite1_level1_pkg.test1_level1 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%suite2_2_level2_pkg.suite2_2_test1_level2 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%suite2_2_level2_pkg.suite2_2_test2_level2 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%suite1_2_level2_pkg.suite1_2_test1_level2 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%suite1_2_level2_pkg.suite1_2_test2_level1 executed%' );
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%suite1_1_level2_pkg.suite1_1_test1_level2 executed%' );
-
-
- end;
-
- procedure invalid_tag_expression is
- l_results ut3_develop.ut_varchar2_list;
- begin
- l_results := ut3_tester_helper.run_helper.run(a_tags => '(!development!&end_to_end)');
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_match('^\s*invalid_tag_expression \[[,\.0-9]+ sec\]\s*$','m');
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like('%(FAILED -%');
-
- l_results := ut3_tester_helper.run_helper.run(a_tags => '(!development&&end_to_end)');
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_match('^\s*invalid_tag_expression \[[,\.0-9]+ sec\]\s*$','m');
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like('%(FAILED -%');
-
- l_results := ut3_tester_helper.run_helper.run(a_tags => '(!development&end_to_end|)');
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_match('^\s*invalid_tag_expression \[[,\.0-9]+ sec\]\s*$','m');
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like('%(FAILED -%');
-
- l_results := ut3_tester_helper.run_helper.run(a_tags => '(!development&!!end_to_end)');
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_match('^\s*invalid_tag_expression \[[,\.0-9]+ sec\]\s*$','m');
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like('%(FAILED -%');
-
- l_results := ut3_tester_helper.run_helper.run(a_tags => '(&development&end_to_end)');
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_match('^\s*invalid_tag_expression \[[,\.0-9]+ sec\]\s*$','m');
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like('%(FAILED -%');
-
- l_results := ut3_tester_helper.run_helper.run(a_tags => '(development|end_to_end))');
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_match('^\s*invalid_tag_expression \[[,\.0-9]+ sec\]\s*$','m');
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like('%(FAILED -%');
-
- end;
-
- procedure invalid_tag_expression_no_tests is
- l_results ut3_develop.ut_varchar2_list;
- begin
- --the package does not exist, so no test is there to evaluate the tag expression on
- l_results := ut3_tester_helper.run_helper.run('ut3_tester_helper.no_such_test_package', a_tags => '(development|end_to_end))');
- end;
-
- procedure tag_run_pkg_wildcard is
- l_results clob;
- begin
- --test_tag_pkg_3 has no test tagged fast
- l_results := ut3_tester_helper.main_helper.table_to_clob(
- ut3_tester_helper.run_helper.run('ut3_tester_helper.test_tag_pkg_*', a_tags => 'fast')
- );
- --Assert
- ut.expect( l_results ).to_be_like( '%test_tag_pkg_1.test1 executed%' );
- ut.expect( l_results ).to_be_like( '%test_tag_pkg_2.test3 executed%' );
- ut.expect( l_results ).not_to_be_like( '%test_tag_pkg_1.test2 executed%' );
- ut.expect( l_results ).not_to_be_like( '%test_tag_pkg_2.test4 executed%' );
- ut.expect( l_results ).not_to_be_like( '%test_tag_pkg_3%' );
- end;
-
- procedure tag_run_proc_wildcard is
- l_results clob;
- begin
- --test_tag_pkg_1.test2 is not tagged fast
- l_results := ut3_tester_helper.main_helper.table_to_clob(
- ut3_tester_helper.run_helper.run('ut3_tester_helper.test_tag_pkg_1.test*', a_tags => 'fast')
- );
- --Assert
- ut.expect( l_results ).to_be_like( '%test_tag_pkg_1.test1 executed%' );
- ut.expect( l_results ).not_to_be_like( '%test_tag_pkg_1.test2 executed%' );
- ut.expect( l_results ).not_to_be_like( '%test_tag_pkg_2%' );
- ut.expect( l_results ).not_to_be_like( '%test_tag_pkg_3%' );
- end;
-
- procedure tag_run_suitepath_wildcard is
- l_results clob;
- begin
- --suitepath suite3 (test_tag_pkg_3) has no test tagged fast
- l_results := ut3_tester_helper.main_helper.table_to_clob(
- ut3_tester_helper.run_helper.run('ut3_tester_helper:suite*', a_tags => 'fast')
- );
- --Assert
- ut.expect( l_results ).to_be_like( '%test_tag_pkg_1.test1 executed%' );
- ut.expect( l_results ).to_be_like( '%test_tag_pkg_2.test3 executed%' );
- ut.expect( l_results ).not_to_be_like( '%test_tag_pkg_1.test2 executed%' );
- ut.expect( l_results ).not_to_be_like( '%test_tag_pkg_2.test4 executed%' );
- ut.expect( l_results ).not_to_be_like( '%test_tag_pkg_3%' );
- end;
-
- procedure tag_run_wildcard_none_left is
- l_results ut3_develop.ut_varchar2_list;
- begin
- l_results := ut3_tester_helper.run_helper.run('ut3_tester_helper.test_tag_pkg_*', a_tags => 'nonexisting');
- ut.fail('Expected exception ORA-20204 was not raised');
- exception
- when others then
- ut.expect(sqlerrm).to_be_like('%ORA-20204: Suite package ut3_tester_helper.test_tag_pkg_* does not exist%');
- end;
-
- procedure blank_tags_run_all_tests is
- l_expected ut3_develop.ut_varchar2_list;
- l_actual ut3_develop.ut_varchar2_list;
- begin
- l_expected := ut3_tester_helper.run_helper.run(ut3_develop.ut_varchar2_list(':tests,:tests2'));
- l_actual := ut3_tester_helper.run_helper.run(ut3_develop.ut_varchar2_list(':tests,:tests2'), a_tags => ' '||chr(9)||' ');
-
- remove_time_from_results(l_expected);
- remove_time_from_results(l_actual);
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_actual) ).to_be_like( '%test_package_1.test1%executed%' );
- ut.expect( anydata.convertCollection(l_actual) ).to_equal( anydata.convertCollection(l_expected) );
- end;
-
- procedure set_application_info is
- begin
- dbms_application_info.set_module( gc_module, gc_action );
- dbms_application_info.set_client_info( gc_client_info );
- end;
-
- procedure create_context_test_suite is
- pragma autonomous_transaction;
- begin
- execute immediate q'[
- create or replace package check_context is
- --%suite(Suite description)
- --%suitepath(some.suite.path)
-
- --%beforeall
- procedure before_suite;
-
- --%context(context description)
- --%name(some_context)
-
- --%beforeall
- procedure before_context;
-
- --%beforeeach
- procedure before_each_test;
-
- --%test(Some test description)
- --%beforetest(before_test)
- --%aftertest(after_test)
- procedure the_test;
- procedure before_test;
- procedure after_test;
-
- --%aftereach
- procedure after_each_test;
-
- --%afterall
- procedure after_context;
-
- --%endcontext
-
-
- --%afterall
- procedure after_suite;
-
- end;]';
- execute immediate q'[
- create or replace package body check_context is
-
- procedure print_context( a_procedure_name varchar2 ) is
- l_results ut_varchar2_rows;
- l_module varchar2(32767);
- l_action varchar2(32767);
- l_client_info varchar2(32767);
- begin
- select attribute||'='||value
- bulk collect into l_results
- from session_context where namespace = 'UT3_DEVELOP_INFO'
- order by attribute;
- for i in 1 .. l_results.count loop
- dbms_output.put_line( upper(a_procedure_name) ||':'|| l_results(i) );
- end loop;
- dbms_application_info.read_module( l_module, l_action );
- dbms_application_info.read_client_info( l_client_info );
-
- dbms_output.put_line( 'APPLICATION_INFO:MODULE=' || l_module );
- dbms_output.put_line( 'APPLICATION_INFO:ACTION=' || l_action );
- dbms_output.put_line( 'APPLICATION_INFO:CLIENT_INFO=' || l_client_info );
- end;
-
- procedure before_suite is
- begin
- print_context('before_suite');
- end;
-
- procedure before_context is
- begin
- print_context('before_context');
- end;
-
- procedure before_each_test is
- begin
- print_context('before_each_test');
- end;
-
- procedure the_test is
- begin
- print_context('the_test');
- end;
-
- procedure before_test is
- begin
- print_context('before_test');
- end;
-
- procedure after_test is
- begin
- print_context('after_test');
- end;
-
- procedure after_each_test is
- begin
- print_context('after_each_test');
- end;
-
- procedure after_context is
- begin
- print_context('after_context');
- end;
-
- procedure after_suite is
- begin
- print_context('after_suite');
- end;
-
- end;]';
- end;
-
- procedure drop_context_test_suite is
- pragma autonomous_transaction;
- begin
- execute immediate q'[drop package check_context]';
- end;
-
- procedure run_context_test_suite is
- l_lines ut3_develop.ut_varchar2_list;
- begin
- select * bulk collect into l_lines from table(ut3_develop.ut.run('check_context'));
- g_context_test_results := ut3_tester_helper.main_helper.table_to_clob(l_lines);
- g_timestamp := current_timestamp;
- end;
-
-
- procedure sys_ctx_on_suite_beforeall is
- begin
- ut.expect(g_context_test_results).to_be_like(
- '%BEFORE_SUITE:COVERAGE_RUN_ID=________________________________%'
- ||'%BEFORE_SUITE:CURRENT_EXECUTABLE_NAME='||gc_owner||'.check_context.before_suite'
- ||'%BEFORE_SUITE:CURRENT_EXECUTABLE_TYPE=beforeall'
- ||'%BEFORE_SUITE:RUN_PATHS=check_context'
- ||'%BEFORE_SUITE:SUITE_DESCRIPTION=Suite description'
- ||'%BEFORE_SUITE:SUITE_PACKAGE='||gc_owner||'.check_context'
- ||'%BEFORE_SUITE:SUITE_PATH=some.suite.path.check_context'
- ||'%BEFORE_SUITE:SUITE_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
- ||'%APPLICATION_INFO:MODULE=utPLSQL'
- ||'%APPLICATION_INFO:ACTION=check_context'
- ||'%APPLICATION_INFO:CLIENT_INFO=before_suite%'
- );
- ut.expect(g_context_test_results).not_to_be_like('%BEFORE_SUITE:CONTEXT_%');
- ut.expect(g_context_test_results).not_to_be_like('%BEFORE_SUITE:TEST_%');
- end;
-
- procedure sys_ctx_on_context_beforeall is
- begin
- ut.expect(g_context_test_results).to_be_like(
- '%BEFORE_CONTEXT:CONTEXT_DESCRIPTION=context description'
- ||'%BEFORE_CONTEXT:CONTEXT_NAME=some_context'
- ||'%BEFORE_CONTEXT:CONTEXT_PATH=some.suite.path.check_context.some_context'
- ||'%BEFORE_CONTEXT:CONTEXT_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
- ||'%BEFORE_CONTEXT:CURRENT_EXECUTABLE_NAME='||gc_owner||'.check_context.before_context'
- ||'%BEFORE_CONTEXT:CURRENT_EXECUTABLE_TYPE=beforeall'
- ||'%BEFORE_CONTEXT:RUN_PATHS=check_context'
- ||'%BEFORE_CONTEXT:SUITE_DESCRIPTION=Suite description'
- ||'%BEFORE_CONTEXT:SUITE_PACKAGE='||gc_owner||'.check_context'
- ||'%BEFORE_CONTEXT:SUITE_PATH=some.suite.path.check_context'
- ||'%BEFORE_CONTEXT:SUITE_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
- ||'%APPLICATION_INFO:MODULE=utPLSQL'
- ||'%APPLICATION_INFO:ACTION=check_context'
- ||'%APPLICATION_INFO:CLIENT_INFO=before_context%'
- );
- ut.expect(g_context_test_results).not_to_be_like('%BEFORE_CONTEXT:TEST_%');
- end;
-
- procedure sys_ctx_on_beforeeach is
- begin
- ut.expect(g_context_test_results).to_be_like(
- '%BEFORE_EACH_TEST:CONTEXT_DESCRIPTION=context description'
- ||'%BEFORE_EACH_TEST:CONTEXT_NAME=some_context'
- ||'%BEFORE_EACH_TEST:CONTEXT_PATH=some.suite.path.check_context.some_context'
- ||'%BEFORE_EACH_TEST:CONTEXT_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
- ||'%BEFORE_EACH_TEST:CURRENT_EXECUTABLE_NAME='||gc_owner||'.check_context.before_each_test'
- ||'%BEFORE_EACH_TEST:CURRENT_EXECUTABLE_TYPE=beforeeach'
- ||'%BEFORE_EACH_TEST:RUN_PATHS=check_context'
- ||'%BEFORE_EACH_TEST:SUITE_DESCRIPTION=Suite description'
- ||'%BEFORE_EACH_TEST:SUITE_PACKAGE='||gc_owner||'.check_context'
- ||'%BEFORE_EACH_TEST:SUITE_PATH=some.suite.path.check_context'
- ||'%BEFORE_EACH_TEST:SUITE_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
- ||'%BEFORE_EACH_TEST:TEST_DESCRIPTION=Some test description'
- ||'%BEFORE_EACH_TEST:TEST_NAME='||gc_owner||'.check_context.the_test'
- ||'%BEFORE_EACH_TEST:TEST_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
- ||'%APPLICATION_INFO:MODULE=utPLSQL'
- ||'%APPLICATION_INFO:ACTION=check_context'
- ||'%APPLICATION_INFO:CLIENT_INFO=before_each_test%'
- );
- end;
-
- procedure sys_ctx_on_beforetest is
- begin
- ut.expect(g_context_test_results).to_be_like(
- '%BEFORE_TEST:CONTEXT_DESCRIPTION=context description'
- ||'%BEFORE_TEST:CONTEXT_NAME=some_context'
- ||'%BEFORE_TEST:CONTEXT_PATH=some.suite.path.check_context.some_context'
- ||'%BEFORE_TEST:CONTEXT_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
- ||'%BEFORE_TEST:CURRENT_EXECUTABLE_NAME='||gc_owner||'.check_context.before_test'
- ||'%BEFORE_TEST:CURRENT_EXECUTABLE_TYPE=beforetest'
- ||'%BEFORE_TEST:RUN_PATHS=check_context'
- ||'%BEFORE_TEST:SUITE_DESCRIPTION=Suite description'
- ||'%BEFORE_TEST:SUITE_PACKAGE='||gc_owner||'.check_context'
- ||'%BEFORE_TEST:SUITE_PATH=some.suite.path.check_context'
- ||'%BEFORE_TEST:SUITE_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
- ||'%BEFORE_TEST:TEST_DESCRIPTION=Some test description'
- ||'%BEFORE_TEST:TEST_NAME='||gc_owner||'.check_context.the_test'
- ||'%BEFORE_TEST:TEST_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
- ||'%APPLICATION_INFO:MODULE=utPLSQL'
- ||'%APPLICATION_INFO:ACTION=check_context'
- ||'%APPLICATION_INFO:CLIENT_INFO=before_test%'
- );
- end;
-
- procedure sys_ctx_on_test is
- begin
- ut.expect(g_context_test_results).to_be_like(
- '%THE_TEST:CONTEXT_DESCRIPTION=context description'
- ||'%THE_TEST:CONTEXT_NAME=some_context'
- ||'%THE_TEST:CONTEXT_PATH=some.suite.path.check_context.some_context'
- ||'%THE_TEST:CONTEXT_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
- ||'%THE_TEST:CURRENT_EXECUTABLE_NAME='||gc_owner||'.check_context.the_test'
- ||'%THE_TEST:CURRENT_EXECUTABLE_TYPE=test'
- ||'%THE_TEST:RUN_PATHS=check_context'
- ||'%THE_TEST:SUITE_DESCRIPTION=Suite description'
- ||'%THE_TEST:SUITE_PACKAGE='||gc_owner||'.check_context'
- ||'%THE_TEST:SUITE_PATH=some.suite.path.check_context'
- ||'%THE_TEST:SUITE_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
- ||'%THE_TEST:TEST_DESCRIPTION=Some test description'
- ||'%THE_TEST:TEST_NAME='||gc_owner||'.check_context.the_test'
- ||'%THE_TEST:TEST_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
- ||'%APPLICATION_INFO:MODULE=utPLSQL'
- ||'%APPLICATION_INFO:ACTION=check_context'
- ||'%APPLICATION_INFO:CLIENT_INFO=the_test%'
- );
- end;
-
- procedure sys_ctx_on_aftertest is
- begin
- ut.expect(g_context_test_results).to_be_like(
- '%AFTER_TEST:CONTEXT_DESCRIPTION=context description'
- ||'%AFTER_TEST:CONTEXT_NAME=some_context'
- ||'%AFTER_TEST:CONTEXT_PATH=some.suite.path.check_context.some_context'
- ||'%AFTER_TEST:CONTEXT_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
- ||'%AFTER_TEST:CURRENT_EXECUTABLE_NAME='||gc_owner||'.check_context.after_test'
- ||'%AFTER_TEST:CURRENT_EXECUTABLE_TYPE=aftertest'
- ||'%AFTER_TEST:RUN_PATHS=check_context'
- ||'%AFTER_TEST:SUITE_DESCRIPTION=Suite description'
- ||'%AFTER_TEST:SUITE_PACKAGE='||gc_owner||'.check_context'
- ||'%AFTER_TEST:SUITE_PATH=some.suite.path.check_context'
- ||'%AFTER_TEST:SUITE_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
- ||'%AFTER_TEST:TEST_DESCRIPTION=Some test description'
- ||'%AFTER_TEST:TEST_NAME='||gc_owner||'.check_context.the_test'
- ||'%AFTER_TEST:TEST_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
- ||'%APPLICATION_INFO:MODULE=utPLSQL'
- ||'%APPLICATION_INFO:ACTION=check_context'
- ||'%APPLICATION_INFO:CLIENT_INFO=after_test%'
- );
- end;
-
- procedure sys_ctx_on_aftereach is
- begin
- ut.expect(g_context_test_results).to_be_like(
- '%AFTER_EACH_TEST:CONTEXT_DESCRIPTION=context description'
- ||'%AFTER_EACH_TEST:CONTEXT_NAME=some_context'
- ||'%AFTER_EACH_TEST:CONTEXT_PATH=some.suite.path.check_context.some_context'
- ||'%AFTER_EACH_TEST:CONTEXT_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
- ||'%AFTER_EACH_TEST:CURRENT_EXECUTABLE_NAME='||gc_owner||'.check_context.after_each_test'
- ||'%AFTER_EACH_TEST:CURRENT_EXECUTABLE_TYPE=aftereach'
- ||'%AFTER_EACH_TEST:RUN_PATHS=check_context'
- ||'%AFTER_EACH_TEST:SUITE_DESCRIPTION=Suite description'
- ||'%AFTER_EACH_TEST:SUITE_PACKAGE='||gc_owner||'.check_context'
- ||'%AFTER_EACH_TEST:SUITE_PATH=some.suite.path.check_context'
- ||'%AFTER_EACH_TEST:SUITE_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
- ||'%AFTER_EACH_TEST:TEST_DESCRIPTION=Some test description'
- ||'%AFTER_EACH_TEST:TEST_NAME='||gc_owner||'.check_context.the_test'
- ||'%AFTER_EACH_TEST:TEST_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
- ||'%APPLICATION_INFO:MODULE=utPLSQL'
- ||'%APPLICATION_INFO:ACTION=check_context'
- ||'%APPLICATION_INFO:CLIENT_INFO=after_each_test%'
- );
- end;
-
- procedure sys_ctx_on_context_afterall is
- begin
- ut.expect(g_context_test_results).to_be_like(
- '%AFTER_CONTEXT:CONTEXT_DESCRIPTION=context description'
- ||'%AFTER_CONTEXT:CONTEXT_NAME=some_context'
- ||'%AFTER_CONTEXT:CONTEXT_PATH=some.suite.path.check_context.some_context'
- ||'%AFTER_CONTEXT:CONTEXT_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
- ||'%AFTER_CONTEXT:CURRENT_EXECUTABLE_NAME='||gc_owner||'.check_context.after_context'
- ||'%AFTER_CONTEXT:CURRENT_EXECUTABLE_TYPE=afterall'
- ||'%AFTER_CONTEXT:RUN_PATHS=check_context'
- ||'%AFTER_CONTEXT:SUITE_DESCRIPTION=Suite description'
- ||'%AFTER_CONTEXT:SUITE_PACKAGE='||gc_owner||'.check_context'
- ||'%AFTER_CONTEXT:SUITE_PATH=some.suite.path.check_context'
- ||'%AFTER_CONTEXT:SUITE_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
- ||'%APPLICATION_INFO:MODULE=utPLSQL'
- ||'%APPLICATION_INFO:ACTION=check_context'
- ||'%APPLICATION_INFO:CLIENT_INFO=after_context%'
- );
- ut.expect(g_context_test_results).not_to_be_like('%AFTER_CONTEXT:TEST_%');
- end;
-
- procedure sys_ctx_on_suite_afterall is
- begin
- ut.expect(g_context_test_results).to_be_like(
- '%AFTER_SUITE:CURRENT_EXECUTABLE_NAME='||gc_owner||'.check_context.after_suite'
- ||'%AFTER_SUITE:CURRENT_EXECUTABLE_TYPE=afterall'
- ||'%AFTER_SUITE:RUN_PATHS=check_context'
- ||'%AFTER_SUITE:SUITE_DESCRIPTION=Suite description'
- ||'%AFTER_SUITE:SUITE_PACKAGE='||gc_owner||'.check_context'
- ||'%AFTER_SUITE:SUITE_PATH=some.suite.path.check_context'
- ||'%AFTER_SUITE:SUITE_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
- ||'%APPLICATION_INFO:MODULE=utPLSQL'
- ||'%APPLICATION_INFO:ACTION=check_context'
- ||'%APPLICATION_INFO:CLIENT_INFO=after_suite%'
- );
- ut.expect(g_context_test_results).not_to_be_like('%AFTER_SUITE:CONTEXT_%');
- ut.expect(g_context_test_results).not_to_be_like('%AFTER_SUITE:TEST_%');
- end;
-
- procedure sys_ctx_clear_after_run is
- l_actual sys_refcursor;
- begin
- open l_actual for
- select attribute||'='||value
- from session_context where namespace = 'UT3_DEVELOP_INFO';
-
- ut.expect(l_actual).to_be_empty();
- end;
-
- procedure app_info_restore_after_run is
- l_module varchar2(32767);
- l_action varchar2(32767);
- l_client_info varchar2(32767);
- begin
- dbms_application_info.read_module( l_module, l_action );
- dbms_application_info.read_client_info( l_client_info );
-
- ut.expect(l_module).to_equal(gc_module);
- ut.expect(l_action).to_equal(gc_action);
- --Disabled as it can't be tested.
- --UT3_LATEST_RELEASE is also setting the client_info on each procedure
- -- ut.expect(l_client_info).to_equal(gc_client_info);
- end;
-
-end;
-/
diff --git a/test/ut3_user/api/test_ut_run.pks b/test/ut3_user/api/test_ut_run.pks
deleted file mode 100644
index 552c5dbf3..000000000
--- a/test/ut3_user/api/test_ut_run.pks
+++ /dev/null
@@ -1,373 +0,0 @@
-create or replace package test_ut_run is
- --%suite(ut.run)
- --%suitepath(utplsql.test_user.api)
-
- procedure clear_expectations;
-
- procedure create_ut3_user_tests;
- procedure drop_ut3_user_tests;
-
- --%test(ut.version() returns version of the framework)
- procedure ut_version;
-
- --%test(ut.fail() marks test as failed)
- --%beforetest(ut3_tester_helper.main_helper.set_ut_run_context)
- --%aftertest(clear_expectations, ut3_tester_helper.main_helper.clear_ut_run_context)
- procedure ut_fail;
-
- --%context(ut_run_procedure)
- --%displayname(ut.run() procedure options)
- --%beforeall(create_ut3_user_tests)
- --%afterall(drop_ut3_user_tests)
-
- --%test(Runs all tests in current schema with default reporter when no parameters given)
- procedure run_proc_no_params;
- --%test(Runs all tests in current schema with specified reporter)
- procedure run_proc_specific_reporter;
- --%test(Runs all tests in current schema with coverage file list)
- procedure run_proc_cov_file_list;
-
- --%test(Runs given package only with package name given as path)
- procedure run_proc_pkg_name;
- --%test(Runs all from given package with package name given as path and coverage file list)
- procedure run_proc_pkg_name_file_list;
- --%test(Runs tests from given paths only with paths list)
- procedure run_proc_path_list;
- --%test(Runs tests from given paths only with paths list and coverage file list)
- procedure run_proc_path_list_file_list;
- --%test(Runs all tests in current schema using default reporter when null reporter given)
- procedure run_proc_null_reporter;
- --%test(Runs all tests in current schema with null path provided)
- procedure run_proc_null_path;
- --%test(Runs all tests in current schema with null path list given)
- procedure run_proc_null_path_list;
- --%test(Runs all tests in current schema with empty path list given)
- procedure run_proc_empty_path_list;
-
- procedure create_suite_with_commit;
- procedure drop_suite_with_commit;
- --%test(Reports a warning if transaction was invalidated by test with automatic rollback)
- --%beforetest(create_suite_with_commit)
- --%aftertest(drop_suite_with_commit)
- procedure run_proc_warn_on_commit;
-
-
- procedure create_failing_beforeall_suite;
- procedure drop_failing_beforeall_suite;
- --%test(Marks child suite as failed when parent's suite beforeall fails)
- --%beforetest(create_failing_beforeall_suite)
- --%aftertest(drop_failing_beforeall_suite)
- procedure run_proc_fail_child_suites;
-
- procedure create_suite_with_link;
- procedure drop_suite_with_link;
-
- --%test(Savepoints are working properly on distributed transactions - Issue #839)
- --%beforetest(create_suite_with_link)
- --%aftertest(drop_suite_with_link)
- procedure savepoints_on_db_links;
-
- --%endcontext
-
- --%context(run_proc_transaction_control)
-
- --%beforeall
- procedure transaction_setup;
- --%afterall
- procedure transaction_cleanup;
- --%test(Leaves transaction open and uncommitted with a_force_manual_rollback)
- procedure run_proc_keep_test_data;
- --%test(Leaves transaction open and uncommitted with a_force_manual_rollback with exceptions)
- procedure run_proc_keep_test_data_raise;
- --%test(Does not impact current transaction when ran without a_force_manual_rollback)
- procedure run_proc_discard_test_data;
-
- --%endcontext
-
-
- --%context(ut_run_function)
-
- --%displayname(ut.run() function options)
- --%beforeall(create_ut3_user_tests)
- --%afterall(drop_ut3_user_tests)
-
- --%test(Runs all tests in current schema with default reporter when no parameters given)
- procedure run_func_no_params;
- --%test(Runs all tests in current schema with specified reporter)
- procedure run_func_specific_reporter;
- --%test(Runs all tests in current schema with coverage file list)
- procedure run_func_cov_file_list;
-
- --%test(Runs given package only with package name given as path)
- procedure run_func_pkg_name;
- --%test(Runs all from given package with package name given as path and coverage file list)
- procedure run_func_pkg_name_file_list;
- --%test(Runs tests from given paths with paths list)
- procedure run_func_path_list;
- --%test(Runs tests from given paths with paths list and coverage file list)
- procedure run_func_path_list_file_list;
- --%test(Runs all tests in current schema using default reporter when null reporter given)
- procedure run_func_null_reporter;
- --%test(Runs all tests in current schema with null path provided)
- procedure run_func_null_path;
- --%test(Runs all tests in current schema with null path list given)
- procedure run_func_null_path_list;
- --%test(Runs all tests in current schema with empty path list given)
- procedure run_func_empty_path_list;
- --%test(Runs all tests in current schema with coverage file list and default reporter)
- procedure run_func_cov_file_lst_null_rep;
- --%test(Executes successfully an empty suite)
- procedure run_func_empty_suite;
-
- --disabled(Makes session wait for lock on 18.1 due to library cache pin wait)
- --%test(ut.run - raises after completing all tests if a test fails with ORA-04068 or ORA-04061)
- --%beforetest(create_test_suite)
- --%aftertest(drop_test_suite)
- procedure raise_in_invalid_state;
- procedure create_test_suite;
- procedure drop_test_suite;
-
- --%test(ut.run - Does not execute suite when specified package is not valid)
- --%beforetest(compile_invalid_package)
- --%aftertest(drop_invalid_package)
- procedure run_in_invalid_state;
- procedure compile_invalid_package;
- procedure drop_invalid_package;
-
- --%test(Invalidate package specs via rebuild but still execute package)
- --%beforetest(generate_invalid_spec)
- --%aftertest(drop_invalid_spec)
- procedure run_and_revalidate_specs;
- procedure generate_invalid_spec;
- procedure drop_invalid_spec;
-
- --%test(Provides warnings on invalid annotations)
- --%beforetest(create_bad_annot)
- --%aftertest(drop_bad_annot)
- procedure run_and_report_warnings;
- procedure create_bad_annot;
- procedure drop_bad_annot;
-
- --%test(Can run test package that is named the same as schema name)
- --%beforetest(create_schema_name_package)
- --%aftertest(drop_schema_name_package)
- procedure run_schema_name_test;
- procedure create_schema_name_package;
- procedure drop_schema_name_package;
-
- --%test(Runs properly formed suite hierarchy regardless of NLS_SORT settings - Issue #1060)
- --%beforetest(create_suites_with_path)
- --%aftertest(drop_suites_with_path)
- procedure run_suite_with_nls_sort;
- procedure create_suites_with_path;
- procedure drop_suites_with_path;
-
- --%endcontext
-
- --%context(random_order)
-
- --%displayname(Random test execution order)
- --%beforeall(create_ut3_user_tests)
- --%afterall(drop_ut3_user_tests)
-
- --%test(Runs tests in random order)
- procedure run_with_random_order;
-
- --%test(Reports test random_test_order_seed)
- procedure run_and_report_random_ord_seed;
-
- --%test(Runs tests in the same random order with provided seed)
- procedure run_with_random_order_seed;
-
- --%endcontext
-
- --%context(support_info)
-
- --%displayname(Support line)
- --%beforeall(create_ut3_user_tests)
- --%afterall(drop_ut3_user_tests)
-
- --%test(ut.run() procedure prints support line by default)
- procedure run_proc_prints_support_info;
-
- --%test(ut.run() procedure omits support line when a_support_info is false)
- procedure run_proc_omits_support_info;
-
- --%test(ut.run() function prints support line by default)
- procedure run_func_prints_support_info;
-
- --%test(ut.run() function omits support line when a_support_info is 0)
- procedure run_func_omits_support_info;
-
- --%endcontext
-
- --%context(run with paths in several schemas)
-
- --%beforeall(create_ut3_user_tests, create_test_suite_in_ut3_user)
- --%afterall(drop_test_suite_in_ut3_user, drop_ut3_user_tests)
-
- --%test(Runs the suites of each schema together, in order of schema names)
- procedure run_groups_suites_by_schema;
-
- --%endcontext
-
- procedure create_test_suite_in_ut3_user;
- procedure drop_test_suite_in_ut3_user;
-
- --%context(run with tags)
- --%displayname(Call ut.run with #tags)
-
- --%beforeall(create_ut3_user_tests)
- --%afterall(drop_ut3_user_tests)
-
- --%test(Execute test by tag ut_run)
- procedure test_run_by_one_tag;
-
- --%test( Execute suite by one tag)
- procedure suite_run_by_one_tag;
-
- --%test(Execute two tests by one tag)
- procedure two_test_run_by_one_tag;
-
- --%test(Execute all suites tests with tag)
- procedure all_suites_run_by_one_tag;
-
- --%test(Execute tests by passing two tags)
- procedure two_test_run_by_two_tags;
-
- --%test(Execute tests by passing two tags - Legacy notation)
- procedure two_test_run_by_two_tags_leg;
-
- --%test(Execute suite and all of its children)
- procedure suite_with_children_tag;
-
- --%test(Execute suite and parents)
- procedure suite_with_tag_parent;
-
- --%test(Execute test for non existing tag)
- procedure test_nonexists_tag;
-
- --%test(Execute test for duplicate list tags)
- procedure test_duplicate_tag;
-
- --%test(Execute suite test for duplicate list tags)
- procedure suite_duplicate_tag;
-
- --%test(Runs given package only with package name given as path and filter by tag)
- procedure run_proc_pkg_name_tag;
-
- --%test(Runs all from given package with package name given as path and coverage file list with tag)
- procedure run_pkg_name_file_list_tag;
-
- --%test(Runs tests from given paths with paths list and tag)
- procedure run_proc_path_list_tag;
-
- --%test(Runs all tests in current schema with default reporter when only tag is given)
- procedure tag_run_func_no_params;
-
- --%test(Runs given package only with package name given as path and filter by tag)
- procedure tag_run_func_pkg_name;
-
- --%test(Runs tests from given paths with paths list and a tag)
- procedure tag_run_func_path_list;
-
- --%test(Runs tests from given paths with paths list and a tag - Legacy Notation)
- procedure tag_run_func_path_list_leg;
-
- --%test(Runs tests from given paths with paths list and include/exclude tags)
- procedure tag_inc_exc_run_func_path_list;
-
- --%test(Runs tests from given paths with paths list and include/exclude tags - Legacy Notation)
- procedure tag_inc_exc_run_fun_pth_lst_lg;
-
- --%test(Runs tests from given path and excludes specific tags)
- procedure tag_exclude_run_func_path_list;
-
- --%test(Runs tests from given path and excludes specific tags - Legacy Notation)
- procedure tag_exclude_run_fun_pth_lst_lg;
-
- --%test(Runs tests from given tags and exclude tags)
- procedure tag_include_exclude_run_func;
-
- --%test(Runs tests from given tags and exclude tags - Legacy Notation)
- procedure tag_include_exclude_run_fun_lg;
-
- --%test(Runs tests suing complex expressions)
- procedure tag_complex_expressions;
-
- --%test(Testing invalid tag expression)
- --%throws(-20219)
- procedure invalid_tag_expression;
-
- --%test(Raises an error for an invalid tag expression when the path selects no tests)
- --%throws(-20219)
- procedure invalid_tag_expression_no_tests;
-
- --%test(Runs tests matching the tags from packages selected by a wildcard, skipping packages without such tests)
- procedure tag_run_pkg_wildcard;
-
- --%test(Runs tests matching the tags from tests selected by a wildcard, skipping the other tests)
- procedure tag_run_proc_wildcard;
-
- --%test(Runs tests matching the tags from suitepaths selected by a wildcard, skipping suites without such tests)
- procedure tag_run_suitepath_wildcard;
-
- --%test(Raises an error naming the wildcard path when the tags exclude all tests it selects)
- procedure tag_run_wildcard_none_left;
-
- --%test(Runs the same tests as without tags when the tag expression is made of spaces and tabs)
- procedure blank_tags_run_all_tests;
-
- --%endcontext
-
- --%context(ut3_info context)
-
- --%beforeall
- procedure set_application_info;
- --%beforeall
- procedure create_context_test_suite;
-
- --%beforeall
- procedure run_context_test_suite;
-
- --%afterall
- procedure drop_context_test_suite;
-
- --%test(sets context for suite level beforeall)
- procedure sys_ctx_on_suite_beforeall;
-
- --%test(sets context for context level beforeall)
- procedure sys_ctx_on_context_beforeall;
-
- --%test(set for context level beforeeach)
- procedure sys_ctx_on_beforeeach;
-
- --%test(set for context level beforetest)
- procedure sys_ctx_on_beforetest;
-
- --%test(set for context level test)
- procedure sys_ctx_on_test;
-
- --%test(set for context level aftertest)
- procedure sys_ctx_on_aftertest;
-
- --%test(set for context level aftereach)
- procedure sys_ctx_on_aftereach;
-
- --%test(set for context level afterall)
- procedure sys_ctx_on_context_afterall;
-
- --%test(set for suite level afterall)
- procedure sys_ctx_on_suite_afterall;
-
- --%test(is cleared after run)
- procedure sys_ctx_clear_after_run;
-
- --%test(application info is restored after run)
- procedure app_info_restore_after_run;
-
- --%endcontext
-
-end;
-/
-
diff --git a/test/ut3_user/api/test_ut_runner.pkb b/test/ut3_user/api/test_ut_runner.pkb
deleted file mode 100644
index 9ef709e91..000000000
--- a/test/ut3_user/api/test_ut_runner.pkb
+++ /dev/null
@@ -1,736 +0,0 @@
-create or replace package body test_ut_runner is
-
- procedure setup_cache_objects is
- begin
- ut3_tester_helper.run_helper.setup_cache_objects();
- end;
-
- procedure setup_cache_objectstag is
- begin
- ut3_tester_helper.run_helper.setup_cache_objectstag();
- end;
-
- procedure setup_cache_twotags is
- begin
- ut3_tester_helper.run_helper.setup_cache_twotags();
- end;
-
- procedure setup_cache is
- begin
- ut3_tester_helper.run_helper.setup_cache();
- end;
-
- procedure cleanup_cache is
- begin
- ut3_tester_helper.run_helper.cleanup_cache();
- end;
-
- procedure setup_cache_context_disabled is
- begin
- ut3_tester_helper.run_helper.setup_cache_context_disabled();
- end;
-
- procedure create_test_spec
- as
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace package test_cache as
- --%suite
-
- --%test
- procedure failing_test;
-end;
-]';
- end;
-
- procedure create_test_body(a_number integer)
- as
- pragma autonomous_transaction;
- begin
- execute immediate 'create or replace package body test_cache as
- procedure failing_test is
- begin
- ut3_develop.ut.expect('||a_number||').to_be_null;
- end;
-end;';
- end;
-
- procedure drop_test_package
- as
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package test_cache';
- end;
-
-
-
- procedure keep_an_open_transaction is
- l_expected varchar2(300);
- l_output_data dbms_output.chararr;
- l_num_lines integer := 100000;
- begin
- --Arrange
- create_test_spec();
- create_test_body(0);
- l_expected := dbms_transaction.local_transaction_id(true);
- --Act
- ut3_develop.ut.run('test_cache');
- dbms_output.get_lines( l_output_data, l_num_lines);
- --Assert
- ut.expect(dbms_transaction.local_transaction_id()).to_equal(l_expected);
- drop_test_package();
- end;
-
- procedure close_newly_opened_transaction is
- l_output_data dbms_output.chararr;
- l_num_lines integer := 100000;
- pragma autonomous_transaction;
- begin
- --Arrange
- create_test_spec();
- create_test_body(0);
- rollback;
- --Act
- ut3_develop.ut.run('test_cache');
- dbms_output.get_lines( l_output_data, l_num_lines);
- --Assert
- ut.expect(dbms_transaction.local_transaction_id()).to_be_null();
- drop_test_package();
- end;
-
- procedure version_comp_check_compare is
- begin
- ut.expect( ut3_develop.ut_runner.version_compatibility_check('v3.0.0.0','v3.0.0.0') ).to_equal(1);
- ut.expect( ut3_develop.ut_runner.version_compatibility_check('v3.0.0.0','v3.0.123.0') ).to_equal(1);
- ut.expect( ut3_develop.ut_runner.version_compatibility_check('v3.0.0.0','v3.123.0.0') ).to_equal(1);
- ut.expect( ut3_develop.ut_runner.version_compatibility_check('v3.0.0.0','v3.13.31.0') ).to_equal(1);
- ut.expect( ut3_develop.ut_runner.version_compatibility_check('v3.0.1.0','v3.0.0.0') ).to_equal(0);
- ut.expect( ut3_develop.ut_runner.version_compatibility_check('v3.1.0.0','v3.0.0.0') ).to_equal(0);
- ut.expect( ut3_develop.ut_runner.version_compatibility_check('v3.0.0.0','v2.0.0.0') ).to_equal(0);
- ut.expect( ut3_develop.ut_runner.version_compatibility_check('v3.0.0.0','v4.0.0.0') ).to_equal(0);
- end;
-
- procedure version_comp_check_ignore is
- begin
- ut.expect( ut3_develop.ut_runner.version_compatibility_check('v3.0.0.123','v3.0.0.0') ).to_equal(1);
- ut.expect( ut3_develop.ut_runner.version_compatibility_check('v3.0.0.0','v3.0.0.123') ).to_equal(1);
- ut.expect( ut3_develop.ut_runner.version_compatibility_check('v3.0.0','v3.0.0.0') ).to_equal(1);
- end;
-
- procedure version_comp_check_short is
- begin
- ut.expect( ut3_develop.ut_runner.version_compatibility_check('v3.0.0','v3.0.0.0') ).to_equal(1);
- ut.expect( ut3_develop.ut_runner.version_compatibility_check('v3.0','v3.0.123.0') ).to_equal(1);
- ut.expect( ut3_develop.ut_runner.version_compatibility_check('v3','v3.123.0.0') ).to_equal(1);
- end;
-
- procedure version_comp_check_exception is
- procedure throws(a_requested varchar2, a_current varchar2) is
- l_compatible integer;
- begin
- l_compatible := ut3_develop.ut_runner.version_compatibility_check(a_requested,a_current);
- ut.fail('Expected exception but nothing was raised');
- exception
- when others then
- ut.expect(sqlcode).to_equal(-20214);
- end;
- begin
- throws('bad_ver','v3.0.0.0');
- throws('v3.0.0.0','bad_ver');
- end;
-
- procedure run_reset_package_body_cache is
- l_results ut3_develop.ut_varchar2_list;
- l_expected clob;
- l_actual clob;
- begin
- --Arrange
- create_test_spec();
- create_test_body(0);
- select *
- bulk collect into l_results
- from table(ut3_develop.ut.run('test_cache'));
-
- --Act
- create_test_body(1);
- select *
- bulk collect into l_results
- from table(ut3_develop.ut.run('test_cache'));
- --Assert
- l_actual := ut3_tester_helper.main_helper.table_to_clob(l_results);
- l_expected := '%ut3_develop.ut.expect(1).to_be_null;%';
- ut.expect(l_actual).to_be_like(l_expected);
- drop_test_package();
- end;
-
- procedure run_keep_dbms_output_buffer is
- l_expected dbmsoutput_linesarray;
- l_actual dbmsoutput_linesarray;
- l_results ut3_develop.ut_varchar2_list;
- l_lines number := 10000;
- begin
- --Arrange
- create_test_spec();
- create_test_body(0);
-
- l_expected := dbmsoutput_linesarray(
- 'A text placed into DBMS_OUTPUT',
- 'Another line',
- lpad('A very long line',10000,'a')
- );
- for i in 1 .. 300 loop
- l_expected.extend;
- l_expected(l_expected.last) := 'line '||i;
- end loop;
-
- for i in 1 .. l_expected.count loop
- dbms_output.put_line(l_expected(i));
- end loop;
-
- --Act
- select *
- bulk collect into l_results
- from table(ut3_develop.ut.run('test_cache'));
-
- --Assert
- dbms_output.get_lines(lines => l_actual, numlines => l_lines);
- for i in 1 .. l_lines loop
- ut.expect(l_actual(i)).to_equal(l_expected(i));
- end loop;
- drop_test_package();
- end;
-
- procedure test_purge_cache_schema_type is
- l_actual sys_refcursor;
- begin
- --Arrange
- l_actual := ut3_tester_helper.run_helper.get_annotation_cache_info_cur(
- a_owner => sys_context('USERENV', 'CURRENT_USER'),
- a_type => 'PROCEDURE'
- );
-
- ut.expect(l_actual).not_to_be_empty();
-
- --Act
- ut3_develop.ut_runner.purge_cache(sys_context('USERENV', 'CURRENT_USER'),'PROCEDURE');
-
- --Assert
-
- l_actual := ut3_tester_helper.run_helper.get_annotation_cache_info_cur(
- a_owner => sys_context('USERENV', 'CURRENT_USER'),
- a_type => 'PROCEDURE'
- );
- --Cache purged for object owner/type
- ut.expect(l_actual).to_be_empty();
-
- l_actual := ut3_tester_helper.run_helper.get_annotation_cache_info_cur(
- a_owner => sys_context('USERENV', 'CURRENT_USER'),
- a_type => 'PACKAGE'
- );
- --Cache not purged for other types
- ut.expect(l_actual).not_to_be_empty();
-
- l_actual := ut3_tester_helper.run_helper.get_annotation_cache_info_cur(
- a_owner => 'UT3_TESTER_HELPER',
- a_type => 'PROCEDURE'
- );
- --Cache not purged for other owners
- ut.expect(l_actual).not_to_be_empty();
-
- end;
-
- procedure test_rebuild_cache_schema_type is
- l_actual sys_refcursor;
- begin
- --Act
- ut3_develop.ut_runner.rebuild_annotation_cache( sys_context('USERENV', 'CURRENT_USER'), 'PACKAGE' );
- --Assert
- l_actual := ut3_tester_helper.run_helper.get_annotation_cache_cursor(
- a_owner => sys_context('USERENV', 'CURRENT_USER'),
- a_type => 'PACKAGE',
- a_name => 'DUMMY_TEST_PACKAGE'
- );
-
- --Rebuild cache for sys_context('USERENV', 'CURRENT_USER')/packages
- ut.expect(l_actual).to_have_count(4);
-
- l_actual := ut3_tester_helper.run_helper.get_annotation_cache_cursor(
- a_owner => sys_context('USERENV', 'CURRENT_USER'),
- a_type => 'PACKAGE'
- );
-
- --Did not rebuild cache for ut3_develop/procedures
- ut.expect(l_actual).to_have_count(0);
- end;
-
- procedure test_get_suites_info_notag is
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_expected for
- select
- 'UT3_USER' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'DUMMY_TEST_PACKAGE' item_name,
- 'dummy_test_suite' item_description, 'UT_SUITE' item_type, 2 item_line_no,
- 'some.path.dummy_test_package' path, 0 disabled_flag, null disabled_reason,null tags
- from dual union all
- select
- 'UT3_USER' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'SOME_DUMMY_TEST_PROCEDURE' item_name,
- 'dummy_test' item_description, 'UT_TEST' item_type, 6 item_line_no,
- 'some.path.dummy_test_package.some_dummy_test_procedure' path, 0 disabled_flag, null disabled_reason,null tags
- from dual union all
- select
- 'UT3_USER' object_owner, 'PATH' object_name, 'PATH' item_name,
- null item_description, 'UT_LOGICAL_SUITE' item_type, null item_line_no,
- 'some.path' path, 0 disabled_flag, null disabled_reason, null tags
- from dual union all
- select
- 'UT3_USER' object_owner, 'SOME' object_name, 'SOME' item_name,
- null item_description, 'UT_LOGICAL_SUITE' item_type, null item_line_no,
- 'some' path, 0 disabled_flag, null disabled_reason, null tags
- from dual;
- --Act
- open l_actual for select * from table(ut3_develop.ut_runner.get_suites_info('UT3_USER','DUMMY_TEST_PACKAGE'));
- --Assert
- ut.expect(l_actual).to_equal(l_expected);
- end;
-
- procedure test_get_suites_info_tag is
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_expected for
- select
- 'UT3_USER' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'DUMMY_TEST_PACKAGE' item_name,
- 'dummy_test_suite' item_description, 'UT_SUITE' item_type, 2 item_line_no,
- 'some.path.dummy_test_package' path, 0 disabled_flag, null disabled_reason,'dummy' tags
- from dual union all
- select
- 'UT3_USER' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'SOME_DUMMY_TEST_PROCEDURE' item_name,
- 'dummy_test' item_description, 'UT_TEST' item_type, 7 item_line_no,
- 'some.path.dummy_test_package.some_dummy_test_procedure' path, 0 disabled_flag, null disabled_reason,'testtag' tags
- from dual union all
- select
- 'UT3_USER' object_owner, 'PATH' object_name, 'PATH' item_name,
- null item_description, 'UT_LOGICAL_SUITE' item_type, null item_line_no,
- 'some.path' path, 0 disabled_flag, null disabled_reason, null tags
- from dual union all
- select
- 'UT3_USER' object_owner, 'SOME' object_name, 'SOME' item_name,
- null item_description, 'UT_LOGICAL_SUITE' item_type, null item_line_no,
- 'some' path, 0 disabled_flag, null disabled_reason, null tags
- from dual;
- --Act
- open l_actual for select * from table(ut3_develop.ut_runner.get_suites_info('UT3_USER','DUMMY_TEST_PACKAGE'));
- --Assert
- ut.expect(l_actual).to_equal(l_expected);
- end;
-
- procedure test_get_suites_info_twotag is
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_expected for
- select
- 'UT3_USER' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'DUMMY_TEST_PACKAGE' item_name,
- 'dummy_test_suite' item_description, 'UT_SUITE' item_type, 2 item_line_no,
- 'dummy_test_package' path, 0 disabled_flag, null disabled_reason,'suitetag1,suitetag2' tags
- from dual union all
- select
- 'UT3_USER' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'SOME_DUMMY_TEST_PROCEDURE' item_name,
- 'dummy_test' item_description, 'UT_TEST' item_type, 6 item_line_no,
- 'dummy_test_package.some_dummy_test_procedure' path, 0 disabled_flag, null disabled_reason,'testtag1,testtag2' tags
- from dual;
- --Act
- open l_actual for select * from table(ut3_develop.ut_runner.get_suites_info('UT3_USER','DUMMY_TEST_PACKAGE'));
- --Assert
- ut.expect(l_actual).to_equal(l_expected);
- end;
-
- procedure test_get_suites_info_by_path is
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_expected for
- select
- 'UT3_USER' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'DUMMY_TEST_PACKAGE' item_name,
- 'dummy_test_suite' item_description, 'UT_SUITE' item_type, 2 item_line_no,
- 'some.path.dummy_test_package' path, 0 disabled_flag, null disabled_reason,null tags
- from dual union all
- select
- 'UT3_USER' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'SOME_DUMMY_TEST_PROCEDURE' item_name,
- 'dummy_test' item_description, 'UT_TEST' item_type, 6 item_line_no,
- 'some.path.dummy_test_package.some_dummy_test_procedure' path, 0 disabled_flag, null disabled_reason,null tags
- from dual union all
- select
- 'UT3_USER' object_owner, 'PATH' object_name, 'PATH' item_name,
- null item_description, 'UT_LOGICAL_SUITE' item_type, null item_line_no,
- 'some.path' path, 0 disabled_flag, null disabled_reason, null tags
- from dual union all
- select
- 'UT3_USER' object_owner, 'SOME' object_name, 'SOME' item_name,
- null item_description, 'UT_LOGICAL_SUITE' item_type, null item_line_no,
- 'some' path, 0 disabled_flag, null disabled_reason, null tags
- from dual;
- --Act
- open l_actual for select * from table(ut3_develop.ut_runner.get_suites_info('ut3_user:some.path.dummy_test_package'));
- --Assert
- ut.expect(l_actual).to_equal(l_expected);
- end;
-
- procedure test_get_suites_info_context is
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_expected for
- select
- 'UT3_USER' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'DUMMY_TEST_PACKAGE' item_name,
- 'dummy_test_suite' item_description, 'UT_SUITE' item_type, 2 item_line_no,
- 'some.path.dummy_test_package' path, 0 disabled_flag, null disabled_reason, null tags
- from dual union all
- select
- 'UT3_USER' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'SOME_DUMMY_TEST_PROCEDURE' item_name,
- 'dummy_test' item_description, 'UT_TEST' item_type, 5 item_line_no,
- 'some.path.dummy_test_package.some_dummy_test_procedure' path, 0 disabled_flag, null disabled_reason, null tags
- from dual union all
- select
- 'UT3_USER' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'NESTED_CONTEXT_#1' item_name,
- 'dummy_context' item_description, 'UT_SUITE_CONTEXT' item_type, 8 item_line_no,
- 'some.path.dummy_test_package.nested_context_#1' path, 0 disabled_flag, null disabled_reason, null tags
- from dual union all
- select
- 'UT3_USER' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'DISABLED_TEST_PROCEDURE' item_name,
- 'disabled_test' item_description, 'UT_TEST' item_type, 10 item_line_no,
- 'some.path.dummy_test_package.nested_context_#1.disabled_test_procedure' path, 1 disabled_flag, 'not ready' disabled_reason, null tags
- from dual union all
- select
- 'UT3_USER' object_owner, 'PATH' object_name, 'PATH' item_name,
- null item_description, 'UT_LOGICAL_SUITE' item_type, null item_line_no,
- 'some.path' path, 0 disabled_flag, null disabled_reason, null tags
- from dual union all
- select
- 'UT3_USER' object_owner, 'SOME' object_name, 'SOME' item_name,
- null item_description, 'UT_LOGICAL_SUITE' item_type, null item_line_no,
- 'some' path, 0 disabled_flag, null disabled_reason, null tags
- from dual;
- --Act
- open l_actual for select * from table(ut3_develop.ut_runner.get_suites_info('UT3_USER','DUMMY_TEST_PACKAGE'));
- --Assert
- ut.expect(l_actual).to_equal(l_expected);
- end;
-
- procedure test_get_suites_info_by_proc is
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_expected for
- select
- 'UT3_USER' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'DUMMY_TEST_PACKAGE' item_name,
- 'dummy_test_suite' item_description, 'UT_SUITE' item_type, 2 item_line_no,
- 'some.path.dummy_test_package' path, 0 disabled_flag, null disabled_reason, null tags
- from dual union all
- select
- 'UT3_USER' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'SOME_DUMMY_TEST_PROCEDURE' item_name,
- 'dummy_test' item_description, 'UT_TEST' item_type, 6 item_line_no,
- 'some.path.dummy_test_package.some_dummy_test_procedure' path, 0 disabled_flag, null disabled_reason, null tags
- from dual union all
- select
- 'UT3_USER' object_owner, 'PATH' object_name, 'PATH' item_name,
- null item_description, 'UT_LOGICAL_SUITE' item_type, null item_line_no,
- 'some.path' path, 0 disabled_flag, null disabled_reason, null tags
- from dual union all
- select
- 'UT3_USER' object_owner, 'SOME' object_name, 'SOME' item_name,
- null item_description, 'UT_LOGICAL_SUITE' item_type, null item_line_no,
- 'some' path, 0 disabled_flag, null disabled_reason, null tags
- from dual;
- --Act
- open l_actual for select * from table(ut3_develop.ut_runner.get_suites_info('ut3_user.dummy_test_package.some_dummy_test_procedure'));
- --Assert
- ut.expect(l_actual).to_equal(l_expected);
- end;
-
- procedure test_get_reporters_list is
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_expected for
- select 'UT3_DEVELOP.UT_COVERAGE_COBERTURA_REPORTER' reporter_object_name, 'Y' is_output_reporter from dual union all
- select 'UT3_DEVELOP.UT_DEBUG_REPORTER', 'Y' from dual union all
- select 'UT3_DEVELOP.UT_COVERAGE_HTML_REPORTER', 'Y' from dual union all
- select 'UT3_DEVELOP.UT_COVERAGE_SONAR_REPORTER', 'Y' from dual union all
- select 'UT3_DEVELOP.UT_DOCUMENTATION_REPORTER', 'Y' from dual union all
- select 'UT3_DEVELOP.UT_JUNIT_REPORTER', 'Y' from dual union all
- select 'UT3_DEVELOP.UT_REALTIME_REPORTER', 'Y' from dual union all
- select 'UT3_DEVELOP.UT_SONAR_TEST_REPORTER', 'Y' from dual union all
- select 'UT3_DEVELOP.UT_TEAMCITY_REPORTER', 'Y' from dual union all
- select 'UT3_DEVELOP.UT_TFS_JUNIT_REPORTER', 'Y' from dual union all
- select 'UT3_DEVELOP.UT_XUNIT_REPORTER', 'Y' from dual union all
- select 'UT3_DEVELOP.UT_TAP_REPORTER', 'Y' from dual
- order by 1;
- --Act
- open l_actual for select * from table(ut3_develop.ut_runner.GET_REPORTERS_LIST()) order by 1;
- --Assert
- ut.expect(l_actual).to_equal(l_expected);
- end;
-
- procedure db_link_cleanup is
- pragma autonomous_transaction;
- begin
- ut3_tester_helper.run_helper.db_link_cleanup();
- end;
-
- procedure db_link_setup is
- pragma autonomous_transaction;
- begin
- ut3_tester_helper.run_helper.db_link_setup();
- end;
-
- procedure raises_20213_on_fail_link is
- l_reporter ut3_develop.ut_documentation_reporter := ut3_develop.ut_documentation_reporter();
- l_lines ut3_develop.ut_varchar2_list;
- pragma autonomous_transaction;
- begin
- --Arrange
- --Act
- ut3_develop.ut_runner.run(ut3_develop.ut_varchar2_list('test_db_link'), ut3_develop.ut_reporters(l_reporter), a_fail_on_errors=> true);
- ut.fail('Expected exception but nothing was raised');
- exception
- when others then
- --Assert
- ut.expect(sqlcode).to_equal(-20213);
- ut.expect(dbms_utility.format_error_stack||dbms_utility.format_error_backtrace).not_to_be_like('%ORA-02055%');
- end;
-
- procedure create_test_csl_packages is
- pragma autonomous_transaction;
- begin
- execute immediate q'[
- create or replace package test_csl_names1 as
- --%suite
- --%suitepath(test_csl_names)
-
- --%test
- procedure one_is_one;
-
- --%test
- procedure two_is_two;
-
- end;
- ]';
-
- execute immediate q'{
- create or replace package body test_csl_names1 as
-
- procedure one_is_one is
- begin
- ut3_develop.ut.expect(1).to_equal(1);
- end;
-
- procedure two_is_two is
- begin
- ut3_develop.ut.expect(2).to_equal(2);
- end;
-
- end;
- }';
-
- execute immediate q'[
- create or replace package test_csl_names2 as
- --%suite
- --%suitepath(test_csl_names)
-
- --%test
- procedure one_is_one;
-
- --%test
- procedure two_is_two;
-
- end;
- ]';
-
- execute immediate q'{
- create or replace package body test_csl_names2 as
-
- procedure one_is_one is
- begin
- ut3_develop.ut.expect(1).to_equal(1);
- end;
-
- procedure two_is_two is
- begin
- ut3_develop.ut.expect(2).to_equal(2);
- end;
-
- end;
- }';
-
- end;
-
- procedure drop_test_csl_packages is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package test_csl_names1';
- execute immediate 'drop package test_csl_names2';
- end;
-
- procedure pass_varchar2_name_list is
- l_results ut3_develop.ut_varchar2_list;
- l_actual clob;
- begin
- select *
- bulk collect into l_results
- from table(ut3_develop.ut.run(ut3_develop.ut_varchar2_list('test_csl_names1','test_csl_names2')));
-
- l_actual := ut3_tester_helper.main_helper.table_to_clob(l_results);
- ut.expect(l_actual).to_be_like('%Finished in % seconds
-%4 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)%');
- end;
-
- procedure pass_varchar2_name is
- l_results ut3_develop.ut_varchar2_list;
- l_actual clob;
- begin
- select *
- bulk collect into l_results
- from table(ut3_develop.ut.run('test_csl_names1'));
-
- l_actual := ut3_tester_helper.main_helper.table_to_clob(l_results);
- ut.expect(l_actual).to_be_like('%Finished in % seconds
-%2 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)%');
- end;
-
- procedure pass_varchar2_suite_csl is
- l_results ut3_develop.ut_varchar2_list;
- l_actual clob;
- begin
- select *
- bulk collect into l_results
- from table(ut3_develop.ut.run('test_csl_names1,test_csl_names2'));
-
- l_actual := ut3_tester_helper.main_helper.table_to_clob(l_results);
- ut.expect(l_actual).to_be_like('%Finished in % seconds
-%4 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)%');
- end;
-
- procedure pass_varchar2_test_csl is
- l_results ut3_develop.ut_varchar2_list;
- l_actual clob;
- begin
- select *
- bulk collect into l_results
- from table(ut3_develop.ut.run('test_csl_names1.one_is_one,test_csl_names2.one_is_one'));
-
- l_actual := ut3_tester_helper.main_helper.table_to_clob(l_results);
- ut.expect(l_actual).to_be_like('%Finished in % seconds
-%2 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)%');
- end;
-
- procedure pass_varch_test_csl_spc is
- l_results ut3_develop.ut_varchar2_list;
- l_actual clob;
- begin
- select *
- bulk collect into l_results
- from table(ut3_develop.ut.run('test_csl_names1.one_is_one, test_csl_names2.one_is_one'));
-
- l_actual := ut3_tester_helper.main_helper.table_to_clob(l_results);
- ut.expect(l_actual).to_be_like('%Finished in % seconds
-%2 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)%');
- end;
-
- procedure pass_csl_with_srcfile is
- l_results ut3_develop.ut_varchar2_list;
- l_actual clob;
- begin
-
- select *
- bulk collect into l_results
- from table(
- ut3_develop.ut.run(
- a_path => 'test_csl_names1.one_is_one,test_csl_names2.one_is_one',
- a_source_files => ut3_develop.ut_varchar2_list('ut3_develop.ut'),
- a_test_files => ut3_develop.ut_varchar2_list('ut3_tester.test_csl_names2')
- )
- );
-
- l_actual := ut3_tester_helper.main_helper.table_to_clob(l_results);
- ut.expect(l_actual).to_be_like('%Finished in % seconds
-%2 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)%');
- end;
-
- procedure pass_csl_within_var2list is
- l_results ut3_develop.ut_varchar2_list;
- l_actual clob;
- begin
- select *
- bulk collect into l_results
- from table(ut3_develop.ut.run(ut3_develop.ut_varchar2_list('test_csl_names1.one_is_one,test_csl_names2.one_is_one')));
-
- l_actual := ut3_tester_helper.main_helper.table_to_clob(l_results);
- ut.expect(l_actual).to_be_like('%Finished in % seconds
-%2 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)%');
- end;
-
- procedure is_test_true is
- begin
- ut.expect(
- ut3_develop.ut_runner.is_test(
- a_owner => 'UT3_USER',
- a_package_name => 'DUMMY_TEST_PACKAGE',
- a_procedure_name => 'SOME_DUMMY_TEST_PROCEDURE'
- )
- ).to_be_true();
- ut.expect( ut3_develop.ut_runner.is_test( 'ut3_user','dummy_test_package','some_dummy_test_procedure' ) ).to_be_true();
- end;
-
- procedure is_test_false is
- begin
- ut.expect( ut3_develop.ut_runner.is_test( 'UT3_USER','DUMMY_TEST_PACKAGE', 'BAD' ) ).to_be_false();
- ut.expect( ut3_develop.ut_runner.is_test( 'UT3_USER','BAD_TEST_PACKAGE', 'some_dummy_test_procedure' ) ).to_be_false();
- ut.expect( ut3_develop.ut_runner.is_test( 'UT3_USER','DUMMY_TEST_PACKAGE', null ) ).to_be_false();
- ut.expect( ut3_develop.ut_runner.is_test( 'UT3_USER',null,'some_dummy_test_procedure' ) ).to_be_false();
- ut.expect( ut3_develop.ut_runner.is_test( null,'DUMMY_TEST_PACKAGE','some_dummy_test_procedure' ) ).to_be_false();
- end;
-
- procedure is_suite_true is
- begin
- ut.expect(
- ut3_develop.ut_runner.is_suite(
- a_owner => 'UT3_USER',
- a_package_name => 'DUMMY_TEST_PACKAGE'
- )
- ).to_be_true();
-
- ut.expect( ut3_develop.ut_runner.is_suite( 'ut3_user','dummy_test_package' ) ).to_be_true();
- end;
-
- procedure is_suite_false is
- begin
- ut.expect( ut3_develop.ut_runner.is_suite( 'UT3_USER','BAD' ) ).to_be_false();
- ut.expect( ut3_develop.ut_runner.is_suite( 'UT3_USER', null ) ).to_be_false();
- ut.expect( ut3_develop.ut_runner.is_suite( null,'DUMMY_TEST_PACKAGE' ) ).to_be_false();
- ut.expect( ut3_develop.ut_runner.is_suite( 'UT3_USER','bad_test_package' ) ).to_be_false();
- end;
-
- procedure has_suites_true is
- begin
- ut.expect( ut3_develop.ut_runner.has_suites( a_owner => 'UT3_USER' ) ).to_be_true();
- ut.expect( ut3_develop.ut_runner.has_suites( 'ut3_user' ) ).to_be_true();
- end;
-
- procedure has_suites_false is
- begin
- ut.expect( ut3_develop.ut_runner.has_suites( 'UT3' ) ).to_be_false();
- ut.expect( ut3_develop.ut_runner.has_suites( 'BAD' ) ).to_be_false();
- ut.expect( ut3_develop.ut_runner.has_suites( null ) ).to_be_false();
- end;
-
-end;
-/
diff --git a/test/ut3_user/api/test_ut_runner.pks b/test/ut3_user/api/test_ut_runner.pks
deleted file mode 100644
index 742d4ad1c..000000000
--- a/test/ut3_user/api/test_ut_runner.pks
+++ /dev/null
@@ -1,165 +0,0 @@
-create or replace package test_ut_runner is
-
- --%suite(ut_runner)
- --%suitepath(utplsql.test_user.api)
- --%rollback(manual)
-
- --%test(transaction stays open after the run if it was opened before the run)
- procedure keep_an_open_transaction;
-
- --%test(closes open transactions if no transaction was open before run)
- procedure close_newly_opened_transaction;
-
- --%context(version_compatibility_check)
-
- --%test(compares major, minor and bugfix number)
- procedure version_comp_check_compare;
-
- --%test(ignores build number)
- procedure version_comp_check_ignore;
-
- --%test(compares short version to a full version)
- procedure version_comp_check_short;
-
- --%test(raises exception when invalid version passed)
- procedure version_comp_check_exception;
-
- --%endcontext
-
- --%test(run resets cache of package body after every run)
- procedure run_reset_package_body_cache;
-
- --%test(does not consume dbms_output from before the run)
- procedure run_keep_dbms_output_buffer;
-
- procedure setup_cache;
- procedure cleanup_cache;
-
- --%test(Purges cache for a given schema and object type)
- --%beforetest(setup_cache)
- --%aftertest(cleanup_cache)
- procedure test_purge_cache_schema_type;
-
- procedure setup_cache_objects;
- procedure setup_cache_objectstag;
- procedure setup_cache_twotags;
-
- --%test(Rebuilds cache for a given schema and object type)
- --%beforetest(setup_cache_objects)
- --%aftertest(cleanup_cache)
- --%DISABLED(TODO -disable trigger for this test to pass)
- procedure test_rebuild_cache_schema_type;
-
- --%test(get_suites_info returns a cursor containing records for a newly created test)
- --%beforetest(setup_cache_objects)
- --%aftertest(cleanup_cache)
- procedure test_get_suites_info_notag;
-
- --%test(get_suites_info returns a cursor containing records for a newly created test with tag)
- --%beforetest(setup_cache_objectstag)
- --%aftertest(cleanup_cache)
- procedure test_get_suites_info_tag;
-
- --%test(get_suites_info returns a cursor containing records for a newly created test with two tags)
- --%beforetest(setup_cache_twotags)
- --%aftertest(cleanup_cache)
- procedure test_get_suites_info_twotag;
-
- --%test(get_suites_info returns a cursor containing records for a newly created test with passed path)
- --%beforetest(setup_cache_objects)
- --%aftertest(cleanup_cache)
- procedure test_get_suites_info_by_path;
-
- procedure setup_cache_context_disabled;
-
- --%test(get_suites_info returns contexts and disabled tests)
- --%beforetest(setup_cache_context_disabled)
- --%aftertest(cleanup_cache)
- procedure test_get_suites_info_context;
-
- --%test(get_suites_info returns a test and its parents for a procedure path)
- --%beforetest(setup_cache_objects)
- --%aftertest(cleanup_cache)
- procedure test_get_suites_info_by_proc;
-
- --%test(get_reporters_list returns a cursor containing all built-in reporters and information about output-reporter)
- --%beforetest(setup_cache_objects)
- --%aftertest(cleanup_cache)
- procedure test_get_reporters_list;
-
- procedure db_link_cleanup;
- procedure db_link_setup;
-
- --%test(ORA-20213 is thrown with a_raise_on_failure when database link operations are used - regression)
- --%beforetest(db_link_setup)
- --%aftertest(db_link_cleanup)
- procedure raises_20213_on_fail_link;
-
- procedure create_test_csl_packages;
- procedure drop_test_csl_packages;
-
- --%context(ut_run_coma_sep_list)
- --%beforeall(create_test_csl_packages)
- --%afterall(drop_test_csl_packages)
-
- --%test( Pass name of tests as varchar2_list )
- procedure pass_varchar2_name_list;
-
- --%test( Pass single test name as varchar2 )
- procedure pass_varchar2_name;
-
- --%test( Pass coma separated list of suite names )
- procedure pass_varchar2_suite_csl;
-
- --%test( Pass coma separated list of test names )
- procedure pass_varchar2_test_csl;
-
- --%test( Pass coma separated list of test names with spaces )
- procedure pass_varch_test_csl_spc;
-
- --%test( Pass coma separated list and source and test files )
- procedure pass_csl_with_srcfile;
-
- --%test( Pass coma separated list in varchar2list )
- procedure pass_csl_within_var2list;
-
- --%endcontext
-
- --%context(is_test)
- --%beforeall(setup_cache_objects)
- --%afterall(cleanup_cache)
-
- --%test(Returns true when procedure is a test)
- procedure is_test_true;
-
- --%test(Returns false when procedure is not a test)
- procedure is_test_false;
-
- --%endcontext
-
- --%context(is_suite)
- --%beforeall(setup_cache_objects)
- --%afterall(cleanup_cache)
-
- --%test(Returns true when package is a test suite)
- procedure is_suite_true;
-
- --%test(Returns false when package is not a test suite)
- procedure is_suite_false;
-
- --%endcontext
-
- --%context(has_suites)
- --%beforeall(setup_cache_objects)
- --%afterall(cleanup_cache)
-
- --%test(Returns true when schema contains test suites)
- procedure has_suites_true;
-
- --%test(Returns false when schema does not contain test suites)
- procedure has_suites_false;
-
- --%endcontext
-
-end;
-/
diff --git a/test/ut3_user/expectations.pkb b/test/ut3_user/expectations.pkb
deleted file mode 100644
index be8627712..000000000
--- a/test/ut3_user/expectations.pkb
+++ /dev/null
@@ -1,60 +0,0 @@
-create or replace package body expectations as
-
- procedure inline_expectation_to_dbms_out is
- l_expected clob;
- l_actual clob;
- pragma autonomous_transaction;
- begin
- --Arrange
- --Act
- execute immediate 'begin some_pkg.some_procedure; end;';
- ut3_develop.ut.expect(1).to_equal(0);
- ut3_develop.ut.expect(0).to_equal(0);
-
- --Assert
- l_actual := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
-
- l_expected := q'[FAILURE
- Actual: 1 (number) was expected to equal: 0 (number)
- at "UT3_USER.SOME_PKG%", line 4 ut3_develop.ut.expect(1).to_equal(0);
- at "anonymous block", line 1
- at "UT3_USER.EXPECTATIONS%", line 10
-SUCCESS
- Actual: 0 (number) was expected to equal: 0 (number)
-FAILURE
- Actual: 1 (number) was expected to equal: 0 (number)
- at "UT3_USER.EXPECTATIONS%", line 11 ut3_develop.ut.expect(1).to_equal(0);
-SUCCESS
- Actual: 0 (number) was expected to equal: 0 (number)
-]';
-
- ut.expect(l_actual).to_be_like(l_expected);
- rollback;
- end;
-
- procedure create_some_pkg is
- pragma autonomous_transaction;
- begin
- execute immediate q'[
- create or replace package some_pkg is
- procedure some_procedure;
- end;]';
-
- execute immediate q'[
- create or replace package body some_pkg is
- procedure some_procedure is
- begin
- ut3_develop.ut.expect(1).to_equal(0);
- ut3_develop.ut.expect(0).to_equal(0);
- end;
- end;]';
- end;
-
- procedure drop_some_pkg is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop package some_pkg';
- end;
-
-end;
-/
\ No newline at end of file
diff --git a/test/ut3_user/expectations.pks b/test/ut3_user/expectations.pks
deleted file mode 100644
index 0324f9ac0..000000000
--- a/test/ut3_user/expectations.pks
+++ /dev/null
@@ -1,18 +0,0 @@
-create or replace package expectations as
- --%suite
- --%suitepath(utplsql.test_user)
-
- --%beforeall(ut3_tester_helper.main_helper.set_ut_run_context)
-
- --%afterall(ut3_tester_helper.main_helper.clear_ut_run_context)
-
- --%test(Expectations return data to screen when called standalone)
- --%beforetest( create_some_pkg, ut3_tester_helper.main_helper.clear_ut_run_context )
- --%aftertest( drop_some_pkg, ut3_tester_helper.main_helper.set_ut_run_context )
- procedure inline_expectation_to_dbms_out;
-
- procedure create_some_pkg;
- procedure drop_some_pkg;
-
-end;
-/
\ No newline at end of file
diff --git a/test/ut3_user/expectations/binary/test_be_greater_or_equal.pkb b/test/ut3_user/expectations/binary/test_be_greater_or_equal.pkb
deleted file mode 100644
index 3f92c84c7..000000000
--- a/test/ut3_user/expectations/binary/test_be_greater_or_equal.pkb
+++ /dev/null
@@ -1,263 +0,0 @@
-create or replace package body test_be_greater_or_equal is
-
- procedure cleanup_expectations is
- begin
- ut3_tester_helper.main_helper.clear_expectations( );
- end;
-
- function to_greater_equal_block(
- a_data_type varchar2,
- a_actual varchar2,
- a_expected varchar2
- ) return varchar2 is
- begin
- return ut3_tester_helper.expectations_helper.binary_expectation_block(
- 'to_be_greater_or_equal', a_data_type, a_actual, a_data_type, a_expected
- );
- end;
-
- function not_to_greater_equal_block(
- a_data_type varchar2,
- a_actual varchar2,
- a_expected varchar2
- ) return varchar2 is
- begin
- return ut3_tester_helper.expectations_helper.binary_expectation_block(
- 'not_to_be_greater_or_equal', a_data_type, a_actual, a_data_type, a_expected
- );
- end;
-
- procedure actual_date_greater is
- begin
- --Act
- execute immediate to_greater_equal_block('date', 'sysdate', 'sysdate-1');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_number_greater is
- begin
- --Act
- execute immediate to_greater_equal_block('number', '2.0', '1.99');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_interval_ym_greater is
- begin
- --Act
- execute immediate to_greater_equal_block('interval year to month', '''2-1''', '''2-0''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_interval_ds_greater is
- begin
- --Act
- execute immediate to_greater_equal_block('interval day to second', '''2 01:00:00''', '''2 00:59:59''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_timestamp_greater is
- begin
- --Act
- execute immediate to_greater_equal_block('timestamp', 'to_timestamp(''1997 13'',''YYYY FF'')', 'to_timestamp(''1997 12'',''YYYY FF'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_timestamp_tz_greater is
- begin
- --Act
- execute immediate to_greater_equal_block('timestamp with time zone', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +02:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_timestamp_ltz_greater is
- begin
- --Act
- execute immediate to_greater_equal_block('timestamp with local time zone', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +02:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_date_equal is
- begin
- --Act
- execute immediate to_greater_equal_block('date', 'sysdate', 'sysdate');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_number_equal is
- begin
- --Act
- execute immediate to_greater_equal_block('number', '2.0', '2.00');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_interval_ym_equal is
- begin
- --Act
- execute immediate to_greater_equal_block('interval year to month', '''2-1''', '''2-1''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_interval_ds_equal is
- begin
- --Act
- execute immediate to_greater_equal_block('interval day to second', '''2 01:00:00''', '''2 01:00:00''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_timestamp_equal is
- begin
- --Act
- execute immediate to_greater_equal_block('timestamp', 'to_timestamp(''1997 13'',''YYYY FF'')', 'to_timestamp(''1997 13'',''YYYY FF'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_timestamp_tz_equal is
- begin
- --Act
- execute immediate to_greater_equal_block('timestamp with time zone', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_timestamp_ltz_equal is
- begin
- --Act
- execute immediate to_greater_equal_block('timestamp with local time zone', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_date_less is
- begin
- --Act
- execute immediate to_greater_equal_block('date', 'sysdate-1', 'sysdate');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_number_less is
- begin
- --Act
- execute immediate to_greater_equal_block('number', '1.0', '1.01');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_interval_ym_less is
- begin
- --Act
- execute immediate to_greater_equal_block('interval year to month', '''2-1''', '''2-2''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_interval_ds_less is
- begin
- --Act
- execute immediate to_greater_equal_block('interval day to second', '''2 00:59:58''', '''2 00:59:59''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_timestamp_less is
- begin
- --Act
- execute immediate to_greater_equal_block('timestamp', 'to_timestamp(''1997 12'',''YYYY FF'')', 'to_timestamp(''1997 13'',''YYYY FF'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_timestamp_tz_less is
- begin
- --Act
- execute immediate to_greater_equal_block('timestamp with time zone', 'to_timestamp_tz(''1997 12 +03:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +02:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_timestamp_ltz_less is
- begin
- --Act
- execute immediate to_greater_equal_block('timestamp with local time zone', 'to_timestamp_tz(''1997 12 +03:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +02:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure not_actual_date_greater is
- begin
- --Act
- execute immediate not_to_greater_equal_block('date', 'sysdate', 'sysdate-1');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure not_actual_number_greater is
- begin
- --Act
- execute immediate not_to_greater_equal_block('number', '2.0', '1.99');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure not_actual_interval_ym_greater is
- begin
- --Act
- execute immediate not_to_greater_equal_block('interval year to month', '''2-1''', '''2-0''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure not_actual_interval_ds_greater is
- begin
- --Act
- execute immediate not_to_greater_equal_block('interval day to second', '''2 01:00:00''', '''2 00:59:59''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure not_actual_timestamp_greater is
- begin
- --Act
- execute immediate not_to_greater_equal_block('timestamp', 'to_timestamp(''1997 13'',''YYYY FF'')', 'to_timestamp(''1997 12'',''YYYY FF'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure not_actual_timestamp_tz_gretr is
- begin
- --Act
- execute immediate not_to_greater_equal_block('timestamp with time zone', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +02:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure not_actual_timestamp_ltz_gretr is
- begin
- --Act
- execute immediate not_to_greater_equal_block('timestamp with local time zone', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +02:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_clob is
- begin
- --Act
- ut3_develop.ut.expect(to_clob('3')).to_( ut3_develop.be_greater_or_equal(3) );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
-end;
-/
diff --git a/test/ut3_user/expectations/binary/test_be_greater_or_equal.pks b/test/ut3_user/expectations/binary/test_be_greater_or_equal.pks
deleted file mode 100644
index 3f51e8e3f..000000000
--- a/test/ut3_user/expectations/binary/test_be_greater_or_equal.pks
+++ /dev/null
@@ -1,97 +0,0 @@
-create or replace package test_be_greater_or_equal is
-
- --%suite((not)to_be_greater_or_equal)
- --%suitepath(utplsql.test_user.expectations.binary)
-
- --%aftereach
- procedure cleanup_expectations;
-
- --%test(Gives success when actual date is greater than expected)
- procedure actual_date_greater;
-
- --%test(Gives success when actual number is greater than expected)
- procedure actual_number_greater;
-
- --%test(Gives success when actual interval year to month is greater than expected)
- procedure actual_interval_ym_greater;
-
- --%test(Gives success when actual interval day to second is greater than expected)
- procedure actual_interval_ds_greater;
-
- --%test(Gives success when actual timestamp is greater than expected)
- procedure actual_timestamp_greater;
-
- --%test(Gives success when actual timestamp with time zone is greater than expected)
- procedure actual_timestamp_tz_greater;
-
- --%test(Gives success when actual timestamp with local time zone is greater than expected)
- procedure actual_timestamp_ltz_greater;
-
- --%test(Gives success when actual date is equal expected)
- procedure actual_date_equal;
-
- --%test(Gives success when actual number is equal expected)
- procedure actual_number_equal;
-
- --%test(Gives success when actual interval year to month is equal expected)
- procedure actual_interval_ym_equal;
-
- --%test(Gives success when actual interval day to second is equal expected)
- procedure actual_interval_ds_equal;
-
- --%test(Gives success when actual timestamp is equal expected)
- procedure actual_timestamp_equal;
-
- --%test(Gives success when actual timestamp with time zone is equal expected)
- procedure actual_timestamp_tz_equal;
-
- --%test(Gives success when actual timestamp with local time zone is equal expected)
- procedure actual_timestamp_ltz_equal;
-
- --%test(Gives failure when actual date is less than expected)
- procedure actual_date_less;
-
- --%test(Gives failure when actual number is less than expected)
- procedure actual_number_less;
-
- --%test(Gives failure when actual interval year to month is less than expected)
- procedure actual_interval_ym_less;
-
- --%test(Gives failure when actual interval day to second is less than expected)
- procedure actual_interval_ds_less;
-
- --%test(Gives failure when actual timestamp is less than expected)
- procedure actual_timestamp_less;
-
- --%test(Gives failure when actual timestamp with time zone is less than expected)
- procedure actual_timestamp_tz_less;
-
- --%test(Gives failure when actual timestamp with local time zone is less than expected)
- procedure actual_timestamp_ltz_less;
-
- --%test(Negated - Gives failure when actual date is greater than expected)
- procedure not_actual_date_greater;
-
- --%test(Negated - Gives failure when actual number is greater than expected)
- procedure not_actual_number_greater;
-
- --%test(Negated - Gives failure when actual interval year to month is greater than expected)
- procedure not_actual_interval_ym_greater;
-
- --%test(Negated - Gives failure when actual interval day to second is greater than expected)
- procedure not_actual_interval_ds_greater;
-
- --%test(Negated - Gives failure when actual timestamp is greater than expected)
- procedure not_actual_timestamp_greater;
-
- --%test(Negated - Gives failure when actual timestamp with time zone is greater than expected)
- procedure not_actual_timestamp_tz_gretr;
-
- --%test(Negated - Gives failure when actual timestamp with local time zone is greater than expected)
- procedure not_actual_timestamp_ltz_gretr;
-
- --%test(Gives failure when running against CLOB)
- procedure actual_clob;
-
-end;
-/
diff --git a/test/ut3_user/expectations/binary/test_be_greater_than.pkb b/test/ut3_user/expectations/binary/test_be_greater_than.pkb
deleted file mode 100644
index 6724b5c41..000000000
--- a/test/ut3_user/expectations/binary/test_be_greater_than.pkb
+++ /dev/null
@@ -1,263 +0,0 @@
-create or replace package body test_be_greater_than is
-
- procedure cleanup_expectations is
- begin
- ut3_tester_helper.main_helper.clear_expectations( );
- end;
-
- function to_greater_than_block(
- a_data_type varchar2,
- a_actual varchar2,
- a_expected varchar2
- ) return varchar2 is
- begin
- return ut3_tester_helper.expectations_helper.binary_expectation_block(
- 'to_be_greater_than', a_data_type, a_actual, a_data_type, a_expected
- );
- end;
-
- function not_to_greater_than_block(
- a_data_type varchar2,
- a_actual varchar2,
- a_expected varchar2
- ) return varchar2 is
- begin
- return ut3_tester_helper.expectations_helper.binary_expectation_block(
- 'not_to_be_greater_than', a_data_type, a_actual, a_data_type, a_expected
- );
- end;
-
- procedure actual_date_greater is
- begin
- --Act
- execute immediate to_greater_than_block('date', 'sysdate', 'sysdate-1');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_number_greater is
- begin
- --Act
- execute immediate to_greater_than_block('number', '2.0', '1.99');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_interval_ym_greater is
- begin
- --Act
- execute immediate to_greater_than_block('interval year to month', '''2-1''', '''2-0''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_interval_ds_greater is
- begin
- --Act
- execute immediate to_greater_than_block('interval day to second', '''2 01:00:00''', '''2 00:59:59''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_timestamp_greater is
- begin
- --Act
- execute immediate to_greater_than_block('timestamp', 'to_timestamp(''1997 13'',''YYYY FF'')', 'to_timestamp(''1997 12'',''YYYY FF'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_timestamp_tz_greater is
- begin
- --Act
- execute immediate to_greater_than_block('timestamp with time zone', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +02:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_timestamp_ltz_greater is
- begin
- --Act
- execute immediate to_greater_than_block('timestamp with local time zone', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +02:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_date_equal is
- begin
- --Act
- execute immediate to_greater_than_block('date', 'sysdate', 'sysdate');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_number_equal is
- begin
- --Act
- execute immediate to_greater_than_block('number', '2.0', '2.00');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_interval_ym_equal is
- begin
- --Act
- execute immediate to_greater_than_block('interval year to month', '''2-1''', '''2-1''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_interval_ds_equal is
- begin
- --Act
- execute immediate to_greater_than_block('interval day to second', '''2 01:00:00''', '''2 01:00:00''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_timestamp_equal is
- begin
- --Act
- execute immediate to_greater_than_block('timestamp', 'to_timestamp(''1997 13'',''YYYY FF'')', 'to_timestamp(''1997 13'',''YYYY FF'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_timestamp_tz_equal is
- begin
- --Act
- execute immediate to_greater_than_block('timestamp with time zone', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_timestamp_ltz_equal is
- begin
- --Act
- execute immediate to_greater_than_block('timestamp with local time zone', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_date_less is
- begin
- --Act
- execute immediate to_greater_than_block('date', 'sysdate-1', 'sysdate');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_number_less is
- begin
- --Act
- execute immediate to_greater_than_block('number', '1.0', '1.01');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_interval_ym_less is
- begin
- --Act
- execute immediate to_greater_than_block('interval year to month', '''2-1''', '''2-2''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_interval_ds_less is
- begin
- --Act
- execute immediate to_greater_than_block('interval day to second', '''2 00:59:58''', '''2 00:59:59''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_timestamp_less is
- begin
- --Act
- execute immediate to_greater_than_block('timestamp', 'to_timestamp(''1997 12'',''YYYY FF'')', 'to_timestamp(''1997 13'',''YYYY FF'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_timestamp_tz_less is
- begin
- --Act
- execute immediate to_greater_than_block('timestamp with time zone', 'to_timestamp_tz(''1997 12 +03:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +02:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_timestamp_ltz_less is
- begin
- --Act
- execute immediate to_greater_than_block('timestamp with local time zone', 'to_timestamp_tz(''1997 12 +03:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +02:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure not_actual_date_greater is
- begin
- --Act
- execute immediate not_to_greater_than_block('date', 'sysdate', 'sysdate-1');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure not_actual_number_greater is
- begin
- --Act
- execute immediate not_to_greater_than_block('number', '2.0', '1.99');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure not_actual_interval_ym_greater is
- begin
- --Act
- execute immediate not_to_greater_than_block('interval year to month', '''2-1''', '''2-0''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure not_actual_interval_ds_greater is
- begin
- --Act
- execute immediate not_to_greater_than_block('interval day to second', '''2 01:00:00''', '''2 00:59:59''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure not_actual_timestamp_greater is
- begin
- --Act
- execute immediate not_to_greater_than_block('timestamp', 'to_timestamp(''1997 13'',''YYYY FF'')', 'to_timestamp(''1997 12'',''YYYY FF'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure not_actual_timestamp_tz_gretr is
- begin
- --Act
- execute immediate not_to_greater_than_block('timestamp with time zone', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +02:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure not_actual_timestamp_ltz_gretr is
- begin
- --Act
- execute immediate not_to_greater_than_block('timestamp with local time zone', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +02:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_clob is
- begin
- --Act
- ut3_develop.ut.expect(to_clob('3')).to_( ut3_develop.be_greater_than(2) );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
-end;
-/
diff --git a/test/ut3_user/expectations/binary/test_be_greater_than.pks b/test/ut3_user/expectations/binary/test_be_greater_than.pks
deleted file mode 100644
index fb158dddb..000000000
--- a/test/ut3_user/expectations/binary/test_be_greater_than.pks
+++ /dev/null
@@ -1,97 +0,0 @@
-create or replace package test_be_greater_than is
-
- --%suite((not)to_be_greater_than)
- --%suitepath(utplsql.test_user.expectations.binary)
-
- --%aftereach
- procedure cleanup_expectations;
-
- --%test(Gives success when actual date is greater than expected)
- procedure actual_date_greater;
-
- --%test(Gives success when actual number is greater than expected)
- procedure actual_number_greater;
-
- --%test(Gives success when actual interval year to month is greater than expected)
- procedure actual_interval_ym_greater;
-
- --%test(Gives success when actual interval day to second is greater than expected)
- procedure actual_interval_ds_greater;
-
- --%test(Gives success when actual timestamp is greater than expected)
- procedure actual_timestamp_greater;
-
- --%test(Gives success when actual timestamp with time zone is greater than expected)
- procedure actual_timestamp_tz_greater;
-
- --%test(Gives success when actual timestamp with local time zone is greater than expected)
- procedure actual_timestamp_ltz_greater;
-
- --%test(Gives failure when actual date is equal expected)
- procedure actual_date_equal;
-
- --%test(Gives failure when actual number is equal expected)
- procedure actual_number_equal;
-
- --%test(Gives failure when actual interval year to month is equal expected)
- procedure actual_interval_ym_equal;
-
- --%test(Gives failure when actual interval day to second is equal expected)
- procedure actual_interval_ds_equal;
-
- --%test(Gives failure when actual timestamp is equal expected)
- procedure actual_timestamp_equal;
-
- --%test(Gives failure when actual timestamp with time zone is equal expected)
- procedure actual_timestamp_tz_equal;
-
- --%test(Gives failure when actual timestamp with local time zone is equal expected)
- procedure actual_timestamp_ltz_equal;
-
- --%test(Gives failure when actual date is less than expected)
- procedure actual_date_less;
-
- --%test(Gives failure when actual number is less than expected)
- procedure actual_number_less;
-
- --%test(Gives failure when actual interval year to month is less than expected)
- procedure actual_interval_ym_less;
-
- --%test(Gives failure when actual interval day to second is less than expected)
- procedure actual_interval_ds_less;
-
- --%test(Gives failure when actual timestamp is less than expected)
- procedure actual_timestamp_less;
-
- --%test(Gives failure when actual timestamp with time zone is less than expected)
- procedure actual_timestamp_tz_less;
-
- --%test(Gives failure when actual timestamp with local time zone is less than expected)
- procedure actual_timestamp_ltz_less;
-
- --%test(Negated - Gives failure when actual date is greater than expected)
- procedure not_actual_date_greater;
-
- --%test(Negated - Gives failure when actual number is greater than expected)
- procedure not_actual_number_greater;
-
- --%test(Negated - Gives failure when actual interval year to month is greater than expected)
- procedure not_actual_interval_ym_greater;
-
- --%test(Negated - Gives failure when actual interval day to second is greater than expected)
- procedure not_actual_interval_ds_greater;
-
- --%test(Negated - Gives failure when actual timestamp is greater than expected)
- procedure not_actual_timestamp_greater;
-
- --%test(Negated - Gives failure when actual timestamp with time zone is greater than expected)
- procedure not_actual_timestamp_tz_gretr;
-
- --%test(Negated - Gives failure when actual timestamp with local time zone is greater than expected)
- procedure not_actual_timestamp_ltz_gretr;
-
- --%test(Gives failure when running against CLOB)
- procedure actual_clob;
-
-end;
-/
diff --git a/test/ut3_user/expectations/binary/test_be_less_or_equal.pkb b/test/ut3_user/expectations/binary/test_be_less_or_equal.pkb
deleted file mode 100644
index aefb58849..000000000
--- a/test/ut3_user/expectations/binary/test_be_less_or_equal.pkb
+++ /dev/null
@@ -1,263 +0,0 @@
-create or replace package body test_be_less_or_equal is
-
- procedure cleanup_expectations is
- begin
- ut3_tester_helper.main_helper.clear_expectations( );
- end;
-
- function to_less_or_equal_block(
- a_data_type varchar2,
- a_actual varchar2,
- a_expected varchar2
- ) return varchar2 is
- begin
- return ut3_tester_helper.expectations_helper.binary_expectation_block(
- 'to_be_less_or_equal', a_data_type, a_actual, a_data_type, a_expected
- );
- end;
-
- function not_to_less_or_equal_block(
- a_data_type varchar2,
- a_actual varchar2,
- a_expected varchar2
- ) return varchar2 is
- begin
- return ut3_tester_helper.expectations_helper.binary_expectation_block(
- 'not_to_be_less_or_equal', a_data_type, a_actual, a_data_type, a_expected
- );
- end;
-
- procedure actual_date_greater is
- begin
- --Act
- execute immediate to_less_or_equal_block('date', 'sysdate', 'sysdate-1');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_number_greater is
- begin
- --Act
- execute immediate to_less_or_equal_block('number', '2.0', '1.99');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_interval_ym_greater is
- begin
- --Act
- execute immediate to_less_or_equal_block('interval year to month', '''2-1''', '''2-0''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_interval_ds_greater is
- begin
- --Act
- execute immediate to_less_or_equal_block('interval day to second', '''2 01:00:00''', '''2 00:59:59''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_timestamp_greater is
- begin
- --Act
- execute immediate to_less_or_equal_block('timestamp', 'to_timestamp(''1997 13'',''YYYY FF'')', 'to_timestamp(''1997 12'',''YYYY FF'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_timestamp_tz_greater is
- begin
- --Act
- execute immediate to_less_or_equal_block('timestamp with time zone', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +02:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_timestamp_ltz_greater is
- begin
- --Act
- execute immediate to_less_or_equal_block('timestamp with local time zone', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +02:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_date_equal is
- begin
- --Act
- execute immediate to_less_or_equal_block('date', 'sysdate', 'sysdate');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_number_equal is
- begin
- --Act
- execute immediate to_less_or_equal_block('number', '2.0', '2.00');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_interval_ym_equal is
- begin
- --Act
- execute immediate to_less_or_equal_block('interval year to month', '''2-1''', '''2-1''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_interval_ds_equal is
- begin
- --Act
- execute immediate to_less_or_equal_block('interval day to second', '''2 01:00:00''', '''2 01:00:00''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_timestamp_equal is
- begin
- --Act
- execute immediate to_less_or_equal_block('timestamp', 'to_timestamp(''1997 13'',''YYYY FF'')', 'to_timestamp(''1997 13'',''YYYY FF'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_timestamp_tz_equal is
- begin
- --Act
- execute immediate to_less_or_equal_block('timestamp with time zone', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_timestamp_ltz_equal is
- begin
- --Act
- execute immediate to_less_or_equal_block('timestamp with local time zone', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_date_less is
- begin
- --Act
- execute immediate to_less_or_equal_block('date', 'sysdate-1', 'sysdate');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_number_less is
- begin
- --Act
- execute immediate to_less_or_equal_block('number', '1.0', '1.01');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_interval_ym_less is
- begin
- --Act
- execute immediate to_less_or_equal_block('interval year to month', '''2-1''', '''2-2''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_interval_ds_less is
- begin
- --Act
- execute immediate to_less_or_equal_block('interval day to second', '''2 00:59:58''', '''2 00:59:59''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_timestamp_less is
- begin
- --Act
- execute immediate to_less_or_equal_block('timestamp', 'to_timestamp(''1997 12'',''YYYY FF'')', 'to_timestamp(''1997 13'',''YYYY FF'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_timestamp_tz_less is
- begin
- --Act
- execute immediate to_less_or_equal_block('timestamp with time zone', 'to_timestamp_tz(''1997 12 +03:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +02:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_timestamp_ltz_less is
- begin
- --Act
- execute immediate to_less_or_equal_block('timestamp with local time zone', 'to_timestamp_tz(''1997 12 +03:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +02:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure not_actual_date_greater is
- begin
- --Act
- execute immediate not_to_less_or_equal_block('date', 'sysdate', 'sysdate-1');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure not_actual_number_greater is
- begin
- --Act
- execute immediate not_to_less_or_equal_block('number', '2.0', '1.99');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure not_actual_interval_ym_greater is
- begin
- --Act
- execute immediate not_to_less_or_equal_block('interval year to month', '''2-1''', '''2-0''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure not_actual_interval_ds_greater is
- begin
- --Act
- execute immediate not_to_less_or_equal_block('interval day to second', '''2 01:00:00''', '''2 00:59:59''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure not_actual_timestamp_greater is
- begin
- --Act
- execute immediate not_to_less_or_equal_block('timestamp', 'to_timestamp(''1997 13'',''YYYY FF'')', 'to_timestamp(''1997 12'',''YYYY FF'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure not_actual_timestamp_tz_gretr is
- begin
- --Act
- execute immediate not_to_less_or_equal_block('timestamp with time zone', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +02:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure not_actual_timestamp_ltz_gretr is
- begin
- --Act
- execute immediate not_to_less_or_equal_block('timestamp with local time zone', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +02:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_clob is
- begin
- --Act
- ut3_develop.ut.expect(to_clob('3')).to_( ut3_develop.be_less_or_equal(3) );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
-end;
-/
diff --git a/test/ut3_user/expectations/binary/test_be_less_or_equal.pks b/test/ut3_user/expectations/binary/test_be_less_or_equal.pks
deleted file mode 100644
index d6baf037e..000000000
--- a/test/ut3_user/expectations/binary/test_be_less_or_equal.pks
+++ /dev/null
@@ -1,97 +0,0 @@
-create or replace package test_be_less_or_equal is
-
- --%suite((not)to_be_less_or_equal)
- --%suitepath(utplsql.test_user.expectations.binary)
-
- --%aftereach
- procedure cleanup_expectations;
-
- --%test(Gives failure when actual date is greater than expected)
- procedure actual_date_greater;
-
- --%test(Gives failure when actual number is greater than expected)
- procedure actual_number_greater;
-
- --%test(Gives failure when actual interval year to month is greater than expected)
- procedure actual_interval_ym_greater;
-
- --%test(Gives failure when actual interval day to second is greater than expected)
- procedure actual_interval_ds_greater;
-
- --%test(Gives failure when actual timestamp is greater than expected)
- procedure actual_timestamp_greater;
-
- --%test(Gives failure when actual timestamp with time zone is greater than expected)
- procedure actual_timestamp_tz_greater;
-
- --%test(Gives failure when actual timestamp with local time zone is greater than expected)
- procedure actual_timestamp_ltz_greater;
-
- --%test(Gives success when actual date is equal expected)
- procedure actual_date_equal;
-
- --%test(Gives success when actual number is equal expected)
- procedure actual_number_equal;
-
- --%test(Gives success when actual interval year to month is equal expected)
- procedure actual_interval_ym_equal;
-
- --%test(Gives success when actual interval day to second is equal expected)
- procedure actual_interval_ds_equal;
-
- --%test(Gives success when actual timestamp is equal expected)
- procedure actual_timestamp_equal;
-
- --%test(Gives success when actual timestamp with time zone is equal expected)
- procedure actual_timestamp_tz_equal;
-
- --%test(Gives success when actual timestamp with local time zone is equal expected)
- procedure actual_timestamp_ltz_equal;
-
- --%test(Gives success when actual date is less than expected)
- procedure actual_date_less;
-
- --%test(Gives success when actual number is less than expected)
- procedure actual_number_less;
-
- --%test(Gives success when actual interval year to month is less than expected)
- procedure actual_interval_ym_less;
-
- --%test(Gives success when actual interval day to second is less than expected)
- procedure actual_interval_ds_less;
-
- --%test(Gives success when actual timestamp is less than expected)
- procedure actual_timestamp_less;
-
- --%test(Gives success when actual timestamp with time zone is less than expected)
- procedure actual_timestamp_tz_less;
-
- --%test(Gives success when actual timestamp with local time zone is less than expected)
- procedure actual_timestamp_ltz_less;
-
- --%test(Negated - Gives success when actual date is greater than expected)
- procedure not_actual_date_greater;
-
- --%test(Negated - Gives success when actual number is greater than expected)
- procedure not_actual_number_greater;
-
- --%test(Negated - Gives success when actual interval year to month is greater than expected)
- procedure not_actual_interval_ym_greater;
-
- --%test(Negated - Gives success when actual interval day to second is greater than expected)
- procedure not_actual_interval_ds_greater;
-
- --%test(Negated - Gives success when actual timestamp is greater than expected)
- procedure not_actual_timestamp_greater;
-
- --%test(Negated - Gives success when actual timestamp with time zone is greater than expected)
- procedure not_actual_timestamp_tz_gretr;
-
- --%test(Negated - Gives success when actual timestamp with local time zone is greater than expected)
- procedure not_actual_timestamp_ltz_gretr;
-
- --%test(Gives failure when running against CLOB)
- procedure actual_clob;
-
-end;
-/
diff --git a/test/ut3_user/expectations/binary/test_equal.pkb b/test/ut3_user/expectations/binary/test_equal.pkb
deleted file mode 100644
index 735915348..000000000
--- a/test/ut3_user/expectations/binary/test_equal.pkb
+++ /dev/null
@@ -1,264 +0,0 @@
-create or replace package body test_equal is
-
- procedure reset_nulls_equal is
- begin
- ut3_tester_helper.main_helper.reset_nulls_equal;
- end;
-
- procedure cleanup_expectations is
- begin
- ut3_tester_helper.main_helper.clear_expectations( );
- end;
-
- function to_equal_block(
- a_matcher_name varchar2,
- a_actual_type varchar2,
- a_expected_type varchar2,
- a_actual varchar2,
- a_expected varchar2,
- a_nulls_equal boolean := null
- ) return varchar2 is
- l_nulls_equal varchar2(10);
- begin
- l_nulls_equal := case when a_nulls_equal then 'true' when not a_nulls_equal then 'false' else 'null' end;
- return '
- declare
- l_actual '||a_actual_type||' := '||a_actual||';
- l_expected '||a_expected_type||' := '||a_expected||';
- begin
- ut3_develop.ut.expect( l_actual ).'||a_matcher_name||'(l_expected, a_nulls_are_equal=>'||l_nulls_equal||');
- end;';
- end;
-
- procedure test_to_equal_success(
- a_actual_type varchar2,
- a_expected_type varchar2,
- a_actual varchar2,
- a_expected varchar2,
- a_nulls_equal boolean := null
- ) is
- begin
- execute immediate
- to_equal_block( 'to_equal', a_actual_type, a_expected_type, a_actual, a_expected, a_nulls_equal );
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- cleanup_expectations;
- end;
-
- procedure test_to_equal_success(
- a_actual_type varchar2,
- a_actual varchar2,
- a_expected varchar2,
- a_nulls_equal boolean := null
- ) is
- begin
- test_to_equal_success(a_actual_type, a_actual_type, a_actual, a_expected, a_nulls_equal);
- end;
-
-
- procedure test_to_equal_fail(
- a_actual_type varchar2,
- a_expected_type varchar2,
- a_actual varchar2,
- a_expected varchar2,
- a_nulls_equal boolean := null
- ) is
- begin
- execute immediate
- to_equal_block( 'to_equal', a_actual_type, a_expected_type, a_actual, a_expected, a_nulls_equal );
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- cleanup_expectations;
- end;
-
- procedure test_not_to_equal_fail(
- a_actual_type varchar2,
- a_expected_type varchar2,
- a_actual varchar2,
- a_expected varchar2,
- a_nulls_equal boolean := null
- ) is
- begin
- execute immediate
- to_equal_block( 'not_to_equal', a_actual_type, a_expected_type, a_actual, a_expected, a_nulls_equal );
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- cleanup_expectations;
- end;
-
- procedure test_to_equal_fail(
- a_actual_type varchar2,
- a_actual varchar2,
- a_expected varchar2,
- a_nulls_equal boolean := null
- ) is
- begin
- test_to_equal_fail(a_actual_type, a_actual_type, a_actual, a_expected, a_nulls_equal);
- end;
-
- procedure equal_fail_on_type_diff is
- begin
- test_to_equal_fail('boolean', 'integer', 'true', '1');
- test_to_equal_fail('integer', 'boolean', '1', 'true');
- test_to_equal_fail('blob', 'clob', 'to_blob(''ABC'')', '''ABC''');
- test_to_equal_fail('clob', 'blob', '''ABC''', 'to_blob(''ABC'')');
- test_to_equal_fail('clob', 'anydata', '''ABC''', 'null');
- test_to_equal_fail('anydata', 'sys_refcursor', 'null', 'null');
- test_to_equal_fail('sys_refcursor', 'anydata', 'null', 'null');
- test_to_equal_fail('clob', 'varchar2(4000)', '''Abc''', '''Abc''');
- test_to_equal_fail('date', 'timestamp', 'sysdate', 'sysdate');
- test_to_equal_fail('date', 'timestamp with local time zone', 'sysdate', 'sysdate');
- test_to_equal_fail('timestamp', 'date', 'sysdate', 'sysdate');
- test_to_equal_fail('timestamp with local time zone', 'timestamp', 'sysdate', 'sysdate');
- test_to_equal_fail('timestamp with local time zone', 'timestamp with time zone', 'sysdate', 'sysdate');
- test_to_equal_fail('number', 'varchar2(4000)', '1', '''1''');
- test_to_equal_fail('varchar2(4000)', 'number', '''1''', '1');
- test_to_equal_fail('varchar2(4000)', 'boolean', '''true''', 'true');
- test_to_equal_fail('interval day to second', 'interval year to month', '''2 01:00:00''', '''1-1''');
- test_to_equal_fail('interval year to month', 'interval day to second', '''1-1''', '''2 01:00:00''');
- end;
-
- procedure not_equal_fail_on_type_diff is
- begin
- test_not_to_equal_fail('boolean', 'integer', 'true', '1');
- test_not_to_equal_fail('integer', 'boolean', '1', 'true');
- test_not_to_equal_fail('blob', 'clob', 'to_blob(''ABC'')', '''ABC''');
- test_not_to_equal_fail('clob', 'blob', '''ABC''', 'to_blob(''ABC'')');
- test_not_to_equal_fail('clob', 'anydata', '''ABC''', 'null');
- test_not_to_equal_fail('anydata', 'sys_refcursor', 'null', 'null');
- test_not_to_equal_fail('sys_refcursor', 'anydata', 'null', 'null');
- test_not_to_equal_fail('clob', 'varchar2(4000)', '''Abc''', '''Abc''');
- test_not_to_equal_fail('date', 'timestamp', 'sysdate', 'sysdate');
- test_not_to_equal_fail('date', 'timestamp with local time zone', 'sysdate', 'sysdate');
- test_not_to_equal_fail('timestamp', 'date', 'sysdate', 'sysdate');
- test_not_to_equal_fail('timestamp with local time zone', 'timestamp', 'sysdate', 'sysdate');
- test_not_to_equal_fail('timestamp with local time zone', 'timestamp with time zone', 'sysdate', 'sysdate');
- test_not_to_equal_fail('number', 'varchar2(4000)', '1', '''1''');
- test_not_to_equal_fail('varchar2(4000)', 'number', '''1''', '1');
- test_not_to_equal_fail('varchar2(4000)', 'boolean', '''true''', 'true');
- test_not_to_equal_fail('interval day to second', 'interval year to month', '''2 01:00:00''', '''1-1''');
- test_not_to_equal_fail('interval year to month', 'interval day to second', '''1-1''', '''2 01:00:00''');
- end;
-
- procedure failure_on_data_diff is
- begin
- test_to_equal_fail('blob', 'to_blob(''abc'')', 'to_blob(''abd'')');
- test_to_equal_fail('boolean', 'false', 'true');
- test_to_equal_fail('boolean', 'true', 'false');
- test_to_equal_fail('clob', '''Abc''', '''abc''');
- test_to_equal_fail('date', 'sysdate', 'sysdate-1');
- test_to_equal_fail('number', '0.1', '0.3');
- test_to_equal_fail('timestamp', 'systimestamp', 'systimestamp');
- test_to_equal_fail('timestamp with local time zone', 'systimestamp', 'systimestamp');
- test_to_equal_fail('timestamp with time zone', 'systimestamp', 'systimestamp');
- test_to_equal_fail('varchar2(4000)', '''Abc''', '''abc''');
- test_to_equal_fail('interval day to second', '''2 01:00:00''', '''2 01:00:01''');
- test_to_equal_fail('interval year to month', '''1-1''', '''1-2''');
- end;
-
- procedure failure_on_actual_null is
- begin
- test_to_equal_fail('blob', 'NULL', 'to_blob(''abc'')');
- test_to_equal_fail('boolean', 'NULL', 'true');
- test_to_equal_fail('clob', 'NULL', '''abc''');
- test_to_equal_fail('date', 'NULL', 'sysdate');
- test_to_equal_fail('number', 'NULL', '1');
- test_to_equal_fail('timestamp', 'NULL', 'systimestamp');
- test_to_equal_fail('timestamp with local time zone', 'NULL', 'systimestamp');
- test_to_equal_fail('timestamp with time zone', 'NULL', 'systimestamp');
- test_to_equal_fail('varchar2(4000)', 'NULL', '''abc''');
- test_to_equal_fail('interval day to second', 'NULL', '''2 01:00:00''');
- test_to_equal_fail('interval year to month', 'NULL', '''1-1''');
- end;
-
- procedure failure_on_expected_null is
- begin
- test_to_equal_fail('blob', 'to_blob(''abc'')', 'NULL');
- test_to_equal_fail('boolean', 'true', 'NULL');
- test_to_equal_fail('clob', '''abc''', 'NULL');
- test_to_equal_fail('date', 'sysdate', 'NULL');
- test_to_equal_fail('number', '1234', 'NULL');
- test_to_equal_fail('timestamp', 'systimestamp', 'NULL');
- test_to_equal_fail('timestamp with local time zone', 'systimestamp', 'NULL');
- test_to_equal_fail('timestamp with time zone', 'systimestamp', 'NULL');
- test_to_equal_fail('varchar2(4000)', '''abc''', 'NULL');
- test_to_equal_fail('interval day to second', '''2 01:00:00''', 'NULL');
- test_to_equal_fail('interval year to month', '''1-1''', 'NULL');
- end;
-
- procedure failure_on_both_null_with_parm is
- begin
- test_to_equal_fail('blob', 'NULL', 'NULL', false);
- test_to_equal_fail('boolean', 'NULL', 'NULL', false);
- test_to_equal_fail('clob', 'NULL', 'NULL', false);
- test_to_equal_fail('date', 'NULL', 'NULL', false);
- test_to_equal_fail('number', 'NULL', 'NULL', false);
- test_to_equal_fail('timestamp', 'NULL', 'NULL', false);
- test_to_equal_fail('timestamp with local time zone', 'NULL', 'NULL', false);
- test_to_equal_fail('timestamp with time zone', 'NULL', 'NULL', false);
- test_to_equal_fail('varchar2(4000)', 'NULL', 'NULL', false);
- test_to_equal_fail('interval day to second', 'NULL', 'NULL', false);
- test_to_equal_fail('interval year to month', 'NULL', 'NULL', false);
- end;
-
- procedure failure_on_both_null_with_conf is
- begin
- ut3_tester_helper.main_helper.nulls_are_equal(false);
- test_to_equal_fail('blob', 'NULL', 'NULL');
- test_to_equal_fail('boolean', 'NULL', 'NULL');
- test_to_equal_fail('clob', 'NULL', 'NULL');
- test_to_equal_fail('date', 'NULL', 'NULL');
- test_to_equal_fail('number', 'NULL', 'NULL');
- test_to_equal_fail('timestamp', 'NULL', 'NULL');
- test_to_equal_fail('timestamp with local time zone', 'NULL', 'NULL');
- test_to_equal_fail('timestamp with time zone', 'NULL', 'NULL');
- test_to_equal_fail('varchar2(4000)', 'NULL', 'NULL');
- test_to_equal_fail('interval day to second', 'NULL', 'NULL');
- test_to_equal_fail('interval year to month', 'NULL', 'NULL');
- end;
-
- procedure success_on_equal_data is
- begin
- test_to_equal_success('blob', 'to_blob(''Abc'')', 'to_blob(''abc'')');
- test_to_equal_success('boolean', 'true', 'true');
- test_to_equal_success('clob', '''Abc''', '''Abc''');
- test_to_equal_success('date', 'sysdate', 'sysdate');
- test_to_equal_success('number', '12345', '12345');
- test_to_equal_success('timestamp(9)', 'to_Timestamp(''2016 123456789'',''yyyy ff'')', 'to_Timestamp(''2016 123456789'',''yyyy ff'')');
- test_to_equal_success('timestamp(9) with local time zone', 'to_Timestamp(''2016 123456789'',''yyyy ff'')', 'to_Timestamp(''2016 123456789'',''yyyy ff'')');
- test_to_equal_success('timestamp(9) with time zone', 'to_Timestamp(''2016 123456789'',''yyyy ff'')', 'to_Timestamp(''2016 123456789'',''yyyy ff'')');
- test_to_equal_success('varchar2(4000)', '''Abc''', '''Abc''');
- test_to_equal_success('interval day to second', '''2 01:00:00''', '''2 01:00:00''');
- test_to_equal_success('interval year to month', '''1-1''', '''1-1''');
- end;
-
- procedure success_on_both_null is
- begin
- test_to_equal_success('blob', 'NULL', 'NULL');
- test_to_equal_success('boolean', 'NULL', 'NULL');
- test_to_equal_success('clob', 'NULL', 'NULL');
- test_to_equal_success('date', 'NULL', 'NULL');
- test_to_equal_success('number', 'NULL', 'NULL');
- test_to_equal_success('timestamp', 'NULL', 'NULL');
- test_to_equal_success('timestamp with local time zone', 'NULL', 'NULL');
- test_to_equal_success('timestamp with time zone', 'NULL', 'NULL');
- test_to_equal_success('varchar2(4000)', 'NULL', 'NULL');
- test_to_equal_success('interval day to second', 'NULL', 'NULL');
- test_to_equal_success('interval year to month', 'NULL', 'NULL');
- end;
-
- procedure success_on_both_null_with_parm is
- begin
- ut3_tester_helper.main_helper.nulls_are_equal(false);
- test_to_equal_success('blob', 'NULL', 'NULL', true);
- test_to_equal_success('boolean', 'NULL', 'NULL', true);
- test_to_equal_success('clob', 'NULL', 'NULL', true);
- test_to_equal_success('date', 'NULL', 'NULL', true);
- test_to_equal_success('number', 'NULL', 'NULL', true);
- test_to_equal_success('timestamp', 'NULL', 'NULL', true);
- test_to_equal_success('timestamp with local time zone', 'NULL', 'NULL', true);
- test_to_equal_success('timestamp with time zone', 'NULL', 'NULL', true);
- test_to_equal_success('varchar2(4000)', 'NULL', 'NULL', true);
- test_to_equal_success('interval day to second', 'NULL', 'NULL', true);
- test_to_equal_success('interval year to month', 'NULL', 'NULL', true);
- end;
-
-end;
-/
diff --git a/test/ut3_user/expectations/binary/test_equal.pks b/test/ut3_user/expectations/binary/test_equal.pks
deleted file mode 100644
index 923d43a31..000000000
--- a/test/ut3_user/expectations/binary/test_equal.pks
+++ /dev/null
@@ -1,38 +0,0 @@
-create or replace package test_equal is
-
- --%suite((not)to_be_equal)
- --%suitepath(utplsql.test_user.expectations.binary)
-
- procedure reset_nulls_equal;
-
- --%aftereach
- procedure cleanup_expectations;
-
- --%test(Gives failure for different data types)
- procedure equal_fail_on_type_diff;
- --%test(Negated - gives failure for different data types)
- procedure not_equal_fail_on_type_diff;
- --%test(Gives failure for different data values)
- procedure failure_on_data_diff;
- --%test(Gives failure when actual is null)
- procedure failure_on_actual_null;
- --%test(Gives failure when expected is null)
- procedure failure_on_expected_null;
- --%test(Gives failure when both values are null and argument nulls_are_equal is false)
- procedure failure_on_both_null_with_parm;
-
- --%test(Gives failure when both values are null and configuration nulls_are_equal is false)
- --%aftertest(reset_nulls_equal)
- procedure failure_on_both_null_with_conf;
-
- --%test(Gives success for equal values)
- procedure success_on_equal_data;
- --%test(Gives success when both values are null)
- procedure success_on_both_null;
-
- --%test(Gives success when both values are null and argument nulls_are_equal is true)
- --%aftertest(reset_nulls_equal)
- procedure success_on_both_null_with_parm;
-
-end;
-/
diff --git a/test/ut3_user/expectations/binary/test_expect_to_be_less_than.pkb b/test/ut3_user/expectations/binary/test_expect_to_be_less_than.pkb
deleted file mode 100644
index dbf6e30a4..000000000
--- a/test/ut3_user/expectations/binary/test_expect_to_be_less_than.pkb
+++ /dev/null
@@ -1,263 +0,0 @@
-create or replace package body test_expect_to_be_less_than is
-
- procedure cleanup_expectations is
- begin
- ut3_tester_helper.main_helper.clear_expectations( );
- end;
-
- function to_be_less_than_block(
- a_data_type varchar2,
- a_actual varchar2,
- a_expected varchar2
- ) return varchar2 is
- begin
- return ut3_tester_helper.expectations_helper.binary_expectation_block(
- 'to_be_less_than', a_data_type, a_actual, a_data_type, a_expected
- );
- end;
-
- function not_to_be_less_than_block(
- a_data_type varchar2,
- a_actual varchar2,
- a_expected varchar2
- ) return varchar2 is
- begin
- return ut3_tester_helper.expectations_helper.binary_expectation_block(
- 'not_to_be_less_than', a_data_type, a_actual, a_data_type, a_expected
- );
- end;
-
- procedure actual_date_greater is
- begin
- --Act
- execute immediate to_be_less_than_block('date', 'sysdate', 'sysdate-1');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_number_greater is
- begin
- --Act
- execute immediate to_be_less_than_block('number', '2.0', '1.99');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_interval_ym_greater is
- begin
- --Act
- execute immediate to_be_less_than_block('interval year to month', '''2-1''', '''2-0''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_interval_ds_greater is
- begin
- --Act
- execute immediate to_be_less_than_block('interval day to second', '''2 01:00:00''', '''2 00:59:59''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_timestamp_greater is
- begin
- --Act
- execute immediate to_be_less_than_block('timestamp', 'to_timestamp(''1997 13'',''YYYY FF'')', 'to_timestamp(''1997 12'',''YYYY FF'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_timestamp_tz_greater is
- begin
- --Act
- execute immediate to_be_less_than_block('timestamp with time zone', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +02:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_timestamp_ltz_greater is
- begin
- --Act
- execute immediate to_be_less_than_block('timestamp with local time zone', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +02:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_date_equal is
- begin
- --Act
- execute immediate to_be_less_than_block('date', 'sysdate', 'sysdate');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_number_equal is
- begin
- --Act
- execute immediate to_be_less_than_block('number', '2.0', '2.00');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_interval_ym_equal is
- begin
- --Act
- execute immediate to_be_less_than_block('interval year to month', '''2-1''', '''2-1''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_interval_ds_equal is
- begin
- --Act
- execute immediate to_be_less_than_block('interval day to second', '''2 01:00:00''', '''2 01:00:00''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_timestamp_equal is
- begin
- --Act
- execute immediate to_be_less_than_block('timestamp', 'to_timestamp(''1997 13'',''YYYY FF'')', 'to_timestamp(''1997 13'',''YYYY FF'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_timestamp_tz_equal is
- begin
- --Act
- execute immediate to_be_less_than_block('timestamp with time zone', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_timestamp_ltz_equal is
- begin
- --Act
- execute immediate to_be_less_than_block('timestamp with local time zone', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure actual_date_less is
- begin
- --Act
- execute immediate to_be_less_than_block('date', 'sysdate-1', 'sysdate');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_number_less is
- begin
- --Act
- execute immediate to_be_less_than_block('number', '1.0', '1.01');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_interval_ym_less is
- begin
- --Act
- execute immediate to_be_less_than_block('interval year to month', '''2-1''', '''2-2''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_interval_ds_less is
- begin
- --Act
- execute immediate to_be_less_than_block('interval day to second', '''2 00:59:58''', '''2 00:59:59''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_timestamp_less is
- begin
- --Act
- execute immediate to_be_less_than_block('timestamp', 'to_timestamp(''1997 12'',''YYYY FF'')', 'to_timestamp(''1997 13'',''YYYY FF'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_timestamp_tz_less is
- begin
- --Act
- execute immediate to_be_less_than_block('timestamp with time zone', 'to_timestamp_tz(''1997 12 +03:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +02:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_timestamp_ltz_less is
- begin
- --Act
- execute immediate to_be_less_than_block('timestamp with local time zone', 'to_timestamp_tz(''1997 12 +03:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +02:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure not_actual_date_greater is
- begin
- --Act
- execute immediate not_to_be_less_than_block('date', 'sysdate', 'sysdate-1');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure not_actual_number_greater is
- begin
- --Act
- execute immediate not_to_be_less_than_block('number', '2.0', '1.99');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure not_actual_interval_ym_greater is
- begin
- --Act
- execute immediate not_to_be_less_than_block('interval year to month', '''2-1''', '''2-0''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure not_actual_interval_ds_greater is
- begin
- --Act
- execute immediate not_to_be_less_than_block('interval day to second', '''2 01:00:00''', '''2 00:59:59''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure not_actual_timestamp_greater is
- begin
- --Act
- execute immediate not_to_be_less_than_block('timestamp', 'to_timestamp(''1997 13'',''YYYY FF'')', 'to_timestamp(''1997 12'',''YYYY FF'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure not_actual_timestamp_tz_gretr is
- begin
- --Act
- execute immediate not_to_be_less_than_block('timestamp with time zone', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +02:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure not_actual_timestamp_ltz_gretr is
- begin
- --Act
- execute immediate not_to_be_less_than_block('timestamp with local time zone', 'to_timestamp_tz(''1997 12 +01:00'',''YYYY FF TZR'')', 'to_timestamp_tz(''1997 12 +02:00'',''YYYY FF TZR'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure actual_clob is
- begin
- --Act
- ut3_develop.ut.expect(to_clob('3')).to_( ut3_develop.be_less_than(4) );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
-end;
-/
diff --git a/test/ut3_user/expectations/binary/test_expect_to_be_less_than.pks b/test/ut3_user/expectations/binary/test_expect_to_be_less_than.pks
deleted file mode 100644
index c03f0d28e..000000000
--- a/test/ut3_user/expectations/binary/test_expect_to_be_less_than.pks
+++ /dev/null
@@ -1,97 +0,0 @@
-create or replace package test_expect_to_be_less_than is
-
- --%suite((not)to_be_less_than)
- --%suitepath(utplsql.test_user.expectations.binary)
-
- --%aftereach
- procedure cleanup_expectations;
-
- --%test(Gives failure when actual date is greater than expected)
- procedure actual_date_greater;
-
- --%test(Gives failure when actual number is greater than expected)
- procedure actual_number_greater;
-
- --%test(Gives failure when actual interval year to month is greater than expected)
- procedure actual_interval_ym_greater;
-
- --%test(Gives failure when actual interval day to second is greater than expected)
- procedure actual_interval_ds_greater;
-
- --%test(Gives failure when actual timestamp is greater than expected)
- procedure actual_timestamp_greater;
-
- --%test(Gives failure when actual timestamp with time zone is greater than expected)
- procedure actual_timestamp_tz_greater;
-
- --%test(Gives failure when actual timestamp with local time zone is greater than expected)
- procedure actual_timestamp_ltz_greater;
-
- --%test(Gives failure when actual date is equal expected)
- procedure actual_date_equal;
-
- --%test(Gives failure when actual number is equal expected)
- procedure actual_number_equal;
-
- --%test(Gives failure when actual interval year to month is equal expected)
- procedure actual_interval_ym_equal;
-
- --%test(Gives failure when actual interval day to second is equal expected)
- procedure actual_interval_ds_equal;
-
- --%test(Gives failure when actual timestamp is equal expected)
- procedure actual_timestamp_equal;
-
- --%test(Gives failure when actual timestamp with time zone is equal expected)
- procedure actual_timestamp_tz_equal;
-
- --%test(Gives failure when actual timestamp with local time zone is equal expected)
- procedure actual_timestamp_ltz_equal;
-
- --%test(Gives success when actual date is less than expected)
- procedure actual_date_less;
-
- --%test(Gives success when actual number is less than expected)
- procedure actual_number_less;
-
- --%test(Gives success when actual interval year to month is less than expected)
- procedure actual_interval_ym_less;
-
- --%test(Gives success when actual interval day to second is less than expected)
- procedure actual_interval_ds_less;
-
- --%test(Gives success when actual timestamp is less than expected)
- procedure actual_timestamp_less;
-
- --%test(Gives success when actual timestamp with time zone is less than expected)
- procedure actual_timestamp_tz_less;
-
- --%test(Gives success when actual timestamp with local time zone is less than expected)
- procedure actual_timestamp_ltz_less;
-
- --%test(Negated - Gives success when actual date is greater than expected)
- procedure not_actual_date_greater;
-
- --%test(Negated - Gives success when actual number is greater than expected)
- procedure not_actual_number_greater;
-
- --%test(Negated - Gives success when actual interval year to month is greater than expected)
- procedure not_actual_interval_ym_greater;
-
- --%test(Negated - Gives success when actual interval day to second is greater than expected)
- procedure not_actual_interval_ds_greater;
-
- --%test(Negated - Gives success when actual timestamp is greater than expected)
- procedure not_actual_timestamp_greater;
-
- --%test(Negated - Gives success when actual timestamp with time zone is greater than expected)
- procedure not_actual_timestamp_tz_gretr;
-
- --%test(Negated - Gives success when actual timestamp with local time zone is greater than expected)
- procedure not_actual_timestamp_ltz_gretr;
-
- --%test(Gives failure when running against CLOB)
- procedure actual_clob;
-
-end;
-/
diff --git a/test/ut3_user/expectations/binary/test_to_be_within.pkb b/test/ut3_user/expectations/binary/test_to_be_within.pkb
deleted file mode 100644
index c9aae6ee2..000000000
--- a/test/ut3_user/expectations/binary/test_to_be_within.pkb
+++ /dev/null
@@ -1,360 +0,0 @@
-create or replace package body test_to_be_within is
-
- procedure cleanup_expectations is
- begin
- ut3_tester_helper.main_helper.clear_expectations( );
- end;
-
- function be_within_expectation_block(
- a_matcher_name varchar2,
- a_actual_data_type varchar2,
- a_actual_data varchar2,
- a_expected_data_type varchar2,
- a_expected_data varchar2,
- a_distance varchar2,
- a_distance_data_type varchar2,
- a_matcher_end varchar2
- ) return varchar2
- is
- l_execute varchar2(32000);
- begin
- l_execute := '
- declare
- l_actual '||a_actual_data_type||' := '||a_actual_data||';
- l_expected '||a_expected_data_type||' := '||a_expected_data||';
- l_distance '||a_distance_data_type||' := '||a_distance||';
- begin
- --act - execute the expectation
- ut3_develop.ut.expect( l_actual ).'||a_matcher_name||'(l_distance).of_(l_expected)'||a_matcher_end||';
- end;';
- return l_execute;
- end;
-
- procedure test_to_be_within_fail(
- a_matcher_name varchar2,
- a_data_type varchar2,
- a_actual varchar2,
- a_expected varchar2,
- a_distance varchar2,
- a_distance_data_type varchar2,
- a_matcher_end varchar2 := null
- ) is
- begin
- execute immediate be_within_expectation_block(
- a_matcher_name,a_data_type, a_actual, a_data_type, a_expected,
- a_distance,a_distance_data_type, a_matcher_end
- );
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).not_to_equal(0);
- cleanup_expectations;
- end;
-
- procedure test_to_be_within_success(
- a_matcher_name varchar2,
- a_data_type varchar2,
- a_actual varchar2,
- a_expected varchar2,
- a_distance varchar2,
- a_distance_data_type varchar2,
- a_matcher_end varchar2 := null
- ) is
- begin
- execute immediate be_within_expectation_block(
- a_matcher_name,a_data_type, a_actual, a_data_type, a_expected,
- a_distance,a_distance_data_type, a_matcher_end
- );
- ut.expect
- (ut3_tester_helper.main_helper.get_failed_expectations_num
- ,be_within_expectation_block(
- a_matcher_name,a_data_type, a_actual, a_data_type, a_expected,
- a_distance,a_distance_data_type, a_matcher_end
- )
- ).to_equal(0);
- cleanup_expectations;
- end;
-
- procedure success_tests is
- begin
- test_to_be_within_success('to_be_within','number', '2', '4','2','number');
- test_to_be_within_success('to_be_within','number', '4', '2','2','number');
- test_to_be_within_success('to_be_within','date', 'sysdate+1', 'sysdate','''1 0:00:11.333''','interval day to second');
- test_to_be_within_success('to_be_within','date', 'sysdate', 'sysdate+1','''1 0:00:11.333''','interval day to second');
- test_to_be_within_success('to_be_within','date', 'sysdate', 'sysdate+200','''1-0''','interval year to month');
- test_to_be_within_success('to_be_within','date', 'sysdate+200', 'sysdate','''1-0''','interval year to month');
-
- test_to_be_within_success('to_be_within','timestamp', q'[TIMESTAMP '2017-08-09 07:00:00']', q'[TIMESTAMP '2017-08-08 06:59:48.667']','''1 0:00:11.333''','interval day to second');
- test_to_be_within_success('to_be_within','timestamp', q'[TIMESTAMP '2017-08-08 06:59:48.667']', q'[TIMESTAMP '2017-08-09 07:00:00']','''1 0:00:11.333''','interval day to second');
- test_to_be_within_success('to_be_within','timestamp', q'[TIMESTAMP '2017-08-09 07:00:00']', q'[TIMESTAMP '2018-08-09 07:00:00']','''1-0''','interval year to month');
- test_to_be_within_success('to_be_within','timestamp', q'[TIMESTAMP '2018-08-09 07:00:00']', q'[TIMESTAMP '2017-08-09 07:00:00']','''1-0''','interval year to month');
- test_to_be_within_success('to_be_within','timestamp_tz_unconstrained', q'[TIMESTAMP '2017-08-09 07:00:00 -7:00']', q'[TIMESTAMP '2017-08-08 05:59:48.668 -8:00']','''1 0:00:11.333''','interval day to second');
- test_to_be_within_success('to_be_within','timestamp_tz_unconstrained', q'[TIMESTAMP '2017-08-08 05:59:48.668 -8:00']', q'[TIMESTAMP '2017-08-09 07:00:00 -7:00']','''1 0:00:11.333''','interval day to second');
- test_to_be_within_success('to_be_within','timestamp_tz_unconstrained', q'[TIMESTAMP '2017-08-09 07:00:00 -7:00']', q'[TIMESTAMP '2018-08-09 07:00:00 -7:00']','''1-0''','interval year to month');
- test_to_be_within_success('to_be_within','timestamp_tz_unconstrained', q'[TIMESTAMP '2018-08-09 07:00:00 -7:00']', q'[TIMESTAMP '2017-08-09 07:00:00 -7:00']','''1-0''','interval year to month');
- test_to_be_within_success('to_be_within','timestamp_ltz_unconstrained', q'[TIMESTAMP '2017-08-09 07:00:00 -7:00']', q'[TIMESTAMP '2017-08-08 05:59:48.668 -8:00']','''1 0:00:11.333''','interval day to second');
- test_to_be_within_success('to_be_within','timestamp_ltz_unconstrained', q'[TIMESTAMP '2017-08-08 05:59:48.668 -8:00']', q'[TIMESTAMP '2017-08-09 07:00:00 -7:00']','''1 0:00:11.333''','interval day to second');
- test_to_be_within_success('to_be_within','timestamp_ltz_unconstrained', q'[TIMESTAMP '2017-08-09 07:00:00 -7:00']', q'[TIMESTAMP '2018-08-09 07:00:00 -7:00']','''1-0''','interval year to month');
- test_to_be_within_success('to_be_within','timestamp_ltz_unconstrained', q'[TIMESTAMP '2018-08-09 07:00:00 -7:00']', q'[TIMESTAMP '2017-08-09 07:00:00 -7:00']','''1-0''','interval year to month');
-
- test_to_be_within_success('to_( ut3_develop.be_within','number', '2', '4','2','number', ')');
- test_to_be_within_success('to_( ut3_develop.be_within','number', '4', '2','2','number', ')');
- test_to_be_within_success('to_( ut3_develop.be_within','date', 'sysdate+1', 'sysdate','''1 0:00:11.333''','interval day to second', ')');
- test_to_be_within_success('to_( ut3_develop.be_within','date', 'sysdate', 'sysdate+1','''1 0:00:11.333''','interval day to second', ')');
- test_to_be_within_success('to_( ut3_develop.be_within','date', 'sysdate', 'sysdate+200','''1-0''','interval year to month', ')');
- test_to_be_within_success('to_( ut3_develop.be_within','date', 'sysdate+200', 'sysdate','''1-0''','interval year to month', ')');
- test_to_be_within_success('to_( ut3_develop.be_within','timestamp', q'[TIMESTAMP '2018-08-09 07:00:00']', q'[TIMESTAMP '2017-08-09 07:00:00']','''1-0''','interval year to month', ')');
- test_to_be_within_success('to_( ut3_develop.be_within','timestamp_tz_unconstrained', q'[TIMESTAMP '2017-08-09 07:00:00 -7:00']', q'[TIMESTAMP '2017-08-08 05:59:48.668 -8:00']','''1 0:00:11.333''','interval day to second', ')');
- test_to_be_within_success('to_( ut3_develop.be_within','timestamp_ltz_unconstrained', q'[TIMESTAMP '2017-08-09 07:00:00 -7:00']', q'[TIMESTAMP '2017-08-08 05:59:48.668 -8:00']','''1 0:00:11.333''','interval day to second', ')');
- test_to_be_within_fail('not_to_be_within','number', '2', '4','2','number');
- test_to_be_within_fail('not_to_be_within','number', '4', '2','2','number');
- test_to_be_within_fail('not_to_be_within','date', 'sysdate+1', 'sysdate','''1 0:00:11.333''','interval day to second');
- test_to_be_within_fail('not_to_be_within','date', 'sysdate', 'sysdate+1','''1 0:00:11.333''','interval day to second');
- test_to_be_within_fail('not_to_be_within','date', 'sysdate', 'sysdate+200','''1-0''','interval year to month');
- test_to_be_within_fail('not_to_be_within','date', 'sysdate+200', 'sysdate','''1-0''','interval year to month');
- test_to_be_within_fail('not_to( ut3_develop.be_within','number', '2', '4','2','number',')');
- test_to_be_within_fail('not_to( ut3_develop.be_within','number', '4', '2','2','number',')');
- test_to_be_within_fail('not_to( ut3_develop.be_within','date', 'sysdate+1', 'sysdate','''1 0:00:11.333''','interval day to second',')');
- test_to_be_within_fail('not_to( ut3_develop.be_within','date', 'sysdate', 'sysdate+1','''1 0:00:11.333''','interval day to second',')');
- test_to_be_within_fail('not_to( ut3_develop.be_within','date', 'sysdate', 'sysdate+200','''1-0''','interval year to month',')');
- test_to_be_within_fail('not_to( ut3_develop.be_within','date', 'sysdate+200', 'sysdate','''1-0''','interval year to month',')');
- test_to_be_within_fail('not_to( ut3_develop.be_within','timestamp', q'[TIMESTAMP '2018-08-09 07:00:00']', q'[TIMESTAMP '2017-08-09 07:00:00']','''1-0''','interval year to month', ')');
- test_to_be_within_fail('not_to( ut3_develop.be_within','timestamp_tz_unconstrained', q'[TIMESTAMP '2017-08-09 07:00:00 -7:00']', q'[TIMESTAMP '2017-08-08 05:59:48.668 -8:00']','''1 0:00:11.333''','interval day to second', ')');
- test_to_be_within_fail('not_to( ut3_develop.be_within','timestamp_ltz_unconstrained', q'[TIMESTAMP '2017-08-09 07:00:00 -7:00']', q'[TIMESTAMP '2017-08-08 05:59:48.668 -8:00']','''1 0:00:11.333''','interval day to second', ')');
- test_to_be_within_fail('not_to_be_within','timestamp', q'[TIMESTAMP '2018-08-09 07:00:00']', q'[TIMESTAMP '2017-08-09 07:00:00']','''1-0''','interval year to month');
- test_to_be_within_fail('not_to_be_within','timestamp_tz_unconstrained', q'[TIMESTAMP '2017-08-09 07:00:00 -7:00']', q'[TIMESTAMP '2017-08-08 05:59:48.668 -8:00']','''1 0:00:11.333''','interval day to second');
- test_to_be_within_fail('not_to_be_within','timestamp_ltz_unconstrained', q'[TIMESTAMP '2017-08-09 07:00:00 -7:00']', q'[TIMESTAMP '2017-08-08 05:59:48.668 -8:00']','''1 0:00:11.333''','interval day to second');
- end;
-
- procedure failed_tests is
- begin
- test_to_be_within_fail('to_be_within','number', '2', '4','1','number');
- test_to_be_within_fail('to_be_within','number', '4', '2','1','number');
- test_to_be_within_fail('to_be_within','date', 'sysdate', 'sysdate+1','''0 0:00:11.333''','interval day to second');
- test_to_be_within_fail('to_be_within','date', 'sysdate+1', 'sysdate','''0 0:00:11.333''','interval day to second');
- test_to_be_within_fail('to_be_within','date', 'sysdate', 'sysdate+750','''1-0''','interval year to month');
- test_to_be_within_fail('to_be_within','date', 'sysdate+750', 'sysdate','''1-0''','interval year to month');
- test_to_be_within_fail('to_( ut3_develop.be_within','number', '2', '4','1','number',')');
- test_to_be_within_fail('to_( ut3_develop.be_within','number', '4', '2','1','number',')');
- test_to_be_within_fail('to_( ut3_develop.be_within','date', 'sysdate', 'sysdate+1','''0 0:00:11.333''','interval day to second',')');
- test_to_be_within_fail('to_( ut3_develop.be_within','date', 'sysdate+1', 'sysdate','''0 0:00:11.333''','interval day to second',')');
- test_to_be_within_fail('to_( ut3_develop.be_within','date', 'sysdate', 'sysdate+750','''1-0''','interval year to month',')');
- test_to_be_within_fail('to_( ut3_develop.be_within','date', 'sysdate+750', 'sysdate','''1-0''','interval year to month',')');
- test_to_be_within_success('not_to_be_within','number', '2', '4','1','number');
- test_to_be_within_success('not_to_be_within','number', '4', '2','1','number');
- test_to_be_within_success('not_to_be_within','date', 'sysdate', 'sysdate+1','''0 0:00:11.333''','interval day to second');
- test_to_be_within_success('not_to_be_within','date', 'sysdate+1', 'sysdate','''0 0:00:11.333''','interval day to second');
- test_to_be_within_success('not_to_be_within','date', 'sysdate', 'sysdate+750','''1-0''','interval year to month');
- test_to_be_within_success('not_to_be_within','date', 'sysdate+750', 'sysdate','''1-0''','interval year to month');
- test_to_be_within_success('not_to( ut3_develop.be_within','number', '2', '4','1','number',')');
- test_to_be_within_success('not_to( ut3_develop.be_within','number', '4', '2','1','number',')');
- test_to_be_within_success('not_to( ut3_develop.be_within','date', 'sysdate', 'sysdate+1','''0 0:00:11.333''','interval day to second',')');
- test_to_be_within_success('not_to( ut3_develop.be_within','date', 'sysdate+1', 'sysdate','''0 0:00:11.333''','interval day to second',')');
- test_to_be_within_success('not_to( ut3_develop.be_within','date', 'sysdate', 'sysdate+750','''1-0''','interval year to month',')');
- test_to_be_within_success('not_to( ut3_develop.be_within','date', 'sysdate+750', 'sysdate','''1-0''','interval year to month',')');
- end;
-
- procedure fail_for_number_not_within is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- --Act
- ut3_develop.ut.expect(4).to_be_within(1).of_(7);
- --Assert
- l_expected_message := q'[Actual: 4 (number) was expected to be within 1 of 7 (number)]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure fail_for_ds_int_not_within is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- --Act
- ut3_develop.ut.expect(sysdate).to_be_within(interval '1' second).of_(sysdate+1);
- --Assert
- l_expected_message := q'[Actual: % (date) was expected to be within 1 second of % (date)]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure fail_for_custom_ds_int is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- --Act
- ut3_develop.ut.expect(sysdate).to_be_within(INTERVAL '2 3:04:11.333' DAY TO SECOND).of_(sysdate+100);
- --Assert
- l_expected_message := q'[Actual: % (date) was expected to be within 2 days 3 hours 4 minutes 11.333 seconds of % (date)]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure fail_for_ym_int_not_within is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- --Act
- ut3_develop.ut.expect(sysdate).to_be_within(INTERVAL '1' MONTH).of_(sysdate+ 47);
- --Assert
- l_expected_message := q'[Actual: % (date) was expected to be within 1 month of % (date)]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure fail_for_custom_ym_int is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- --Act
- ut3_develop.ut.expect(sysdate).to_be_within(INTERVAL '1-3' YEAR TO MONTH).of_(sysdate+720);
- --Assert
- l_expected_message := q'[Actual: % (date) was expected to be within 1 year 3 months % (date)]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure fail_msg_when_not_within is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- --Act
- ut3_develop.ut.expect(1).to_be_within(3).of_(12);
- --Assert
- l_expected_message := q'[Actual: 1 (number) was expected to be within 3 of 12 (number)]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure fail_msg_wrong_types is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Act
- ut3_develop.ut.expect(sysdate).to_be_within(interval '1' second).of_(systimestamp);
- --Assert
- l_expected_message := q'[Matcher 'be within' cannot be used to compare Actual (date) with Expected (timestamp with time zone) using distance (interval day to second).]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure null_expected is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Act
- ut3_develop.ut.expect(sysdate).to_be_within(interval '1' second).of_(to_date(null));
- --Assert
- l_expected_message := q'[Actual: % (date) was expected to be within 1 second of NULL (date)]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure null_actual_and_expected is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Act
- ut3_develop.ut.expect(to_date(null)).to_be_within(interval '1' second).of_(to_date(null));
- --Assert
- l_expected_message := q'[Actual: NULL (date) was expected to be within 1 second of NULL (date)]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure null_actual is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Act
- ut3_develop.ut.expect(to_date(null)).to_be_within(interval '1' second).of_(sysdate);
- --Assert
- l_expected_message := q'[Actual: NULL (date) was expected to be within 1 second of % (date)]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
-
- procedure null_distance is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Act
- ut3_develop.ut.expect(sysdate).to_be_within(cast(null as interval day to second)).of_(sysdate);
- --Assert
- l_expected_message := q'[Actual: % (date) was expected to be within NULL of % (date)]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
-
- procedure invalid_distance_for_number is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Act
- ut3_develop.ut.expect(2).to_be_within(interval '1' second).of_(1);
- --Assert
- l_expected_message := q'[Matcher 'be within' cannot be used to compare Actual (number) with Expected (number) using distance (interval day to second).]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
-
- procedure invalid_distance_for_timestamp is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Act
- ut3_develop.ut.expect(sysdate).to_be_within(1).of_(sysdate);
- --Assert
- l_expected_message := q'[Matcher 'be within' cannot be used to compare Actual (date) with Expected (date) using distance (number).]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure failure_on_tiny_time_diff is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Act
- ut3_develop.ut.expect(timestamp'2022-01-29 23:23:23.000000009').to_be_within(interval '0.000000001' second).of_(timestamp'2022-01-29 23:23:23.000000001');
- --Assert
- l_expected_message := q'[Actual: 2022-01-29T23:23:23.000000009 (timestamp) was expected to be within .000000001 seconds of 2022-01-29T23:23:23.000000001 (timestamp)]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
-
- procedure failure_on_large_years_compare is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Act
- ut3_develop.ut.expect(to_date('-4000-01-01','syyyy-mm-dd')).to_be_within(interval '9990' year).of_(date '9999-12-31');
- --Assert
- l_expected_message := q'[Actual: -4000-01-01T00:00:00 (date) was expected to be within 9990 years of 9999-12-31T00:00:00 (date)]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
-end;
-/
diff --git a/test/ut3_user/expectations/binary/test_to_be_within.pks b/test/ut3_user/expectations/binary/test_to_be_within.pks
deleted file mode 100644
index 966e9baaf..000000000
--- a/test/ut3_user/expectations/binary/test_to_be_within.pks
+++ /dev/null
@@ -1,61 +0,0 @@
-create or replace package test_to_be_within is
-
- --%suite((not)to_be_within)
- --%suitepath(utplsql.test_user.expectations.binary)
-
- --%aftereach
- procedure cleanup_expectations;
-
- --%test(gives success for values within a distance)
- procedure success_tests;
-
- --%test(gives failure when value is not within distance)
- procedure failed_tests;
-
- --%test(returns well formatted failure message when expectation fails)
- procedure fail_for_number_not_within;
-
- --%test(returns well formatted failure message for inteval of 1 sec not within)
- procedure fail_for_ds_int_not_within;
-
- --%test(returns well formatted failure message for custom ds interval not within)
- procedure fail_for_custom_ds_int;
-
- --%test(returns well formatted failure message for inteval of 1 month not within)
- procedure fail_for_ym_int_not_within;
-
- --%test(returns well formatted failure message for custom ym interval not within)
- procedure fail_for_custom_ym_int;
-
- --%test(returns well formatted failure message for simple within)
- procedure fail_msg_when_not_within;
-
- --%test(returns well formatted failure message when comparing different datatypes)
- procedure fail_msg_wrong_types;
-
- --%test(failure on null expected value)
- procedure null_expected;
-
- --%test(failure on null actual value)
- procedure null_actual;
-
- --%test(failure on null expected and actual value)
- procedure null_actual_and_expected;
-
- --%test(failure on null distance value)
- procedure null_distance;
-
- --%test(failure on invalid distance datatype for number expected)
- procedure invalid_distance_for_number;
-
- --%test(failure on invalid distance datatype for timestamp expected)
- procedure invalid_distance_for_timestamp;
-
- --%test(failure on exceeding difference in day second time by nanosecond)
- procedure failure_on_tiny_time_diff;
-
- --%test(failure when comparing very large year difference)
- procedure failure_on_large_years_compare;
-
-end;
-/
diff --git a/test/ut3_user/expectations/binary/test_to_be_within_pct.pkb b/test/ut3_user/expectations/binary/test_to_be_within_pct.pkb
deleted file mode 100644
index da634d90e..000000000
--- a/test/ut3_user/expectations/binary/test_to_be_within_pct.pkb
+++ /dev/null
@@ -1,221 +0,0 @@
-create or replace package body test_to_be_within_pct is
-
- procedure cleanup_expectations is
- begin
- ut3_tester_helper.main_helper.clear_expectations( );
- end;
-
- function be_within_expectation_block(
- a_matcher varchar2,
- a_actual_type varchar2,
- a_actual varchar2,
- a_expected_type varchar2,
- a_expected varchar2,
- a_distance varchar2,
- a_distance_type varchar2,
- a_matcher_end varchar2
- ) return varchar2
- is
- l_execute varchar2(32000);
- begin
- l_execute := '
- declare
- l_actual '||a_actual_type||' := '||a_actual||';
- l_expected '||a_expected_type||' := '||a_expected||';
- l_distance '||a_distance_type||' := '||a_distance||';
- begin
- --act - execute the expectation
- ut3_develop.ut.expect( l_actual ).'||a_matcher||'( l_distance ).of_( l_expected )'||a_matcher_end||';
- end;';
- return l_execute;
- end;
-
- procedure test_to_be_within_fail(
- a_matcher varchar2,
- a_actual_type varchar2,
- a_actual varchar2,
- a_expected_type varchar2,
- a_expected varchar2,
- a_distance varchar2,
- a_distance_type varchar2,
- a_failure_message varchar2 := null,
- a_matcher_end varchar2 := null
- ) is
- l_failure_text varchar2(4000);
- begin
- execute immediate be_within_expectation_block(
- a_matcher,a_actual_type, a_actual, a_expected_type, a_expected,
- a_distance,a_distance_type, a_matcher_end
- );
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(1);
- if a_failure_message is not null then
- l_failure_text := ut3_tester_helper.main_helper.get_failed_expectations(1);
- ut.expect( l_failure_text ).to_be_like('%'||a_failure_message||'%' );
- end if;
- cleanup_expectations;
- end;
-
- procedure test_to_be_within_success(
- a_matcher varchar2,
- a_actual_type varchar2,
- a_actual varchar2,
- a_expected_type varchar2,
- a_expected varchar2,
- a_distance varchar2,
- a_distance_type varchar2,
- a_matcher_end varchar2 := null
- ) is
- begin
- execute immediate be_within_expectation_block(
- a_matcher,a_actual_type, a_actual, a_expected_type, a_expected,
- a_distance,a_distance_type, a_matcher_end
- );
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- cleanup_expectations;
- end;
-
-
- procedure test_to_be_within_error(
- a_matcher varchar2,
- a_actual_type varchar2,
- a_actual varchar2,
- a_expected_type varchar2,
- a_expected varchar2,
- a_distance varchar2,
- a_distance_type varchar2,
- a_error_message varchar2,
- a_matcher_end varchar2 := null
- ) is
- begin
- execute immediate be_within_expectation_block(
- a_matcher,a_actual_type, a_actual, a_expected_type, a_expected,
- a_distance,a_distance_type, a_matcher_end
- );
- cleanup_expectations;
- ut.fail('Expected exception but nothing was raised');
- exception
- when others then
- ut.expect(sqlerrm).to_be_like('%'||a_error_message||'%');
- cleanup_expectations;
- end;
-
-
- procedure expect_success is
- begin
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- cleanup_expectations;
- end;
-
- procedure expect_failure is
- begin
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(1);
- cleanup_expectations;
- end;
-
- procedure success_tests is
- begin
- ut3_develop.ut.expect( 1 ).to_be_within_pct( 0.01 ).of_(1.0001);
- expect_success;
-
- ut3_develop.ut.expect( 1.0001 ).to_( ut3_develop.be_within_pct( 0.01 ).of_(1) );
- expect_success;
-
- ut3_develop.ut.expect( 1.0002 ).not_to_be_within_pct( 0.01 ).of_(1);
- expect_success;
-
- ut3_develop.ut.expect( 1 ).not_to( ut3_develop.be_within_pct( 0.01 ).of_(1.0002) );
- expect_success;
-
- ut3_develop.ut.expect( 1.0001 ).to_be_within_pct( -0.01 ).of_(1);
- expect_success;
-
- ut3_develop.ut.expect( 1 ).to_( ut3_develop.be_within_pct( -0.01 ).of_(1.0001) );
- expect_success;
-
- ut3_develop.ut.expect( 1.00000001 ).not_to_be_within_pct( 0 ).of_(1);
- expect_success;
-
- ut3_develop.ut.expect( 0 ).not_to( ut3_develop.be_within_pct( 0.01 ).of_(0.000001) );
- expect_success;
-
- ut3_develop.ut.expect( 0 ).to_be_within_pct( 0 ).of_( 0 );
- expect_success;
-
- ut3_develop.ut.expect( 0 ).to_be_within_pct( 100 ).of_( 1 );
- expect_success;
-
- ut3_develop.ut.expect( -1 ).to_be_within_pct( 200 ).of_( 1 );
- expect_success;
- end;
-
- procedure failed_tests is
- begin
- ut3_develop.ut.expect( 1 ).not_to_be_within_pct( 0.01 ).of_(1.0001);
- expect_failure;
-
- ut3_develop.ut.expect( 1.0001 ).not_to( ut3_develop.be_within_pct( 0.01 ).of_(1) );
- expect_failure;
-
- ut3_develop.ut.expect( 1.0002 ).to_be_within_pct( 0.01 ).of_(1);
- expect_failure;
-
- ut3_develop.ut.expect( 1 ).to_( ut3_develop.be_within_pct( 0.01 ).of_(1.0002) );
- expect_failure;
-
- ut3_develop.ut.expect( 1.0001 ).not_to_be_within_pct( -0.01 ).of_(1);
- expect_failure;
-
- ut3_develop.ut.expect( 1 ).not_to( ut3_develop.be_within_pct( -0.01 ).of_(1.0001) );
- expect_failure;
-
- ut3_develop.ut.expect( 1.00000001 ).to_be_within_pct( 0 ).of_(1);
- expect_failure;
-
- ut3_develop.ut.expect( 0 ).to_( ut3_develop.be_within_pct( 0.01 ).of_(0.000001) );
- expect_failure;
-
- ut3_develop.ut.expect( 0 ).not_to_be_within_pct( 0 ).of_( 0 );
- expect_failure;
-
- ut3_develop.ut.expect( 0 ).not_to_be_within_pct( 100 ).of_( 1 );
- expect_failure;
-
- ut3_develop.ut.expect( -1 ).not_to_be_within_pct( 200 ).of_( 1 );
- expect_failure;
- end;
-
- procedure fail_for_number_not_within is
- begin
- test_to_be_within_fail(
- 'to_be_within_pct','number', '4', 'number','7',
- '1','number',
- q'[Actual: 4 (number) was expected to be within 1 % of 7 (number)]'
- );
- end;
-
- procedure fail_at_invalid_argument_types is
- begin
- test_to_be_within_error(
- 'to_be_within_pct','date', 'sysdate', 'date','sysdate',
- '''0 0:00:11.333''','interval day to second',
- 'wrong number or types of arguments in call to ''TO_BE_WITHIN_PCT'''
- );
- test_to_be_within_error(
- 'to_be_within_pct','number','1', 'date', 'sysdate',
- '1','number',
- ' wrong number or types of arguments in call to ''OF_'''
- );
- test_to_be_within_error(
- 'to_be_within_pct','number','1','number','1',
- 'sysdate', 'date',
- ' wrong number or types of arguments in call to ''TO_BE_WITHIN_PCT'''
- );
- test_to_be_within_fail(
- 'to_be_within_pct','date', 'sysdate', 'number','1',
- '1','number',
- 'Matcher ''be within pct'' cannot be used to compare Actual (date) with Expected (number) using distance (number).'
- );
- end;
-
-end;
-/
diff --git a/test/ut3_user/expectations/binary/test_to_be_within_pct.pks b/test/ut3_user/expectations/binary/test_to_be_within_pct.pks
deleted file mode 100644
index 4b8f0cb4c..000000000
--- a/test/ut3_user/expectations/binary/test_to_be_within_pct.pks
+++ /dev/null
@@ -1,22 +0,0 @@
-create or replace package test_to_be_within_pct is
-
- --%suite((not)to_be_within_pct)
- --%suitepath(utplsql.test_user.expectations.binary)
-
- --%aftereach
- procedure cleanup_expectations;
-
- --%test(gives success for values within a distance)
- procedure success_tests;
-
- --%test(gives failure when number is not within distance)
- procedure failed_tests;
-
- --%test(returns well formatted failure message when expectation fails)
- procedure fail_for_number_not_within;
-
- --%test(fails at compile or run time for unsupported data-types )
- procedure fail_at_invalid_argument_types;
-
-end;
-/
diff --git a/test/ut3_user/expectations/test_expectation_anydata.pkb b/test/ut3_user/expectations/test_expectation_anydata.pkb
deleted file mode 100644
index 5f76e6715..000000000
--- a/test/ut3_user/expectations/test_expectation_anydata.pkb
+++ /dev/null
@@ -1,1257 +0,0 @@
-create or replace package body test_expectation_anydata is
-
- g_test_expected anydata;
- g_test_actual anydata;
-
- procedure cleanup_expectations is
- begin
- ut3_tester_helper.main_helper.clear_expectations( );
- end;
-
- procedure cleanup is
- begin
- g_test_expected := null;
- g_test_actual := null;
- cleanup_expectations();
- end;
-
- procedure fail_on_different_type_null is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- g_test_expected := anydata.convertObject( cast(null as ut3_tester_helper.test_dummy_object) );
- g_test_actual := anydata.convertObject( cast(null as ut3_tester_helper.other_dummy_object) );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- --Assert
- l_expected_message := q'[%Actual (ut3_tester_helper.other_dummy_object) cannot be compared to Expected (ut3_tester_helper.test_dummy_object) using matcher 'equal'.]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure fail_on_different_type is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_object(1, 'A', '0') );
- g_test_actual := anydata.convertObject( ut3_tester_helper.other_dummy_object(1, 'A', '0') );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- --Assert
- l_expected_message := q'[%Actual (ut3_tester_helper.other_dummy_object) cannot be compared to Expected (ut3_tester_helper.test_dummy_object) using matcher 'equal'.]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure fail_on_different_object_data is
- begin
- --Arrange
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_object(1, 'A', '0') );
- g_test_actual := anydata.convertObject( ut3_tester_helper.test_dummy_object(1, null, '0') );
- --Act
- ut3_develop.ut.expect( g_test_actual ).not_to_equal( g_test_expected );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure fail_on_one_object_null is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_object(1, 'A', '0') );
- g_test_actual := anydata.convertObject( cast(null as ut3_tester_helper.test_dummy_object) );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- --Assert
- l_expected_message := q'[%Actual: ut3_tester_helper.test_dummy_object was expected to equal: ut3_tester_helper.test_dummy_object
-%Diff:
-%Rows: [ 1 differences ]
-%Row No. 1 - Missing: 1A0]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
-
- end;
-
- procedure fail_on_collection_vs_object is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_object(1, 'A', '0') );
- g_test_actual := anydata.convertCollection( ut3_tester_helper.test_dummy_object_list(ut3_tester_helper.test_dummy_object(1, 'A', '0')) );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- --Assert
- l_expected_message := q'[%Actual (ut3_tester_helper.test_dummy_object_list) cannot be compared to Expected (ut3_tester_helper.test_dummy_object) using matcher 'equal'.]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure fail_on_null_vs_empty_coll is
- l_null_list ut3_tester_helper.test_dummy_object_list;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- g_test_expected := anydata.convertCollection( ut3_tester_helper.test_dummy_object_list() );
- g_test_actual := anydata.convertCollection( l_null_list );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- --Assert
- l_expected_message := q'[%Actual: ut3_tester_helper.test_dummy_object_list [ null ] was expected to equal: ut3_tester_helper.test_dummy_object_list [ count = 0 ]]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
-
- end;
-
- procedure fail_on_one_collection_null is
- l_null_list ut3_tester_helper.test_dummy_object_list;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- g_test_expected := anydata.convertCollection( ut3_tester_helper.test_dummy_object_list(ut3_tester_helper.test_dummy_object(1, 'A', '0')) );
- g_test_actual := anydata.convertCollection( l_null_list );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- --Assert
- l_expected_message := q'[%Actual: ut3_tester_helper.test_dummy_object_list [ null ] was expected to equal: ut3_tester_helper.test_dummy_object_list [ count = 1 ]
-%Diff:
-%Rows: [ 1 differences ]
-%Row No. 1 - Missing: 1A0]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure fail_on_one_collection_empty is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- g_test_expected := anydata.convertCollection( ut3_tester_helper.test_dummy_object_list(ut3_tester_helper.test_dummy_object(1, 'A', '0')) );
- g_test_actual := anydata.convertCollection( ut3_tester_helper.test_dummy_object_list() );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- --Assert
- l_expected_message := q'[%Actual: ut3_tester_helper.test_dummy_object_list [ count = 0 ] was expected to equal: ut3_tester_helper.test_dummy_object_list [ count = 1 ]
-%Diff:
-%Rows: [ 1 differences ]
-%Row No. 1 - Missing: 1A0]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
-
- end;
-
- procedure fail_on_different_coll_data is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- l_obj ut3_tester_helper.test_dummy_object := ut3_tester_helper.test_dummy_object(1, 'A', '0');
- begin
- --Arrange
- g_test_expected := anydata.convertCollection( ut3_tester_helper.test_dummy_object_list(l_obj) );
- g_test_actual := anydata.convertCollection( ut3_tester_helper.test_dummy_object_list(l_obj, l_obj) );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- --Assert
- l_expected_message := q'[%Actual: ut3_tester_helper.test_dummy_object_list [ count = 2 ] was expected to equal: ut3_tester_helper.test_dummy_object_list [ count = 1 ]
-%Diff:
-%Rows: [ 1 differences ]
-%Row No. 2 - Extra: 1A0]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- --%test(Gives success when both anydata are NULL)
- procedure success_on_both_anydata_null is
- --Arrange
- l_null_anydata anydata;
- begin
- --Act
- ut3_develop.ut.expect( l_null_anydata ).to_equal( l_null_anydata );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure success_on_both_object_null is
- --Arrange
- l_null_object ut3_tester_helper.test_dummy_object;
- l_anydata anydata := anydata.convertObject(l_null_object);
- begin
- --Act
- ut3_develop.ut.expect( l_anydata ).to_equal( l_anydata );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure success_on_both_coll_null is
- --Arrange
- l_null_collection ut3_tester_helper.test_dummy_object_list;
- l_anydata anydata := anydata.convertCollection(l_null_collection);
- begin
- --Act
- ut3_develop.ut.expect( l_anydata ).to_equal( l_anydata );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure success_on_same_coll_data is
- begin
- --Arrange
- g_test_expected := anydata.convertCollection( ut3_tester_helper.test_dummy_object_list(ut3_tester_helper.test_dummy_object(1, 'A', '0')) );
- g_test_actual := anydata.convertCollection( ut3_tester_helper.test_dummy_object_list(ut3_tester_helper.test_dummy_object(1, 'A', '0')) );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure fail_on_coll_different_order is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- l_first_obj ut3_tester_helper.test_dummy_object := ut3_tester_helper.test_dummy_object(1, 'A', '0');
- l_second_obj ut3_tester_helper.test_dummy_object := ut3_tester_helper.test_dummy_object(2, 'b', '1');
- begin
- --Arrange
- g_test_expected := anydata.convertCollection( ut3_tester_helper.test_dummy_object_list(l_first_obj, l_second_obj) );
- g_test_actual := anydata.convertCollection( ut3_tester_helper.test_dummy_object_list(l_second_obj, l_first_obj) );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure success_on_same_object_data is
- begin
- --Arrange
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_object(1, 'A', '0') );
- g_test_actual := anydata.convertObject( ut3_tester_helper.test_dummy_object(1, 'A', '0') );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure exclude_attributes_as_list is
- l_list ut3_develop.ut_varchar2_list;
- begin
- --Arrange
- l_list := ut3_develop.ut_varchar2_list('Value','/ID');
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_object(id=>1, "name"=>'A',"Value"=>'0') );
- g_test_actual := anydata.convertObject( ut3_tester_helper.test_dummy_object(id=>3, "name"=>'A',"Value"=>'1') );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected, a_exclude=> l_list );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure exclude_attributes_as_csv is
- l_list varchar2(100);
- begin
- --Arrange
- l_list := 'Value,ID';
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_object(id=>1, "name"=>'A',"Value"=>'0') );
- g_test_actual := anydata.convertObject( ut3_tester_helper.test_dummy_object(id=>2, "name"=>'A',"Value"=>'1') );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected, a_exclude=> l_list );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure exclude_attributes_xpath is
- l_xpath varchar2(100);
- begin
- --Arrange
- l_xpath := '//Value|//ID';
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_object(id=>1, "name"=>'A',"Value"=>'0') );
- g_test_actual := anydata.convertObject( ut3_tester_helper.test_dummy_object(id=>2, "name"=>'A',"Value"=>'1') );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected, a_exclude=> l_xpath );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure exclude_ignores_invalid_attrib is
- l_exclude varchar2(100);
- begin
- --Arrange
- l_exclude := 'BadAttributeName';
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_object(id=>1, "name"=>'A',"Value"=>'0') );
- g_test_actual := anydata.convertObject( ut3_tester_helper.test_dummy_object(id=>1, "name"=>'A',"Value"=>'0') );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected, a_exclude=> l_exclude );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure include_attributes_as_list is
- l_list ut3_develop.ut_varchar2_list;
- begin
- --Arrange
- l_list := ut3_develop.ut_varchar2_list('Value','ID');
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_object(id=>1, "name"=>'A',"Value"=>'0') );
- g_test_actual := anydata.convertObject( ut3_tester_helper.test_dummy_object(id=>1, "name"=>'b',"Value"=>'0') );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected ).include( l_list );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure include_attributes_as_csv is
- l_xpath varchar2(100);
- begin
- --Arrange
- l_xpath := 'key,ID';
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_object(id=>1, "name"=>'A',"Value"=>'0') );
- g_test_actual := anydata.convertObject( ut3_tester_helper.test_dummy_object(id=>1, "name"=>'A',"Value"=>'1') );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected ).include( l_xpath );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure include_attributes_xpath is
- l_xpath varchar2(100);
- begin
- --Arrange
- l_xpath := '//key|//ID';
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_object(id=>1, "name"=>'A',"Value"=>'0') );
- g_test_actual := anydata.convertObject( ut3_tester_helper.test_dummy_object(id=>1, "name"=>'A',"Value"=>'1') );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected ).include( l_xpath );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure include_ignores_invalid_attrib is
- l_include varchar2(100);
- begin
- --Arrange
- l_include := ' BadAttributeName, ID ';
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_object(id=>1, "name"=>'B',"Value"=>'0') );
- g_test_actual := anydata.convertObject( ut3_tester_helper.test_dummy_object(id=>1, "name"=>'A',"Value"=>'1') );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected ).include( l_include );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure include_exclude_attributes_csv is
- l_exclude varchar2(100);
- l_include varchar2(100);
- begin
- --Arrange
- l_include := 'key,ID,Value';
- l_exclude := '//key|//Value';
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_object(id=>1, "name"=>'B',"Value"=>'0') );
- g_test_actual := anydata.convertObject( ut3_tester_helper.test_dummy_object(id=>1, "name"=>'A',"Value"=>'1') );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected ).exclude( l_exclude ).include( l_include );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure include_exclude_attrib_list is
- l_exclude ut3_develop.ut_varchar2_list;
- l_include ut3_develop.ut_varchar2_list;
- l_expected varchar2(32767);
- l_actual varchar2(32767);
- begin
- --Arrange
- l_include := ut3_develop.ut_varchar2_list('key','ID','Value');
- l_exclude := ut3_develop.ut_varchar2_list('key','Value');
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_object(id=>1, "name"=>'B',"Value"=>'0') );
- g_test_actual := anydata.convertObject( ut3_tester_helper.test_dummy_object(id=>1, "name"=>'A',"Value"=>'1') );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected ).exclude( l_exclude ).include( l_include );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure reports_diff_attribute is
- l_expected varchar2(32767);
- l_actual varchar2(32767);
- begin
- --Arrange
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_object(1, 'A', '0') );
- g_test_actual := anydata.convertObject( ut3_tester_helper.test_dummy_object(1, NULL, '0') );
- l_expected := q'[Actual: ut3_tester_helper.test_dummy_object was expected to equal: ut3_tester_helper.test_dummy_object
-Diff:
-Rows: [ 1 differences ]
- Row No. 1 - Actual:
- Row No. 1 - Expected: A]';
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- --Assert
- l_actual := ut3_tester_helper.main_helper.get_failed_expectations(1);
- ut.expect(l_actual).to_be_like(l_expected);
- end;
-
-
- procedure reports_diff_structure is
- l_obj ut3_tester_helper.test_dummy_object := ut3_tester_helper.test_dummy_object(1, 'A', '0');
- l_expected varchar2(32767);
- l_actual varchar2(32767);
- begin
- --Arrange
- g_test_expected := anydata.convertCollection( ut3_tester_helper.test_dummy_object_list(l_obj) );
- g_test_actual := anydata.convertCollection( ut3_tester_helper.test_dummy_object_list(l_obj, l_obj) );
- l_expected := q'[Actual: ut3_tester_helper.test_dummy_object_list [ count = 2 ] was expected to equal: ut3_tester_helper.test_dummy_object_list [ count = 1 ]
-Diff:
-Rows: [ 1 differences ]
- Row No. 2 - Extra: 1A0]';
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- --Assert
- l_actual := ut3_tester_helper.main_helper.get_failed_expectations(1);
- ut.expect(l_actual).to_be_like(l_expected);
- end;
-
- function get_anydata return anydata is
- begin
- return anydata.convertObject( ut3_tester_helper.test_dummy_object(1, 'B', '0') );
- end;
-
- procedure deprec_to_equal_excl_varch is
- begin
- --Act
- ut3_develop.ut.expect(get_anydata()).to_equal(get_anydata(), a_exclude => 'A_COLUMN,Some_Col');
- --Assert
- ut.expect(cardinality(ut3_tester_helper.main_helper.get_warnings())).to_equal(1);
- ut.expect(ut3_tester_helper.main_helper.get_warnings()(1)).to_be_like('The syntax: "%" is deprecated.%');
- end;
-
- procedure deprec_to_equal_excl_list is
- begin
- --Act
- ut3_develop.ut.expect(get_anydata()).to_equal(get_anydata(), a_exclude => ut3_develop.ut_varchar2_list('A_COLUMN','Some_Col'));
- --Assert
- ut.expect(cardinality(ut3_tester_helper.main_helper.get_warnings())).to_equal(1);
- ut.expect(ut3_tester_helper.main_helper.get_warnings()(1)).to_be_like('The syntax: "%" is deprecated.%');
- end;
-
- procedure deprec_not_to_equal_excl_varch is
- begin
- --Act
- ut3_develop.ut.expect(get_anydata()).not_to_equal(get_anydata(), a_exclude => 'A_COLUMN,Some_Col');
- --Assert
- ut.expect(cardinality(ut3_tester_helper.main_helper.get_warnings())).to_equal(1);
- ut.expect(ut3_tester_helper.main_helper.get_warnings()(1)).to_be_like('The syntax: "%" is deprecated.%');
- end;
-
- procedure deprec_not_to_equal_excl_list is
- begin
- --Act
- ut3_develop.ut.expect(get_anydata()).not_to_equal(get_anydata(), a_exclude => ut3_develop.ut_varchar2_list('A_COLUMN','Some_Col'));
- --Assert
- ut.expect(cardinality(ut3_tester_helper.main_helper.get_warnings())).to_equal(1);
- ut.expect(ut3_tester_helper.main_helper.get_warnings()(1)).to_be_like('The syntax: "%" is deprecated.%');
- end;
-
- procedure deprec_equal_excl_varch is
- begin
- --Act
- ut3_develop.ut.expect(get_anydata()).to_(ut3_develop.equal(get_anydata(), a_exclude => 'A_COLUMN,Some_Col'));
- --Assert
- ut.expect(cardinality(ut3_tester_helper.main_helper.get_warnings())).to_equal(1);
- ut.expect(ut3_tester_helper.main_helper.get_warnings()(1)).to_be_like('The syntax: "%" is deprecated.%');
- end;
-
- procedure deprec_equal_excl_list is
- begin
- --Act
- ut3_develop.ut.expect(get_anydata()).to_(ut3_develop.equal(get_anydata(), a_exclude => ut3_develop.ut_varchar2_list('A_COLUMN','Some_Col')));
- --Assert
- ut.expect(cardinality(ut3_tester_helper.main_helper.get_warnings())).to_equal(1);
- ut.expect(ut3_tester_helper.main_helper.get_warnings()(1)).to_be_like('The syntax: "%" is deprecated.%');
- end;
-
- procedure data_diff_on_atr_data_mismatch is
- l_actual ut3_tester_helper.test_dummy_object_list;
- l_expected ut3_tester_helper.test_dummy_object_list;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum)
- bulk collect into l_actual
- from dual connect by level <=2;
- select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum)
- bulk collect into l_expected
- from dual connect by level <=2
- order by rownum desc;
- --Act
- ut3_develop.ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
-
- l_expected_message := q'[Actual: ut3_tester_helper.test_dummy_object_list [ count = 2 ] was expected to equal: ut3_tester_helper.test_dummy_object_list [ count = 2 ]
-Diff:
-Rows: [ 2 differences ]
- Row No. 1 - Actual: 1Something 11
- Row No. 1 - Expected: 2Something 22
- Row No. 2 - Actual: 2Something 22
- Row No. 2 - Expected: 1Something 11]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure data_diff_on_20_rows_only is
- l_actual ut3_tester_helper.test_dummy_object_list;
- l_expected ut3_tester_helper.test_dummy_object_list;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- select ut3_tester_helper.test_dummy_object( rn, 'Something '||rn, rn1)
- bulk collect into l_actual
- from (select rownum * case when mod(rownum,2) = 0 then -1 else 1 end rn,
- rownum * case when mod(rownum,4) = 0 then -1 else 1 end rn1
- from dual connect by level <=100);
- select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum)
- bulk collect into l_expected
- from dual connect by level <=110;
- --Act
- ut3_develop.ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
-
- l_expected_message := q'[Actual: ut3_tester_helper.test_dummy_object_list [ count = 100 ] was expected to equal: ut3_tester_helper.test_dummy_object_list [ count = 110 ]
-Diff:
-Rows: [ 60 differences, showing first 20 ]
- Row No. 2 - Actual: -2Something -2
- Row No. 2 - Expected: 2Something 2
- Row No. 4 - Actual: -4Something -4-4
- Row No. 4 - Expected: 4Something 44
- %
- Row No. 38 - Actual: -38Something -38
- Row No. 38 - Expected: 38Something 38
- Row No. 40 - Actual: -40Something -40-40
- Row No. 40 - Expected: 40Something 4040]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure collection_include_list is
- l_actual ut3_tester_helper.test_dummy_object_list;
- l_expected ut3_tester_helper.test_dummy_object_list;
- l_list ut3_develop.ut_varchar2_list;
- begin
- l_list := ut3_develop.ut_varchar2_list('Value','ID');
- --Arrange
- select ut3_tester_helper.test_dummy_object( rownum, 'SomethingsDifferent '||rownum, rownum)
- bulk collect into l_actual
- from dual connect by level <=2;
- select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum)
- bulk collect into l_expected
- from dual connect by level <=2;
- --Act
- ut3_develop.ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected)).include( l_list );
-
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure collection_exclude_list is
- l_actual ut3_tester_helper.test_dummy_object_list;
- l_expected ut3_tester_helper.test_dummy_object_list;
- l_list ut3_develop.ut_varchar2_list;
- begin
- l_list := ut3_develop.ut_varchar2_list('Value','ID');
- --Arrange
- select ut3_tester_helper.test_dummy_object( rownum*2, 'Something '||rownum, rownum*2)
- bulk collect into l_actual
- from dual connect by level <=2;
- select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum)
- bulk collect into l_expected
- from dual connect by level <=2;
- --Act
- ut3_develop.ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected)).exclude( l_list );
-
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure collection_include_list_fail is
- l_actual ut3_tester_helper.test_dummy_object_list;
- l_expected ut3_tester_helper.test_dummy_object_list;
- l_list ut3_develop.ut_varchar2_list;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- l_list := ut3_develop.ut_varchar2_list('name');
- --Arrange
- select ut3_tester_helper.test_dummy_object( rownum, 'SomethingsDifferent '||rownum, rownum)
- bulk collect into l_actual
- from dual connect by level <=2;
- select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum)
- bulk collect into l_expected
- from dual connect by level <=2;
- --Act
- ut3_develop.ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected)).include( l_list );
-
- l_expected_message := q'[%Actual: ut3_tester_helper.test_dummy_object_list [ count = 2 ] was expected to equal: ut3_tester_helper.test_dummy_object_list [ count = 2 ]
-%Diff:
-%Rows: [ 2 differences ]
-%Row No. 1 - Actual: SomethingsDifferent 1
-%Row No. 1 - Expected: Something 1
-%Row No. 2 - Actual: SomethingsDifferent 2
-%Row No. 2 - Expected: Something 2]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure array_same_data is
- begin
- --Arrange
- g_test_expected := anydata.convertCollection( ut3_tester_helper.t_tab_varchar('A') );
- g_test_actual := anydata.convertCollection( ut3_tester_helper.t_tab_varchar('A') );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure array_diff_data is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- g_test_expected := anydata.convertCollection( ut3_tester_helper.t_tab_varchar('A') );
- g_test_actual := anydata.convertCollection( ut3_tester_helper.t_tab_varchar('B') );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- l_expected_message := q'[%Actual: ut3_tester_helper.t_tab_varchar [ count = 1 ] was expected to equal: ut3_tester_helper.t_tab_varchar [ count = 1 ]
-%Diff:
-%Rows: [ 1 differences ]
-%Row No. 1 - Actual: B
-%Row No. 1 - Expected: A]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure array_is_null is
- l_is_null ut3_tester_helper.t_tab_varchar ;
- begin
- ut3_develop.ut.expect( anydata.convertCollection( l_is_null ) ).to_be_null;
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure array_null_equal_array_null is
- l_is_null ut3_tester_helper.t_tab_varchar ;
- l_is_null_bis ut3_tester_helper.t_tab_varchar ;
- begin
- ut3_develop.ut.expect( anydata.convertCollection( l_is_null ) ).to_equal(anydata.convertCollection( l_is_null_bis ));
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure array_null_equal_array_notnull is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- l_is_null ut3_tester_helper.t_tab_varchar ;
- begin
- --Arrange
- g_test_expected := anydata.convertCollection( l_is_null );
- g_test_actual := anydata.convertCollection( ut3_tester_helper.t_tab_varchar('A') );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- l_expected_message := q'[%Actual: ut3_tester_helper.t_tab_varchar [ count = 1 ] was expected to equal: ut3_tester_helper.t_tab_varchar [ null ]
-%Diff:
-%Rows: [ 1 differences ]
-%Row No. 1 - Extra: A]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure empty_array_have_zero_elem is
- begin
- ut3_develop.ut.expect( anydata.convertCollection(ut3_tester_helper.t_tab_varchar())).to_have_count(0);
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure array_empty_equal_array_empty is
- begin
- --Arrange
- g_test_expected := anydata.convertCollection(ut3_tester_helper.t_tab_varchar());
- g_test_actual := anydata.convertCollection(ut3_tester_helper.t_tab_varchar());
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure arr_empty_equal_arr_notempty is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- l_is_null ut3_tester_helper.t_tab_varchar ;
- begin
- --Arrange
- g_test_expected := anydata.convertCollection( ut3_tester_helper.t_tab_varchar() );
- g_test_actual := anydata.convertCollection( ut3_tester_helper.t_tab_varchar('A') );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- l_expected_message := q'[%Actual: ut3_tester_helper.t_tab_varchar [ count = 1 ] was expected to equal: ut3_tester_helper.t_tab_varchar [ count = 0 ]
-%Diff:
-%Rows: [ 1 differences ]
-%Row No. 1 - Extra: A]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure collection_is_null is
- l_null_list ut3_tester_helper.test_dummy_object_list;
- begin
- --Arrange
- g_test_actual := anydata.convertCollection( l_null_list );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_be_null;
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure collection_is_empty is
- begin
- --Arrange
- g_test_actual := anydata.convertCollection( ut3_tester_helper.test_dummy_object_list() );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_have_count(0);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
-
- end;
-
- procedure varray_same_data is
- begin
- --Arrange
- g_test_expected := anydata.convertCollection( ut3_tester_helper.t_varray(1) );
- g_test_actual := anydata.convertCollection( ut3_tester_helper.t_varray(1) );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure varray_diff_data is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- g_test_expected := anydata.convertCollection( ut3_tester_helper.t_varray(1) );
- g_test_actual := anydata.convertCollection( ut3_tester_helper.t_varray(2) );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- l_expected_message := q'[%Actual: ut3_tester_helper.t_varray [ count = 1 ] was expected to equal: ut3_tester_helper.t_varray [ count = 1 ]
-%Diff:
-%Rows: [ 1 differences ]
-%Row No. 1 - Actual: 2
-%Row No. 1 - Expected: 1]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure varray_is_null is
- l_is_null ut3_tester_helper.t_varray ;
- begin
- ut3_develop.ut.expect( anydata.convertCollection( l_is_null ) ).to_be_null;
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure varray_null_equal_varray_null is
- l_is_null ut3_tester_helper.t_varray ;
- l_is_null_bis ut3_tester_helper.t_varray ;
- begin
- ut3_develop.ut.expect( anydata.convertCollection( l_is_null ) ).to_equal(anydata.convertCollection( l_is_null_bis ));
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure varr_null_equal_varr_notnull is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- l_is_null ut3_tester_helper.t_varray ;
- begin
- --Arrange
- g_test_expected := anydata.convertCollection( l_is_null );
- g_test_actual := anydata.convertCollection( ut3_tester_helper.t_varray(1) );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- l_expected_message := q'[%Actual: ut3_tester_helper.t_varray [ count = 1 ] was expected to equal: ut3_tester_helper.t_varray [ null ]
-%Diff:
-%Rows: [ 1 differences ]
-%Row No. 1 - Extra: 1]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure empty_varray_have_zero_elem is
- begin
- ut3_develop.ut.expect( anydata.convertCollection(ut3_tester_helper.t_varray())).to_have_count(0);
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure varr_empty_equal_varr_empty is
- begin
- --Arrange
- g_test_expected := anydata.convertCollection(ut3_tester_helper.t_varray());
- g_test_actual := anydata.convertCollection(ut3_tester_helper.t_varray());
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure varr_empty_equal_varr_notempty is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- l_is_null ut3_tester_helper.t_varray ;
- begin
- --Arrange
- g_test_expected := anydata.convertCollection( ut3_tester_helper.t_varray() );
- g_test_actual := anydata.convertCollection( ut3_tester_helper.t_varray(1) );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- l_expected_message := q'[%Actual: ut3_tester_helper.t_varray [ count = 1 ] was expected to equal: ut3_tester_helper.t_varray [ count = 0 ]
-%Diff:
-%Rows: [ 1 differences ]
-%Row No. 1 - Extra: 1]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure collection_join_by is
- l_actual ut3_tester_helper.test_dummy_object_list;
- l_expected ut3_tester_helper.test_dummy_object_list;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum)
- bulk collect into l_actual
- from dual connect by level <=2;
- select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum)
- bulk collect into l_expected
- from dual connect by level <=2
- order by rownum desc;
- --Act
- ut3_develop.ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected)).join_by('ID');
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure collection_join_by_fail is
- l_actual ut3_tester_helper.test_dummy_object_list;
- l_expected ut3_tester_helper.test_dummy_object_list;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum)
- bulk collect into l_actual
- from dual connect by level <=2;
- select ut3_tester_helper.test_dummy_object( rownum * 2, 'Something '||rownum, rownum)
- bulk collect into l_expected
- from dual connect by level <=2
- order by rownum desc;
- --Act
- ut3_develop.ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected)).join_by('ID');
- l_expected_message := q'[%Actual: ut3_tester_helper.test_dummy_object_list [ count = 2 ] was expected to equal: ut3_tester_helper.test_dummy_object_list [ count = 2 ]
-%Diff:
-%Rows: [ 3 differences ]
-%PK 2 - Actual: Something 22
-%PK 2 - Expected: Something 11
-%PK 1 - Extra: 1Something 11
-%PK 4 - Missing: 4Something 22]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure collection_unordered is
- l_actual ut3_tester_helper.test_dummy_object_list;
- l_expected ut3_tester_helper.test_dummy_object_list;
- begin
- --Arrange
- select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum)
- bulk collect into l_actual
- from dual connect by level <=3;
- select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum)
- bulk collect into l_expected
- from dual connect by level <=3
- order by rownum desc;
- --Act
- ut3_develop.ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected)).unordered;
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure collection_unordered_fail is
- l_actual ut3_tester_helper.test_dummy_object_list;
- l_expected ut3_tester_helper.test_dummy_object_list;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum)
- bulk collect into l_actual
- from dual connect by level <=2;
- select ut3_tester_helper.test_dummy_object( rownum * 2, 'Something '||rownum, rownum)
- bulk collect into l_expected
- from dual connect by level <=2
- order by rownum desc;
-
- l_expected_message := q'[%Actual: ut3_tester_helper.test_dummy_object_list [ count = 2 ] was expected to equal: ut3_tester_helper.test_dummy_object_list [ count = 2 ]
-%Diff:
-%Rows: [ 4 differences ]
-%Extra: 1Something 11
-%Extra: 2Something 22
-%Missing: 4Something 22
-%Missing: 2Something 11]';
-
- ut3_develop.ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected)).unordered;
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure object_join_by is
- begin
- --Arrange
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_object(1, 'A', '0') );
- g_test_actual := anydata.convertObject( ut3_tester_helper.test_dummy_object(1, 'A', '0') );
-
- --Act
- ut3_develop.ut.expect(g_test_actual).to_equal(g_test_expected).join_by('ID');
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure object_unordered is
- begin
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_object(1, 'A', '0') );
- g_test_actual := anydata.convertObject( ut3_tester_helper.test_dummy_object(1, 'A', '0') );
-
- --Act
- ut3_develop.ut.expect(g_test_actual).to_equal(g_test_expected).unordered;
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure collection_to_contain is
- l_actual ut3_tester_helper.test_dummy_object_list;
- l_expected ut3_tester_helper.test_dummy_object_list;
- begin
- --Arrange
- select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum)
- bulk collect into l_actual
- from dual connect by level <=4;
- select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum)
- bulk collect into l_expected
- from dual connect by level <=2
- order by rownum desc;
- --Act
- ut3_develop.ut.expect(anydata.convertCollection(l_actual)).to_contain(anydata.convertCollection(l_expected));
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure collection_not_to_contain is
- l_actual ut3_tester_helper.test_dummy_object_list;
- l_expected ut3_tester_helper.test_dummy_object_list;
- begin
- --Arrange
- select ut3_tester_helper.test_dummy_object( rownum, 'Something2 '||rownum, rownum+100)
- bulk collect into l_actual
- from dual connect by level <=4;
- select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum)
- bulk collect into l_expected
- from dual connect by level <=2
- order by rownum desc;
- --Act
- ut3_develop.ut.expect(anydata.convertCollection(l_actual)).not_to_contain(anydata.convertCollection(l_expected));
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure object_to_contain is
- begin
- --Arrange
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_object(1, 'A', '0') );
- g_test_actual := anydata.convertObject( ut3_tester_helper.test_dummy_object(1, 'A', '0') );
-
- --Act
- ut3_develop.ut.expect(g_test_actual).to_contain(g_test_expected);
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure arr_empty_eq_arr_empty_unord is
- begin
- --Arrange
- g_test_expected := anydata.convertCollection(ut3_tester_helper.t_tab_varchar(null));
- g_test_actual := anydata.convertCollection(ut3_tester_helper.t_tab_varchar(null));
-
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected ).unordered();
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
-
- end;
-
- procedure arr_empty_nqua_arr_e_unord is
- begin
- --Arrange
- g_test_expected := anydata.convertCollection(ut3_tester_helper.t_tab_varchar('t'));
- g_test_actual := anydata.convertCollection(ut3_tester_helper.t_tab_varchar(' '));
-
- --Act
- ut3_develop.ut.expect( g_test_actual ).not_to_equal( g_test_expected ).unordered();
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
-
- end;
-
- procedure failure_nesting_objects is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_nested_object(ut3_tester_helper.test_dummy_object(1, 'A', '0'),ut3_tester_helper.test_dummy_object(1, 'B', '0') ));
- g_test_actual := anydata.convertObject( ut3_tester_helper.test_dummy_nested_object(ut3_tester_helper.test_dummy_object(1, 'A', '0'),ut3_tester_helper.test_dummy_object(1, 'C', '0') ));
- --Act
- l_expected_message := q'[%Actual: ut3_tester_helper.test_dummy_nested_object was expected to equal: ut3_tester_helper.test_dummy_nested_object
-%Diff:
-%Rows: [ 1 differences ]
-%Row No. 1 - Actual: 1C0
-%Row No. 1 - Expected: 1B0]';
- ut3_develop.ut.expect(g_test_actual).to_equal(g_test_expected);
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure failure_double_nested_objects is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_double_nested_obj(ut3_tester_helper.test_dummy_nested_object(ut3_tester_helper.test_dummy_object(1, 'A', '0'),ut3_tester_helper.test_dummy_object(1, 'B', '0') ),'Test'));
- g_test_actual := anydata.convertObject( ut3_tester_helper.test_dummy_double_nested_obj(ut3_tester_helper.test_dummy_nested_object(ut3_tester_helper.test_dummy_object(1, 'A', '0'),ut3_tester_helper.test_dummy_object(1, 'C', '0') ),'Test'));
- --Act
- l_expected_message := q'[%Actual: ut3_tester_helper.test_dummy_double_nested_obj was expected to equal: ut3_tester_helper.test_dummy_double_nested_obj
-%Diff:
-%Rows: [ 1 differences ]
-%Row No. 1 - Actual: 1A01C0
-%Row No. 1 - Expected: 1A01B0]';
- ut3_develop.ut.expect(g_test_actual).to_equal(g_test_expected);
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure success_nesting_objects is
- begin
- --Arrange
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_nested_object(ut3_tester_helper.test_dummy_object(1, 'A', '0'),ut3_tester_helper.test_dummy_object(1, 'B', '0') ));
- g_test_actual := anydata.convertObject( ut3_tester_helper.test_dummy_nested_object(ut3_tester_helper.test_dummy_object(1, 'A', '0'),ut3_tester_helper.test_dummy_object(1, 'B', '0') ));
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure success_double_nested_objects is
- begin
- --Arrange
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_double_nested_obj(ut3_tester_helper.test_dummy_nested_object(ut3_tester_helper.test_dummy_object(1, 'A', '0'),ut3_tester_helper.test_dummy_object(1, 'B', '0') ),'Test'));
- g_test_actual := anydata.convertObject( ut3_tester_helper.test_dummy_double_nested_obj(ut3_tester_helper.test_dummy_nested_object(ut3_tester_helper.test_dummy_object(1, 'A', '0'),ut3_tester_helper.test_dummy_object(1, 'B', '0') ),'Test'));
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure failure_nested_object_list is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- l_actual ut3_tester_helper.test_dummy_object_list;
- l_expected ut3_tester_helper.test_dummy_object_list;
- begin
- --Arrange
- select ut3_tester_helper.test_dummy_object( rownum + 1, 'Something '||rownum, rownum)
- bulk collect into l_actual
- from dual connect by level <=2
- order by rownum desc;
- select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum)
- bulk collect into l_expected
- from dual connect by level <=2
- order by rownum desc;
- --Arrange
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_nested_object_list(l_actual,'Test'));
- g_test_actual := anydata.convertObject( ut3_tester_helper.test_dummy_nested_object_list(l_expected,'Test'));
- --Act
- l_expected_message := q'[%Actual: ut3_tester_helper.test_dummy_nested_object_list was expected to equal: ut3_tester_helper.test_dummy_nested_object_list
-%Diff:
-%Rows: [ 1 differences ]
-%Row No. 1 - Actual: 2Something 221Something 11
-%Row No. 1 - Expected: 3Something 222Something 11]';
- ut3_develop.ut.expect(g_test_actual).to_equal(g_test_expected);
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure success_nested_object_list is
- l_actual ut3_tester_helper.test_dummy_object_list;
- l_expected ut3_tester_helper.test_dummy_object_list;
- begin
- --Arrange
- select ut3_tester_helper.test_dummy_object( rownum , 'Something '||rownum, rownum)
- bulk collect into l_actual
- from dual connect by level <=2
- order by rownum desc;
- select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum)
- bulk collect into l_expected
- from dual connect by level <=2
- order by rownum desc;
- --Arrange
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_dummy_nested_object_list(l_actual,'Test'));
- g_test_actual := anydata.convertObject( ut3_tester_helper.test_dummy_nested_object_list(l_expected,'Test'));
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure nested_varray_same_data is
- begin
- --Arrange
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_nested_tab_varray(ut3_tester_helper.t_varray(1)) );
- g_test_actual := anydata.convertObject( ut3_tester_helper.test_nested_tab_varray(ut3_tester_helper.t_varray(1)) );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure nested_varray_diff_data is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- g_test_expected := anydata.convertObject( ut3_tester_helper.test_nested_tab_varray(ut3_tester_helper.t_varray(1)) );
- g_test_actual := anydata.convertObject( ut3_tester_helper.test_nested_tab_varray(ut3_tester_helper.t_varray(2)) );
- --Act
- ut3_develop.ut.expect( g_test_actual ).to_equal( g_test_expected );
- l_expected_message := q'[%Actual: ut3_tester_helper.test_nested_tab_varray was expected to equal: ut3_tester_helper.test_nested_tab_varray
-%Diff:
-%Rows: [ 1 differences ]
-%Row No. 1 - Actual: 2
-%Row No. 1 - Expected: 1]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure user_def_type_null_issue_1098 is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- l_actual ut3_tester_helper.test_dummy_dble_nest_lst_obj;
- l_expected ut3_tester_helper.test_dummy_dble_nest_lst_obj;
- begin
- l_actual:= ut3_tester_helper.test_dummy_dble_nest_lst_obj(
- 1, 'North America',
- ut3_tester_helper.test_dummy_double_nested_list (
- ut3_tester_helper.test_dummy_nested_object_list(
- ut3_tester_helper.test_dummy_object_list(
- ut3_tester_helper.test_dummy_object(1, '100 Broadway', 02474),
- ut3_tester_helper.test_dummy_object(2, '200 Indian School Rd', 85016)
- ),'USA'
- ),
- ut3_tester_helper.test_dummy_nested_object_list(
- ut3_tester_helper.test_dummy_object_list(),'USA'
- )
- )
- );
-
- l_expected := ut3_tester_helper.test_dummy_dble_nest_lst_obj(
- 1,
- 'North America',
- ut3_tester_helper.test_dummy_double_nested_list(ut3_tester_helper.test_dummy_nested_object_list(ut3_tester_helper.test_dummy_object_list(
- ut3_tester_helper.test_dummy_object(1, '100 Broadway', 02474),
- ut3_tester_helper.test_dummy_object(2, '200 Indian School Rd', 85016)
- ), 'USA'))
- );
- ut3_develop.ut.expect(anydata.convertObject(l_actual)).to_equal(anydata.convertObject(l_expected)).unordered;
-
- l_expected_message := q'[%Actual: ut3_tester_helper.test_dummy_dble_nest_lst_obj was expected to equal: ut3_tester_helper.test_dummy_dble_nest_lst_obj
-%Diff:
-%Rows: [ 2 differences ]
-%Extra: 1North America1100 Broadway24742200 Indian School Rd85016USAUSA
-%Missing: 1North America1100 Broadway24742200 Indian School Rd85016USA]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
-
- end;
-
- procedure complex_nested_object_success is
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- l_actual ut3_tester_helper.test_dummy_dble_nest_lst_obj;
- l_expected ut3_tester_helper.test_dummy_dble_nest_lst_obj;
- begin
- l_actual:= ut3_tester_helper.test_dummy_dble_nest_lst_obj(
- 1, 'North America',
- ut3_tester_helper.test_dummy_double_nested_list (
- ut3_tester_helper.test_dummy_nested_object_list(
- ut3_tester_helper.test_dummy_object_list(
- ut3_tester_helper.test_dummy_object(1, '100 Broadway', 02474),
- ut3_tester_helper.test_dummy_object(2, '200 Indian School Rd', 85016)
- ),'USA'
- ),
- ut3_tester_helper.test_dummy_nested_object_list(
- ut3_tester_helper.test_dummy_object_list(),'USA'
- )
- )
- );
-
- l_expected := ut3_tester_helper.test_dummy_dble_nest_lst_obj(
- 1, 'North America',
- ut3_tester_helper.test_dummy_double_nested_list (
- ut3_tester_helper.test_dummy_nested_object_list(
- ut3_tester_helper.test_dummy_object_list(
- ut3_tester_helper.test_dummy_object(1, '100 Broadway', 02474),
- ut3_tester_helper.test_dummy_object(2, '200 Indian School Rd', 85016)
- ),'USA'
- ),
- ut3_tester_helper.test_dummy_nested_object_list(
- ut3_tester_helper.test_dummy_object_list(),'USA'
- )
- )
- );
- ut3_develop.ut.expect(anydata.convertObject(l_actual)).to_equal(anydata.convertObject(l_expected)).unordered;
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
-
- end;
-
- procedure long_names_object_types is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace type
- very_long_type_name_valid_for_oracle_12_so_utPLSQL_should_allow_it_definitely_well_still_not_reached_128_but_wait_we_did_it
- is object (
- code number(18)
- )]';
- execute immediate q'[
- begin
- ut3_develop.ut.expect(anydata.convertObject(
- very_long_type_name_valid_for_oracle_12_so_utPLSQL_should_allow_it_definitely_well_still_not_reached_128_but_wait_we_did_it(1)
- )).to_equal(anydata.convertObject(
- very_long_type_name_valid_for_oracle_12_so_utPLSQL_should_allow_it_definitely_well_still_not_reached_128_but_wait_we_did_it(1)
- ));
- end;]';
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- execute immediate 'drop type very_long_type_name_valid_for_oracle_12_so_utPLSQL_should_allow_it_definitely_well_still_not_reached_128_but_wait_we_did_it';
- exception
- when others then
- execute immediate 'drop type very_long_type_name_valid_for_oracle_12_so_utPLSQL_should_allow_it_definitely_well_still_not_reached_128_but_wait_we_did_it';
- raise;
- end;
-
-end;
-/
\ No newline at end of file
diff --git a/test/ut3_user/expectations/test_expectation_anydata.pks b/test/ut3_user/expectations/test_expectation_anydata.pks
deleted file mode 100644
index 557eb58db..000000000
--- a/test/ut3_user/expectations/test_expectation_anydata.pks
+++ /dev/null
@@ -1,244 +0,0 @@
-create or replace package test_expectation_anydata is
-
- --%suite(equal on anydata)
- --%suitepath(utplsql.test_user.expectations)
-
- --%aftereach
- procedure cleanup;
-
- --%test(Gives failure when comparing NULL objects of different type)
- procedure fail_on_different_type_null;
-
- --%test(Gives failure when comparing objects of different type)
- procedure fail_on_different_type;
-
- --%test(Gives failure when objects holds different data)
- procedure fail_on_different_object_data;
-
- --%test(Gives failure when one of objects is NULL)
- procedure fail_on_one_object_null;
-
- --%test(Gives failure when comparing object to collection)
- procedure fail_on_collection_vs_object;
-
- --%test(Gives failure when comparing empty collection to NULL collection)
- procedure fail_on_null_vs_empty_coll;
-
- --%test(Gives failure when one of collections is NULL)
- procedure fail_on_one_collection_null;
-
- --%test(Gives failure when one of collections is empty)
- procedure fail_on_one_collection_empty;
-
- --%test(Gives failure when collections holds different data)
- procedure fail_on_different_coll_data;
-
- --%test(Gives success when both anydata are NULL)
- procedure success_on_both_anydata_null;
-
- --%test(Gives success when both objects are null)
- procedure success_on_both_object_null;
-
- --%test(Gives success when both collections are null)
- procedure success_on_both_coll_null;
-
- --%test(Gives success when both collections are of same type contain identical data)
- procedure success_on_same_coll_data;
-
- --%test(Gives failure when both collections contain the same data in different order)
- procedure fail_on_coll_different_order;
-
- --%test(Gives success when both objects are of same type and hold the same data)
- procedure success_on_same_object_data;
-
- --%test(List of attributes to exclude is case sensitive)
- procedure exclude_attributes_as_list;
-
- --%test(Comma separated list of attributes to exclude is case sensitive)
- procedure exclude_attributes_as_csv;
-
- --%test(Exclude attributes by XPath is case sensitive)
- procedure exclude_attributes_xpath;
-
- --%test(Excludes existing attributes when some of attributes on exclude are not valid column names)
- procedure exclude_ignores_invalid_attrib;
-
- --%test(List of attributes to include is case sensitive)
- procedure include_attributes_as_list;
-
- --%test(Comma separated list of attributes to include is case sensitive)
- procedure include_attributes_as_csv;
-
- --%test(Include attributes by XPath is case sensitive)
- procedure include_attributes_xpath;
-
- --%test(Includes existing attributes when some of attributes on exclude are not valid column names)
- procedure include_ignores_invalid_attrib;
-
- --%test(Includes only attributes that are not excluded)
- procedure include_exclude_attributes_csv;
-
- --%test(Includes only attributes that are not on exclude list)
- procedure include_exclude_attrib_list;
-
- --%test(Reports diff on incorrect attributes of an object type)
- procedure reports_diff_attribute;
-
- --%test(Reports diff on incorrect rows and attributes of a collection type)
- procedure reports_diff_structure;
-
- --%test(Adds a warning when using depreciated syntax to_equal( a_expected anydata, a_exclude varchar2 ))
- procedure deprec_to_equal_excl_varch;
-
- --%test(Adds a warning when using depreciated syntax to_equal( a_expected anydata, a_exclude ut_varchar2_list ))
- procedure deprec_to_equal_excl_list;
-
- --%test(Adds a warning when using depreciated syntax not_to_equal( a_expected anydata, a_exclude varchar2 ))
- procedure deprec_not_to_equal_excl_varch;
-
- --%test(Adds a warning when using depreciated syntax not_to_equal( a_expected anydata, a_exclude ut_varchar2_list ))
- procedure deprec_not_to_equal_excl_list;
-
- --%test(Adds a warning when using depreciated syntax to_( equal( a_expected anydata, a_exclude varchar2 ) ))
- procedure deprec_equal_excl_varch;
-
- --%test(Adds a warning when using depreciated syntax to_( equal( a_expected anydata, a_exclude ut_varchar2_list )) )
- procedure deprec_equal_excl_list;
-
- --%test(Reports only mismatched attributes on row data mismatch)
- procedure data_diff_on_atr_data_mismatch;
-
- --%test(Reports only first 20 rows of diff and gives a full diff count)
- procedure data_diff_on_20_rows_only;
-
- --%test(Validate include list on collections of objects)
- procedure collection_include_list;
-
- --%test(Validate exclude list on collections of objects)
- procedure collection_exclude_list;
-
- --%test(Validate include list on collections of objects fail)
- procedure collection_include_list_fail;
-
- --%test(Two ARRAYS with same data)
- procedure array_same_data;
-
- --%test(Two ARRAYS with different data)
- procedure array_diff_data;
-
- --%test(ARRAY is atomically null)
- procedure array_is_null;
-
- --%test(Compare two null ARRAYs)
- procedure array_null_equal_array_null;
-
- --%test(Compare null ARRAY to ARRAY with data)
- procedure array_null_equal_array_notnull;
-
- --%test(Empty ARRAY have count of 0)
- procedure empty_array_have_zero_elem;
-
- --%test(Compare two empty ARRAYs)
- procedure array_empty_equal_array_empty;
-
- --%test(Compare empty ARRAY to ARRAY with data)
- procedure arr_empty_equal_arr_notempty;
-
- --%test(Collection is atomically NULL)
- procedure collection_is_null;
-
- --%test(Collection is empty)
- procedure collection_is_empty;
-
- --%test(Two VARRAYS with same data)
- procedure varray_same_data;
-
- --%test(Two VARRAYS with different data)
- procedure varray_diff_data;
-
- --%test(VARRAY is atomically null)
- procedure varray_is_null;
-
- --%test(Compare two null VARRAYs)
- procedure varray_null_equal_varray_null;
-
- --%test(Compare null VARRAY to VARRAY with data)
- procedure varr_null_equal_varr_notnull;
-
- --%test(Empty VARRAY have count of 0)
- procedure empty_varray_have_zero_elem;
-
- --%test(Compare two empty VARRAYs)
- procedure varr_empty_equal_varr_empty;
-
- --%test(Compare empty VARRAY to VARRAY with data)
- procedure varr_empty_equal_varr_notempty;
-
- --%test( Anydata collection using joinby )
- procedure collection_join_by;
-
- --%test( Anydata collection using joinby fail)
- procedure collection_join_by_fail;
-
- --%test( Anydata collection unordered )
- procedure collection_unordered;
-
- --%test( Anydata collection unordered fail )
- procedure collection_unordered_fail;
-
- --%test( Anydata object using joinby )
- procedure object_join_by;
-
- --%test( Anydata object unordered )
- procedure object_unordered;
-
- --%test( Success when anydata collection contains data from another anydata collection)
- procedure collection_to_contain;
-
- --%test( Success when anydata collection not contains data from another anydata collection)
- procedure collection_not_to_contain;
-
- --%test( Success when anydata object contains data from another anydata)
- procedure object_to_contain;
-
- --%test ( Empty Array equal empty array )
- procedure arr_empty_eq_arr_empty_unord;
-
- --%test ( Empty Array not equal array with space )
- procedure arr_empty_nqua_arr_e_unord;
-
- --%test ( Reports diff between not equal nested objects )
- procedure failure_nesting_objects;
-
- --%test ( Reports diff between not equal double nested objects )
- procedure failure_double_nested_objects;
-
- --%test (Reports success when comparing identical nested object )
- procedure success_nesting_objects;
-
- --%test ( Reports success when comparing identical double nested object )
- procedure success_double_nested_objects;
-
- --%test ( Reports diff between two not equal nested object list )
- procedure failure_nested_object_list;
-
- --%test ( Reports success when comparing identical nested object list )
- procedure success_nested_object_list;
-
- --%test ( Reports success when comparing identical nested VARRAYS )
- procedure nested_varray_same_data;
-
- --%test ( Reports diff between two not equal nested VARRAYS )
- procedure nested_varray_diff_data;
-
- --%test ( Comparision won't fail on user_defined type that is null as per issue 1098 )
- procedure user_def_type_null_issue_1098;
-
- --%test ( Reports success when comparing complex nested objects )
- procedure complex_nested_object_success;
-
- --%test ( Compares object types with long names - Issue #1235 )
- procedure long_names_object_types;
-
-end;
-/
diff --git a/test/ut3_user/expectations/test_expectations_cursor.pkb b/test/ut3_user/expectations/test_expectations_cursor.pkb
deleted file mode 100644
index aa5375500..000000000
--- a/test/ut3_user/expectations/test_expectations_cursor.pkb
+++ /dev/null
@@ -1,3031 +0,0 @@
-create or replace package body test_expectations_cursor is
-
- gc_blob blob := to_blob('123');
- gc_clob clob := to_clob('abc');
- gc_date date := sysdate;
- gc_ds_int interval day(9) to second(9) := numtodsinterval(1.12345678912, 'day');
- gc_num number := 123456789.1234567890123456789;
- gc_ts timestamp(9) := to_timestamp_tz('2017-03-30 00:21:12.123456789 cet','yyyy-mm-dd hh24:mi:ss.ff9 tzr');
- gc_ts_tz timestamp(9) with time zone := to_timestamp_tz('2017-03-30 00:21:12.123456789 cet','yyyy-mm-dd hh24:mi:ss.ff9 tzr');
- gc_ts_ltz timestamp(9) with local time zone := to_timestamp_tz('2017-03-30 00:21:12.123456789 cet','yyyy-mm-dd hh24:mi:ss.ff9 tzr');
- gc_varchar varchar2(4000) := 'a varchar2';
- gc_ym_int interval year(9) to month := numtoyminterval(1.1, 'year');
-
- procedure cleanup_expectations is
- begin
- ut3_tester_helper.main_helper.clear_expectations( );
- end;
-
- procedure setup_temp_table_test
- as
- pragma autonomous_transaction;
- begin
- execute immediate 'create global temporary table gtt_test_table (
- value varchar2(250)
- ) on commit delete rows';
-
- end;
-
- procedure cleanup_temp_table_test
- as
- pragma autonomous_transaction;
- begin
- execute immediate 'drop table gtt_test_table';
- end;
-
- procedure with_temp_table
- as
- pragma autonomous_transaction;
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- -- Arrange
- execute immediate 'insert into gtt_test_table ( value ) ' ||
- 'select ''Test-entry'' from dual union all ' ||
- 'select ''Other test entry'' from dual';
- open l_expected for
- select 'Test-entry' as value from dual union all
- select 'Other test entry' as value from dual;
- open l_actual for 'select * from gtt_test_table';
- --Act - execute the expectation on cursor opened on GTT
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- --Cleanup
- rollback;
- end;
-
-
- procedure success_on_same_data
- as
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- -- Arrange
- ut3_develop.ut.set_nls;
- open l_expected for
- select 1 as my_num,
- 'This is my test string' as my_string,
- to_clob('This is an even longer test clob') as my_clob,
- to_date('1984-09-05', 'YYYY-MM-DD') as my_date
- from dual;
- open l_actual for
- select 1 as my_num,
- 'This is my test string' as my_string,
- to_clob('This is an even longer test clob') as my_clob,
- to_date('1984-09-05', 'YYYY-MM-DD') as my_date
- from dual;
- --Act
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- ut3_develop.ut.reset_nls;
- end;
-
- procedure success_on_same_data_float
- as
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- -- Arrange
- ut3_develop.ut.set_nls;
- open l_expected for
- select cast(3.14 as binary_double) as pi_double,
- cast(3.14 as binary_float) as pi_float
- from dual;
- open l_actual for
- select cast(3.14 as binary_double) as pi_double,
- cast(3.14 as binary_float) as pi_float
- from dual;
- --Act
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- ut3_develop.ut.reset_nls;
- end;
-
- procedure success_on_empty
- as
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- -- Arrange
- open l_expected for select * from dual where 1=0;
- open l_actual for select * from dual where 1=0;
- --Act
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure success_on_both_null
- as
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- --Act
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure success_to_be_null
- as
- l_actual sys_refcursor;
- begin
- --Act
- ut3_develop.ut.expect( l_actual ).to_be_null();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure success_not_to_be_not_null
- as
- l_actual sys_refcursor;
- begin
- --Act
- ut3_develop.ut.expect( l_actual ).not_to_be_not_null();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure success_not_to_be_null
- as
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_actual for select * from dual;
- --Act
- ut3_develop.ut.expect( l_actual ).to_be_not_null();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure success_to_be_not_null
- as
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_actual for select * from dual;
- --Act
- ut3_develop.ut.expect( l_actual ).to_be_not_null();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure success_is_empty
- as
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_actual for select * from dual where 0=1;
- --Act
- ut3_develop.ut.expect( l_actual ).to_be_empty();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure success_is_not_empty
- as
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_actual for select * from dual;
- --Act
- ut3_develop.ut.expect( l_actual ).not_to_be_empty();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure failure_is_null
- as
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_actual for select * from dual;
- --Act
- ut3_develop.ut.expect( l_actual ).to_be_null();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure failure_is_not_null
- as
- l_actual sys_refcursor;
- begin
- --Act
- ut3_develop.ut.expect( l_actual ).not_to_be_null();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure failure_is_empty
- as
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_actual for select * from dual;
- --Act
- ut3_develop.ut.expect( l_actual ).to_be_empty();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure failure_is_not_empty
- as
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_actual for select * from dual where 0=1;
- --Act
- ut3_develop.ut.expect( l_actual ).not_to_be_empty();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure fail_null_vs_empty
- as
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_expected for select * from dual where 1=0;
- --Act
- ut3_develop.ut.expect( l_actual ).not_to_equal( l_expected );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure fail_on_difference
- as
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_expected for select to_clob('This is an even longer test clob') as my_clob from dual;
- open l_actual for select to_clob('Another totally different story') as my_clob from dual;
- --Act
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure fail_on_expected_missing
- as
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_expected for select 1 as my_num from dual;
- open l_actual for select 1 as my_num from dual union all select 1 as my_num from dual;
- --Act
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure fail_on_actual_missing
- as
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_expected for select 1 as my_num from dual union all select 1 as my_num from dual;
- open l_actual for select 1 as my_num from dual;
- --Act
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure fail_on_different_column_name
- as
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_expected for select 1 as col_1 from dual;
- open l_actual for select 1 as col_2 from dual;
- --Act
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
-
- procedure fail_on_different_column_order
- as
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_expected for select 1 as col_1, 2 as col_2 from dual;
- open l_actual for select 2 as col_2, 1 as col_1 from dual;
- --Act
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure pass_on_different_column_order
- as
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_expected for select 1 as col_1, 2 as col_2 from dual;
- open l_actual for select 2 as col_2, 1 as col_1 from dual;
- --Act
- ut3_develop.ut.expect( l_actual ).to_( ut3_develop.equal( l_expected ).unordered_columns() );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure pass_on_diff_column_ord_uc
- as
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_expected for select 1 as col_1, 2 as col_2 from dual;
- open l_actual for select 2 as col_2, 1 as col_1 from dual;
- --Act
- ut3_develop.ut.expect( l_actual ).to_( ut3_develop.equal( l_expected ).uc() );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure fail_on_multi_diff_col_order
- as
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_expected for select 1 as col_1, 2 as col_2,3 as col_3, 4 as col_4,5 col_5 from dual;
- open l_actual for select 2 as col_2, 1 as col_1,40 as col_4, 5 as col_5, 30 col_3 from dual;
- --Act
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected ).unordered_columns;
- --Assert
- l_expected_message := q'[Actual: refcursor [ count = 1 ] was expected to equal: refcursor [ count = 1 ]
-%Diff:
-%Rows: [ 1 differences ]
-%Row No. 1 - Actual: 3040
-%Row No. 1 - Expected: 34]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure fail_on_multi_diff_col_ord_uc
- as
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_expected for select 1 as col_1, 2 as col_2,3 as col_3, 4 as col_4,5 col_5 from dual;
- open l_actual for select 2 as col_2, 1 as col_1,40 as col_4, 5 as col_5, 30 col_3 from dual;
- --Act
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected ).uc;
- --Assert
- l_expected_message := q'[Actual: refcursor [ count = 1 ] was expected to equal: refcursor [ count = 1 ]
-%Diff:
-%Rows: [ 1 differences ]
-%Row No. 1 - Actual: 3040
-%Row No. 1 - Expected: 34]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure fail_on_different_row_order
- as
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_expected for select 1 as my_num from dual union all select 2 as my_num from dual;
- open l_actual for select 2 as my_num from dual union all select 1 as my_num from dual;
- --Act
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure include_time_in_date_with_nls
- as
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- c_second constant number := 1/24/60/60;
- begin
- --Arrange
- ut3_develop.ut.set_nls;
- open l_actual for select gc_date as some_date from dual;
- open l_expected for select gc_date - c_second some_date from dual;
- --Act
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- ut3_develop.ut.reset_nls;
- end;
-
- procedure uses_default_nls_for_date
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select gc_date as some_date from dual;
- open l_expected for select to_date(to_char(gc_date)) as some_date from dual;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure exclude_columns_as_list
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'a' as "A_Column", 'c' as A_COLUMN, 'x' SOME_COL, 'd' "Some_Col" from dual a connect by level < 4;
- open l_expected for select rownum as rn, 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual a connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected, a_exclude=>ut3_develop.ut_varchar2_list('A_COLUMN','Some_Col'));
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure exclude_columns_as_csv
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'a' as "A_Column", 'c' as A_COLUMN, 'x' SOME_COL, 'd' "Some_Col" from dual a connect by level < 4;
- open l_expected for select rownum as rn, 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual a connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected, a_exclude=>'A_COLUMN,Some_Col');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure exclude_columns_as_mixed_list is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'a' as "A_Column", 'c' as A_COLUMN, 'x' SOME_COL, 'd' "Some_Col" from dual a connect by level < 4;
- open l_expected for select rownum as rn, 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual a connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected, a_exclude=>ut3_develop.ut_varchar2_list('A_COLUMN','/ROW/Some_Col'));
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure exclude_columns_as_mix_csv_lst is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'a' as "A_Column", 'c' as A_COLUMN, 'x' SOME_COL, 'd' "Some_Col" from dual a connect by level < 4;
- open l_expected for select rownum as rn, 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual a connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected, a_exclude=>'A_COLUMN,/ROW/Some_Col');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure exclude_columns_xpath_invalid
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_actual for select rownum as rn, 'a' as "A_Column", 'c' as A_COLUMN, 'x' SOME_COL, 'd' "Some_Col" from dual a connect by level < 4;
- open l_expected for select rownum as rn, 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual a connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected, a_exclude=>'/ROW/A_COLUMN,\\//Some_Col');
- --Assert
- l_expected_message := q'[Actual: refcursor [ count = 3 ] was expected to equal: refcursor [ count = 3 ]
-%Diff:
-%Rows: [ 3 differences ]
-%Row No. 1 - Actual: d
-%Row No. 1 - Expected: c
-%Row No. 2 - Actual: d
-%Row No. 2 - Expected: c
-%Row No. 3 - Actual: d
-%Row No. 3 - Expected: c]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure exclude_columns_xpath
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select 'a' as "A_Column", 'c' as A_COLUMN, 'x' SOME_COL, 'd' "Some_Col" from dual;
- open l_expected for select 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected, a_exclude=>'/ROW/A_COLUMN|/ROW/Some_Col');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure exclude_ignores_invalid_column
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'c' as A_COLUMN from dual a connect by level < 4;
- open l_expected for select rownum as rn, 'd' as A_COLUMN from dual a connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected, a_exclude=>ut3_develop.ut_varchar2_list('A_COLUMN','non_existing_column'));
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure include_columns_as_list
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'a' as "A_Column", 'c' as A_COLUMN, 'x' SOME_COL, 'd' "Some_Col" from dual a connect by level < 4;
- open l_expected for select rownum as rn, 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual a connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).include(ut3_develop.ut_varchar2_list('RN','//A_Column','SOME_COL'));
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure include_columns_as_csv
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'a' as "A_Column", 'c' as A_COLUMN, 'x' SOME_COL, 'd' "Some_Col" from dual a connect by level < 4;
- open l_expected for select rownum as rn, 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual a connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).include('RN,//A_Column, SOME_COL');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure include_columns_xpath
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'a' as "A_Column", 'c' as A_COLUMN, 'x' SOME_COL, 'd' "Some_Col" from dual connect by level < 4;
- open l_expected for select rownum as rn, 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).to_( ut3_develop.equal(l_expected).include('/ROW/RN|//A_Column|//SOME_COL') );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure include_ignores_invalid_column
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'c' as A_COLUMN from dual a connect by level < 4;
- open l_expected for select rownum as rn, 'd' as A_COLUMN from dual a connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).include(ut3_develop.ut_varchar2_list(' RN ',' non_existing_column '));
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure include_exclude_col_csv_xpath
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'a' as "A_Column", 'c' as A_COLUMN, 'x' SOME_COL, 'd' "Some_Col" from dual connect by level < 4;
- open l_expected for select rownum as rn, 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).exclude('Some_Col').include('/ROW/RN|//Some_Col');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure include_exclude_columns_list
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'a' as "A_Column", 'c' as A_COLUMN, 'x' SOME_COL, 'd' "Some_Col" from dual connect by level < 4;
- open l_expected for select rownum as rn, 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).exclude(ut3_develop.ut_varchar2_list('A_COLUMN')).include(ut3_develop.ut_varchar2_list('RN','A_Column','A_COLUMN'));
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure data_diff_on_rows_mismatch
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_actual for select 1 rn from dual union all select 6 rn from dual;
- open l_expected for select rownum rn from dual connect by level <=3;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected);
-
- l_expected_message := q'[Actual: refcursor [ count = 2 ] was expected to equal: refcursor [ count = 3 ]
-Diff:
-Rows: [ 2 differences ]
- Row No. 2 - Actual: 6
- Row No. 2 - Expected: 2
- Row No. 3 - Missing: 3]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure char_and_varchar2_col_is_equal is
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_actual for select cast('a' as char(1)) a_column, 1 as id from dual;
- open l_expected for select cast('a' as varchar2(10)) a_column from dual;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected);
- l_expected_message := q'[Actual: refcursor [ count = 1 ] was expected to equal: refcursor [ count = 1 ]
-Diff:
-Columns:
- Column [position: 2, data-type: NUMBER] is not expected in results.
-Rows: [ 1 differences ]
- All rows are different as the columns are not matching.]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure column_diff_on_data_type_diff is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_actual for select to_char(rownum) rn, rownum another_rn from dual connect by level <=2;
- open l_expected for select rownum rn, rownum another_rn from dual connect by level <=2;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected);
-
- l_expected_message := q'[Actual: refcursor [ count = 2 ] was expected to equal: refcursor [ count = 2 ]
-Diff:
-Columns:
- Column data-type is invalid. Expected: NUMBER, actual: VARCHAR2.
-Rows: [ all different ]
- All rows are different as the columns position is not matching.]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure column_diff_on_col_name_diff is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_actual for select rownum rn, rownum bad_column_name from dual connect by level <=2;
- open l_expected for select rownum rn, rownum expected_column_name from dual connect by level <=2;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected);
-
- l_expected_message := q'[Actual: refcursor [ count = 2 ] was expected to equal: refcursor [ count = 2 ]
-Diff:
-Columns:%
- Column [data-type: NUMBER] is missing. Expected column position: 2.%
- Column [position: 2, data-type: NUMBER] is not expected in results.%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure column_diff_on_col_position is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_actual for select rownum+1 col_1, rownum+2 col_2, rownum+3 col_3, rownum+4 col_4 from dual connect by level <=2;
- open l_expected for select rownum+1 col_1, rownum+4 col_4, rownum+2 col_2, rownum+3 col_3 from dual connect by level <=2;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected);
-
- l_expected_message := q'[Actual: refcursor [ count = 2 ] was expected to equal: refcursor [ count = 2 ]
-Diff:
-Columns:
- Column is misplaced. Expected position: 2, actual position: 4.
- Column is misplaced. Expected position: 3, actual position: 2.
- Column is misplaced. Expected position: 4, actual position: 3.
-Rows: [ all different ]
- All rows are different as the columns position is not matching.]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure column_diff_on_col_pos_unord is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_actual for select rownum+1 col_1, rownum+2 col_2, rownum+3 col_3, rownum+4 col_4 from dual connect by level <=2;
- open l_expected for select rownum+1 col_1, rownum+4 col_4, rownum+2 col_2, rownum+3 col_3 from dual connect by level <=2;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).unordered_columns;
-
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- --%test(Reports only mismatched columns on column data mismatch)
- procedure data_diff_on_col_data_mismatch is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_actual for select rownum good_col, -rownum bad_col from dual connect by level <=2;
- open l_expected for select rownum good_col, rownum bad_col from dual connect by level <=2;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected);
-
- l_expected_message := q'[Actual: refcursor [ count = 2 ] was expected to equal: refcursor [ count = 2 ]
-Diff:
-Rows: [ 2 differences ]
- Row No. 1 - Actual: -1
- Row No. 1 - Expected: 1
- Row No. 2 - Actual: -2
- Row No. 2 - Expected: 2]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure data_diff_on_20_rows_only is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_actual for
- select rownum
- * case when mod(rownum,2) = 0 then -1 else 1 end bad_col,
- rownum good_col
- from dual connect by level <=100;
- open l_expected for select rownum bad_col, rownum good_col from dual connect by level <=110;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected);
-
- l_expected_message := q'[Actual: refcursor [ count = 100 ] was expected to equal: refcursor [ count = 110 ]
-Diff:
-Rows: [ 60 differences, showing first 20 ]
- Row No. 2 - Actual: -2
- Row No. 2 - Expected: 2
- Row No. 4 - Actual: -4
- Row No. 4 - Expected: 4
- Row No. 6 - Actual: -6
- Row No. 6 - Expected: 6
- Row No. 8 - Actual: -8
- Row No. 8 - Expected: 8
- %
- Row No. 38 - Actual: -38
- Row No. 38 - Expected: 38
- Row No. 40 - Actual: -40
- Row No. 40 - Expected: 40]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure column_and_data_diff is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_expected for
- select 1 as ID, 'JACK' as FIRST_NAME, 'SPARROW' AS LAST_NAME, 10000 AS SALARY from dual union all
- select 2 as ID, 'LUKE' as FIRST_NAME, 'SKYWALKER' AS LAST_NAME, 1000 AS SALARY from dual union all
- select 3 as ID, 'TONY' as FIRST_NAME, 'STARK' AS LAST_NAME, 100000 AS SALARY from dual;
- open l_actual for
- select 'M' AS GENDER, 'JACK' as FIRST_NAME, 'SPARROW' AS LAST_NAME, 1 as ID, '25000' AS SALARY from dual union all
- select 'M' AS GENDER, 'TONY' as FIRST_NAME, 'STARK' AS LAST_NAME, 3 as ID, '100000' AS SALARY from dual union all
- select 'F' AS GENDER, 'JESSICA' as FIRST_NAME, 'JONES' AS LAST_NAME, 4 as ID, '2345' AS SALARY from dual union all
- select 'M' AS GENDER, 'LUKE' as FIRST_NAME, 'SKYWALKER' AS LAST_NAME, 2 as ID, '1000' AS SALARY from dual;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected);
- l_expected_message := q'[Actual: refcursor [ count = 4 ] was expected to equal: refcursor [ count = 3 ]
-Diff:
-Columns:
- Column is misplaced. Expected position: 1, actual position: 4.
- Column data-type is invalid. Expected: NUMBER, actual: VARCHAR2.
- Column [position: 1, data-type: CHAR] is not expected in results.
-Rows: [ 4 differences ]
- Row No. 1 - Actual: 25000
- Row No. 1 - Expected: 10000
- Row No. 2 - Actual: 3TONYSTARK100000
- Row No. 2 - Expected: 2LUKESKYWALKER1000
- Row No. 3 - Actual: 4JESSICAJONES2345
- Row No. 3 - Expected: 3TONYSTARK100000
- Row No. 4 - Extra: MLUKESKYWALKER21000]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure col_and_data_diff_not_ordered is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_expected for
- select 1 as ID, 'JACK' as FIRST_NAME, 'SPARROW' AS LAST_NAME, 10000 AS SALARY from dual union all
- select 2 as ID, 'LUKE' as FIRST_NAME, 'SKYWALKER' AS LAST_NAME, 1000 AS SALARY from dual union all
- select 3 as ID, 'TONY' as FIRST_NAME, 'STARK' AS LAST_NAME, 100000 AS SALARY from dual;
- open l_actual for
- select 'M' AS GENDER, 'JACK' as FIRST_NAME, 'SPARROW' AS LAST_NAME, 1 as ID, '25000' AS SALARY from dual union all
- select 'M' AS GENDER, 'TONY' as FIRST_NAME, 'STARK' AS LAST_NAME, 3 as ID, '100000' AS SALARY from dual union all
- select 'F' AS GENDER, 'JESSICA' as FIRST_NAME, 'JONES' AS LAST_NAME, 4 as ID, '2345' AS SALARY from dual union all
- select 'M' AS GENDER, 'LUKE' as FIRST_NAME, 'SKYWALKER' AS LAST_NAME, 2 as ID, '1000' AS SALARY from dual;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).unordered_columns;
- l_expected_message := q'[Actual: refcursor [ count = 4 ] was expected to equal: refcursor [ count = 3 ]
-Diff:
-Columns:
- Column data-type is invalid. Expected: NUMBER, actual: VARCHAR2.
- Column [position: 1, data-type: CHAR] is not expected in results.
-Rows: [ 4 differences ]
- Row No. 1 - Actual: 25000
- Row No. 1 - Expected: 10000
- Row No. 2 - Actual: 3TONYSTARK100000
- Row No. 2 - Expected: 2LUKESKYWALKER1000
- Row No. 3 - Actual: 4JESSICAJONES2345
- Row No. 3 - Expected: 3TONYSTARK100000
- Row No. 4 - Extra: MLUKESKYWALKER21000]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure prepare_table
- as
- pragma autonomous_transaction;
- begin
- execute immediate
- 'create table test_table_for_cursors (
- some_blob blob,
- some_clob clob,
- some_date date,
- some_ds_interval interval day(9) to second(9),
- some_nummber number,
- some_timestamp timestamp(9),
- some_timestamp_tz timestamp(9) with time zone,
- some_timestamp_ltz timestamp(9) with local time zone,
- some_varchar2 varchar2(4000),
- some_ym_interval interval year(9) to month
- )';
- execute immediate q'[
- insert into test_table_for_cursors
- values( :gc_blob, :gc_clob, :gc_date, :gc_ds_int, :gc_num, :gc_ts, :gc_ts_tz, :gc_ts_ltz, :gc_varchar, :gc_ym_int
- )
-]' using gc_blob, gc_clob, gc_date, gc_ds_int, gc_num, gc_ts, gc_ts_tz, gc_ts_ltz, gc_varchar, gc_ym_int;
- commit;
- end;
-
- procedure cleanup_table
- as
- pragma autonomous_transaction;
- begin
- execute immediate 'drop table test_table_for_cursors';
- end;
-
- procedure compares_sql_and_plsql_types is
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_expected for
- select gc_blob some_blob,
- gc_clob some_clob,
- gc_date some_date,
- gc_ds_int some_ds_interval,
- gc_num some_nummber,
- gc_ts some_timestamp,
- gc_ts_tz some_timestamp_tz,
- gc_ts_ltz some_timestamp_ltz ,
- gc_varchar some_varchar2,
- gc_ym_int some_ym_interval
- from dual;
- open l_actual for q'[select * from test_table_for_cursors]';
- --Act
- ut3_develop.ut.expect(l_expected).to_equal(l_actual);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure closes_cursor_after_use
- as
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_actual for select 1 as value from dual;
- --Act
- ut3_develop.ut.expect(l_actual).to_be_empty();
- --Assert
- ut.expect(l_actual%isopen).to_be_false();
- end;
-
- procedure closes_cursor_after_use_on_err
- as
- l_actual sys_refcursor;
- begin
- --Arrange
- open l_actual for select 1/0 as value from dual;
- --Act
- begin
- ut3_develop.ut.expect(l_actual).to_be_empty();
- exception
- when others then
- null;
- end;
- --Assert
- ut.expect(l_actual%isopen).to_be_false();
- end;
-
- procedure reports_on_exception_in_cursor
- as
- l_actual sys_refcursor;
- begin
- --Act
- open l_actual for select 1/0 as error_column from dual connect by level < 10;
- ut3_develop.ut.expect(l_actual).to_be_empty();
-
- ut.fail('Expected exception on cursor fetch');
- exception
- when others then
- ut.expect(sqlerrm).to_be_like('%ORA-20218: SQL exception thrown when fetching data from cursor:%
-%ORA-01476: divisor is equal to zero%Check the query and data for errors%');
- end;
-
- procedure exception_when_closed_cursor
- is
- l_actual sys_refcursor;
- l_error_code constant integer := -20155;
- begin
- --Arrange
- open l_actual for select * from dual;
- close l_actual;
- --Act
- ut3_develop.ut.expect( l_actual ).not_to_be_null;
- exception
- when others then
- --Assert
- ut.expect(sqlcode).to_equal(l_error_code);
- end;
-
- procedure compares_over_1000_rows
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum object_name from dual connect by level <=1100;
- open l_expected for select rownum object_name from dual connect by level <=1100;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected);
-
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- function get_cursor return sys_refcursor is
- l_cursor sys_refcursor;
- begin
- open l_cursor for select rownum as rn, 'a' as "A_Column", 'c' as A_COLUMN, 'x' SOME_COL, 'd' "Some_Col" from dual a connect by level < 4;
- return l_cursor;
- end;
-
- procedure deprec_to_equal_excl_varch is
- begin
- --Act
- ut3_develop.ut.expect(get_cursor()).to_equal(get_cursor(), a_exclude => 'A_COLUMN,Some_Col');
- --Assert
- ut.expect(cardinality(ut3_tester_helper.main_helper.get_warnings())).to_equal(1);
- ut.expect(ut3_tester_helper.main_helper.get_warnings()(1)).to_be_like('The syntax: "%" is deprecated.%');
- end;
-
- procedure deprec_to_equal_excl_list is
- begin
- --Act
- ut3_develop.ut.expect(get_cursor()).to_equal(get_cursor(), a_exclude => ut3_develop.ut_varchar2_list('A_COLUMN','Some_Col'));
- --Assert
- ut.expect(cardinality(ut3_tester_helper.main_helper.get_warnings())).to_equal(1);
- ut.expect(ut3_tester_helper.main_helper.get_warnings()(1)).to_be_like('The syntax: "%" is deprecated.%');
- end;
-
- procedure deprec_not_to_equal_excl_varch is
- begin
- --Act
- ut3_develop.ut.expect(get_cursor()).not_to_equal(get_cursor(), a_exclude => 'A_COLUMN,Some_Col');
- --Assert
- ut.expect(cardinality(ut3_tester_helper.main_helper.get_warnings())).to_equal(1);
- ut.expect(ut3_tester_helper.main_helper.get_warnings()(1)).to_be_like('The syntax: "%" is deprecated.%');
- end;
-
- procedure deprec_not_to_equal_excl_list is
- begin
- --Act
- ut3_develop.ut.expect(get_cursor()).not_to_equal(get_cursor(), a_exclude => ut3_develop.ut_varchar2_list('A_COLUMN','Some_Col'));
- --Assert
- ut.expect(cardinality(ut3_tester_helper.main_helper.get_warnings())).to_equal(1);
- ut.expect(ut3_tester_helper.main_helper.get_warnings()(1)).to_be_like('The syntax: "%" is deprecated.%');
- end;
-
- procedure deprec_equal_excl_varch is
- begin
- --Act
- ut3_develop.ut.expect(get_cursor()).to_(ut3_develop.equal(get_cursor(), a_exclude => 'A_COLUMN,Some_Col'));
- --Assert
- ut.expect(cardinality(ut3_tester_helper.main_helper.get_warnings())).to_equal(1);
- ut.expect(ut3_tester_helper.main_helper.get_warnings()(1)).to_be_like('The syntax: "%" is deprecated.%');
- end;
-
- procedure deprec_equal_excl_list is
- begin
- --Act
- ut3_develop.ut.expect(get_cursor()).to_(ut3_develop.equal(get_cursor(), a_exclude => ut3_develop.ut_varchar2_list('A_COLUMN','Some_Col')));
- --Assert
- ut.expect(cardinality(ut3_tester_helper.main_helper.get_warnings())).to_equal(1);
- ut.expect(ut3_tester_helper.main_helper.get_warnings()(1)).to_be_like('The syntax: "%" is deprecated.%');
- end;
-
- procedure col_diff_on_col_name_implicit is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_actual for select '1' , '2' from dual connect by level <=2;
- open l_expected for select rownum , rownum expected_column_name from dual connect by level <=2;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected);
-
- l_expected_message := q'[%Actual: refcursor [ count = 2 ] was expected to equal: refcursor [ count = 2 ]
-%Diff:
-%Columns:
-%Column [data-type: NUMBER] is missing. Expected column position: 1.
-%Column [data-type: NUMBER] is missing. Expected column position: 2.
-%Column <1> [position: 1, data-type: CHAR] is not expected in results.
-%Column <2> [position: 2, data-type: CHAR] is not expected in results.
-%Rows: [ all different ]
-%All rows are different as the columns position is not matching.]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure col_mtch_on_col_name_implicit is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_actual for select '1' , rownum from dual connect by level <=2;
- open l_expected for select '1' , rownum from dual connect by level <=2;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure cursor_unorderd_compr_success is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select username , user_id from all_users order by username asc;
- open l_expected for select username , user_id from all_users order by username desc;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).unordered;
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure cursor_unord_compr_success_uc is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select user_id, username from all_users order by username asc;
- open l_expected for select username , user_id from all_users order by username desc;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).unordered().uc();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure cursor_unordered_compare_fail is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_actual for select 'test1' username,-100 user_id from dual
- union all
- select 'test' username,-666 user_id from dual
- order by 1 asc;
-
- open l_expected for select 'test1' username,-100 user_id from dual
- union all
- select 'test' username,-667 user_id from dual
- order by 1 desc;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).unordered;
- l_expected_message := q'[%Actual: refcursor [ count = 2 ] was expected to equal: refcursor [ count = 2 ]%
-%Diff:%
-%Rows: [ 2 differences ]%
-%Extra: test-666%
-%Missing: test-667%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure cursor_joinby_compare_uc is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select owner, object_id, object_name,object_type from all_objects where owner = user;
- open l_expected for select object_id, owner, object_name,object_type from all_objects where owner = user;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by('OBJECT_ID').uc();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure cursor_joinby_compare is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select object_id, owner, object_name,object_type from all_objects where owner = user;
- open l_expected for select object_id, owner, object_name,object_type from all_objects where owner = user;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by('OBJECT_ID');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure cursor_joinby_col_not_ord
- as
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_expected for select 1 as col_1, 2 as col_2,3 as col_3, 4 as col_4,5 col_5 from dual;
- open l_actual for select 2 as col_2, 1 as col_1,40 as col_4, 5 as col_5, 30 col_3 from dual;
- --Act
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected ).join_by('COL_1').unordered_columns;
- --Assert
- l_expected_message := q'[Actual: refcursor [ count = 1 ] was expected to equal: refcursor [ count = 1 ]
-%Diff:
-%Rows: [ 1 differences ]
-%PK 1 - Actual: 3040
-%PK 1 - Expected: 34]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure cursor_joinby_compare_twocols is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select object_id, owner, object_name,object_type from all_objects where owner = user;
- open l_expected for select object_id, owner, object_name,object_type from all_objects where owner = user;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by(ut3_develop.ut_varchar2_list('OBJECT_ID,OBJECT_NAME'));
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure cursor_joinby_compare_nokey is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_actual for select rownum as rn, 'x' SOME_COL from dual a connect by level < 4;
- open l_expected for select rownum as rn, 'x' SOME_COL from dual a connect by level < 4;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by('OWNER');
- --Assert
- l_expected_message := q'[%Actual: refcursor [ count = 3 ] was expected to equal: refcursor [ count = 3 ]%
-Diff:%
-%Unable to join sets:%
-%Join key OWNER does not exists in expected%
-%Join key OWNER does not exists in actual%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure cur_joinby_comp_twocols_nokey is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_actual for select rownum as rn, 'x' SOME_COL from dual a connect by level < 4;
- open l_expected for select rownum as rn, 'x' SOME_COL from dual a connect by level < 4;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by(ut3_develop.ut_varchar2_list('OWNER,USER_ID'));
- --Assert
- l_expected_message := q'[%Actual: refcursor [ count = 3 ] was expected to equal: refcursor [ count = 3 ]%
-Diff:%
-%Unable to join sets:%
-%Join key OWNER does not exists in expected%
-%Join key USER_ID does not exists in expected%
-%Join key OWNER does not exists in actual%
-%Join key USER_ID does not exists in actual%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure cursor_joinby_compare_exkey is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_actual for select rownum as rn, 'x' SOME_COL from dual a connect by level < 4;
- open l_expected for select rownum as rn, 'x' SOME_COL from dual a connect by level < 4;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by('SOME_COL').exclude('SOME_COL');
- --Assert
- l_expected_message := q'[%Actual: refcursor [ count = 3 ] was expected to equal: refcursor [ count = 3 ]%
-Diff:%
-%Unable to join sets:%
-%Join key SOME_COL does not exists in expected%
-%Join key SOME_COL does not exists in actual%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure cur_joinby_comp_twocols_exkey is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_actual for select rownum as rn, 'x' SOME_COL from dual a connect by level < 4;
- open l_expected for select rownum as rn, 'x' SOME_COL from dual a connect by level < 4;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by(ut3_develop.ut_varchar2_list('RN,SOME_COL')).exclude('RN');
- --Assert
- l_expected_message := q'[%Actual: refcursor [ count = 3 ] was expected to equal: refcursor [ count = 3 ]%
-Diff:%
-%Unable to join sets:%
-%Join key RN does not exists in expected%
-%Join key RN does not exists in actual%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure cursor_joinby_comp_nokey_ex is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_actual for select rownum as rni, 'x' SOME_COL from dual a connect by level < 4;
- open l_expected for select rownum as rn, 'x' SOME_COL from dual a connect by level < 4;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by('RNI');
- --Assert
- l_expected_message := q'[%Actual: refcursor [ count = 3 ] was expected to equal: refcursor [ count = 3 ]%
-Diff:%
-%Unable to join sets:%
-%Join key RNI does not exists in expected%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure cursor_joinby_comp_nokey_ac is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_actual for select rownum as rn, 'x' SOME_COL from dual a connect by level < 4;
- open l_expected for select rownum as rni, 'x' SOME_COL from dual a connect by level < 4;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by('RNI');
- --Assert
- l_expected_message := q'[%Actual: refcursor [ count = 3 ] was expected to equal: refcursor [ count = 3 ]%
-Diff:%
-%Unable to join sets:%
-%Join key RNI does not exists in actual%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure cursor_joinby_compare_1000 is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select level object_id, level || '_TEST' object_name from dual connect by level <=1100;
- open l_expected for select level object_id, level || '_TEST' object_name from dual connect by level <=1100;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by('OBJECT_ID');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure cursor_unorder_compare_1000 is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select level object_id, level || '_TEST' object_name from dual connect by level <=1100;
- open l_expected for select level object_id, level || '_TEST' object_name from dual connect by level <=1100;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).unordered;
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure cursor_joinby_compare_fail is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_expected for select username, user_id from all_users union all
- select 'TEST' username, -600 user_id from dual order by 1 desc;
-
- open l_actual for select username, user_id from all_users union all
- select 'TEST' username, -610 user_id from dual order by 1 asc;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by('USERNAME');
- --Assert
- l_expected_message := q'[%Actual: refcursor [ count = % ] was expected to equal: refcursor [ count = % ]
-%Diff:%
-%Rows: [ 1 differences ]%
-%PK TEST - Actual:%-610%
-%PK TEST - Expected:%-600%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure cursor_joinby_cmp_twocol_fail is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_expected for select username, user_id from all_users union all
- select 'TEST' username, -600 user_id from dual order by 1 desc;
-
- open l_actual for select username, user_id from all_users union all
- select 'TEST' username, -610 user_id from dual order by 1 asc;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by(ut3_develop.ut_varchar2_list('USERNAME,USER_ID'));
- --Assert
- l_expected_message := q'[%Actual: refcursor [ count = % ] was expected to equal: refcursor [ count = % ]
-%Diff:%
-%Rows: [ 2 differences ]%
-%PK TEST-610 - Extra: TEST-610%
-%PK TEST-600 - Missing: TEST-600%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure cur_joinby_cmp_threcol_fail is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_expected for select username, user_id,'Y' is_valid from all_users union all
- select 'TEST' username, -600 user_id,'Y' is_valid from dual order by 1 desc;
-
- open l_actual for select username, user_id,'Y' is_valid from all_users union all
- select 'TEST' username, -610 user_id,'Y' is_valid from dual order by 1 asc;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by(ut3_develop.ut_varchar2_list('USERNAME,IS_VALID'));
- --Assert
- l_expected_message := q'[%Actual: refcursor [ count = % ] was expected to equal: refcursor [ count = % ]
-%Diff:%
-%Rows: [ 1 differences ]%
-%PK TESTY - Actual:%-610%
-%PK TESTY - Expected:%-600%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure unord_incl_cols_as_list
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'a' as "A_Column", 'c' as A_COLUMN, 'x' SOME_COL, 'd' "Some_Col" from dual a connect by level < 4;
- open l_expected for select rownum as rn, 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual a connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).include(ut3_develop.ut_varchar2_list('RN','//A_Column','SOME_COL')).unordered;
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure joinby_incl_cols_as_list
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'a' as "A_Column", 'c' as A_COLUMN, 'x' SOME_COL, 'd' "Some_Col" from dual a connect by level < 4;
- open l_expected for select rownum as rn, 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual a connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).include(ut3_develop.ut_varchar2_list('RN','//A_Column','SOME_COL')).join_by('RN');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure joinby_excl_cols_as_list
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'a' as "A_Column", 'c' as A_COLUMN, 'x' SOME_COL, 'd' "Some_Col" from dual a connect by level < 4;
- open l_expected for select rownum as rn, 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual a connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).exclude(ut3_develop.ut_varchar2_list('//Some_Col','A_COLUMN')).join_by('RN');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure unord_excl_cols_as_list
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'a' as "A_Column", 'c' as A_COLUMN, 'x' SOME_COL, 'd' "Some_Col" from dual a connect by level < 4;
- open l_expected for select rownum as rn, 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual a connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).exclude(ut3_develop.ut_varchar2_list('A_COLUMN|//Some_Col')).unordered;
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure excl_dif_cols_as_list
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'TEST' as A_COLUMN from dual a connect by level < 4;
- open l_expected for select rownum as rn, 1 as A_COLUMN from dual a connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).exclude(ut3_develop.ut_varchar2_list('A_COLUMN'));
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure inlc_dif_cols_as_list
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'TEST' as A_COLUMN from dual a connect by level < 4;
- open l_expected for select rownum as rn, 1 as A_COLUMN from dual a connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).include(ut3_develop.ut_varchar2_list('RN'));
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure inlc_exc_dif_cols_as_list
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'TEST' as A_COLUMN from dual a connect by level < 4;
- open l_expected for select rownum as rn, 1 as A_COLUMN from dual a connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).include(ut3_develop.ut_varchar2_list('RN')).exclude(ut3_develop.ut_varchar2_list('A_COLUMN'));
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure compare_obj_typ_col_un is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum) as colval
- from dual connect by level <=2 order by rownum asc;
-
- open l_expected for select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum) as colval
- from dual connect by level <=2 order by rownum desc;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).unordered;
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure compare_obj_typ_col_jb is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum) as colval
- from dual connect by level <=2 order by rownum asc;
-
- open l_expected for select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum) as colval
- from dual connect by level <=2 order by rownum desc;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by('COLVAL/ID');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure comp_obj_typ_col_un_fail is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- --Arrange
- open l_actual for select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum) as colval
- from dual connect by level <=2 order by rownum asc;
-
- open l_expected for select ut3_tester_helper.test_dummy_object( rownum, 'Somethings '||rownum, rownum) as colval
- from dual connect by level <=3 order by rownum desc;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).unordered;
- l_expected_message := q'[%Actual: refcursor [ count = 2 ] was expected to equal: refcursor [ count = 3 ]%
-Diff:%
-Rows: [ 5 differences%
-%Extra: 1Something 11%
-%Extra: 2Something 22%
-%Missing: 3Somethings 33%
-%Missing: 2Somethings 22%
-%Missing: 1Somethings 11%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure comp_obj_typ_col_jb_fail is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum) as colval
- from dual connect by level <=2 order by rownum asc;
-
- open l_expected for select ut3_tester_helper.test_dummy_object( rownum, 'Somethings '||rownum, rownum) as colval
- from dual connect by level <=2 order by rownum desc;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by('COLVAL/ID');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure comp_obj_typ_col_jb_multi is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn,ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum) as colval
- from dual connect by level <=2 order by rownum asc;
-
- open l_expected for select rownum as rn,ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum) as colval
- from dual connect by level <=2 order by rownum desc;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by(ut3_develop.ut_varchar2_list('RN,COLVAL/ID'));
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure comp_obj_typ_col_jb_nokey is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- --Arrange
- open l_actual for select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum) as colval
- from dual connect by level <=2 order by rownum asc;
-
- open l_expected for select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum) as colval
- from dual connect by level <=2 order by rownum desc;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by('COLVAL/IDS');
-
- l_expected_message := q'[%Actual: refcursor [ count = 2 ] was expected to equal: refcursor [ count = 2 ]%
-Diff:%
-%Unable to join sets:%
-%Join key COLVAL/IDS does not exists in expected%
-%Join key COLVAL/IDS does not exists in actual%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure compare_nest_tab_col_jb is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_tab ut3_develop.ut_key_value_pairs := ut3_develop.ut_key_value_pairs();
- l_expected_tab ut3_develop.ut_key_value_pairs := ut3_develop.ut_key_value_pairs();
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- select ut3_develop.ut_key_value_pair(rownum,'Something '||rownum)
- bulk collect into l_actual_tab
- from dual connect by level <=2;
-
- select ut3_develop.ut_key_value_pair(rownum,'Something '||rownum)
- bulk collect into l_expected_tab
- from dual connect by level <=2;
-
- --Arrange
- open l_actual for select key,value
- from table(l_actual_tab) order by 1 asc;
-
- open l_expected for select key,value
- from table(l_expected_tab) order by 1 desc;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by('KEY');
-
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure compare_nest_tab_col_jb_fail is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_tab ut3_develop.ut_key_value_pairs := ut3_develop.ut_key_value_pairs();
- l_expected_tab ut3_develop.ut_key_value_pairs := ut3_develop.ut_key_value_pairs();
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- select ut3_develop.ut_key_value_pair(rownum,'Something '||rownum)
- bulk collect into l_actual_tab
- from dual connect by level <=2;
-
- select ut3_develop.ut_key_value_pair(rownum,'Somethings '||rownum)
- bulk collect into l_expected_tab
- from dual connect by level <=2;
-
- --Arrange
- open l_actual for select key,value
- from table(l_actual_tab) order by 1 asc;
-
- open l_expected for select key,value
- from table(l_expected_tab) order by 1 desc;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by('KEY');
- l_expected_message := q'[%Actual: refcursor [ count = 2 ] was expected to equal: refcursor [ count = 2 ]%
-%Diff:%
-%Rows: [ 2 differences ]%
-%PK % - Actual: %%
-%PK % - Expected: %%
-%PK % - Actual: %%
-%PK % - Expected: %%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure compare_nest_tab_cols_jb is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_tab ut3_develop.ut_key_value_pairs := ut3_develop.ut_key_value_pairs();
- l_expected_tab ut3_develop.ut_key_value_pairs := ut3_develop.ut_key_value_pairs();
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- select ut3_develop.ut_key_value_pair(rownum,'Something '||rownum)
- bulk collect into l_actual_tab
- from dual connect by level <=2;
-
- select ut3_develop.ut_key_value_pair(rownum,'Something '||rownum)
- bulk collect into l_expected_tab
- from dual connect by level <=2;
-
- --Arrange
- open l_actual for select key,value
- from table(l_actual_tab) order by 1 asc;
-
- open l_expected for select key,value
- from table(l_expected_tab) order by 1 desc;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by(ut3_develop.ut_varchar2_list('KEY,VALUE'));
-
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure compare_nest_tab_cols_jb_fail is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_tab ut3_develop.ut_key_value_pairs := ut3_develop.ut_key_value_pairs();
- l_expected_tab ut3_develop.ut_key_value_pairs := ut3_develop.ut_key_value_pairs();
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- select ut3_develop.ut_key_value_pair(rownum,'Something '||rownum)
- bulk collect into l_actual_tab
- from dual connect by level <=2;
-
- select ut3_develop.ut_key_value_pair(rownum,'Somethings '||rownum)
- bulk collect into l_expected_tab
- from dual connect by level <=2;
-
- --Arrange
- open l_actual for select key,value
- from table(l_actual_tab) order by 1 asc;
-
- open l_expected for select key,value
- from table(l_expected_tab) order by 1 desc;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by(ut3_develop.ut_varchar2_list('KEY,VALUE'));
- l_expected_message := q'[%Actual: refcursor [ count = 2 ] was expected to equal: refcursor [ count = 2 ]%
-%Diff:%
-%Rows: [ 4 differences ]%
-%PK %% - Extra%
-%PK %% - Extra%
-%PK %% - Missing%
-%PK %% - Missing%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure compare_tabtype_as_cols_jb is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_tab ut3_develop.ut_key_value_pairs := ut3_develop.ut_key_value_pairs();
- l_expected_tab ut3_develop.ut_key_value_pairs := ut3_develop.ut_key_value_pairs();
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- select ut3_develop.ut_key_value_pair(rownum,'Something '||rownum)
- bulk collect into l_actual_tab
- from dual connect by level <=2;
-
- select ut3_develop.ut_key_value_pair(rownum,'Somethings '||rownum)
- bulk collect into l_expected_tab
- from dual connect by level <=2;
-
- --Arrange
- open l_actual for select rownum rn, l_actual_tab as nested_table
- from dual connect by level <=2;
-
- open l_expected for select rownum rn, l_expected_tab as nested_table
- from dual connect by level <=2;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by('NESTED_TABLE');
-
- --Assert
- l_expected_message := q'[%Actual: refcursor [ count = 2 ] was expected to equal: refcursor [ count = 2 ]%
-%Diff:%
-%Rows: [ 4 differences ]%
-%PK %%%%%%%%%%%%%Extra%%%
-%PK %%%%%%%%%%%%%Extra%%%
-%PK %%%%%%%%%%%%%Missing%%%
-%PK %%%%%%%%%%%%%Missing%%%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
-
- end;
-
- procedure compare_tabtype_as_cols is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_tab ut3_develop.ut_key_value_pairs := ut3_develop.ut_key_value_pairs();
- l_expected_tab ut3_develop.ut_key_value_pairs := ut3_develop.ut_key_value_pairs();
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- select ut3_develop.ut_key_value_pair(rownum,'Something '||rownum)
- bulk collect into l_actual_tab
- from dual connect by level <=2 order by rownum asc;
-
- select ut3_develop.ut_key_value_pair(rownum,'Something '||rownum)
- bulk collect into l_expected_tab
- from dual connect by level <=2 order by rownum asc;
-
- --Arrange
- open l_actual for select rownum rn, l_actual_tab as nested_table
- from dual connect by level <=2;
-
- open l_expected for select rownum rn, l_expected_tab as nested_table
- from dual connect by level <=2;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
-
- end;
-
- procedure compare_tabtype_as_cols_coll is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_tab ut3_develop.ut_key_value_pairs := ut3_develop.ut_key_value_pairs();
- l_expected_tab ut3_develop.ut_key_value_pairs := ut3_develop.ut_key_value_pairs();
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- select ut3_develop.ut_key_value_pair(rownum,'Apples '||rownum)
- bulk collect into l_actual_tab
- from dual connect by level <=2;
-
- select ut3_develop.ut_key_value_pair(rownum,'Peaches '||rownum)
- bulk collect into l_expected_tab
- from dual connect by level <=2;
-
- --Arrange
- open l_actual for select rownum rn, l_actual_tab as nested_table
- from dual connect by level <=2;
-
- open l_expected for select rownum rn, l_expected_tab as nested_table
- from dual connect by level <=2;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by('NESTED_TABLE/UT_KEY_VALUE_PAIRS');
-
- --Assert
- l_expected_message := q'[%Actual: refcursor [ count = 2 ] was expected to equal: refcursor [ count = 2 ]
-%Diff:
-%Rows: [ 4 differences ]
-%Extra: 11Apples 12Apples 2
-%Extra: 21Apples 12Apples 2
-%Missing: 11Peaches 12Peaches 2
-%Missing: 21Peaches 12Peaches 2%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
-
- end;
-
- procedure compare_rec_colltype_as_cols is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_tab some_object;
- l_expected_tab some_object;
- begin
- select some_object( user,'TEST', gc_date, some_items( some_item(1,'test'), some_item(2,'test') ) )
- into l_actual_tab from dual;
-
- select some_object( user,'TEST', gc_date, some_items( some_item(1,'test'), some_item(2,'test') ) )
- into l_expected_tab from dual;
-
- --Arrange
- open l_actual for select l_actual_tab as nested_table from dual;
-
- open l_expected for select l_expected_tab as nested_table from dual;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by('NESTED_TABLE');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
-
- end;
-
- procedure compare_rec_colltype_as_attr is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_tab some_object;
- l_expected_tab some_object;
- begin
- select some_object( user,'TEST', gc_date, some_items( some_item(1,'test'), some_item(2,'test') ) )
- into l_actual_tab from dual;
-
- select some_object( user,'TEST', gc_date, some_items( some_item(1,'test'), some_item(2,'test') ) )
- into l_expected_tab from dual;
-
- --Arrange
- open l_actual for select l_actual_tab as nested_table from dual;
-
- open l_expected for select l_expected_tab as nested_table from dual;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by('NESTED_TABLE/OBJECT_OWNER');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
-
- end;
-
- procedure compare_collection_in_rec is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_tab some_object;
- l_expected_tab some_object;
- begin
- select some_object( user,'TEST', gc_date, some_items( some_item(1,'test'), some_item(2,'test') ) )
- into l_actual_tab from dual;
-
- select some_object( user,'TEST', gc_date, some_items( some_item(1,'test'), some_item(2,'test') ) )
- into l_expected_tab from dual;
-
- --Arrange
- open l_actual for select l_actual_tab as nested_table from dual;
-
- open l_expected for select l_expected_tab as nested_table from dual;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by('NESTED_TABLE/ITEMS');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
-
- end;
-
- procedure compare_rec_coll_as_cols_fl is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_tab some_object;
- l_expected_tab some_object;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- select some_object( 'TEST','TEST', gc_date, some_items( some_item(1,'BAD'), some_item(2,'test') ) )
- into l_actual_tab from dual;
-
- select some_object( 'TEST','TEST', gc_date, some_items( some_item(1,'TEST'), some_item(2,'test') ) )
- into l_expected_tab from dual;
-
- --Arrange
- open l_actual for select rownum rn, l_actual_tab as nested_table
- from dual;
-
- open l_expected for select rownum rn, l_expected_tab as nested_table
- from dual;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by('NESTED_TABLE/OBJECT_OWNER');
-
- --Assert
- l_expected_message := q'[%Actual: refcursor [ count = 1 ] was expected to equal: refcursor [ count = 1 ]
-%Diff:
-%Rows: [ 1 differences ]
-%PK TEST - Actual: TESTTEST%1BAD2test%
-%PK TEST - Expected: TESTTEST%1TEST2test%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure compare_rec_coll_as_join is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_actual_tab some_object;
- l_expected_tab some_object;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- select some_object( 'TEST','TEST', gc_date, some_items( some_item(1,'BAD'), some_item(2,'test') ) )
- into l_actual_tab from dual;
-
- select some_object( 'TEST','TEST', gc_date, some_items( some_item(1,'TEST'), some_item(2,'test') ) )
- into l_expected_tab from dual;
-
- --Arrange
- open l_actual for select l_actual_tab as nested_table from dual;
-
- open l_expected for select l_expected_tab as nested_table from dual;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by('NESTED_TABLE/ITEMS/ID');
-
- --Assert
- l_expected_message := q'[%Actual: refcursor [ count = 1 ] was expected to equal: refcursor [ count = 1 ]%
-%Diff:%
-%Unable to join sets:%
-%Join key NESTED_TABLE/ITEMS/ID does not exists in expected%
-%Join key NESTED_TABLE/ITEMS/ID does not exists in actual%
-%Please make sure that your join clause is not refferring to collection element%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
-
- end;
-
- procedure unordered_fix_764 is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- open l_expected for
- select 'Table' as name from dual
- union all
- select 'Desk' as name from dual
- union all
- select 'Table' as name from dual;
-
- open l_actual for
- select 'Desk' as name from dual
- union all
- select 'Table' as name from dual;
-
- --Assert
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected ).unordered();
-
- --Assert
- l_expected_message := q'[%Actual: refcursor [ count = 2 ] was expected to equal: refcursor [ count = 3 ]
-%Diff:
-%Rows: [ 1 differences ]
-%Missing: Table%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
-
- end;
-
- procedure cursor_to_contain is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select owner, object_name,object_type from all_objects where owner = user
- order by 1,2,3 asc;
- open l_expected for select owner, object_name,object_type from all_objects where owner = user
- and rownum < 20;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_contain(l_expected);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure cursor_to_contain_uc is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select owner, object_name, object_type from all_objects where owner = user
- order by 1,2,3 asc;
- open l_expected for select object_type, owner, object_name from all_objects where owner = user
- and rownum < 20;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_contain(l_expected).uc();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure cursor_to_contain_unordered is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for
- select rownum owner, rownum||'name' object_name,'PACKAGE' object_type from dual connect by level < 20
- order by 1,2,3 asc;
- open l_expected for
- select rownum owner, rownum||'name' object_name,'PACKAGE' object_type from dual connect by level < 10;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_contain(l_expected).unordered();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure cursor_to_contain_fail is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- --Arrange
- open l_actual for select rownum owner,rownum object_name, 'PACKAGE' object_type from dual connect by level < 5;
- open l_expected for select rownum owner,rownum object_name, 'PACKAGE' object_type from dual connect by level < 10;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_contain(l_expected);
- --Assert
- l_expected_message := q'[%Actual: refcursor [ count = 4 ] was expected to contain: refcursor [ count = 9 ]
-%Diff:
-%Rows: [ 5 differences ]
-%Missing: %%%%
-%Missing: %%%%
-%Missing: %%%%
-%Missing: %%%%
-%Missing: %%%%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure cursor_contain_joinby is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select username,user_id from all_users;
- open l_expected for select username ,user_id from all_users where rownum < 5;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_contain(l_expected).join_by('USERNAME');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure cursor_contain_joinby_fail is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- --Arrange
- open l_actual for select username, user_id from all_users
- union all
- select 'TEST' username, -600 user_id from dual
- order by 1 desc;
- open l_expected for select username, user_id from all_users
- union all
- select 'TEST' username, -601 user_id from dual
- order by 1 asc;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_contain(l_expected).join_by('USERNAME');
- --Assert
- l_expected_message := q'[%Actual: refcursor [ count = % ] was expected to contain: refcursor [ count = % ]
-%Diff:
-%Rows: [ 1 differences ]
-%PK TEST - Actual: -600
-%PK TEST - Expected: -601%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
-
- end;
-
- procedure to_contain_incl_cols_as_list
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'a' as "A_Column", 'c' as A_COLUMN, 'x' SOME_COL, 'd' "Some_Col" from dual a connect by level < 6;
- open l_expected for select rownum as rn, 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual a connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).to_contain(l_expected).include(ut3_develop.ut_varchar2_list('RN','//A_Column','SOME_COL'));
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure to_cont_join_incl_cols_as_lst
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'a' as "A_Column", 'c' as A_COLUMN, 'x' SOME_COL, 'd' "Some_Col" from dual a connect by level < 10;
- open l_expected for select rownum as rn, 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual a connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).to_contain(l_expected).include(ut3_develop.ut_varchar2_list('RN','//A_Column','SOME_COL')).join_by('RN');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure contain_join_excl_cols_as_lst
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'a' as "A_Column", 'c' as A_COLUMN, 'x' SOME_COL, 'd' "Some_Col" from dual a connect by level < 10;
- open l_expected for select rownum as rn, 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual a connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).to_contain(l_expected).exclude(ut3_develop.ut_varchar2_list('//Some_Col','A_COLUMN')).join_by('RN');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure contain_excl_cols_as_list
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'a' as "A_Column", 'c' as A_COLUMN, 'x' SOME_COL, 'd' "Some_Col" from dual a connect by level < 10;
- open l_expected for select rownum as rn, 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual a connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).to_contain(l_expected).exclude(ut3_develop.ut_varchar2_list('A_COLUMN|//Some_Col'));
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure cursor_not_to_contain
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- open l_expected for select 'TEST' username, -600 user_id from dual;
-
- open l_actual for select username, user_id from all_users
- union all
- select 'TEST1' username, -601 user_id from dual;
-
- --Act
- ut3_develop.ut.expect(l_actual).not_to_contain(l_expected);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure cursor_not_to_contain2
- as
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- open l_expected for select 'TEST' username, -600 user_id from dual;
-
- open l_actual for select username, user_id from all_users
- union all
- select 'TEST1' username, -601 user_id from dual;
-
- --Act
- ut3_develop.ut.expect(l_actual).not_to(ut3_develop.contain(l_expected));
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure cursor_not_to_contain_fail is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- --Arrange
- open l_expected for select 'TEST' username, -600 user_id from dual;
-
- open l_actual for select username, user_id from all_users
- union all
- select 'TEST' username, -600 user_id from dual;
-
- --Act
- ut3_develop.ut.expect(l_actual).not_to_contain(l_expected);
- --Assert
- l_expected_message := q'[%Actual: (refcursor [ count = % ])%
-%Data-types:%
-%VARCHAR2NUMBER%
-%Data:%
-%was expected not to contain:(refcursor [ count = 1 ])%
-%Data-types:%
-%CHARNUMBER%
-%Data:%
-%TEST-600%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
-
- procedure cursor_not_to_contain_fail2 is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- --Arrange
- open l_expected for select 'TEST' username, -600 user_id from dual;
-
- open l_actual for select username, user_id from all_users
- union all
- select 'TEST' username, -600 user_id from dual;
-
- --Act
- ut3_develop.ut.expect(l_actual).not_to(ut3_develop.contain(l_expected));
- --Assert
- l_expected_message := q'[%Actual: (refcursor [ count = % ])%
-%Data-types:%
-%VARCHAR2NUMBER%
-%Data:%
-%was expected not to contain:(refcursor [ count = 1 ])%
-%Data-types:%
-%CHARNUMBER%
-%Data:%
-%TEST-600%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure cursor_not_to_contain_joinby is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select username,rownum * 10 user_id from all_users where rownum < 5;
- open l_expected for select username||to_char(rownum) username ,rownum user_id from all_users where rownum < 5;
-
- --Act
- ut3_develop.ut.expect(l_actual).not_to_contain(l_expected).join_by('USER_ID');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure cursor_not_to_contain_joinby2 is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select username,rownum * 10 user_id from all_users where rownum < 5;
- open l_expected for select username||to_char(rownum) username ,rownum user_id from all_users where rownum < 5;
-
- --Act
- ut3_develop.ut.expect(l_actual).not_to(ut3_develop.contain(l_expected).join_by('USER_ID'));
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure not_cont_join_incl_cols_as_lst is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'b' as "A_Column", 'c' as A_COLUMN, 'x' SOME_COL, 'd' "Some_Col" from dual a connect by level < 10;
- open l_expected for select rownum * 20 rn, 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual a connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).not_to_contain(l_expected).include(ut3_develop.ut_varchar2_list('RN','//A_Column','SOME_COL')).join_by('RN');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure not_con_join_incl_cols_as_lst2 is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'b' as "A_Column", 'c' as A_COLUMN, 'x' SOME_COL, 'd' "Some_Col" from dual a connect by level < 10;
- open l_expected for select rownum * 20 rn, 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual a connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).not_to(ut3_develop.contain(l_expected).include(ut3_develop.ut_varchar2_list('RN','//A_Column','SOME_COL')).join_by('RN'));
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure not_cont_join_excl_cols_as_lst is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'a' as "A_Column", 'c' as A_COLUMN, 'y' SOME_COL, 'd' "Some_Col" from dual a connect by level < 10;
- open l_expected for select rownum * 20 as rn, 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual a connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).not_to_contain(l_expected).exclude(ut3_develop.ut_varchar2_list('//Some_Col','A_COLUMN')).join_by('RN');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure not_con_join_excl_cols_as_lst2 is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn, 'a' as "A_Column", 'c' as A_COLUMN, 'y' SOME_COL, 'd' "Some_Col" from dual a connect by level < 10;
- open l_expected for select rownum * 20 as rn, 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual a connect by level < 4;
- --Act
- ut3_develop.ut.expect(l_actual).not_to(ut3_develop.contain(l_expected).exclude(ut3_develop.ut_varchar2_list('//Some_Col','A_COLUMN')).join_by('RN'));
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure to_contain_duplicates is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_actual for select rownum as rn from dual a connect by level < 10
- union all
- select rownum as rn from dual a connect by level < 4;
- open l_expected for select rownum as rn from dual a connect by level < 4;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_contain(l_expected);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure to_contain_duplicates_fail is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- --Arrange
- open l_actual for select rownum as rn from dual a connect by level < 10;
- open l_expected for select rownum as rn from dual a connect by level < 4
- union all select rownum as rn from dual a connect by level < 4;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_contain(l_expected);
- --Assert
- l_expected_message := q'[%Actual: refcursor [ count = 9 ] was expected to contain: refcursor [ count = 6 ]
-%Diff:
-%Rows: [ 3 differences ]
-%Missing: %
-%Missing: %
-%Missing: %]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure to_not_contain_fails_1245 is
- c1 sys_refcursor;
- c2 sys_refcursor;
- begin
- open c1 for select 'a' as letter from dual union all select 'b' from dual;
- open c2 for select 'c' as letter from dual;
- ut3_develop.ut.expect(c1).not_to(ut3_develop.contain(c2));
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure udt_messg_format_eq is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_expected_tab ut3_develop.ut_key_value_pairs := ut3_develop.ut_key_value_pairs();
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- select ut3_develop.ut_key_value_pair(rownum,'Something '||rownum)
- bulk collect into l_expected_tab
- from dual connect by level <=2;
-
- --Arrange
- open l_actual for select object_name, owner from all_objects where rownum < 3;
- open l_expected for select value(x) as udt from table(l_expected_tab) x;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_contain(l_expected);
- --Assert
- l_expected_message := q'[%Actual: refcursor [ count = 2 ] was expected to contain: refcursor [ count = 2 ]
-%Diff:
-%Columns:
-%Column [data-type: UT_KEY_VALUE_PAIR] is missing. Expected column position: 1.
-%Column [position: 1, data-type: VARCHAR2] is not expected in results.
-%Column [position: 2, data-type: VARCHAR2] is not expected in results.
-%Rows: [ 2 differences ]
-%Missing: 1Something 1
-%Missing: 2Something 2%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure udt_messg_format_empt is
- l_actual sys_refcursor;
- l_actual_tab ut3_develop.ut_key_value_pairs := ut3_develop.ut_key_value_pairs();
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- select ut3_develop.ut_key_value_pair(rownum,'Something '||rownum)
- bulk collect into l_actual_tab
- from dual connect by level <=2;
-
- --Arrange
- open l_actual for select value(x) as udt from table(l_actual_tab) x;
-
- --Act
- ut3_develop.ut.expect(l_actual).to_be_empty();
- --Assert
- l_expected_message := q'[%Actual: (refcursor [ count = 2 ])
-%Data-types:
-%UT_KEY_VALUE_PAIR
-%Data:
-%1Something 12Something 2
-%was expected to be empty%]';
-
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure xml_error_actual is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_exp_message varchar2(32000);
- begin
- l_exp_message :='ORA-20218: SQL exception thrown when fetching data from cursor:
-ORA-01476: divisor is equal to zero
-at "UT3_USER.TEST_EXPECTATIONS_CURSOR%", line % ut3_develop.ut.expect(l_actual).to_equal(l_expected);%
-Check the query and data for errors.';
-
- open l_actual for
- select 1 as test from dual;
- open l_expected for
- select 1/0 as test from dual;
-
- ut3_develop.ut.expect(l_actual).to_equal(l_expected);
- --Line that error relates to in expected messag
-
- ut.fail('Expected exception on cursor fetch');
- exception
- when others then
- ut.expect(sqlerrm).to_be_like(l_exp_message);
- end;
-
- procedure xml_error_expected is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- l_exp_message varchar2(32000);
- begin
-
- l_exp_message :='ORA-20218: SQL exception thrown when fetching data from cursor:
-ORA-01476: divisor is equal to zero
-at "UT3_USER.TEST_EXPECTATIONS_CURSOR%", line % ut3_develop.ut.expect(l_actual).to_equal(l_expected);%
-Check the query and data for errors.';
-
- open l_expected for
- select 1/0 as test from dual;
- open l_actual for
- select 1 as test from dual;
-
- ut3_develop.ut.expect(l_actual).to_equal(l_expected);
-
- ut.fail('Expected exception on cursor fetch');
- exception
- when others then
- ut.expect(sqlerrm).to_be_like(l_exp_message);
- end;
-
- procedure no_length_datatypes is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- ut3_develop.ut.set_nls;
- open l_expected for
- select cast(3.14 as binary_double) as pi_double,
- cast(3.14 as binary_float) as pi_float,
- rowid as row_rowid,
- numtodsinterval(1.12345678912, 'day') row_ds_interval,
- numtoyminterval(1.1, 'year') row_ym_interval
- from dual;
-
- open l_actual for
- select cast(3.14 as binary_double) as pi_double,
- cast(3.14 as binary_float) as pi_float,
- rowid as row_rowid,
- numtodsinterval(1.12345678912, 'day') row_ds_interval,
- numtoyminterval(1.1, 'year') row_ym_interval
- from dual;
- --Act
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- ut3_develop.ut.reset_nls;
-
- end;
-
- procedure colon_part_of_columnname is
- type t_key_val_rec is record(
- key varchar2(100),
- value varchar2(100));
-
- l_act t_key_val_rec;
- l_exp t_key_val_rec;
- l_act_cur sys_refcursor;
- l_exp_cur sys_refcursor;
- begin
- l_act.key := 'NAME';
- l_act.value := 'TEST';
- l_exp.key := 'NAME';
- l_exp.value := 'TEST';
-
- OPEN l_act_cur FOR SELECT l_act.key, l_act.value
- FROM dual;
-
- OPEN l_exp_cur FOR SELECT l_exp.key, l_exp.value
- FROM dual;
-
- ut3_develop.ut.expect(l_act_cur).to_equal(l_exp_cur);
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
-
- end;
-
- procedure specialchar_part_of_colname is
- l_act_cur sys_refcursor;
- l_exp_cur sys_refcursor;
- begin
-
- OPEN l_act_cur FOR SELECT 1 as "$Test", 2 as "&Test"
- FROM dual;
-
- OPEN l_exp_cur FOR SELECT 1 as "$Test", 2 as "&Test"
- FROM dual;
-
- ut3_develop.ut.expect(l_act_cur).to_equal(l_exp_cur);
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
-
- end;
-
- procedure nonxmlchar_part_of_colname is
- l_act_cur sys_refcursor;
- l_exp_cur sys_refcursor;
- begin
-
- OPEN l_act_cur FOR SELECT 1 as "", 2 as "_Test", 3 as ".Test>"
- FROM dual;
-
- OPEN l_exp_cur FOR SELECT 1 as "", 2 as "_Test", 3 as ".Test>"
- FROM dual;
-
- ut3_develop.ut.expect(l_act_cur).to_equal(l_exp_cur);
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
-
- end;
-
-
- procedure space_only_vs_empty is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- open l_expected for
- select column_value t1 from table(ut_varchar2_list(''));
-
- open l_actual for
- select column_value t1 from table(ut_varchar2_list(' '));
- --Assert
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure tab_only_vs_empty is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- open l_expected for
- select column_value t1 from table(ut_varchar2_list(''));
-
- open l_actual for
- select column_value t1 from table(ut_varchar2_list(chr(9)));
- --Assert
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure insignificant_start_end_space is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- open l_expected for
- select ' t ' t1 from dual;
-
- open l_actual for
- select 't' t1 from dual;
- --Assert
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure double_vs_single_start_end_ws is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- open l_expected for
- select ' t ' t1 from dual;
-
- open l_actual for
- select ' t ' t1 from dual;
- --Assert
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure leading_tab_vs_space is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- open l_expected for
- select ' t' t1 from dual;
-
- open l_actual for
- select chr(9)||'t' t1 from dual;
- --Assert
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure number_from_dual is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- open l_expected for select
- 12345 as n1,
- cast(7456123.89 as number(7,-2)) as n2,
- cast(7456123.89 as number(9,1)) as n3,
- cast(7456123.89 as number(9,2)) as n4,
- cast(7456123.89 as number(9)) as n5,
- cast(7456123.89 as number(*,1)) as n6,
- 7456123.89 as n7
- from dual;
-
- open l_actual for select
- 12345 as n1,
- 7456100 as n2,
- 7456123.9 as n3,
- 7456123.89 as n4,
- 7456124 as n5,
- 7456123.9 as n6,
- 7456123.89 as n7
- from dual;
- ut3_develop.ut.expect(l_actual).to_equal(l_expected);
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure compare_number_pckg_type
- as
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- l_expected_data t_num_tab;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
-
- l_expected_data(1).col1 := 2135;
- l_expected_data(1).col4 := 2016;
- l_expected_data(1).col5 := -1;
-
- open l_expected for
- select *
- from table (l_expected_data);
-
- open l_actual for
- select
- 1 as col1
- ,2 as col2
- ,3 as col3
- ,2016 as col4
- ,-1 as col5
- from dual;
-
- ut3_develop.ut.expect(l_actual).to_equal(a_expected => l_expected);
-
- l_expected_message := q'[%Actual: refcursor [ count = 1 ] was expected to equal: refcursor [ count = 1 ]
-%Diff:
-%Rows: [ 1 differences ]
-%Row No. 1 - Actual: 123
-%Row No. 1 - Expected: 2135%]';
-
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
-
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure uc_columns_exclude is
- v_actual SYS_REFCURSOR;
- v_expected SYS_REFCURSOR;
- begin
- open v_expected for
- select to_Char(null) id, 'ok' name from dual;
- open v_actual for
- select 'ok' name, to_number(null) id from dual;
-
- ut3_develop.ut.expect(v_actual).to_equal(v_expected).exclude('ID');
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure compare_long_column_names is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- -- populate actual
- open l_actual for
- select rownum as id, '1' some_column_with_a_pretty_long_enough_name from dual;
-
- open l_expected for
- select rownum as id, '1' some_column_with_a_pretty_long_enough_name from dual;
-
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).include('ID,SOME_COLUMN_WITH_A_PRETTY_LONG_ENOUGH_NAME').join_by('ID');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure compare_column_names_over_max_identifier is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- --An unaliased literal gets a column name longer than an identifier can be
- l_sql varchar2(4000) := 'select '''||rpad('a',ora_max_name_len_supported + 10,'a')||''' from dual';
- begin
- --Act
- open l_actual for l_sql;
- open l_expected for l_sql;
- ut3_develop.ut.expect(l_actual).to_equal(l_expected);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
-
- --Act
- open l_actual for l_sql;
- open l_expected for l_sql||' connect by level <= 2';
- ut3_develop.ut.expect(l_actual).to_equal(l_expected);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(1);
- end;
-
- procedure compare_varchar2_described_over_4000 is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- --A dynamic bind longer than 4000 chars is described as a varchar2 longer than 4000, even with max_string_size=standard
- c_sql constant varchar2(100) := 'select :some_text as some_text from dual';
- begin
- --Act
- open l_actual for c_sql using rpad('x',4001,'x');
- open l_expected for c_sql using rpad('x',4001,'x');
- ut3_develop.ut.expect(l_actual).to_equal(l_expected);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
-
- --Act
- open l_actual for c_sql using rpad('x',4001,'x');
- open l_expected for c_sql using rpad('y',4001,'y');
- ut3_develop.ut.expect(l_actual).to_equal(l_expected);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(1);
- end;
-
- procedure compare_specific_column_names is
- function get_cursor return sys_refcursor is
- l_result sys_refcursor;
- begin
- open l_result for
- select 'a' as item_data, rownum as data_id, rownum as item_no, rownum as dup_no, rownum as position from dual;
- return l_result;
- end;
- begin
- ut3_develop.ut.expect(get_cursor()).to_equal(get_cursor());
- ut3_develop.ut.expect(get_cursor()).to_equal(get_cursor()).unordered();
- ut3_develop.ut.expect(get_cursor()).to_equal(get_cursor()).join_by('ITEM_DATA,DATA_ID,ITEM_NO,DUP_NO');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure multiple_cursor_expectations is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- open l_actual for select rownum rn from dual connect by level < 5;
- open l_expected for select rownum rn from dual connect by level = 1;
- ut3_develop.ut.expect(l_actual).to_equal(l_expected);
- open l_actual for select rownum rn from dual connect by level < 3;
- open l_expected for select * from (select rownum rn from dual connect by level < 3) order by 1 desc;
- ut3_develop.ut.expect(l_actual).to_equal(l_expected);
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations(1)).to_equal(
-'Actual: refcursor [ count = 4 ] was expected to equal: refcursor [ count = 1 ]
-Diff:
-Rows: [ 3 differences ]
- Row No. 2 - Extra: 2
- Row No. 3 - Extra: 3
- Row No. 4 - Extra: 4'
- );
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations(2)).to_equal(
-'Actual: refcursor [ count = 2 ] was expected to equal: refcursor [ count = 2 ]
-Diff:
-Rows: [ 2 differences ]
- Row No. 1 - Actual: 1
- Row No. 1 - Expected: 2
- Row No. 2 - Actual: 2
- Row No. 2 - Expected: 1'
- );
- end;
-
- procedure cr_joinby_compare_issue_1293 is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_expected for
- select 'FOO' username, 12 from dual union all
- select 'TEST' username, -600 user_id from dual
- order by 1 desc;
- open l_actual for
- select 'FOO' username, 12 from dual union all
- select 'TEST' username, -600 user_id from dual union all
- -- DUPLICATE!!!
- select 'TEST' username, -600 user_id from dual
- order by 1 asc;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by('USERNAME');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure cr_not_joinby_comp_issue_1293 is
- l_actual sys_refcursor;
- l_expected sys_refcursor;
- begin
- --Arrange
- open l_expected for
- select 'FOO' username, 12 from dual union all
- select 'TEST' username, -600 user_id from dual
- order by 1 desc;
- open l_actual for
- select 'FOO' username, 12 from dual union all
- select 'TEST' username, -600 user_id from dual union all
- -- DUPLICATE!!!
- select 'TEST' username, -600 user_id from dual
- order by 1 asc;
- --Act
- ut3_develop.ut.expect(l_actual).to_equal(l_expected);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
-end;
-/
diff --git a/test/ut3_user/expectations/test_expectations_cursor.pks b/test/ut3_user/expectations/test_expectations_cursor.pks
deleted file mode 100644
index d7ff823de..000000000
--- a/test/ut3_user/expectations/test_expectations_cursor.pks
+++ /dev/null
@@ -1,501 +0,0 @@
-create or replace package test_expectations_cursor is
-
- --%suite(cursor expectations)
- --%suitepath(utplsql.test_user.expectations)
-
- --%aftereach
- procedure cleanup_expectations;
-
- procedure setup_temp_table_test;
- procedure cleanup_temp_table_test;
-
- --%test(Compares data from cursor on temporary table)
- --%beforetest(setup_temp_table_test)
- --%aftertest(cleanup_temp_table_test)
- procedure with_temp_table;
-
- --%test(Gives success for identical data)
- procedure success_on_same_data;
-
- --%test(Gives success for identical data with floats)
- procedure success_on_same_data_float;
-
- --%test(Gives success when both cursors are empty)
- procedure success_on_empty;
-
- --%test(Gives success when both cursors are null)
- procedure success_on_both_null;
-
- --%test(Gives success on to_be_null if cursor is null)
- procedure success_to_be_null;
-
- --%test(Gives success on not_to_be_not_null if cursor is null)
- procedure success_not_to_be_not_null;
-
- --%test(Gives success on not_to_be_null if cursor is not null)
- procedure success_not_to_be_null;
-
- --%test(Gives success on to_be_not_null if cursor is not null)
- procedure success_to_be_not_null;
-
- --%test(Gives success on is_empty if cursor is empty)
- procedure success_is_empty;
-
- --%test(Gives success on is_not_empty if cursor is not empty)
- procedure success_is_not_empty;
-
- --%test(Gives failure on is_null if cursor is null)
- procedure failure_is_null;
-
- --%test(Gives failure on is_not_null if cursor is not null)
- procedure failure_is_not_null;
-
- --%test(Gives failure on is_empty if cursor is empty)
- procedure failure_is_empty;
-
- --%test(Gives failure on is_not_empty if cursor is not empty)
- procedure failure_is_not_empty;
-
- --%test(Gives failure when one cursor is empty and another is null)
- procedure fail_null_vs_empty;
-
- --%test(Gives failure when different data present in one of rows)
- procedure fail_on_difference;
-
- --%test(Gives failure when more rows exist in actual)
- procedure fail_on_expected_missing;
-
- --%test(Gives failure when more rows exist in expected)
- procedure fail_on_actual_missing;
-
- --%test(Gives failure when different column name is used in cursors)
- procedure fail_on_different_column_name;
-
- --%test(Gives failure when different column ordering is used in cursors when enforced column order)
- procedure fail_on_different_column_order;
-
- --%test(Pass when different column ordering is used in cursors)
- procedure pass_on_different_column_order;
-
- --%test(Pass when different column ordering is used in cursors - shortname)
- procedure pass_on_diff_column_ord_uc;
-
- --%test(Fail and highlight diffrence between columns when columns are unordered and different value)
- procedure fail_on_multi_diff_col_order;
-
- --%test(Fail and highlight diffrence between columns when columns are unordered and different value - shortname)
- procedure fail_on_multi_diff_col_ord_uc;
-
- --%test(Gives failure when different row ordering is used in cursors)
- procedure fail_on_different_row_order;
-
- --%test(Compares time part of date when set_nls was used)
- procedure include_time_in_date_with_nls;
-
- --%test(Uses default NLS for date when set_nls was not used)
- procedure uses_default_nls_for_date;
-
- --%test(List of columns to exclude is case sensitive)
- procedure exclude_columns_as_list;
-
- --%test(Comma separated list of columns to exclude is case sensitive)
- procedure exclude_columns_as_csv;
-
- --%test(Excludes list of mixed columns and XPath)
- procedure exclude_columns_as_mixed_list;
-
- --%test(Excludes comma separated list of mixed columns and XPath)
- procedure exclude_columns_as_mix_csv_lst;
-
- --%test(Exclude column with invalid filter will result in column being included )
- procedure exclude_columns_xpath_invalid;
-
- --%test(Exclude columns by XPath is case sensitive)
- procedure exclude_columns_xpath;
-
- --%test(Excludes existing columns when some of columns on exclude are not valid column names)
- procedure exclude_ignores_invalid_column;
-
- --%test(List of columns to include is case sensitive)
- procedure include_columns_as_list;
-
- --%test(Comma separated list of columns to include is case sensitive)
- procedure include_columns_as_csv;
-
- --%test(Include columns by XPath is case sensitive)
- procedure include_columns_xpath;
-
- --%test(Includes existing columns when some of columns on exclude are not valid column names)
- procedure include_ignores_invalid_column;
-
- --%test(Includes only columns that are not excluded using combination of CSV and XPath)
- procedure include_exclude_col_csv_xpath;
-
- --%test(Includes only columns that are not on exclude list)
- procedure include_exclude_columns_list;
-
- --%test(Reports data-diff on rows mismatch)
- procedure data_diff_on_rows_mismatch;
-
- --%test(Char and varchar2 data-types are equal)
- procedure char_and_varchar2_col_is_equal;
-
- --%test(Reports column diff on cursor with different column data-type)
- procedure column_diff_on_data_type_diff;
-
- --%test(Reports column diff on cursor with different column name)
- procedure column_diff_on_col_name_diff;
-
- --%test(Reports column diff on cursor with different column positions when column order is enforced)
- procedure column_diff_on_col_position;
-
- --%test(Reports column diff on cursor with different column positions)
- procedure column_diff_on_col_pos_unord;
-
- --%test(Reports only mismatched columns on row data mismatch)
- procedure data_diff_on_col_data_mismatch;
-
- --%test(Reports only first 20 rows of diff and gives a full diff count)
- procedure data_diff_on_20_rows_only;
-
- --%test(Reports data diff and column diff when both are different with enforced ordered columns)
- procedure column_and_data_diff;
-
- --%test(Reports data diff and column diff when both are different when columns are not ordered)
- procedure col_and_data_diff_not_ordered;
-
- procedure prepare_table;
- procedure cleanup_table;
-
- --%test(Compares cursor on table to cursor on plsql data)
- --%beforetest(prepare_table)
- --%aftertest(cleanup_table)
- procedure compares_sql_and_plsql_types;
-
- --%test(Closes the cursor after use)
- procedure closes_cursor_after_use;
-
- --%test(Closes the cursor after use when exception was raised)
- procedure closes_cursor_after_use_on_err;
-
- --%test(Reports exception when cursor raises exception)
- procedure reports_on_exception_in_cursor;
-
- --%test(Reports an exception when cursor is closed)
- procedure exception_when_closed_cursor;
-
- --%test(Compares cursors with more than 1000 rows)
- procedure compares_over_1000_rows;
-
- --%test(Adds a warning when using depreciated syntax to_equal( a_expected sys_refcursor, a_exclude varchar2 ))
- procedure deprec_to_equal_excl_varch;
-
- --%test(Adds a warning when using depreciated syntax to_equal( a_expected sys_refcursor, a_exclude ut_varchar2_list ))
- procedure deprec_to_equal_excl_list;
-
- --%test(Adds a warning when using depreciated syntax not_to_equal( a_expected sys_refcursor, a_exclude varchar2 ))
- procedure deprec_not_to_equal_excl_varch;
-
- --%test(Adds a warning when using depreciated syntax not_to_equal( a_expected sys_refcursor, a_exclude ut_varchar2_list ))
- procedure deprec_not_to_equal_excl_list;
-
- --%test(Adds a warning when using depreciated syntax to_( equal( a_expected sys_refcursor, a_exclude varchar2 ) ))
- procedure deprec_equal_excl_varch;
-
- --%test(Adds a warning when using depreciated syntax to_( equal( a_expected sys_refcursor, a_exclude ut_varchar2_list )) )
- procedure deprec_equal_excl_list;
-
- --%test(Reports column diff on cursor with column name implicit )
- procedure col_diff_on_col_name_implicit;
-
- --%test(Reports column match on cursor with column name implicit )
- procedure col_mtch_on_col_name_implicit;
-
- --%test( Compare cursors using unordered method success)
- procedure cursor_unorderd_compr_success;
-
- --%test( Compare cursors using unordered method success and unordered columns position)
- procedure cursor_unord_compr_success_uc;
-
- --%test( Compare cursors using unordered method failure)
- procedure cursor_unordered_compare_fail;
-
- --%test( Compare cursors join by single key )
- procedure cursor_joinby_compare;
-
- --%test( Compare cursors join by single key with unordered columns position using shortname)
- procedure cursor_joinby_compare_uc;
-
- --%test(Compare cursors by single key with unordered columns position)
- procedure cursor_joinby_col_not_ord;
-
- --%test( Compare cursors join by composite key)
- procedure cursor_joinby_compare_twocols;
-
- --%test( Compare cursors join by single key - key doesnt exists )
- procedure cursor_joinby_compare_nokey;
-
- --%test( Compare cursors join by composite key - one part of key doesnt exists )
- procedure cur_joinby_comp_twocols_nokey;
-
- --%test( Compare cursors join by single key - key doesnt is excluded )
- procedure cursor_joinby_compare_exkey;
-
- --%test( Compare cursors join by composite key - one part of key is excluded exists )
- procedure cur_joinby_comp_twocols_exkey;
-
- --%test( Compare cursors join by single key - key doesnt exists in expected)
- procedure cursor_joinby_comp_nokey_ex;
-
- --%test( Compare cursors join by single key - key doesnt exists in actual)
- procedure cursor_joinby_comp_nokey_ac;
-
- --%test( Compare cursors join by single key more than 1000 rows)
- procedure cursor_joinby_compare_1000;
-
- --%test( Compare cursors unorder more than 1000 rows)
- procedure cursor_unorder_compare_1000;
-
- --%test( Compare two column cursors join by and fail to match )
- procedure cursor_joinby_compare_fail;
-
- --%test( Compare two column cursors join by two columns and fail to match )
- procedure cursor_joinby_cmp_twocol_fail;
-
- --%test( Compare three column cursors join by two columns and fail to match )
- procedure cur_joinby_cmp_threcol_fail;
-
- --%test(Unordered List of columns to include)
- procedure unord_incl_cols_as_list;
-
- --%test(Join By List of columns to include)
- procedure joinby_incl_cols_as_list;
-
- --%test(Unordered List of columns to exclude)
- procedure unord_excl_cols_as_list;
-
- --%test(Join By List of columns to exclude)
- procedure joinby_excl_cols_as_list;
-
- --%test(Exclude columns of different type)
- procedure excl_dif_cols_as_list;
-
- --%test(Include column of same type leaving different type out)
- procedure inlc_dif_cols_as_list;
-
- --%test(Include column of same type leaving different type out and exclude different type)
- procedure inlc_exc_dif_cols_as_list;
-
- --%test(Compare object type unordered)
- procedure compare_obj_typ_col_un;
-
- --%test(Compare object type join by)
- procedure compare_obj_typ_col_jb;
-
- --%test(Compare nested table type unordered fail)
- procedure comp_obj_typ_col_un_fail;
-
- --%test(Compare object type join by fail)
- procedure comp_obj_typ_col_jb_fail;
-
- --%test(Compare object type join by multi key)
- procedure comp_obj_typ_col_jb_multi;
-
- --%test(Compare object type join by missing nested key)
- procedure comp_obj_typ_col_jb_nokey;
-
- --%test(Compare table type join by)
- procedure compare_nest_tab_col_jb;
-
- --%test(Compare table type join by - Failure)
- procedure compare_nest_tab_col_jb_fail;
-
- --%test(Compare table type join by mulitple columns)
- procedure compare_nest_tab_cols_jb;
-
- --%test(Compare table type join by multiple columns- Failure)
- procedure compare_nest_tab_cols_jb_fail;
-
- --%test(Compare table type as column join by multiple columns - Cannot find match)
- procedure compare_tabtype_as_cols_jb;
-
- --%test(Compare table type as column normal compare )
- procedure compare_tabtype_as_cols;
-
- --%test(Compare table type as column join on collection element )
- procedure compare_tabtype_as_cols_coll;
-
- --%test(Compare same content on record with collections join on record)
- procedure compare_rec_colltype_as_cols;
-
- --%test(Compare same content record with collection join on record attribute)
- procedure compare_rec_colltype_as_attr;
-
- --%test(Compare same content record with collection join on whole collection)
- procedure compare_collection_in_rec;
-
- --%test(Compare diffrent content record with collection join on record attribute)
- procedure compare_rec_coll_as_cols_fl;
-
- --%test(Trying to join on collection element inside record )
- procedure compare_rec_coll_as_join;
-
- --%test( Unordered fix for issues with duplicate no : #764 )
- procedure unordered_fix_764;
-
- --%test( Success when cursor contains data from another cursor)
- procedure cursor_to_contain;
-
- --%test( Fail cursor contains data from another cursor using second keyword)
- procedure cursor_to_contain_fail;
-
- --%test( Success cursor to contain cursor with unordered columns)
- procedure cursor_to_contain_uc;
-
- --%test( Does not fail when comparing cursor to contain cursor with unordered rows option)
- procedure cursor_to_contain_unordered;
-
- --%test( Cursor contains data from another cursor with joinby)
- procedure cursor_contain_joinby;
-
- --%test( Fail cursor contains data from another cursor with joinby)
- procedure cursor_contain_joinby_fail;
-
- --%test(Cursor contains data with list of columns to include)
- procedure to_contain_incl_cols_as_list;
-
- --%test(Cursor contains data with of columns to include and join by value)
- procedure to_cont_join_incl_cols_as_lst;
-
- --%test(Cursor contains data with of columns to exclude and join by value)
- procedure contain_join_excl_cols_as_lst;
-
- --%test(Cursor contains data with of columns to exclude)
- procedure contain_excl_cols_as_list;
-
- --%test( Cursor not to contains data from another cursor)
- procedure cursor_not_to_contain;
-
- --%test( Cursor not_to[contain] data from another cursor)
- procedure cursor_not_to_contain2;
-
- --%test( Cursor fail not to contains data from another cursor)
- procedure cursor_not_to_contain_fail;
-
- --%test( Cursor fail not_to[contain] data from another cursor)
- procedure cursor_not_to_contain_fail2;
-
- --%test( Cursor not contains data from another cursor with joinby clause)
- procedure cursor_not_to_contain_joinby;
-
- --%test( Cursor not_to[contain] data from another cursor with joinby clause)
- procedure cursor_not_to_contain_joinby2;
-
- --%test(Cursor not contains data with of columns to include and join by value)
- procedure not_cont_join_incl_cols_as_lst;
-
- --%test(Cursor not_to[contain] data with of columns to include and join by value)
- procedure not_con_join_incl_cols_as_lst2;
-
- --%test(Cursor not contains data with of columns to exclude and join by value)
- procedure not_cont_join_excl_cols_as_lst;
-
- --%test(Cursor not_to[contain] data with of columns to exclude and join by value)
- procedure not_con_join_excl_cols_as_lst2;
-
- --%test(Cursor to contain duplicates)
- procedure to_contain_duplicates;
-
- --%test(Cursor to contain duplicates fail)
- procedure to_contain_duplicates_fail;
-
- --%test(Cursor using not_to[contain] fails #1245)
- procedure to_not_contain_fails_1245;
-
- --%test(Display a message with a uer defined type with only type name not structure on equal)
- procedure udt_messg_format_eq;
-
- --%test(Display a message with a uer defined type with only type name not structure on empty)
- procedure udt_messg_format_empt;
-
- --%test(Fail to process a cursor for actual)
- procedure xml_error_actual;
-
- --%test(Fail to process a cursor for expected)
- procedure xml_error_expected;
-
- --%test(Check that cursor correctly handles no length dataypes)
- procedure no_length_datatypes;
-
- --%test(Check that colon is converted properly fix #902)
- procedure colon_part_of_columnname;
-
- --%test(Check that column name accept special characters fix #902)
- procedure specialchar_part_of_colname;
-
- --%test(Check that column name accept non xml characters fix #902)
- procedure nonxmlchar_part_of_colname;
-
-
- /*Oracle Bug not reading properly in XMLTable - See - Issue #880 */
- --%disabled
- --%test ( Space-only string is not equal empty string )
- procedure space_only_vs_empty;
-
- /*Oracle Bug not reading properly in XMLTable - See - Issue #880 */
- --%disabled
- --%test ( Tab-only string is not equal empty string )
- procedure tab_only_vs_empty;
-
- --%test ( Insignificant start/end whitespaces are considered )
- procedure insignificant_start_end_space;
-
- --%test ( Double and single leading/trailing space is distinguished )
- procedure double_vs_single_start_end_ws;
-
- --%test ( Leading Tab vs. Space is distinguished )
- procedure leading_tab_vs_space;
-
-
- --%test(Check precision of number from dual #907)
- procedure number_from_dual;
-
- --%test( Comparing number types with different precisions works with package-type nested tables )
- procedure compare_number_pckg_type;
-
- type t_num_rec is record (
- col1 number(15,0),
- col2 number(1,0),
- col3 number(4,0),
- col4 number(4,0),
- col5 number(38,0));
-
-
- type t_num_tab is table of t_num_rec index by binary_integer;
-
- --%test( Mixed column order exclusion )
- procedure uc_columns_exclude;
-
- --%test( Compares cursors with long column names - Issue #952 )
- procedure compare_long_column_names;
-
- --%test( Compares cursors with column names longer than the maximum identifier length )
- procedure compare_column_names_over_max_identifier;
-
- --%test( Compares cursors with varchar2 columns described as longer than 4000 )
- procedure compare_varchar2_described_over_4000;
-
- --%test( Compares cursors with specific column names - Issue #997 )
- procedure compare_specific_column_names;
-
- --%test( Multiple failures reported correctly - Issue #998 )
- procedure multiple_cursor_expectations;
-
- --%test( Compares cursors with duplicate rows using join by - Issue #1293 )
- procedure cr_joinby_compare_issue_1293;
-
- --%test( Compares cursors with duplicate rows - Issue #1293 )
- procedure cr_not_joinby_comp_issue_1293;
-
-end;
-/
diff --git a/test/ut3_user/expectations/test_expectations_json.pkb b/test/ut3_user/expectations/test_expectations_json.pkb
deleted file mode 100644
index 2c501d71f..000000000
--- a/test/ut3_user/expectations/test_expectations_json.pkb
+++ /dev/null
@@ -1,1807 +0,0 @@
-create or replace package body test_expectations_json is
-
- procedure cleanup_expectations is
- begin
- ut3_tester_helper.main_helper.clear_expectations( );
- end;
-
- procedure success_on_same_data
- as
- l_expected json_element_t;
- l_actual json_element_t;
- begin
- -- Arrange
- l_actual := json_element_t.parse(' {
- "Actors": [
- {
- "name": "Tom Cruise",
- "age": 56,
- "Born At": "Syracuse, NY",
- "Birthdate": "July 3, 1962",
- "photo": "https://jsonformatter.org/img/tom-cruise.jpg",
- "wife": null,
- "weight": 67.5,
- "hasChildren": true,
- "hasGreyHair": false,
- "children": [
- "Suri",
- "Isabella Jane",
- "Connor"
- ]
- },
- {
- "name": "Robert Downey Jr.",
- "age": 53,
- "Born At": "New York City, NY",
- "Birthdate": "April 4, 1965",
- "photo": "https://jsonformatter.org/img/Robert-Downey-Jr.jpg",
- "wife": "Susan Downey",
- "weight": 77.1,
- "hasChildren": true,
- "hasGreyHair": false,
- "children": [
- "Indio Falconer",
- "Avri Roel",
- "Exton Elias"
- ]
- }
- ]
- }');
-
- --Act
- ut3_develop.ut.expect( l_actual ).to_( ut3_develop.equal( l_actual ) );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure fail_on_diff_data
- as
- l_expected json_element_t;
- l_actual json_element_t;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- -- Arrange
- l_actual := json_element_t.parse('{"Aidan Gillen": {"array": ["Game of Thrones","The Wire"],"string": "some string","int": "2","otherint": 4, "aboolean": "true", "boolean": false,"object": {"foo": "bar"}},"Amy Ryan": ["In Treatment","The Wire"],"Annie Fitzgerald": ["True Blood","Big Love","The Sopranos","Oz"],"Anwan Glover": ["Treme","The Wire"],"Alexander Skarsg?rd": ["Generation Kill","True Blood"],"Alice Farmer": ["The Corner","Oz","The Wire"]}');
- l_expected := json_element_t.parse('{"Aidan Gillen": {"array": ["Game of Thron\"es","The Wire"],"string": "some string","int": 2,"aboolean": true, "boolean": true,"object": {"foo": "bar","object1": {"new prop1": "new prop value"},"object2": {"new prop1": "new prop value"},"object3": {"new prop1": "new prop value"},"object4": {"new prop1": "new prop value"}}},"Amy Ryan": {"one": "In Treatment","two": "The Wire"},"Annie Fitzgerald": ["Big Love","True Blood"],"Anwan Glover": ["Treme","The Wire"],"Alexander Skarsgard": ["Generation Kill","True Blood"], "Clarke Peters": null}');
-
- --Act
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
- --Assert
- l_expected_message := q'[%Missing property: "Alexander Skarsg?rd" on path: $
-%Extra property: "Alexander Skarsgard" on path: $
-%Missing property: "Alice Farmer" on path: $
-%Extra property: "Clarke Peters" on path: $
-%Extra property: "one" on path: $."Amy Ryan"
-%Missing property: "The Sopranos" on path: $."Annie Fitzgerald"[2]
-%Extra property: "two" on path: $."Amy Ryan"
-%Missing property: "Oz" on path: $."Annie Fitzgerald"[3]
-%Missing property: "otherint" on path: $."Aidan Gillen"
-%Extra property: "object1" on path: $."Aidan Gillen"."object"
-%Extra property: "object2" on path: $."Aidan Gillen"."object"
-%Extra property: "object3" on path: $."Aidan Gillen"."object"
-%Extra property: "object4" on path: $."Aidan Gillen"."object"
-%Actual type: 'array' was expected to be: 'object' on path: $."Amy Ryan"
-%Actual type: 'string' was expected to be: 'number' on path: $."Aidan Gillen"."int"
-%Actual type: 'string' was expected to be: 'boolean' on path: $."Aidan Gillen"."aboolean"
-%Actual value: "True Blood" was expected to be: "Big Love" on path: $."Annie Fitzgerald"[0]
-%Actual value: "Big Love" was expected to be: "True Blood" on path: $."Annie Fitzgerald"[1]
-%Actual value: FALSE was expected to be: TRUE on path: $."Aidan Gillen"."boolean"
-%Actual value: "Game of Thrones" was expected to be: "Game of Thron\"es" on path: $."Aidan Gillen"."array"[0]%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- ut.expect(l_actual_message).to_be_like('%Diff: 20 differences found%');
- ut.expect(l_actual_message).to_be_like('%13 missing properties%');
- ut.expect(l_actual_message).to_be_like('%4 unequal values%');
- ut.expect(l_actual_message).to_be_like('%3 incorrect types%');
- end;
-
- procedure null_json_variable
- as
- l_expected json_object_t ;
- begin
- -- Arrange
- l_expected := cast (null as json_object_t );
-
- --Act
- ut3_develop.ut.expect( l_expected ).to_be_null;
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure not_null_json_variable
- as
- l_expected json_object_t ;
- begin
- -- Arrange
- l_expected := json_object_t();
-
- --Act
- ut3_develop.ut.expect( l_expected ).not_to_be_null;
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure fail_null_json_var
- as
- l_expected json_object_t ;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- -- Arrange
- l_expected := json_object_t('{ "t" : "1" }');
-
- --Act
- ut3_develop.ut.expect( l_expected ).to_be_null;
- --Assert
- l_expected_message := q'[%Actual: (json)
-%'{"t":"1"}'
-%was expected to be null%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure fail_not_null_json_var
- as
- l_expected json_object_t;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- -- Arrange
- l_expected := cast (null as json_object_t );
-
- --Act
- ut3_develop.ut.expect( l_expected ).not_to_be_null;
- --Assert
- l_expected_message := q'[%Actual: NULL (json) was expected not to be null%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure empty_json
- as
- l_expected json_object_t;
- begin
- -- Arrange
- l_expected := json_object_t();
-
- --Act
- ut3_develop.ut.expect( l_expected ).to_be_empty;
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure not_empty_json
- as
- l_expected json_object_t;
- begin
- -- Arrange
- l_expected := json_object_t.parse('{ "name" : "test" }');
-
- --Act
- ut3_develop.ut.expect( l_expected ).not_to_be_empty;
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure fail_empty_json
- as
- l_expected json_object_t;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- -- Arrange
- l_expected := json_object_t.parse('{ "name" : "test" }');
-
- --Act
- ut3_develop.ut.expect( l_expected ).to_be_empty;
- --Assert
- l_expected_message := q'[%Actual: (json)
-%'{"name":"test"}'
-%was expected to be empty%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure fail_not_empty_json
- as
- l_expected json_object_t;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- -- Arrange
- l_expected := json_object_t();
-
- --Act
- ut3_develop.ut.expect( l_expected ).not_to_be_empty;
- --Assert
- l_expected_message := q'[%Actual: (json)
-%'{}'
-%was expected not to be empty%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure to_have_count as
- l_actual json_element_t;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- -- Arrange
- l_actual := json_element_t.parse('{"Aidan Gillen": {"array": ["Game of Thrones","The Wire"],"string": "some string","int": "2","otherint": 4, "aboolean": "true", "boolean": false,"object": {"foo": "bar"}},"Amy Ryan": ["In Treatment","The Wire"],"Annie Fitzgerald": ["True Blood","Big Love","The Sopranos","Oz"],"Anwan Glover": ["Treme","The Wire"],"Alexander Skarsg?rd": ["Generation Kill","True Blood"],"Alice Farmer": ["The Corner","Oz","The Wire"]}');
-
- --Act
- ut3_develop.ut.expect( l_actual ).to_have_count( 6 );
-
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
-
- end;
-
- procedure fail_to_have_count
- as
- l_actual json_element_t;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- -- Arrange
- l_actual := json_element_t.parse('{"Aidan Gillen": {"array": ["Game of Thrones","The Wire"],"string": "some string","int": "2","otherint": 4, "aboolean": "true", "boolean": false,"object": {"foo": "bar"}},"Amy Ryan": ["In Treatment","The Wire"],"Annie Fitzgerald": ["True Blood","Big Love","The Sopranos","Oz"],"Anwan Glover": ["Treme","The Wire"],"Alexander Skarsg?rd": ["Generation Kill","True Blood"],"Alice Farmer": ["The Corner","Oz","The Wire"]}');
-
- --Act
- ut3_develop.ut.expect( l_actual ).to_have_count( 2 );
- --Assert
- l_expected_message := q'[%Actual: (json [ count = 6 ]) was expected to have [ count = 2 ]%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
-
- end;
-
- procedure not_to_have_count
- as
- l_actual json_element_t;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- -- Arrange
- l_actual := json_element_t.parse('{"Aidan Gillen": {"array": ["Game of Thrones","The Wire"],"string": "some string","int": "2","otherint": 4, "aboolean": "true", "boolean": false,"object": {"foo": "bar"}},"Amy Ryan": ["In Treatment","The Wire"],"Annie Fitzgerald": ["True Blood","Big Love","The Sopranos","Oz"],"Anwan Glover": ["Treme","The Wire"],"Alexander Skarsg?rd": ["Generation Kill","True Blood"],"Alice Farmer": ["The Corner","Oz","The Wire"]}');
-
- --Act
- ut3_develop.ut.expect( l_actual ).not_to_have_count( 7 );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure fail_not_to_have_count
- as
- l_actual json_element_t;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- -- Arrange
- l_actual := json_element_t.parse('{"Aidan Gillen": {"array": ["Game of Thrones","The Wire"],"string": "some string","int": "2","otherint": 4, "aboolean": "true", "boolean": false,"object": {"foo": "bar"}},"Amy Ryan": ["In Treatment","The Wire"],"Annie Fitzgerald": ["True Blood","Big Love","The Sopranos","Oz"],"Anwan Glover": ["Treme","The Wire"],"Alexander Skarsg?rd": ["Generation Kill","True Blood"],"Alice Farmer": ["The Corner","Oz","The Wire"]}');
-
- --Act
- ut3_develop.ut.expect( l_actual ).not_to_have_count( 6 );
- --Assert
- l_expected_message := q'[%Actual: json [ count = 6 ] was expected not to have [ count = 6 ]%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure to_have_count_array
- as
- l_actual json_element_t;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- -- Arrange
- l_actual := json_element_t.parse('["Game of Thrones","The Wire"]');
-
- --Act
- ut3_develop.ut.expect( l_actual ).to_have_count( 2 );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure to_diff_json_extract_same
- as
- l_expected json_object_t;
- l_actual json_object_t;
- BEGIN
- -- Arrange
- l_expected := json_object_t.parse(' {
- "Actors": [
- {
- "name": "Tom Cruise",
- "age": 56,
- "Born At": "Syracuse, NY",
- "Birthdate": "July 3, 1962",
- "photo": "https://jsonformatter.org/img/tom-cruise.jpg",
- "wife": null,
- "weight": 67.5,
- "hasChildren": true,
- "hasGreyHair": false,
- "children": [
- "Suri",
- "Isabella Jane",
- "Connor"
- ]
- },
- {
- "name": "Robert Downey Jr.",
- "age": 53,
- "Born At": "New York City, NY",
- "Birthdate": "April 4, 1965",
- "photo": "https://jsonformatter.org/img/Robert-Downey-Jr.jpg",
- "wife": "Susan Downey",
- "weight": 77.1,
- "hasChildren": true,
- "hasGreyHair": false,
- "children": [
- "Indio Falconer",
- "Avri Roel",
- "Exton Elias"
- ]
- }
- ]
- }'
- );
- l_actual := json_object_t.parse(' {
- "Actors":
- {
- "name": "Krzystof Jarzyna",
- "age": 53,
- "Born At": "Szczecin",
- "Birthdate": "April 4, 1965",
- "photo": "niewidzialny",
- "wife": "Susan Downey",
- "children": [
- "Indio Falconer",
- "Avri Roel",
- "Exton Elias"
- ]
- }
- }'
- );
-
-
- --Act
- ut3_develop.ut.expect(json_array_t(json_query(l_actual.stringify,'$.Actors.children'))).to_equal(json_array_t(json_query(l_expected
- .stringify,'$.Actors[1].children')));
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure to_diff_json_extract_diff
- as
- l_expected json_object_t;
- l_actual json_object_t;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- -- Arrange
- l_actual := json_object_t.parse(' {
- "Actors": [
- {
- "name": "Tom Cruise",
- "age": 56,
- "Born At": "Syracuse, NY",
- "Birthdate": "July 3, 1962",
- "photo": "https://jsonformatter.org/img/tom-cruise.jpg",
- "wife": null,
- "weight": 67.5,
- "hasChildren": true,
- "hasGreyHair": false,
- "children": [
- "Suri",
- "Isabella Jane",
- "Connor"
- ]
- },
- {
- "name": "Robert Downey Jr.",
- "age": 53,
- "Born At": "New York City, NY",
- "Birthdate": "April 4, 1965",
- "photo": "https://jsonformatter.org/img/Robert-Downey-Jr.jpg",
- "wife": "Susan Downey",
- "weight": 77.1,
- "hasChildren": true,
- "hasGreyHair": false,
- "children": [
- "Noemi",
- "Avri Roel",
- "Exton Elias"
- ]
- }
- ]
- }'
- );
- l_expected := json_object_t.parse(' {
- "Actors":
- {
- "name": "Krzystof Jarzyna",
- "age": 53,
- "Born At": "Szczecin",
- "Birthdate": "April 4, 1965",
- "photo": "niewidzialny",
- "wife": "Susan Downey",
- "children": [
- "Indio Falconer",
- "Avri Roel",
- "Exton Elias"
- ]
- }
- }'
- );
-
-
- --Act
- ut3_develop.ut.expect(json_array_t(json_query(l_actual.stringify,'$.Actors[1].children'))).to_equal(json_array_t(json_query(l_expected
- .stringify,'$.Actors.children')));
- --Assert
- l_expected_message := q'[%Actual: json was expected to equal: json
-%Diff: 1 differences found
-%1 unequal values
-%Actual value: "Noemi" was expected to be: "Indio Falconer" on path: $[0]%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure long_json_test
- as
- l_actual json_element_t;
- begin
- l_actual := json_element_t.parse('[
- {
- "_id": "5ce6dc0c3a11766d5a26f494",
- "index": 0,
- "guid": "a86b8b2d-216d-4061-bafa-f3820e41efbe",
- "isActive": true,
- "balance": "$1,754.93",
- "picture": "http://placehold.it/32x32",
- "age": 39,
- "eyeColor": "green",
- "name": "Pearlie Lott",
- "gender": "female",
- "company": "KOG",
- "email": "pearlielott@kog.com",
- "phone": "+1 (852) 567-2605",
- "address": "357 Eldert Street, Benson, Montana, 5484",
- "about": "Est officia consectetur reprehenderit fugiat culpa ea commodo aliqua deserunt enim eu. Exercitation adipisicing laboris nisi irure commodo dolor consectetur tempor minim sunt ullamco Lorem occaecat. Irure quis ut Lorem aliquip aute pariatur magna laboris duis veniam qui velit. Pariatur occaecat eu minim adipisicing est do. Occaecat do ipsum ut in enim quis voluptate et. Sit ea irure nulla culpa in eiusmod.\r\n",
- "registered": "2018-08-24T12:46:31 -01:00",
- "latitude": -22.323554,
- "longitude": 139.071611,
- "tags": [
- "id",
- "do",
- "amet",
- "magna",
- "est",
- "veniam",
- "voluptate"
- ],
- "friends": [
- {
- "id": 0,
- "name": "Tammi Lowe"
- },
- {
- "id": 1,
- "name": "Simpson Miles"
- },
- {
- "id": 2,
- "name": "Hogan Osborne"
- }
- ],
- "greeting": "Hello, Pearlie Lott! You have 2 unread messages.",
- "favoriteFruit": "banana"
- },
- {
- "_id": "5ce6dc0c2b56a6f3271fc272",
- "index": 1,
- "guid": "2a24b446-d11a-4a52-b6c8-86acba1dc65f",
- "isActive": true,
- "balance": "$1,176.58",
- "picture": "http://placehold.it/32x32",
- "age": 30,
- "eyeColor": "brown",
- "name": "Bertha Mack",
- "gender": "female",
- "company": "AQUAFIRE",
- "email": "berthamack@aquafire.com",
- "phone": "+1 (804) 504-2151",
- "address": "636 Bouck Court, Cresaptown, Vermont, 5203",
- "about": "Ipsum est exercitation excepteur reprehenderit ipsum. Do velit dolore minim ad. Quis amet dolor dolore exercitation sint Lorem. Exercitation nulla magna ut incididunt enim veniam voluptate Lorem velit adipisicing sunt deserunt sunt aute. Ullamco id anim Lorem dolore do labore excepteur et reprehenderit sit adipisicing sunt esse veniam. Anim laborum labore labore incididunt in labore exercitation ad occaecat amet ea quis veniam ut.\r\n",
- "registered": "2017-12-29T06:00:27 -00:00",
- "latitude": 75.542572,
- "longitude": 147.312705,
- "tags": [
- "veniam",
- "sunt",
- "commodo",
- "ad",
- "enim",
- "officia",
- "nisi"
- ],
- "friends": [
- {
- "id": 0,
- "name": "Riddle Williams"
- },
- {
- "id": 1,
- "name": "Tracy Wagner"
- },
- {
- "id": 2,
- "name": "Morrow Phillips"
- }
- ],
- "greeting": "Hello, Bertha Mack! You have 8 unread messages.",
- "favoriteFruit": "banana"
- },
- {
- "_id": "5ce6dc0c6d8631fbfdd2afc7",
- "index": 2,
- "guid": "66ca5411-4c88-4347-9972-e1016f628098",
- "isActive": false,
- "balance": "$2,732.22",
- "picture": "http://placehold.it/32x32",
- "age": 33,
- "eyeColor": "blue",
- "name": "Fox Morgan",
- "gender": "male",
- "company": "PERKLE",
- "email": "foxmorgan@perkle.com",
- "phone": "+1 (985) 401-3450",
- "address": "801 Whitty Lane, Snyderville, Guam, 5253",
- "about": "Ex officia eu Lorem velit ullamco qui cupidatat irure sunt ea ad deserunt. Officia est consequat aute labore occaecat aliquip. Velit commodo cillum incididunt cupidatat ad id veniam aute labore tempor qui culpa voluptate dolor. Occaecat in ea id labore exercitation non tempor occaecat laboris aute irure fugiat dolor mollit. Voluptate non proident officia deserunt ex et ullamco aute eiusmod cupidatat consequat elit id.\r\n",
- "registered": "2015-04-02T06:40:53 -01:00",
- "latitude": -27.612441,
- "longitude": -134.005929,
- "tags": [
- "occaecat",
- "amet",
- "eu",
- "dolore",
- "ad",
- "fugiat",
- "quis"
- ],
- "friends": [
- {
- "id": 0,
- "name": "Case Preston"
- },
- {
- "id": 1,
- "name": "Pollard Dawson"
- },
- {
- "id": 2,
- "name": "Frye Mann"
- }
- ],
- "greeting": "Hello, Fox Morgan! You have 2 unread messages.",
- "favoriteFruit": "apple"
- },
- {
- "_id": "5ce6dc0c0a7fea91e0a1fdf5",
- "index": 3,
- "guid": "f895a236-fc0d-4c08-b2f0-9d1638dc256d",
- "isActive": true,
- "balance": "$2,746.32",
- "picture": "http://placehold.it/32x32",
- "age": 34,
- "eyeColor": "green",
- "name": "Deleon Tucker",
- "gender": "male",
- "company": "ZANILLA",
- "email": "deleontucker@zanilla.com",
- "phone": "+1 (883) 415-2709",
- "address": "540 Vandam Street, Chical, Wyoming, 5181",
- "about": "Consectetur consectetur sint Lorem non id. Fugiat reprehenderit nulla dolore nisi culpa esse ea. Ad occaecat qui magna proident ex pariatur aliquip adipisicing do aute aute sunt. Aliqua aliqua et exercitation sunt ut adipisicing.\r\n",
- "registered": "2017-10-08T09:05:49 -01:00",
- "latitude": 34.893845,
- "longitude": 110.699256,
- "tags": [
- "culpa",
- "sunt",
- "sit",
- "ut",
- "eiusmod",
- "laboris",
- "ullamco"
- ],
- "friends": [
- {
- "id": 0,
- "name": "Bernadine Pennington"
- },
- {
- "id": 1,
- "name": "Latoya Bradshaw"
- },
- {
- "id": 2,
- "name": "Iva Caldwell"
- }
- ],
- "greeting": "Hello, Deleon Tucker! You have 7 unread messages.",
- "favoriteFruit": "banana"
- },
- {
- "_id": "5ce6dc0c18bc92716a12a8e4",
- "index": 4,
- "guid": "6ed45f42-1a2b-48b2-89ce-5fdb2505343b",
- "isActive": true,
- "balance": "$1,049.96",
- "picture": "http://placehold.it/32x32",
- "age": 30,
- "eyeColor": "blue",
- "name": "Schwartz Norman",
- "gender": "male",
- "company": "UPDAT",
- "email": "schwartznorman@updat.com",
- "phone": "+1 (826) 404-3309",
- "address": "925 Harman Street, Cornucopia, Georgia, 5748",
- "about": "Qui Lorem ullamco veniam irure aliquip amet exercitation. Velit nisi id laboris adipisicing in esse adipisicing commodo cillum do exercitation tempor. Consequat tempor dolor minim consequat minim ad do tempor excepteur.\r\n",
- "registered": "2014-08-10T08:34:27 -01:00",
- "latitude": 27.35547,
- "longitude": -77.343791,
- "tags": [
- "reprehenderit",
- "nisi",
- "duis",
- "fugiat",
- "id",
- "non",
- "laboris"
- ],
- "friends": [
- {
- "id": 0,
- "name": "Dora Combs"
- },
- {
- "id": 1,
- "name": "Emerson Wade"
- },
- {
- "id": 2,
- "name": "Alma Mccormick"
- }
- ],
- "greeting": "Hello, Schwartz Norman! You have 1 unread messages.",
- "favoriteFruit": "apple"
- },
- {
- "_id": "5ce6dc0cb7ae44eb76c3e5fd",
- "index": 5,
- "guid": "0516df27-73db-42a8-b2c3-d34bd976e031",
- "isActive": false,
- "balance": "$3,679.94",
- "picture": "http://placehold.it/32x32",
- "age": 32,
- "eyeColor": "brown",
- "name": "Christi Oneal",
- "gender": "female",
- "company": "SUREPLEX",
- "email": "christioneal@sureplex.com",
- "phone": "+1 (985) 408-3098",
- "address": "640 Fayette Street, Dennard, Washington, 7962",
- "about": "Dolore fugiat sit non dolore nostrud mollit enim id sint culpa do reprehenderit ad. Velit occaecat incididunt nostrud aliqua incididunt do cillum occaecat laboris quis duis. Non tempor culpa aliquip est est consectetur ullamco elit. Voluptate et sit do et. Amet sit irure eu ex enim nulla anim deserunt ut. Sit aute ea ut fugiat eu tempor Lorem.\r\n",
- "registered": "2015-05-10T09:24:56 -01:00",
- "latitude": 43.343805,
- "longitude": 79.535043,
- "tags": [
- "occaecat",
- "laboris",
- "nulla",
- "nisi",
- "dolore",
- "cillum",
- "dolore"
- ],
- "friends": [
- {
- "id": 0,
- "name": "Marquez Wiggins"
- },
- {
- "id": 1,
- "name": "Mai Fischer"
- },
- {
- "id": 2,
- "name": "Newman Davenport"
- }
- ],
- "greeting": "Hello, Christi Oneal! You have 8 unread messages.",
- "favoriteFruit": "strawberry"
- }
-]');
-
- --Act
- ut3_develop.ut.expect( l_actual ).to_equal( l_actual );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure json_same_diffrent_ord
- as
- l_expected json_element_t;
- l_actual json_element_t;
- begin
- -- Arrange
- l_expected := json_element_t.parse('{
- "records": [
- {"field1": "outer", "field2": "thought"},
- {"field2": "thought", "field1": "outer"}
- ] ,
- "special message": "hello, world!"
-}');
- l_actual := json_element_t.parse('{
- "special message": "hello, world!" ,
- "records": [
- {"field2": "thought" ,"field1": "outer"},
- {"field1": "outer" , "field2": "thought"}
- ]
-}');
-
- --Act
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure long_json_test2
- as
- l_actual json_element_t;
- begin
- l_actual := json_element_t.parse('[
- {
- "_id":"5ce6dc0c3a11766d5a26f494",
- "index":0,
- "guid":"a86b8b2d-216d-4061-bafa-f3820e41efbe",
- "isActive":true,
- "balance":"$1,754.93",
- "picture":"http://placehold.it/32x32",
- "age":39,
- "eyeColor":"green",
- "name":"Pearlie Lott",
- "gender":"female",
- "company":"KOG",
- "email":"pearlielott@kog.com",
- "phone":"+1 (852) 567-2605",
- "address":"357 Eldert Street, Benson, Montana, 5484",
- "about":"Est officia consectetur reprehenderit fugiat culpa ea commodo aliqua deserunt enim eu. Exercitation adipisicing laboris nisi irure commodo dolor consectetur tempor minim sunt ullamco Lorem occaecat. Irure quis ut Lorem aliquip aute pariatur magna laboris duis veniam qui velit. Pariatur occaecat eu minim adipisicing est do. Occaecat do ipsum ut in enim quis voluptate et. Sit ea irure nulla culpa in eiusmod.\r\n",
- "registered":"2018-08-24T12:46:31 -01:00",
- "latitude":-22.323554,
- "longitude":139.071611,
- "tags":[
- "id",
- "do",
- "amet",
- "magna",
- "est",
- "veniam",
- "voluptate"
- ],
- "friends":[
- {
- "id":0,
- "name":"Tammi Lowe"
- },
- {
- "id":1,
- "name":"Simpson Miles"
- },
- {
- "id":2,
- "name":"Hogan Osborne"
- }
- ],
- "greeting":"Hello, Pearlie Lott! You have 2 unread messages.",
- "favoriteFruit":"banana"
- },
- {
- "_id":"5ce6dc0c2b56a6f3271fc272",
- "index":1,
- "guid":"2a24b446-d11a-4a52-b6c8-86acba1dc65f",
- "isActive":true,
- "balance":"$1,176.58",
- "picture":"http://placehold.it/32x32",
- "age":30,
- "eyeColor":"brown",
- "name":"Bertha Mack",
- "gender":"female",
- "company":"AQUAFIRE",
- "email":"berthamack@aquafire.com",
- "phone":"+1 (804) 504-2151",
- "address":"636 Bouck Court, Cresaptown, Vermont, 5203",
- "about":"Ipsum est exercitation excepteur reprehenderit ipsum. Do velit dolore minim ad. Quis amet dolor dolore exercitation sint Lorem. Exercitation nulla magna ut incididunt enim veniam voluptate Lorem velit adipisicing sunt deserunt sunt aute. Ullamco id anim Lorem dolore do labore excepteur et reprehenderit sit adipisicing sunt esse veniam. Anim laborum labore labore incididunt in labore exercitation ad occaecat amet ea quis veniam ut.\r\n",
- "registered":"2017-12-29T06:00:27 -00:00",
- "latitude":75.542572,
- "longitude":147.312705,
- "tags":[
- "veniam",
- "sunt",
- "commodo",
- "ad",
- "enim",
- "officia",
- "nisi"
- ],
- "friends":[
- {
- "id":0,
- "name":"Riddle Williams"
- },
- {
- "id":1,
- "name":"Tracy Wagner"
- },
- {
- "id":2,
- "name":"Morrow Phillips"
- }
- ],
- "greeting":"Hello, Bertha Mack! You have 8 unread messages.",
- "favoriteFruit":"banana"
- },
- {
- "_id":"5ce6dc0c6d8631fbfdd2afc7",
- "index":2,
- "guid":"66ca5411-4c88-4347-9972-e1016f628098",
- "isActive":false,
- "balance":"$2,732.22",
- "picture":"http://placehold.it/32x32",
- "age":33,
- "eyeColor":"blue",
- "name":"Fox Morgan",
- "gender":"male",
- "company":"PERKLE",
- "email":"foxmorgan@perkle.com",
- "phone":"+1 (985) 401-3450",
- "address":"801 Whitty Lane, Snyderville, Guam, 5253",
- "about":"Ex officia eu Lorem velit ullamco qui cupidatat irure sunt ea ad deserunt. Officia est consequat aute labore occaecat aliquip. Velit commodo cillum incididunt cupidatat ad id veniam aute labore tempor qui culpa voluptate dolor. Occaecat in ea id labore exercitation non tempor occaecat laboris aute irure fugiat dolor mollit. Voluptate non proident officia deserunt ex et ullamco aute eiusmod cupidatat consequat elit id.\r\n",
- "registered":"2015-04-02T06:40:53 -01:00",
- "latitude":-27.612441,
- "longitude":-134.005929,
- "tags":[
- "occaecat",
- "amet",
- "eu",
- "dolore",
- "ad",
- "fugiat",
- "quis"
- ],
- "friends":[
- {
- "id":0,
- "name":"Case Preston"
- },
- {
- "id":1,
- "name":"Pollard Dawson"
- },
- {
- "id":2,
- "name":"Frye Mann"
- }
- ],
- "greeting":"Hello, Fox Morgan! You have 2 unread messages.",
- "favoriteFruit":"apple"
- },
- {
- "_id":"5ce6dc0c0a7fea91e0a1fdf5",
- "index":3,
- "guid":"f895a236-fc0d-4c08-b2f0-9d1638dc256d",
- "isActive":true,
- "balance":"$2,746.32",
- "picture":"http://placehold.it/32x32",
- "age":34,
- "eyeColor":"green",
- "name":"Deleon Tucker",
- "gender":"male",
- "company":"ZANILLA",
- "email":"deleontucker@zanilla.com",
- "phone":"+1 (883) 415-2709",
- "address":"540 Vandam Street, Chical, Wyoming, 5181",
- "about":"Consectetur consectetur sint Lorem non id. Fugiat reprehenderit nulla dolore nisi culpa esse ea. Ad occaecat qui magna proident ex pariatur aliquip adipisicing do aute aute sunt. Aliqua aliqua et exercitation sunt ut adipisicing.\r\n",
- "registered":"2017-10-08T09:05:49 -01:00",
- "latitude":34.893845,
- "longitude":110.699256,
- "tags":[
- "culpa",
- "sunt",
- "sit",
- "ut",
- "eiusmod",
- "laboris",
- "ullamco"
- ],
- "friends":[
- {
- "id":0,
- "name":"Bernadine Pennington"
- },
- {
- "id":1,
- "name":"Latoya Bradshaw"
- },
- {
- "id":2,
- "name":"Iva Caldwell"
- }
- ],
- "greeting":"Hello, Deleon Tucker! You have 7 unread messages.",
- "favoriteFruit":"banana"
- },
- {
- "_id":"5ce6dc0c18bc92716a12a8e4",
- "index":4,
- "guid":"6ed45f42-1a2b-48b2-89ce-5fdb2505343b",
- "isActive":true,
- "balance":"$1,049.96",
- "picture":"http://placehold.it/32x32",
- "age":30,
- "eyeColor":"blue",
- "name":"Schwartz Norman",
- "gender":"male",
- "company":"UPDAT",
- "email":"schwartznorman@updat.com",
- "phone":"+1 (826) 404-3309",
- "address":"925 Harman Street, Cornucopia, Georgia, 5748",
- "about":"Qui Lorem ullamco veniam irure aliquip amet exercitation. Velit nisi id laboris adipisicing in esse adipisicing commodo cillum do exercitation tempor. Consequat tempor dolor minim consequat minim ad do tempor excepteur.\r\n",
- "registered":"2014-08-10T08:34:27 -01:00",
- "latitude":27.35547,
- "longitude":-77.343791,
- "tags":[
- "reprehenderit",
- "nisi",
- "duis",
- "fugiat",
- "id",
- "non",
- "laboris"
- ],
- "friends":[
- {
- "id":0,
- "name":"Dora Combs"
- },
- {
- "id":1,
- "name":"Emerson Wade"
- },
- {
- "id":2,
- "name":"Alma Mccormick"
- }
- ],
- "greeting":"Hello, Schwartz Norman! You have 1 unread messages.",
- "favoriteFruit":"apple"
- },
- {
- "_id":"5ce6dc0cb7ae44eb76c3e5fd",
- "index":5,
- "guid":"0516df27-73db-42a8-b2c3-d34bd976e031",
- "isActive":false,
- "balance":"$3,679.94",
- "picture":"http://placehold.it/32x32",
- "age":32,
- "eyeColor":"brown",
- "name":"Christi Oneal",
- "gender":"female",
- "company":"SUREPLEX",
- "email":"christioneal@sureplex.com",
- "phone":"+1 (985) 408-3098",
- "address":"640 Fayette Street, Dennard, Washington, 7962",
- "about":"Dolore fugiat sit non dolore nostrud mollit enim id sint culpa do reprehenderit ad. Velit occaecat incididunt nostrud aliqua incididunt do cillum occaecat laboris quis duis. Non tempor culpa aliquip est est consectetur ullamco elit. Voluptate et sit do et. Amet sit irure eu ex enim nulla anim deserunt ut. Sit aute ea ut fugiat eu tempor Lorem.\r\n",
- "registered":"2015-05-10T09:24:56 -01:00",
- "latitude":43.343805,
- "longitude":79.535043,
- "tags":[
- "occaecat",
- "laboris",
- "nulla",
- "nisi",
- "dolore",
- "cillum",
- "dolore"
- ],
- "friends":[
- {
- "id":0,
- "name":"Marquez Wiggins"
- },
- {
- "id":1,
- "name":"Mai Fischer"
- },
- {
- "id":2,
- "name":"Newman Davenport"
- }
- ],
- "greeting":"Hello, Christi Oneal! You have 8 unread messages.",
- "favoriteFruit":"strawberry"
- }
-]');
-
- --Act
- ut3_develop.ut.expect( l_actual ).to_equal( l_actual );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure long_json_diff as
- l_expected json_element_t;
- l_actual json_element_t;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- -- Arrange
- l_actual := json_element_t.parse('[
- {
- "_id": "5ce6ec46cb9977b050f15d97",
- "index": 0,
- "guid": "1acb2b6b-15b5-4747-a62f-db477e18df61",
- "isActive": false,
- "balance": "$1,443.80",
- "picture": "http://placehold.it/32x32",
- "age": 33,
- "eyeColor": "brown",
- "name": "Carson Conley",
- "gender": "male",
- "company": "EYEWAX",
- "email": "carsonconley@eyewax.com",
- "phone": "+1 (873) 520-2117",
- "address": "289 Wallabout Street, Cazadero, Nevada, 4802",
- "about": "Lorem aliqua veniam eiusmod exercitation anim sunt esse qui tempor officia amet nulla labore enim. Fugiat eiusmod amet exercitation incididunt mollit pariatur amet et quis et ex amet adipisicing. Elit in commodo tempor adipisicing exercitation Lorem amet cillum sint sint aliquip. Officia enim do irure velit qui officia et reprehenderit qui enim.\r\n",
- "registered": "2018-08-07T05:03:13 -01:00",
- "latitude": -1.973252,
- "longitude": 17.835529,
- "tags": [
- "dolore",
- "occaecat",
- "proident",
- "laborum",
- "nostrud",
- "non",
- "occaecat"
- ],
- "friends": [
- {
- "id": 0,
- "name": "Riggs Cardenas"
- },
- {
- "id": 1,
- "name": "Duncan Schultz"
- },
- {
- "id": 2,
- "name": "Galloway Bond"
- }
- ],
- "greeting": "Hello, Carson Conley! You have 5 unread messages.",
- "favoriteFruit": "strawberry"
- },
- {
- "_id": "5ce6ec469ba57bef5c421021",
- "index": 1,
- "guid": "59be5b73-fffe-4a4f-acea-65c5abbdb53c",
- "isActive": true,
- "balance": "$3,895.35",
- "picture": "http://placehold.it/32x32",
- "age": 21,
- "eyeColor": "brown",
- "name": "Melton Carroll",
- "gender": "male",
- "company": "ISOSPHERE",
- "email": "meltoncarroll@isosphere.com",
- "phone": "+1 (804) 416-2235",
- "address": "114 Windsor Place, Dubois, Oklahoma, 9648",
- "about": "Pariatur ea voluptate aute dolor minim laborum cillum ad reprehenderit. Mollit sint voluptate duis et culpa amet irure laborum. Nulla veniam fugiat sint proident aliquip dolore laboris nisi et. Nisi in do aliqua voluptate cupidatat enim dolor minim minim qui tempor. Eu anim ea mollit sunt esse et est cillum cillum pariatur dolor. Ea anim duis sunt eiusmod sit cillum consectetur aliquip ad et elit culpa irure commodo.\r\n",
- "registered": "2018-10-20T01:38:32 -01:00",
- "latitude": 46.821539,
- "longitude": 19.78817,
- "tags": [
- "sunt",
- "aliquip",
- "commodo",
- "occaecat",
- "mollit",
- "minim",
- "sint"
- ],
- "friends": [
- {
- "id": 0,
- "name": "Tameka Reese"
- },
- {
- "id": 1,
- "name": "Rosemarie Buckley"
- },
- {
- "id": 2,
- "name": "Houston Moran"
- }
- ],
- "greeting": "Hello, Melton Carroll! You have 10 unread messages.",
- "favoriteFruit": "strawberry"
- },
- {
- "_id": "5ce6ec464e6f8751e75ed29f",
- "index": 2,
- "guid": "42e07b71-b769-4078-b226-f79048b75bd2",
- "isActive": false,
- "balance": "$3,366.81",
- "picture": "http://placehold.it/32x32",
- "age": 23,
- "eyeColor": "blue",
- "name": "Kathie Cameron",
- "gender": "female",
- "company": "EVENTIX",
- "email": "kathiecameron@eventix.com",
- "phone": "+1 (949) 416-3458",
- "address": "171 Henderson Walk, Barstow, American Samoa, 3605",
- "about": "Lorem est mollit consequat pariatur elit. Enim adipisicing ipsum sit labore exercitation fugiat qui eu enim. Quis irure Lorem exercitation laborum sunt quis Lorem pariatur officia veniam aute officia mollit quis.\r\n",
- "registered": "2015-07-15T08:40:18 -01:00",
- "latitude": -12.947501,
- "longitude": 51.221756,
- "tags": [
- "voluptate",
- "officia",
- "laborum",
- "nulla",
- "anim",
- "mollit",
- "adipisicing"
- ],
- "friends": [
- {
- "id": 0,
- "name": "Noelle Leonard"
- },
- {
- "id": 1,
- "name": "Sally Barr"
- },
- {
- "id": 2,
- "name": "Rosie Rutledge"
- }
- ],
- "greeting": "Hello, Kathie Cameron! You have 10 unread messages.",
- "favoriteFruit": "strawberry"
- },
- {
- "_id": "5ce6ec4632328a654d592cb6",
- "index": 3,
- "guid": "6b9124a9-fbde-4c60-8dac-e296f5daa3c4",
- "isActive": true,
- "balance": "$2,374.96",
- "picture": "http://placehold.it/32x32",
- "age": 32,
- "eyeColor": "brown",
- "name": "Ebony Carver",
- "gender": "female",
- "company": "EVENTEX",
- "email": "ebonycarver@eventex.com",
- "phone": "+1 (816) 535-3332",
- "address": "452 Lott Street, Iberia, South Carolina, 1635",
- "about": "Ea cupidatat occaecat in Lorem adipisicing quis sunt. Occaecat sit Lorem eiusmod et. Velit nostrud cupidatat do exercitation. Officia esse excepteur labore aliqua fugiat dolor duis. Ullamco qui ipsum eu do nostrud et laboris magna dolor cillum. Dolore eiusmod do occaecat dolore.\r\n",
- "registered": "2017-04-12T09:20:02 -01:00",
- "latitude": 65.70655,
- "longitude": 150.667286,
- "tags": [
- "do",
- "laboris",
- "exercitation",
- "quis",
- "laboris",
- "amet",
- "sint"
- ],
- "friends": [
- {
- "id": 0,
- "name": "Rowena Holloway"
- },
- {
- "id": 1,
- "name": "Lee Chang"
- },
- {
- "id": 2,
- "name": "Delaney Kennedy"
- }
- ],
- "greeting": "Hello, Ebony Carver! You have 10 unread messages.",
- "favoriteFruit": "apple"
- },
- {
- "_id": "5ce6ec46d9dbfbf9b184cee7",
- "index": 4,
- "guid": "9dece65b-6b48-4960-880b-7795ff63c81c",
- "isActive": false,
- "balance": "$2,927.54",
- "picture": "http://placehold.it/32x32",
- "age": 27,
- "eyeColor": "green",
- "name": "Mae Payne",
- "gender": "female",
- "company": "ZEPITOPE",
- "email": "maepayne@zepitope.com",
- "phone": "+1 (904) 531-2930",
- "address": "575 Amity Street, Eden, Iowa, 4017",
- "about": "Voluptate ex enim aliqua ea et proident ipsum est anim nostrud. Duis aliquip voluptate voluptate non aliquip. Elit commodo Lorem aliqua sit elit consectetur reprehenderit in aute minim. Dolor non incididunt do tempor aliquip esse non magna anim eiusmod ut id id.\r\n",
- "registered": "2016-08-29T06:23:00 -01:00",
- "latitude": -60.325313,
- "longitude": 88.598722,
- "tags": [
- "est",
- "incididunt",
- "officia",
- "sunt",
- "eu",
- "ut",
- "deserunt"
- ],
- "friends": [
- {
- "id": 0,
- "name": "Taylor Walton"
- },
- {
- "id": 1,
- "name": "Celina Mcdonald"
- },
- {
- "id": 2,
- "name": "Berry Rivers"
- }
- ],
- "greeting": "Hello, Mae Payne! You have 4 unread messages.",
- "favoriteFruit": "strawberry"
- }
-]');
- l_expected := json_element_t.parse('[
- {
- "_id": "5ce6ec6660565269b16cf836",
- "index": 0,
- "guid": "c222eda5-d925-4163-89e3-4b0e50d5e297",
- "isActive": false,
- "balance": "$3,626.25",
- "picture": "http://placehold.it/32x32",
- "age": 28,
- "eyeColor": "green",
- "name": "Leigh Munoz",
- "gender": "female",
- "company": "OATFARM",
- "email": "leighmunoz@oatfarm.com",
- "phone": "+1 (969) 545-2708",
- "address": "218 Mersereau Court, Homeworth, Connecticut, 4423",
- "about": "Eiusmod exercitation incididunt ea incididunt anim voluptate. Duis laboris ut Lorem pariatur tempor voluptate occaecat laboris. Enim duis excepteur cillum ullamco pariatur sint. Dolor labore qui ullamco deserunt do consectetur labore velit occaecat officia incididunt Lorem dolore. Pariatur dolor voluptate ex adipisicing labore quis aliquip aliquip. Culpa tempor proident nisi occaecat aliqua mollit ullamco nisi cillum ipsum exercitation quis excepteur. Consequat officia ex ipsum id consequat deserunt sunt id nostrud magna.\r\n",
- "registered": "2018-10-08T10:24:07 -01:00",
- "latitude": -42.796797,
- "longitude": -14.220273,
- "tags": [
- "ex",
- "elit",
- "consectetur",
- "ipsum",
- "aute",
- "ipsum",
- "Lorem"
- ],
- "friends": [
- {
- "id": 0,
- "name": "Selena Dunn"
- },
- {
- "id": 1,
- "name": "Wilda Haynes"
- },
- {
- "id": 2,
- "name": "Calderon Long"
- }
- ],
- "greeting": "Hello, Leigh Munoz! You have 6 unread messages.",
- "favoriteFruit": "strawberry"
- },
- {
- "_id": "5ce6ec66383ddbf3c400e3ed",
- "index": 1,
- "guid": "2e778803-50d3-411f-b34d-47d0f19d03f7",
- "isActive": false,
- "balance": "$2,299.28",
- "picture": "http://placehold.it/32x32",
- "age": 23,
- "eyeColor": "blue",
- "name": "Velez Drake",
- "gender": "male",
- "company": "GENMY",
- "email": "velezdrake@genmy.com",
- "phone": "+1 (870) 564-2219",
- "address": "526 Erskine Loop, Websterville, Nebraska, 1970",
- "about": "Consectetur Lorem do ex est dolor. Consectetur do tempor amet elit. Amet dolore cupidatat Lorem sunt reprehenderit.\r\n",
- "registered": "2017-11-24T04:42:37 -00:00",
- "latitude": -45.78579,
- "longitude": 142.062878,
- "tags": [
- "do",
- "esse",
- "nisi",
- "sunt",
- "et",
- "nisi",
- "nostrud"
- ],
- "friends": [
- {
- "id": 0,
- "name": "Bessie Schmidt"
- },
- {
- "id": 1,
- "name": "Harriett Lyons"
- },
- {
- "id": 2,
- "name": "Jerry Gonzales"
- }
- ],
- "greeting": "Hello, Velez Drake! You have 1 unread messages.",
- "favoriteFruit": "apple"
- },
- {
- "_id": "5ce6ec660a8b5f95ed543305",
- "index": 2,
- "guid": "bb0eaa88-f7fd-4b72-8538-8c0b4595bcec",
- "isActive": true,
- "balance": "$3,085.28",
- "picture": "http://placehold.it/32x32",
- "age": 36,
- "eyeColor": "green",
- "name": "Gallegos Dominguez",
- "gender": "male",
- "company": "QOT",
- "email": "gallegosdominguez@qot.com",
- "phone": "+1 (947) 581-3675",
- "address": "375 Temple Court, Beaulieu, Minnesota, 3880",
- "about": "Qui consequat est aliquip esse minim Lorem qui quis. Enim consequat anim culpa consequat ex incididunt ad incididunt est id excepteur nulla culpa. Aliqua enim enim exercitation anim velit occaecat voluptate qui minim ut ullamco fugiat. Anim voluptate nulla minim labore dolore eu veniam. Exercitation sint eiusmod aute aliqua magna aliqua pariatur Lorem velit pariatur ex duis.\r\n",
- "registered": "2019-03-11T12:36:55 -00:00",
- "latitude": -1.619328,
- "longitude": -160.580052,
- "tags": [
- "ipsum",
- "reprehenderit",
- "id",
- "aliqua",
- "ad",
- "do",
- "sunt"
- ],
- "friends": [
- {
- "id": 0,
- "name": "Justice Bruce"
- },
- {
- "id": 1,
- "name": "Alta Clements"
- },
- {
- "id": 2,
- "name": "Amy Hobbs"
- }
- ],
- "greeting": "Hello, Gallegos Dominguez! You have 10 unread messages.",
- "favoriteFruit": "strawberry"
- },
- {
- "_id": "5ce6ec6600fb7aaee2d1243e",
- "index": 3,
- "guid": "4a4363b5-9d65-4b22-9b58-a5c8c1c5bd5d",
- "isActive": false,
- "balance": "$3,152.70",
- "picture": "http://placehold.it/32x32",
- "age": 37,
- "eyeColor": "green",
- "name": "Bobbie Baldwin",
- "gender": "female",
- "company": "IDEGO",
- "email": "bobbiebaldwin@idego.com",
- "phone": "+1 (937) 501-3123",
- "address": "271 Coles Street, Deltaville, Massachusetts, 349",
- "about": "Dolor labore quis Lorem eiusmod duis adipisicing ut. Aute aute aliquip exercitation eiusmod veniam ullamco irure sit est. Ut Lorem incididunt do sint laborum cillum Lorem commodo duis. Dolor nulla ad consectetur non cillum. Est excepteur esse mollit elit laborum ullamco exercitation sit esse. Reprehenderit occaecat ad ad reprehenderit adipisicing non Lorem ipsum fugiat culpa. Do quis non exercitation ea magna elit non.\r\n",
- "registered": "2014-06-25T07:44:03 -01:00",
- "latitude": -70.045195,
- "longitude": 117.328462,
- "tags": [
- "anim",
- "excepteur",
- "aliqua",
- "mollit",
- "non",
- "in",
- "adipisicing"
- ],
- "friends": [
- {
- "id": 0,
- "name": "Lora Little"
- },
- {
- "id": 1,
- "name": "Stanton Pollard"
- },
- {
- "id": 2,
- "name": "Bernice Knowles"
- }
- ],
- "greeting": "Hello, Bobbie Baldwin! You have 5 unread messages.",
- "favoriteFruit": "apple"
- },
- {
- "_id": "5ce6ec660585cbb589b34fc8",
- "index": 4,
- "guid": "18547241-6fd0-466d-9f79-21aeb0485294",
- "isActive": false,
- "balance": "$3,853.86",
- "picture": "http://placehold.it/32x32",
- "age": 32,
- "eyeColor": "blue",
- "name": "Erika Benton",
- "gender": "female",
- "company": "SURETECH",
- "email": "erikabenton@suretech.com",
- "phone": "+1 (833) 472-2277",
- "address": "893 Jamison Lane, Grayhawk, Illinois, 1820",
- "about": "Ullamco nisi quis esse fugiat eu proident nisi cupidatat reprehenderit nostrud nulla laborum duis. Duis quis ipsum ad voluptate enim. Et excepteur irure proident adipisicing enim eu veniam aliquip nostrud amet sit est. Non laborum reprehenderit qui ullamco occaecat elit sunt ea nostrud reprehenderit incididunt sunt.\r\n",
- "registered": "2018-01-19T11:58:53 -00:00",
- "latitude": -44.595301,
- "longitude": 100.938225,
- "tags": [
- "cupidatat",
- "aliqua",
- "nostrud",
- "nostrud",
- "ipsum",
- "ipsum",
- "commodo"
- ],
- "friends": [
- {
- "id": 0,
- "name": "Addie Benjamin"
- },
- {
- "id": 1,
- "name": "Brock Nolan"
- },
- {
- "id": 2,
- "name": "Betty Suarez"
- }
- ],
- "greeting": "Hello, Erika Benton! You have 5 unread messages.",
- "favoriteFruit": "apple"
- },
- {
- "_id": "5ce6ec66ff15753596332021",
- "index": 5,
- "guid": "f865dabb-4871-4f29-9c56-17361d254f39",
- "isActive": true,
- "balance": "$3,474.90",
- "picture": "http://placehold.it/32x32",
- "age": 32,
- "eyeColor": "blue",
- "name": "Rice Owens",
- "gender": "male",
- "company": "ACIUM",
- "email": "riceowens@acium.com",
- "phone": "+1 (975) 576-3718",
- "address": "400 Halleck Street, Lafferty, District Of Columbia, 495",
- "about": "Cupidatat laborum mollit non eu aute amet consectetur aliqua officia consectetur consequat. Tempor labore pariatur Lorem sint quis laborum est dolore et. Est ipsum incididunt eiusmod enim nostrud laboris duis est enim proident do laborum id culpa.\r\n",
- "registered": "2018-05-06T02:43:06 -01:00",
- "latitude": 2.843708,
- "longitude": -3.301217,
- "tags": [
- "laboris",
- "velit",
- "dolore",
- "sunt",
- "ad",
- "aliqua",
- "duis"
- ],
- "friends": [
- {
- "id": 0,
- "name": "Ramirez King"
- },
- {
- "id": 1,
- "name": "Jeannie Boyer"
- },
- {
- "id": 2,
- "name": "Deloris Jensen"
- }
- ],
- "greeting": "Hello, Rice Owens! You have 9 unread messages.",
- "favoriteFruit": "banana"
- }
-]');
-
- --Act
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
- --Assert
- l_expected_message := q'[%Extra property: object on path: $[5]
-%Actual value: "5ce6ec46cb9977b050f15d97" was expected to be: "5ce6ec6660565269b16cf836" on path: $[0]."_id"
-%Actual value: "5ce6ec469ba57bef5c421021" was expected to be: "5ce6ec66383ddbf3c400e3ed" on path: $[1]."_id"
-%Actual value: "5ce6ec4632328a654d592cb6" was expected to be: "5ce6ec6600fb7aaee2d1243e" on path: $[3]."_id"
-%Actual value: "5ce6ec464e6f8751e75ed29f" was expected to be: "5ce6ec660a8b5f95ed543305" on path: $[2]."_id"
-%Actual value: "5ce6ec46d9dbfbf9b184cee7" was expected to be: "5ce6ec660585cbb589b34fc8" on path: $[4]."_id"
-%Actual value: "59be5b73-fffe-4a4f-acea-65c5abbdb53c" was expected to be: "2e778803-50d3-411f-b34d-47d0f19d03f7" on path: $[1]."guid"
-%Actual value: "9dece65b-6b48-4960-880b-7795ff63c81c" was expected to be: "18547241-6fd0-466d-9f79-21aeb0485294" on path: $[4]."guid"
-%Actual value: "42e07b71-b769-4078-b226-f79048b75bd2" was expected to be: "bb0eaa88-f7fd-4b72-8538-8c0b4595bcec" on path: $[2]."guid"
-%Actual value: "6b9124a9-fbde-4c60-8dac-e296f5daa3c4" was expected to be: "4a4363b5-9d65-4b22-9b58-a5c8c1c5bd5d" on path: $[3]."guid"
-%Actual value: "1acb2b6b-15b5-4747-a62f-db477e18df61" was expected to be: "c222eda5-d925-4163-89e3-4b0e50d5e297" on path: $[0]."guid"
-%Actual value: FALSE was expected to be: TRUE on path: $[2]."isActive"
-%Actual value: TRUE was expected to be: FALSE on path: $[3]."isActive"
-%Actual value: TRUE was expected to be: FALSE on path: $[1]."isActive"
-%Actual value: "$3,895.35" was expected to be: "$2,299.28" on path: $[1]."balance"
-%Actual value: "$1,443.80" was expected to be: "$3,626.25" on path: $[0]."balance"
-%Actual value: "$3,366.81" was expected to be: "$3,085.28" on path: $[2]."balance"
-%Actual value: "$2,927.54" was expected to be: "$3,853.86" on path: $[4]."balance"
-%Actual value: "$2,374.96" was expected to be: "$3,152.70" on path: $[3]."balance"
-%Actual value: 23 was expected to be: 36 on path: $[2]."age"%]';
-
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- ut.expect(l_actual_message).to_be_like('%Diff: 133 differences found, showing first 20%');
- ut.expect(l_actual_message).to_be_like('%1 missing properties%');
- ut.expect(l_actual_message).to_be_like('%132 unequal values%');
- end;
-
- procedure check_json_objects is
- l_expected json_object_t;
- l_actual json_object_t;
- begin
- l_expected := json_object_t('{ "name" : "Bond", "proffesion" : "spy", "drink" : "martini"}');
- l_actual := json_object_t('{ "proffesion" : "spy","name" : "Bond", "drink" : "martini"}');
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure check_json_arrays is
- l_expected json_array_t;
- l_actual json_array_t;
- begin
- l_expected := json_array_t('[ {"name" : "Bond", "proffesion" : "spy", "drink" : "martini"} , {"name" : "Kloss", "proffesion" : "spy", "drink" : "beer"} ]');
- l_actual := json_array_t('[ {"name" : "Bond", "proffesion" : "spy", "drink" : "martini"} , {"name" : "Kloss", "proffesion" : "spy", "drink" : "beer"} ]');
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- $if dbms_db_version.version >= 21 $then
-
- procedure success_on_same_data_njson
- as
- l_actual json;
- begin
- -- Arrange
- l_actual := json(' {
- "Actors": [
- {
- "name": "Tom Cruise",
- "age": 56,
- "Born At": "Syracuse, NY",
- "Birthdate": "July 3, 1962",
- "photo": "https://jsonformatter.org/img/tom-cruise.jpg",
- "wife": null,
- "weight": 67.5,
- "hasChildren": true,
- "hasGreyHair": false,
- "children": [
- "Suri",
- "Isabella Jane",
- "Connor"
- ]
- },
- {
- "name": "Robert Downey Jr.",
- "age": 53,
- "Born At": "New York City, NY",
- "Birthdate": "April 4, 1965",
- "photo": "https://jsonformatter.org/img/Robert-Downey-Jr.jpg",
- "wife": "Susan Downey",
- "weight": 77.1,
- "hasChildren": true,
- "hasGreyHair": false,
- "children": [
- "Indio Falconer",
- "Avri Roel",
- "Exton Elias"
- ]
- }
- ]
- }');
-
- --Act
- ut3_develop.ut.expect( l_actual ).to_equal( l_actual );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure fail_on_diff_data_njson
- as
- l_expected json;
- l_actual json;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- -- Arrange
- l_actual := json('{"Aidan Gillen": {"array": ["Game of Thrones","The Wire"],"string": "some string","int": "2","otherint": 4, "aboolean": "true", "boolean": false,"object": {"foo": "bar"}},"Amy Ryan": ["In Treatment","The Wire"],"Annie Fitzgerald": ["True Blood","Big Love","The Sopranos","Oz"],"Anwan Glover": ["Treme","The Wire"],"Alexander Skarsg?rd": ["Generation Kill","True Blood"],"Alice Farmer": ["The Corner","Oz","The Wire"]}');
- l_expected := json('{"Aidan Gillen": {"array": ["Game of Thron\"es","The Wire"],"string": "some string","int": 2,"aboolean": true, "boolean": true,"object": {"foo": "bar","object1": {"new prop1": "new prop value"},"object2": {"new prop1": "new prop value"},"object3": {"new prop1": "new prop value"},"object4": {"new prop1": "new prop value"}}},"Amy Ryan": {"one": "In Treatment","two": "The Wire"},"Annie Fitzgerald": ["Big Love","True Blood"],"Anwan Glover": ["Treme","The Wire"],"Alexander Skarsgard": ["Generation Kill","True Blood"], "Clarke Peters": null}');
-
- --Act
- ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
- --Assert
- l_expected_message := q'[%Missing property: "Alexander Skarsg?rd" on path: $
-%Extra property: "Alexander Skarsgard" on path: $
-%Missing property: "Alice Farmer" on path: $
-%Extra property: "Clarke Peters" on path: $
-%Extra property: "one" on path: $."Amy Ryan"
-%Missing property: "The Sopranos" on path: $."Annie Fitzgerald"[2]
-%Extra property: "two" on path: $."Amy Ryan"
-%Missing property: "Oz" on path: $."Annie Fitzgerald"[3]
-%Missing property: "otherint" on path: $."Aidan Gillen"
-%Extra property: "object1" on path: $."Aidan Gillen"."object"
-%Extra property: "object2" on path: $."Aidan Gillen"."object"
-%Extra property: "object3" on path: $."Aidan Gillen"."object"
-%Extra property: "object4" on path: $."Aidan Gillen"."object"
-%Actual type: 'array' was expected to be: 'object' on path: $."Amy Ryan"
-%Actual type: 'string' was expected to be: 'number' on path: $."Aidan Gillen"."int"
-%Actual type: 'string' was expected to be: 'boolean' on path: $."Aidan Gillen"."aboolean"
-%Actual value: "True Blood" was expected to be: "Big Love" on path: $."Annie Fitzgerald"[0]
-%Actual value: "Big Love" was expected to be: "True Blood" on path: $."Annie Fitzgerald"[1]
-%Actual value: FALSE was expected to be: TRUE on path: $."Aidan Gillen"."boolean"
-%Actual value: "Game of Thrones" was expected to be: "Game of Thron\"es" on path: $."Aidan Gillen"."array"[0]%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- ut.expect(l_actual_message).to_be_like('%Diff: 20 differences found%');
- ut.expect(l_actual_message).to_be_like('%13 missing properties%');
- ut.expect(l_actual_message).to_be_like('%4 unequal values%');
- ut.expect(l_actual_message).to_be_like('%3 incorrect types%');
- end;
-
-
- --Please note that by the looks of things the call to json() results in null value being returned.
- procedure null_json_variable_njson
- as
- l_expected json ;
- begin
- -- Arrange
- l_expected := cast (null as json );
-
- --Act
- ut3_develop.ut.expect( l_expected ).to_be_null;
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure to_have_count_njson as
- l_actual json;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- -- Arrange
- l_actual := json('{"Aidan Gillen": {"array": ["Game of Thrones","The Wire"],"string": "some string","int": "2","otherint": 4, "aboolean": "true", "boolean": false,"object": {"foo": "bar"}},"Amy Ryan": ["In Treatment","The Wire"],"Annie Fitzgerald": ["True Blood","Big Love","The Sopranos","Oz"],"Anwan Glover": ["Treme","The Wire"],"Alexander Skarsg?rd": ["Generation Kill","True Blood"],"Alice Farmer": ["The Corner","Oz","The Wire"]}');
-
- --Act
- ut3_develop.ut.expect( l_actual ).to_have_count( 6 );
-
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
-
- end;
-
- procedure fail_to_have_count_njson
- as
- l_actual json;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- -- Arrange
- l_actual := json('{"Aidan Gillen": {"array": ["Game of Thrones","The Wire"],"string": "some string","int": "2","otherint": 4, "aboolean": "true", "boolean": false,"object": {"foo": "bar"}},"Amy Ryan": ["In Treatment","The Wire"],"Annie Fitzgerald": ["True Blood","Big Love","The Sopranos","Oz"],"Anwan Glover": ["Treme","The Wire"],"Alexander Skarsg?rd": ["Generation Kill","True Blood"],"Alice Farmer": ["The Corner","Oz","The Wire"]}');
-
- --Act
- ut3_develop.ut.expect( l_actual ).to_have_count( 2 );
- --Assert
- l_expected_message := q'[%Actual: (json [ count = 6 ]) was expected to have [ count = 2 ]%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
-
- end;
-
- procedure not_to_have_count_njson
- as
- l_actual json;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- -- Arrange
- l_actual := json('{"Aidan Gillen": {"array": ["Game of Thrones","The Wire"],"string": "some string","int": "2","otherint": 4, "aboolean": "true", "boolean": false,"object": {"foo": "bar"}},"Amy Ryan": ["In Treatment","The Wire"],"Annie Fitzgerald": ["True Blood","Big Love","The Sopranos","Oz"],"Anwan Glover": ["Treme","The Wire"],"Alexander Skarsg?rd": ["Generation Kill","True Blood"],"Alice Farmer": ["The Corner","Oz","The Wire"]}');
-
- --Act
- ut3_develop.ut.expect( l_actual ).not_to_have_count( 7 );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure fail_not_to_have_count_njson
- as
- l_actual json;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- -- Arrange
- l_actual := json('{"Aidan Gillen": {"array": ["Game of Thrones","The Wire"],"string": "some string","int": "2","otherint": 4, "aboolean": "true", "boolean": false,"object": {"foo": "bar"}},"Amy Ryan": ["In Treatment","The Wire"],"Annie Fitzgerald": ["True Blood","Big Love","The Sopranos","Oz"],"Anwan Glover": ["Treme","The Wire"],"Alexander Skarsg?rd": ["Generation Kill","True Blood"],"Alice Farmer": ["The Corner","Oz","The Wire"]}');
-
- --Act
- ut3_develop.ut.expect( l_actual ).not_to_have_count( 6 );
- --Assert
- l_expected_message := q'[%Actual: json [ count = 6 ] was expected not to have [ count = 6 ]%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- $end
-
- procedure p_1113_reg_exp_chg_with_act is
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- ut3_develop.ut.expect(json_element_t.parse('{"a":"value a"}')).to_equal(json_element_t.parse('{"a":"value b"}'));
-
- --Assert
- l_expected_message := q'[%Actual: json was expected to equal: json
-%Diff: 1 differences found
-%1 unequal values
-%Actual value: "value a" was expected to be: "value b" on path: $."a"%]';
-
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
-
-end;
-/
diff --git a/test/ut3_user/expectations/test_expectations_json.pks b/test/ut3_user/expectations/test_expectations_json.pks
deleted file mode 100644
index 410c3050b..000000000
--- a/test/ut3_user/expectations/test_expectations_json.pks
+++ /dev/null
@@ -1,107 +0,0 @@
-create or replace package test_expectations_json is
-
- --%suite(json expectations)
- --%suitepath(utplsql.test_user.expectations)
-
- --%aftereach
- procedure cleanup_expectations;
-
- --%test(Gives success for identical data)
- procedure success_on_same_data;
-
- --%test(Gives failure for different data)
- procedure fail_on_diff_data;
-
- --%test( Json variable is null)
- procedure null_json_variable;
-
- --%test( Json variable is not null)
- procedure not_null_json_variable;
-
- --%test( Fail json variable is null)
- procedure fail_null_json_var;
-
- --%test( Fail json variable is not null)
- procedure fail_not_null_json_var;
-
- --%test(Json string is empty)
- procedure empty_json;
-
- --%test(Json string is not empty)
- procedure not_empty_json;
-
- --%test( Fail json string is empty)
- procedure fail_empty_json;
-
- --%test( Fail json string is not empty)
- procedure fail_not_empty_json;
-
- --%test( Json object to have count )
- procedure to_have_count;
-
- --%test( Fail Json object to have count)
- procedure fail_to_have_count;
-
- --%test( Json object not to have count)
- procedure not_to_have_count;
-
- --%test( Fail Json object not to have count)
- procedure fail_not_to_have_count;
-
- --%test( Json object to have count on array)
- procedure to_have_count_array;
-
- --%test( Two json use plsql function to extract same pieces and compare)
- procedure to_diff_json_extract_same;
-
- --%test( Two json use plsql function to extract diff pieces and compare)
- procedure to_diff_json_extract_diff;
-
- --%test( Long JSON test same )
- procedure long_json_test;
-
- --%test( JSON test same semantic content different order )
- procedure json_same_diffrent_ord;
-
- --%test( Long complex nested JSON test )
- procedure long_json_test2;
-
- --%test( Long complex json differences )
- procedure long_json_diff;
-
- --%test( Compare two objects json )
- procedure check_json_objects;
-
- --%test( Compare two json arrays )
- procedure check_json_arrays;
-
- $if dbms_db_version.version >= 21 $then
-
- --%test(Gives success for identical data using native json for 21c and above)
- procedure success_on_same_data_njson;
-
- --%test(Gives failure for different data using native json for 21c and above)
- procedure fail_on_diff_data_njson;
-
- --%test( Json variable is null using native json for 21c and above)
- procedure null_json_variable_njson;
-
- --%test( Json object to have count using native json for 21c and above)
- procedure to_have_count_njson;
-
- --%test( Fail Json object to have count using native json for 21c and above)
- procedure fail_to_have_count_njson;
-
- --%test( Json object not to have count using native json for 21c and above)
- procedure not_to_have_count_njson;
-
- --%test( Fail Json object not to have count using native json for 21c and above)
- procedure fail_not_to_have_count_njson;
-
- $end
-
- --%test( Regression scenario tests for issue #1113 where the expected has been switched with actual)
- procedure p_1113_reg_exp_chg_with_act;
-
-end;
-/
diff --git a/test/ut3_user/expectations/test_matchers.pkb b/test/ut3_user/expectations/test_matchers.pkb
deleted file mode 100644
index e1d87d4cb..000000000
--- a/test/ut3_user/expectations/test_matchers.pkb
+++ /dev/null
@@ -1,271 +0,0 @@
-create or replace package body test_matchers is
-
- procedure cleanup_expectations is
- begin
- ut3_tester_helper.main_helper.clear_expectations( );
- end;
-
- procedure exec_matcher(a_type varchar2, a_actual_value varchar2, a_expected_value varchar2, a_matcher varchar2, a_result integer, a_prefix varchar2 := null) is
- l_statement varchar2(32767);
- begin
- l_statement := '
- declare
- l_actual '||a_type||' := '||a_actual_value||';
- l_expected '||a_type||' := '||a_expected_value||';
- begin
- ut3_develop.ut.expect( l_actual ).'||a_prefix||'to_'||a_matcher||'( l_expected );
- end;';
- execute immediate l_statement;
- if a_result = ut3_tester_helper.main_helper.gc_success then
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num()).to_equal(0);
- else
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num()).to_be_greater_than(0);
- end if;
- cleanup_expectations();
- end exec_matcher;
-
- procedure exec_be_between(a_type varchar2, a_actual_value varchar2, a_expected1_value varchar2, a_expected2_value varchar2,a_result integer) is
- l_statement varchar2(32767);
- begin
- l_statement := '
- declare
- l_actual_value '||a_type||' := '||a_actual_value||';
- l_lower '||a_type||' := '||a_expected1_value||';
- l_higher '||a_type||' := '||a_expected2_value||';
- begin
- ut3_develop.ut.expect(l_actual_value).to_be_between(l_lower, l_higher);
- end;';
- execute immediate l_statement;
- if a_result = ut3_tester_helper.main_helper.gc_success then
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num()).to_equal(0);
- else
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num()).to_be_greater_than(0);
- end if;
- cleanup_expectations();
- end exec_be_between;
-
- procedure exec_be_between2(a_type varchar2, a_actual_value varchar2, a_expected1_value varchar2, a_expected2_value varchar2,a_result integer, a_not_prefix varchar2 default null) is
- l_statement varchar2(32767);
- begin
- l_statement := '
- declare
- l_actual_value '||a_type||' := '||a_actual_value||';
- l_value1 '||a_type||' := '||a_expected1_value||';
- l_value2 '||a_type||' := '||a_expected2_value||';
- begin
- ut3_develop.ut.expect(l_actual_value).'||a_not_prefix||'to_be_between(l_value1, l_value2);
- end;';
- execute immediate l_statement;
- if a_result = ut3_tester_helper.main_helper.gc_success then
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num()).to_equal(0);
- else
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num()).to_be_greater_than(0);
- end if;
- cleanup_expectations();
- end exec_be_between2;
-
- procedure exec_be_like(a_type varchar2, a_value varchar2, a_pattern varchar2, a_escape varchar2, a_result integer, a_prefix varchar2 default null) is
- begin
- execute immediate
- 'declare
- l_actual ' || a_type || ' := '||a_value||';
- l_pattern varchar2(32767) := :pattern;
- l_escape_char varchar2(32767) := :a_escape;
- l_result integer;
- begin
- ut3_develop.ut.expect( l_actual ).' || a_prefix ||q'[to_be_like(l_pattern, l_escape_char);
- end;]'
- using a_pattern, a_escape;
- if a_result = ut3_tester_helper.main_helper.gc_success then
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num()).to_equal(0);
- else
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num()).to_be_greater_than(0);
- end if;
- cleanup_expectations();
- end;
-
- procedure exec_match(a_type varchar2, a_actual_value varchar2, a_pattern varchar2, a_modifiers varchar2, a_result integer, a_not_prefix varchar2 default null) is
- l_statement varchar2(32767);
- begin
- l_statement :=
- 'declare
- l_actual '||a_type||' := '||a_actual_value||';
- l_pattern varchar2(32767) := :a_pattern;
- l_modifiers varchar2(32767) := :a_modifiers;
- l_result integer;
- begin
- ut3_develop.ut.expect( l_actual ).'||a_not_prefix||'to_match(l_pattern, l_modifiers);
- end;';
- execute immediate l_statement using a_pattern, a_modifiers;
- if a_result = ut3_tester_helper.main_helper.gc_success then
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num()).to_equal(0);
- else
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num()).to_be_greater_than(0);
- end if;
- cleanup_expectations();
- end;
-
- procedure test_be_between2 is
- begin
-
- --failure when value out of range
- exec_be_between2('date', 'sysdate', 'sysdate-2', 'sysdate-1', ut3_tester_helper.main_helper.gc_failure, '');
- exec_be_between2('number', '2.0', '1.99', '1.999', ut3_tester_helper.main_helper.gc_failure, '');
- exec_be_between2('varchar2(1)', '''c''', '''a''', '''b''', ut3_tester_helper.main_helper.gc_failure, '');
- exec_be_between2('timestamp', 'systimestamp+1', 'systimestamp-1', 'systimestamp', ut3_tester_helper.main_helper.gc_failure, '');
- exec_be_between2('timestamp with local time zone', 'systimestamp+1', 'systimestamp-1', 'systimestamp', ut3_tester_helper.main_helper.gc_failure, '');
- exec_be_between2('timestamp with time zone', 'systimestamp+1', 'systimestamp-1', 'systimestamp', ut3_tester_helper.main_helper.gc_failure, '');
- exec_be_between2('interval year to month', '''2-2''', '''2-0''', '''2-1''', ut3_tester_helper.main_helper.gc_failure, '');
- exec_be_between2('interval day to second', '''2 01:00:00''', '''2 00:59:58''', '''2 00:59:59''', ut3_tester_helper.main_helper.gc_failure, '');
-
- --success when value in range
- exec_be_between2('date', 'sysdate', 'sysdate-1', 'sysdate+1', ut3_tester_helper.main_helper.gc_success, '');
- exec_be_between2('number', '2.0', '1.99', '2.01', ut3_tester_helper.main_helper.gc_success, '');
- exec_be_between2('varchar2(1)', '''b''', '''a''', '''c''', ut3_tester_helper.main_helper.gc_success, '');
- exec_be_between2('timestamp', 'systimestamp', 'systimestamp-1', 'systimestamp+1', ut3_tester_helper.main_helper.gc_success, '');
- exec_be_between2('timestamp with local time zone', 'systimestamp', 'systimestamp-1', 'systimestamp+1', ut3_tester_helper.main_helper.gc_success, '');
- exec_be_between2('timestamp with time zone', 'systimestamp', 'systimestamp-1', 'systimestamp+1', ut3_tester_helper.main_helper.gc_success, '');
- exec_be_between2('interval year to month', '''2-1''', '''2-0''', '''2-2''', ut3_tester_helper.main_helper.gc_success, '');
- exec_be_between2('interval day to second', '''2 01:00:00''', '''2 00:59:58''', '''2 01:00:01''', ut3_tester_helper.main_helper.gc_success, '');
-
- --success when value not in range
- exec_be_between2('date', 'sysdate', 'sysdate-2', 'sysdate-1', ut3_tester_helper.main_helper.gc_success, 'not_');
- exec_be_between2('number', '2.0', '1.99', '1.999', ut3_tester_helper.main_helper.gc_success, 'not_');
- exec_be_between2('varchar2(1)', '''c''', '''a''', '''b''', ut3_tester_helper.main_helper.gc_success, 'not_');
- exec_be_between2('timestamp', 'systimestamp+1', 'systimestamp-1', 'systimestamp', ut3_tester_helper.main_helper.gc_success, 'not_');
- exec_be_between2('timestamp with local time zone', 'systimestamp+1', 'systimestamp-1', 'systimestamp', ut3_tester_helper.main_helper.gc_success, 'not_');
- exec_be_between2('timestamp with time zone', 'systimestamp+1', 'systimestamp-1', 'systimestamp', ut3_tester_helper.main_helper.gc_success, 'not_');
- exec_be_between2('interval year to month', '''2-2''', '''2-0''', '''2-1''', ut3_tester_helper.main_helper.gc_success, 'not_');
- exec_be_between2('interval day to second', '''2 01:00:00''', '''2 00:59:58''', '''2 00:59:59''', ut3_tester_helper.main_helper.gc_success, 'not_');
-
- --failure when value not out of range
- exec_be_between2('date', 'sysdate', 'sysdate-1', 'sysdate+1', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_be_between2('number', '2.0', '1.99', '2.01', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_be_between2('varchar2(1)', '''b''', '''a''', '''c''', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_be_between2('timestamp', 'systimestamp', 'systimestamp-1', 'systimestamp+1', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_be_between2('timestamp with local time zone', 'systimestamp', 'systimestamp-1', 'systimestamp+1', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_be_between2('timestamp with time zone', 'systimestamp', 'systimestamp-1', 'systimestamp+1', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_be_between2('interval year to month', '''2-1''', '''2-0''', '''2-2''', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_be_between2('interval day to second', '''2 01:00:00''', '''2 00:59:58''', '''2 01:00:01''', ut3_tester_helper.main_helper.gc_failure, 'not_');
-
- --failure when value is null
- exec_be_between2('date', 'null', 'sysdate-1', 'sysdate+1', ut3_tester_helper.main_helper.gc_failure, '');
- exec_be_between2('number', 'null', '1.99', '2.01', ut3_tester_helper.main_helper.gc_failure, '');
- exec_be_between2('varchar2(1)', 'null', '''a''', '''c''', ut3_tester_helper.main_helper.gc_failure, '');
- exec_be_between2('timestamp', 'null', 'systimestamp-1', 'systimestamp+1', ut3_tester_helper.main_helper.gc_failure, '');
- exec_be_between2('timestamp with local time zone', 'null', 'systimestamp-1', 'systimestamp+1', ut3_tester_helper.main_helper.gc_failure, '');
- exec_be_between2('timestamp with time zone', 'null', 'systimestamp-1', 'systimestamp+1', ut3_tester_helper.main_helper.gc_failure, '');
- exec_be_between2('interval year to month', 'null', '''2-0''', '''2-2''', ut3_tester_helper.main_helper.gc_failure, '');
- exec_be_between2('interval day to second', 'null', '''2 00:59:58''', '''2 01:00:01''', ut3_tester_helper.main_helper.gc_failure, '');
-
- exec_be_between2('date', 'null', 'sysdate-2', 'sysdate-1', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_be_between2('number', 'null', '1.99', '1.999', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_be_between2('varchar2(1)', 'null', '''a''', '''b''', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_be_between2('timestamp', 'null', 'systimestamp-1', 'systimestamp', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_be_between2('timestamp with local time zone', 'null', 'systimestamp-1', 'systimestamp', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_be_between2('timestamp with time zone', 'null', 'systimestamp-1', 'systimestamp', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_be_between2('interval year to month', 'null', '''2-0''', '''2-1''', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_be_between2('interval day to second', 'null', '''2 00:59:58''', '''2 00:59:59''', ut3_tester_helper.main_helper.gc_failure, 'not_');
-
- --failure when lower bound is null
- exec_be_between2('date', 'sysdate', 'null', 'sysdate+1', ut3_tester_helper.main_helper.gc_failure, '');
- exec_be_between2('number', '2.0', 'null', '2.01', ut3_tester_helper.main_helper.gc_failure, '');
- exec_be_between2('varchar2(1)', '''b''', 'null', '''c''', ut3_tester_helper.main_helper.gc_failure, '');
- exec_be_between2('timestamp', 'systimestamp', 'null', 'systimestamp+1', ut3_tester_helper.main_helper.gc_failure, '');
- exec_be_between2('timestamp with local time zone', 'systimestamp', 'null', 'systimestamp+1', ut3_tester_helper.main_helper.gc_failure, '');
- exec_be_between2('timestamp with time zone', 'systimestamp', 'null', 'systimestamp+1', ut3_tester_helper.main_helper.gc_failure, '');
- exec_be_between2('interval year to month', '''2-1''', 'null', '''2-2''', ut3_tester_helper.main_helper.gc_failure, '');
- exec_be_between2('interval day to second', '''2 01:00:00''', 'null', '''2 01:00:01''', ut3_tester_helper.main_helper.gc_failure, '');
-
- exec_be_between2('date', 'sysdate', 'null', 'sysdate-1', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_be_between2('number', '2.0', 'null', '1.999', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_be_between2('varchar2(1)', '''b''', 'null', '''b''', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_be_between2('timestamp', 'systimestamp+1', 'null', 'systimestamp', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_be_between2('timestamp with local time zone', 'systimestamp+1', 'null', 'systimestamp', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_be_between2('timestamp with time zone', 'systimestamp+1', 'null', 'systimestamp', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_be_between2('interval year to month', '''2-2''', 'null', '''2-1''', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_be_between2('interval day to second', '''2 01:00:00''', 'null', '''2 00:59:59''', ut3_tester_helper.main_helper.gc_failure, 'not_');
- --Fails for unsupported data-type
- exec_be_between2('clob', '''b''', '''a''', '''c''', ut3_tester_helper.main_helper.gc_failure, '');
- end;
-
- procedure test_match is
- begin
- exec_match('varchar2(100)', '''Stephen''', '^Ste(v|ph)en$', '', ut3_tester_helper.main_helper.gc_success);
- exec_match('varchar2(100)', '''sTEPHEN''', '^Ste(v|ph)en$', 'i', ut3_tester_helper.main_helper.gc_success);
- exec_match('clob', 'to_clob(rpad('', '',32767)||''Stephen'')', 'Ste(v|ph)en$', '', ut3_tester_helper.main_helper.gc_success);
- exec_match('clob', 'to_clob(rpad('', '',32767)||''sTEPHEN'')', 'Ste(v|ph)en$', 'i', ut3_tester_helper.main_helper.gc_success);
-
- exec_match('varchar2(100)', '''Stephen''', '^Steven$', '', ut3_tester_helper.main_helper.gc_failure);
- exec_match('varchar2(100)', '''sTEPHEN''', '^Steven$', 'i', ut3_tester_helper.main_helper.gc_failure);
- exec_match('clob', 'to_clob(rpad('', '',32767)||''Stephen'')', '^Stephen', '', ut3_tester_helper.main_helper.gc_failure);
- exec_match('clob', 'to_clob(rpad('', '',32767)||''sTEPHEN'')', '^Stephen', 'i', ut3_tester_helper.main_helper.gc_failure);
-
- exec_match('varchar2(100)', '''Stephen''', '^Ste(v|ph)en$', '', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_match('varchar2(100)', '''sTEPHEN''', '^Ste(v|ph)en$', 'i', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_match('clob', 'to_clob(rpad('', '',32767)||''Stephen'')', 'Ste(v|ph)en$', '', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_match('clob', 'to_clob(rpad('', '',32767)||''sTEPHEN'')', 'Ste(v|ph)en$', 'i', ut3_tester_helper.main_helper.gc_failure, 'not_');
-
- exec_match('varchar2(100)', '''Stephen''', '^Steven$', '', ut3_tester_helper.main_helper.gc_success, 'not_');
- exec_match('varchar2(100)', '''sTEPHEN''', '^Steven$', 'i', ut3_tester_helper.main_helper.gc_success, 'not_');
- exec_match('clob', 'to_clob(rpad('', '',32767)||''Stephen'')', '^Stephen', '', ut3_tester_helper.main_helper.gc_success, 'not_');
- exec_match('clob', 'to_clob(rpad('', '',32767)||''sTEPHEN'')', '^Stephen', 'i', ut3_tester_helper.main_helper.gc_success, 'not_');
- --Fails for unsupported data-type
- exec_match('number', '12345', '^123.*', 'i', ut3_tester_helper.main_helper.gc_failure);
- end;
-
- procedure test_be_like is
- begin
- exec_be_like('varchar2(100)', '''Stephen_King''', 'Ste__en%', '', ut3_tester_helper.main_helper.gc_success);
- exec_be_like('varchar2(100)', '''Stephen_King''', 'Ste__en\_K%', '\', ut3_tester_helper.main_helper.gc_success);
- exec_be_like('clob', 'to_clob(rpad(''a'',32767,''a'')||''Stephen_King'')', 'a%Ste__en%', '', ut3_tester_helper.main_helper.gc_success);
- exec_be_like('clob', 'to_clob(rpad(''a'',32767,''a'')||''Stephen_King'')', 'a%Ste__en\_K%', '\', ut3_tester_helper.main_helper.gc_success);
-
- exec_be_like('varchar2(100)', '''Stephen_King''', 'Ste_en%', '', ut3_tester_helper.main_helper.gc_failure);
- exec_be_like('varchar2(100)', '''Stephen_King''', 'Stephe\__%', '\', ut3_tester_helper.main_helper.gc_failure);
- exec_be_like('clob', 'to_clob(rpad(''a'',32767,''a'')||''Stephen_King'')', 'a%Ste_en%', '', ut3_tester_helper.main_helper.gc_failure);
- exec_be_like('clob', 'to_clob(rpad(''a'',32767,''a'')||''Stephen_King'')', 'a%Stephe\__%', '\', ut3_tester_helper.main_helper.gc_failure);
-
- exec_be_like('varchar2(100)', '''Stephen_King''', 'Ste__en%', '', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_be_like('varchar2(100)', '''Stephen_King''', 'Ste__en\_K%', '\', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_be_like('clob', 'to_clob(rpad(''a'',32767,''a'')||''Stephen_King'')', 'a%Ste__en%', '', ut3_tester_helper.main_helper.gc_failure, 'not_');
- exec_be_like('clob', 'to_clob(rpad(''a'',32767,''a'')||''Stephen_King'')', 'a%Ste__en\_K%', '\', ut3_tester_helper.main_helper.gc_failure, 'not_');
-
- exec_be_like('varchar2(100)', '''Stephen_King''', 'Ste_en%', '', ut3_tester_helper.main_helper.gc_success, 'not_');
- exec_be_like('varchar2(100)', '''Stephen_King''', 'Stephe\__%', '\', ut3_tester_helper.main_helper.gc_success, 'not_');
- exec_be_like('clob', 'to_clob(rpad(''a'',32767,''a'')||''Stephen_King'')', 'a%Ste_en%', '', ut3_tester_helper.main_helper.gc_success, 'not_');
- exec_be_like('clob', 'to_clob(rpad(''a'',32767,''a'')||''Stephen_King'')', 'a%Stephe\__%', '\', ut3_tester_helper.main_helper.gc_success, 'not_');
-
- --Fails for unsupported data-type
- exec_be_like('number', '12345', '123%', '', ut3_tester_helper.main_helper.gc_failure);
- end;
-
- procedure test_timestamp_between is
- l_value timestamp := to_timestamp('1997-01-31 09:26:50.13','YYYY-MM-DD HH24.MI.SS.FF');
- l_value_lower timestamp := to_timestamp('1997-01-31 09:26:50.11','YYYY-MM-DD HH24.MI.SS.FF');
- l_value_upper timestamp := to_timestamp('1997-01-31 09:26:50.14','YYYY-MM-DD HH24.MI.SS.FF');
- begin
- ut3_develop.ut.expect(l_value).to_be_between(l_value_lower, l_value_upper);
- ut3_develop.ut.expect(l_value).not_to_be_between(l_value_upper, l_value_lower);
- end;
-
- procedure test_timestamp_ltz_between is
- l_value timestamp with local time zone := to_timestamp_tz('1997-01-31 09:26:50.12 +02:00','YYYY-MM-DD HH24.MI.SS.FF TZR');
- l_value_lower timestamp with local time zone := to_timestamp_tz('1997-01-31 09:26:50.12 +03:00','YYYY-MM-DD HH24.MI.SS.FF TZR');
- l_value_upper timestamp with local time zone := to_timestamp_tz('1997-01-31 09:26:50.12 +01:00','YYYY-MM-DD HH24.MI.SS.FF TZR');
- begin
- ut3_develop.ut.expect(l_value).to_be_between(l_value_lower, l_value_upper);
- ut3_develop.ut.expect(l_value).not_to_be_between(l_value_upper, l_value_lower);
- end;
-
- procedure test_timestamp_tz_between is
- l_value timestamp with time zone := to_timestamp_tz('1997-01-31 09:26:50.12 +02:00','YYYY-MM-DD HH24.MI.SS.FF TZR');
- l_value_lower timestamp with time zone := to_timestamp_tz('1997-01-31 09:26:50.12 +03:00','YYYY-MM-DD HH24.MI.SS.FF TZR');
- l_value_upper timestamp with time zone := to_timestamp_tz('1997-01-31 09:26:50.12 +01:00','YYYY-MM-DD HH24.MI.SS.FF TZR');
- begin
- ut3_develop.ut.expect(l_value).to_be_between(l_value_lower, l_value_upper);
- ut3_develop.ut.expect(l_value).not_to_be_between(l_value_upper, l_value_lower);
- end;
-
-end test_matchers;
-/
diff --git a/test/ut3_user/expectations/test_matchers.pks b/test/ut3_user/expectations/test_matchers.pks
deleted file mode 100644
index e3e22e0cd..000000000
--- a/test/ut3_user/expectations/test_matchers.pks
+++ /dev/null
@@ -1,27 +0,0 @@
-create or replace package test_matchers is
-
- --%suite(matchers)
- --%suitepath(utplsql.test_user.expectations)
-
- --%aftereach
- procedure cleanup_expectations;
-
- --%test
- procedure test_be_between2;
- --%test
- procedure test_match;
-
- --%test
- procedure test_be_like;
-
- --%test
- procedure test_timestamp_between;
-
- --%test
- procedure test_timestamp_ltz_between;
-
- --%test
- procedure test_timestamp_tz_between;
-
-end test_matchers;
-/
diff --git a/test/ut3_user/expectations/unary/test_expect_not_to_be_null.pkb b/test/ut3_user/expectations/unary/test_expect_not_to_be_null.pkb
deleted file mode 100644
index 448addb8c..000000000
--- a/test/ut3_user/expectations/unary/test_expect_not_to_be_null.pkb
+++ /dev/null
@@ -1,265 +0,0 @@
-create or replace package body test_expect_not_to_be_null
-is
- gc_object_name constant varchar2(30) := 't_not_to_be_null_test';
- gc_nested_table_name constant varchar2(30) := 'tt_not_to_be_null_test';
- gc_varray_name constant varchar2(30) := 'tv_not_to_be_null_test';
-
- procedure cleanup_expectations is
- begin
- ut3_tester_helper.main_helper.clear_expectations( );
- end;
-
- procedure create_types is
- pragma autonomous_transaction;
- begin
- execute immediate 'create type ' || gc_object_name || ' is object (dummy number)';
- execute immediate 'create type ' || gc_nested_table_name || ' is table of number';
- execute immediate 'create type ' || gc_varray_name || ' is varray(1) of number';
- end;
-
- procedure drop_types is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop type ' || gc_object_name;
- execute immediate 'drop type ' || gc_nested_table_name;
- execute immediate 'drop type ' || gc_varray_name;
- end;
-
- procedure blob_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'not_to_be_null', 'blob', 'to_blob(''abc'')' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure blob_0_length is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'not_to_be_null', 'blob', 'empty_blob()' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure boolean_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'not_to_be_null', 'boolean', 'true' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure clob_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'not_to_be_null', 'clob', 'to_clob(''abc'')' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
-
- procedure clob_0_length is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'not_to_be_null', 'clob', 'empty_clob()' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure date_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'not_to_be_null', 'date', 'sysdate' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure number_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'not_to_be_null', 'number', '1234' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure timestamp_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'not_to_be_null', 'timestamp', 'systimestamp' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure timestamp_with_ltz_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block(
- 'not_to_be_null', 'timestamp with local time zone', 'systimestamp'
- );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure timestamp_with_tz_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'not_to_be_null', 'timestamp with time zone',
- 'systimestamp' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure varchar2_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'not_to_be_null', 'varchar2(4000)', '''abc''' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure initialized_object is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_object_block(
- 'not_to_be_null', gc_object_name, gc_object_name || '(1)', 'object'
- );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure initialized_nested_table is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_object_block(
- 'not_to_be_null', gc_nested_table_name, gc_nested_table_name || '()', 'collection'
- );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure initialized_varray is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_object_block(
- 'not_to_be_null', gc_varray_name, gc_varray_name || '()', 'collection'
- );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure null_blob is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'not_to_be_null', 'blob', 'null' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure null_boolean is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'not_to_be_null', 'boolean', 'null' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure null_clob is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'not_to_be_null', 'clob', 'null' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure null_date is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'not_to_be_null', 'date', 'null' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure null_number is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'not_to_be_null', 'number', 'null' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure null_timestamp is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'not_to_be_null', 'timestamp', 'null' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure null_timestamp_with_ltz is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block(
- 'not_to_be_null', 'timestamp with local time zone', 'null'
- );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure null_timestamp_with_tz is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block(
- 'not_to_be_null', 'timestamp with time zone', 'null'
- );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure null_varchar2 is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'not_to_be_null', 'varchar2(4000)', 'null' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure null_anydata is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'not_to_be_null', 'anydata', 'null' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure uninit_object_in_anydata is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_object_block(
- 'not_to_be_null', gc_object_name, 'null', 'object'
- );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure uninit_nested_table_in_anydata is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_object_block(
- 'not_to_be_null', gc_nested_table_name, 'null', 'collection'
- );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure uninit_varray_in_anydata is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_object_block(
- 'not_to_be_null', gc_varray_name, 'null', 'collection'
- );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
-end test_expect_not_to_be_null;
-/
diff --git a/test/ut3_user/expectations/unary/test_expect_not_to_be_null.pks b/test/ut3_user/expectations/unary/test_expect_not_to_be_null.pks
deleted file mode 100644
index 11648d5d2..000000000
--- a/test/ut3_user/expectations/unary/test_expect_not_to_be_null.pks
+++ /dev/null
@@ -1,97 +0,0 @@
-create or replace package test_expect_not_to_be_null
-is
- --%suite(not_to_be_null)
- --%suitepath(utplsql.test_user.expectations.unary)
-
- --%aftereach
- procedure cleanup_expectations;
-
- --%beforeall
- procedure create_types;
-
- --%afterall
- procedure drop_types;
-
- --%test(Gives success for not null blob)
- procedure blob_not_null;
-
- --%test(Gives success for blob with length 0)
- procedure blob_0_length;
-
- --%test(Gives success for not null boolean)
- procedure boolean_not_null;
-
- --%test(Gives success for not null clob)
- procedure clob_not_null;
-
- --%test(Gives success for clob with length 0)
- procedure clob_0_length;
-
- --%test(Gives success for not null date)
- procedure date_not_null;
-
- --%test(Gives success for not null number)
- procedure number_not_null;
-
- --%test(Gives success for not null timestamp)
- procedure timestamp_not_null;
-
- --%test(Gives success for not null timestamp with local time zone)
- procedure timestamp_with_ltz_not_null;
-
- --%test(Gives success for not null timestamp with time zone)
- procedure timestamp_with_tz_not_null;
-
- --%test(Gives success for not null varchar2)
- procedure varchar2_not_null;
-
- --%test(Gives success for initialized object within anydata)
- procedure initialized_object;
-
- --%test(Gives success for initialized nested table within anydata)
- procedure initialized_nested_table;
-
- --%test(Gives success for initialized varray within anydata)
- procedure initialized_varray;
-
- --%test(Gives failure with null blob)
- procedure null_blob;
-
- --%test(Gives failure with null boolean)
- procedure null_boolean;
-
- --%test(Gives failure with null clob)
- procedure null_clob;
-
- --%test(Gives failure with null date)
- procedure null_date;
-
- --%test(Gives failure with null number)
- procedure null_number;
-
- --%test(Gives failure null timestamp)
- procedure null_timestamp;
-
- --%test(Gives failure with null timestamp with local time zone)
- procedure null_timestamp_with_ltz;
-
- --%test(Gives failure with null timestamp with time zone)
- procedure null_timestamp_with_tz;
-
- --%test(Gives failure with null varchar2)
- procedure null_varchar2;
-
- --%test(Gives failure with null anydata)
- procedure null_anydata;
-
- --%test(Gives failure with uninitialized object within anydata)
- procedure uninit_object_in_anydata;
-
- --%test(Gives failure with uninitialized nested table within anydata)
- procedure uninit_nested_table_in_anydata;
-
- --%test(Gives failure with uninitialized varray within anydata)
- procedure uninit_varray_in_anydata;
-
-end test_expect_not_to_be_null;
-/
diff --git a/test/ut3_user/expectations/unary/test_expect_to_be_empty.pkb b/test/ut3_user/expectations/unary/test_expect_to_be_empty.pkb
deleted file mode 100644
index 931e24d10..000000000
--- a/test/ut3_user/expectations/unary/test_expect_to_be_empty.pkb
+++ /dev/null
@@ -1,270 +0,0 @@
-create or replace package body test_expect_to_be_empty is
-
- procedure cleanup_expectations is
- begin
- ut3_tester_helper.main_helper.clear_expectations( );
- end;
- procedure success_be_empty_cursor is
- l_cursor sys_refcursor;
- begin
- --Arrange
- open l_cursor for select * from dual where 1 = 2;
- --Act
- ut3_develop.ut.expect(l_cursor).to_be_empty;
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure fail_be_empty_cursor is
- l_cursor sys_refcursor;
- begin
- --Arrange
- open l_cursor for select * from dual;
- --Act
- ut3_develop.ut.expect(l_cursor).to_be_empty;
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure fail_be_empty_cursor_report is
- l_cursor sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_cursor for select * from dual;
- --Act
- ut3_develop.ut.expect(l_cursor).to_be_empty;
-
- l_expected_message := q'[Actual: (refcursor [ count = 1 ])%
- X%
- was expected to be empty%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
-
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure success_not_be_empty_cursor is
- l_cursor sys_refcursor;
- begin
- --Arrange
- open l_cursor for select * from dual;
- --Act
- ut3_develop.ut.expect(l_cursor).not_to_be_empty;
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure fail_not_be_empty_cursor is
- l_cursor sys_refcursor;
- begin
- --Arrange
- open l_cursor for select * from dual where 1 = 2;
- --Act
- ut3_develop.ut.expect(l_cursor).not_to_be_empty;
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure success_be_empty_collection is
- l_actual anydata;
- begin
- --Arrange
- l_actual := anydata.convertcollection(ora_mining_varchar2_nt());
- -- Act
- ut3_develop.ut.expect(l_actual).to_be_empty();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure fail_be_empty_collection is
- l_actual anydata;
- begin
- --Arrange
- l_actual := anydata.convertcollection(ora_mining_varchar2_nt('a'));
- -- Act
- ut3_develop.ut.expect(l_actual).to_be_empty();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure success_not_be_empty_coll is
- l_actual anydata;
- begin
- --Arrange
- l_actual := anydata.convertcollection(ora_mining_varchar2_nt('a'));
- -- Act
- ut3_develop.ut.expect(l_actual).not_to_be_empty();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure fail_not_be_empty_collection is
- l_actual anydata;
- begin
- --Arrange
- l_actual := anydata.convertcollection(ora_mining_varchar2_nt());
- -- Act
- ut3_develop.ut.expect(l_actual).not_to_be_empty();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure fail_be_empty_null_collection is
- l_actual anydata;
- l_data ora_mining_varchar2_nt;
- begin
- --Arrange
- l_actual := anydata.convertcollection(l_data);
- -- Act
- ut3_develop.ut.expect(l_actual).to_be_empty();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure fail_not_be_empty_null_coll is
- l_actual anydata;
- l_data ora_mining_varchar2_nt;
- begin
- --Arrange
- l_actual := anydata.convertcollection(l_data);
- -- Act
- ut3_develop.ut.expect(l_actual).not_to_be_empty();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure fail_be_empty_object is
- l_actual anydata;
- begin
- --Arrange
- l_actual := anydata.convertObject(ut3_tester_helper.test_dummy_number(1));
- -- Act
- ut3_develop.ut.expect(l_actual).to_be_empty();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure fail_be_empty_null_object is
- l_actual anydata;
- l_data ut3_tester_helper.test_dummy_number;
- begin
- --Arrange
- l_actual := anydata.convertObject(l_data);
- -- Act
- ut3_develop.ut.expect(l_actual).to_be_empty();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure fail_be_empty_number is
- begin
- -- Act
- ut3_develop.ut.expect( 1 ).to_( ut3_develop.be_empty() );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- /**
- * https://docs.oracle.com/en/database/oracle/oracle-database/18/adobj/declaring-initializing-objects-in-plsql.html#GUID-23135172-82E2-4C3E-800D-E584B43B578E
- * User-defined types, just like collections, are atomically null, until you initialize the object by calling the constructor for its object type. That is, the object itself is null, not just its attributes.
- */
- procedure fail_not_be_empty_object is
- l_actual anydata;
- begin
- --Arrange
- l_actual := anydata.convertObject(ut3_tester_helper.test_dummy_number(1));
- -- Act
- ut3_develop.ut.expect(l_actual).not_to_be_empty();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure fail_not_be_empty_null_object is
- l_actual anydata;
- l_data ut3_tester_helper.test_dummy_number;
- begin
- --Arrange
- l_actual := anydata.convertObject(l_data);
- -- Act
- ut3_develop.ut.expect(l_actual).not_to_be_empty();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure fail_not_be_empty_number is
- begin
- -- Act
- ut3_develop.ut.expect( 1 ).not_to( ut3_develop.be_empty() );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure success_be_empty_clob is
- begin
- -- Act
- ut3_develop.ut.expect( empty_clob() ).to_( ut3_develop.be_empty() );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure fail_be_empty_clob is
- begin
- -- Act
- ut3_develop.ut.expect( to_clob(' ') ).to_( ut3_develop.be_empty() );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure success_be_empty_blob is
- begin
- -- Act
- ut3_develop.ut.expect( empty_blob() ).to_( ut3_develop.be_empty() );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure fail_be_empty_blob is
- begin
- -- Act
- ut3_develop.ut.expect( to_blob('AA') ).to_( ut3_develop.be_empty() );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
-
- procedure fail_not_be_empty_clob is
- begin
- -- Act
- ut3_develop.ut.expect( empty_clob() ).not_to( ut3_develop.be_empty() );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure success_not_be_empty_clob is
- begin
- -- Act
- ut3_develop.ut.expect( to_clob(' ') ).not_to( ut3_develop.be_empty() );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure fail_not_be_empty_blob is
- begin
- -- Act
- ut3_develop.ut.expect( empty_blob() ).not_to( ut3_develop.be_empty() );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure success_not_be_empty_blob is
- begin
- -- Act
- ut3_develop.ut.expect( to_blob('AA') ).not_to( ut3_develop.be_empty() );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
-end;
-/
\ No newline at end of file
diff --git a/test/ut3_user/expectations/unary/test_expect_to_be_empty.pks b/test/ut3_user/expectations/unary/test_expect_to_be_empty.pks
deleted file mode 100644
index a76787ac5..000000000
--- a/test/ut3_user/expectations/unary/test_expect_to_be_empty.pks
+++ /dev/null
@@ -1,93 +0,0 @@
-create or replace package test_expect_to_be_empty is
-
- --%suite
- --%suitepath(utplsql.test_user.expectations.unary)
-
- --%aftereach
- procedure cleanup_expectations;
-
- --%context(to_be_empty)
-
- --%test(Gives success for an empty cursor)
- procedure success_be_empty_cursor;
-
- --%test(Gives failure for a non empty cursor)
- procedure fail_be_empty_cursor;
-
- --%test(Reports the content of cursor when cursor is not empty)
- procedure fail_be_empty_cursor_report;
-
- --%test(Gives success for an empty collection)
- procedure success_be_empty_collection;
-
- --%test(Gives failure for a non empty collection)
- procedure fail_be_empty_collection;
-
- --%test(Gives failure for a NULL collection)
- procedure fail_be_empty_null_collection;
-
- --%test(Gives failure for an object)
- procedure fail_be_empty_object;
-
- --%test(Gives failure for a null object)
- procedure fail_be_empty_null_object;
-
- --%test(Gives failure for number)
- procedure fail_be_empty_number;
-
- --%test(Gives success for an empty CLOB)
- procedure success_be_empty_clob;
-
- --%test(Gives failure for a non empty CLOB)
- procedure fail_be_empty_clob;
-
- --%test(Gives success for an empty BLOB)
- procedure success_be_empty_blob;
-
- --%test(Gives failure for a non empty BLOB)
- procedure fail_be_empty_blob;
-
- --%endcontext
-
- --%context(not_to_be_empty)
-
- --%test(Gives failure for an empty cursor)
- procedure fail_not_be_empty_cursor;
-
- --%test(Gives success for a non empty cursor)
- procedure success_not_be_empty_cursor;
-
- --%test(Gives success for a non empty collection)
- procedure success_not_be_empty_coll;
-
- --%test(Gives failure for an empty collection)
- procedure fail_not_be_empty_collection;
-
- --%test(Gives failure for an empty collection)
- procedure fail_not_be_empty_null_coll;
-
- --%test(Gives failure for an empty object)
- procedure fail_not_be_empty_object;
-
- --%test(Gives failure for a null object)
- procedure fail_not_be_empty_null_object;
-
- --%test(Gives failure for number)
- procedure fail_not_be_empty_number;
-
- --%test(Gives failure for an empty CLOB)
- procedure fail_not_be_empty_clob;
-
- --%test(Gives success for a non empty CLOB)
- procedure success_not_be_empty_clob;
-
- --%test(Gives failure for an empty BLOB)
- procedure fail_not_be_empty_blob;
-
- --%test(Gives success for a non empty BLOB)
- procedure success_not_be_empty_blob;
-
- --%endcontext
-
-end;
-/
diff --git a/test/ut3_user/expectations/unary/test_expect_to_be_not_null.pkb b/test/ut3_user/expectations/unary/test_expect_to_be_not_null.pkb
deleted file mode 100644
index 0e747eb85..000000000
--- a/test/ut3_user/expectations/unary/test_expect_to_be_not_null.pkb
+++ /dev/null
@@ -1,264 +0,0 @@
-create or replace package body test_expect_to_be_not_null
-is
- gc_object_name constant varchar2(30) := 't_to_be_not_null_test';
- gc_nested_table_name constant varchar2(30) := 'tt_to_be_not_null_test';
- gc_varray_name constant varchar2(30) := 'tv_to_be_not_null_test';
-
- procedure cleanup_expectations is
- begin
- ut3_tester_helper.main_helper.clear_expectations( );
- end;
-
- procedure create_types is
- pragma autonomous_transaction;
- begin
- execute immediate 'create type '||gc_object_name||' is object (dummy number)';
- execute immediate 'create type '||gc_nested_table_name||' is table of number';
- execute immediate 'create type '||gc_varray_name||' is varray(1) of number';
- end;
-
- procedure drop_types is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop type '||gc_object_name;
- execute immediate 'drop type '||gc_nested_table_name;
- execute immediate 'drop type '||gc_varray_name;
- end;
-
- procedure blob_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block('to_be_not_null', 'blob', 'to_blob(''abc'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure empty_blob is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block('to_be_not_null', 'blob', 'empty_blob()');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure boolean_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block('to_be_not_null', 'boolean', 'true');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure clob_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block('to_be_not_null', 'clob', 'to_clob(''abc'')');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure empty_clob is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block('to_be_not_null', 'clob', 'empty_clob()');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure date_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block('to_be_not_null', 'date', 'sysdate');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure number_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block('to_be_not_null', 'number', '1234');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure timestamp_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block('to_be_not_null', 'timestamp', 'systimestamp');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure timestamp_with_ltz_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block('to_be_not_null', 'timestamp with local time zone', 'systimestamp');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure timestamp_with_tz_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block('to_be_not_null', 'timestamp with time zone', 'systimestamp');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure varchar2_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block('to_be_not_null', 'varchar2(4000)', '''abc''');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure initialized_object is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_object_block(
- 'to_be_not_null', gc_object_name, gc_object_name||'(1)', 'object'
- );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure initialized_nested_table is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_object_block(
- 'to_be_not_null', gc_nested_table_name, gc_nested_table_name||'()', 'collection'
- );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure initialized_varray is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_object_block(
- 'to_be_not_null', gc_varray_name, gc_varray_name||'()', 'collection'
- );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure null_blob is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block('to_be_not_null', 'blob', 'null');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure null_boolean is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block('to_be_not_null', 'boolean', 'null');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
-
- procedure null_clob is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block('to_be_not_null', 'clob', 'null');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
-
- procedure null_date is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block('to_be_not_null', 'date', 'null');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
-
- procedure null_number is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block('to_be_not_null', 'number', 'null');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
-
- procedure null_timestamp is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block('to_be_not_null', 'timestamp', 'null');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
-
- procedure null_timestamp_with_ltz is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block('to_be_not_null', 'timestamp with local time zone', 'null');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
-
- procedure null_timestamp_with_tz is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block('to_be_not_null', 'timestamp with time zone', 'null');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
-
- procedure null_varchar2 is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block('to_be_not_null', 'varchar2(4000)', 'null');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure null_anydata is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block('to_be_not_null', 'anydata', 'null');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure uninit_object_in_anydata is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_object_block(
- 'to_be_not_null', gc_object_name, 'null', 'object'
- );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure uninit_nested_table_in_anydata is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_object_block(
- 'to_be_not_null', gc_nested_table_name, 'null', 'collection'
- );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure uninit_varray_in_anydata is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_object_block(
- 'to_be_not_null', gc_varray_name, 'null', 'collection'
- );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
-end test_expect_to_be_not_null;
-/
diff --git a/test/ut3_user/expectations/unary/test_expect_to_be_not_null.pks b/test/ut3_user/expectations/unary/test_expect_to_be_not_null.pks
deleted file mode 100644
index 7cb7cc265..000000000
--- a/test/ut3_user/expectations/unary/test_expect_to_be_not_null.pks
+++ /dev/null
@@ -1,97 +0,0 @@
-create or replace package test_expect_to_be_not_null
-is
- --%suite(to_be_not_null)
- --%suitepath(utplsql.test_user.expectations.unary)
-
- --%aftereach
- procedure cleanup_expectations;
-
- --%beforeall
- procedure create_types;
-
- --%afterall
- procedure drop_types;
-
- --%test(Gives success for not null blob)
- procedure blob_not_null;
-
- --%test(Gives success for empty blob)
- procedure empty_blob;
-
- --%test(Gives success for not null boolean)
- procedure boolean_not_null;
-
- --%test(Gives success for not null clob)
- procedure clob_not_null;
-
- --%test(Gives success for empty clob)
- procedure empty_clob;
-
- --%test(Gives success for not null date)
- procedure date_not_null;
-
- --%test(Gives success for not null number)
- procedure number_not_null;
-
- --%test(Gives success for not null timestamp)
- procedure timestamp_not_null;
-
- --%test(Gives success for not null timestamp with local time zone)
- procedure timestamp_with_ltz_not_null;
-
- --%test(Gives success for not null timestamp with time zone)
- procedure timestamp_with_tz_not_null;
-
- --%test(Gives success for not null varchar2)
- procedure varchar2_not_null;
-
- --%test(Gives success for initialized object within anydata)
- procedure initialized_object;
-
- --%test(Gives success for initialized nested table within anydata)
- procedure initialized_nested_table;
-
- --%test(Gives success for initialized varray within anydata)
- procedure initialized_varray;
-
- --%test(Gives failure with null blob)
- procedure null_blob;
-
- --%test(Gives failure with null boolean)
- procedure null_boolean;
-
- --%test(Gives failure with null clob)
- procedure null_clob;
-
- --%test(Gives failure with null date)
- procedure null_date;
-
- --%test(Gives failure with null number)
- procedure null_number;
-
- --%test(Gives failure null timestamp)
- procedure null_timestamp;
-
- --%test(Gives failure with null timestamp with local time zone)
- procedure null_timestamp_with_ltz;
-
- --%test(Gives failure with null timestamp with time zone)
- procedure null_timestamp_with_tz;
-
- --%test(Gives failure with null varchar2)
- procedure null_varchar2;
-
- --%test(Gives failure with null anydata)
- procedure null_anydata;
-
- --%test(Gives failure with uninitialized object within anydata)
- procedure uninit_object_in_anydata;
-
- --%test(Gives failure with uninitialized nested table within anydata)
- procedure uninit_nested_table_in_anydata;
-
- --%test(Gives failure with uninitialized varray within anydata)
- procedure uninit_varray_in_anydata;
-
-end test_expect_to_be_not_null;
-/
diff --git a/test/ut3_user/expectations/unary/test_expect_to_be_null.pkb b/test/ut3_user/expectations/unary/test_expect_to_be_null.pkb
deleted file mode 100644
index c0899c08d..000000000
--- a/test/ut3_user/expectations/unary/test_expect_to_be_null.pkb
+++ /dev/null
@@ -1,260 +0,0 @@
-create or replace package body test_expect_to_be_null
-is
- gc_object_name constant varchar2(30) := 't_to_be_null_test';
- gc_nested_table_name constant varchar2(30) := 'tt_to_be_null_test';
- gc_varray_name constant varchar2(30) := 'tv_to_be_null_test';
-
- procedure cleanup_expectations is
- begin
- ut3_tester_helper.main_helper.clear_expectations( );
- end;
-
- procedure create_types is
- pragma autonomous_transaction;
- begin
- execute immediate 'create type ' || gc_object_name || ' is object (dummy number)';
- execute immediate 'create type ' || gc_nested_table_name || ' is table of number';
- execute immediate 'create type ' || gc_varray_name || ' is varray(1) of number';
- end;
-
- procedure drop_types is
- pragma autonomous_transaction;
- begin
- execute immediate 'drop type ' || gc_object_name;
- execute immediate 'drop type ' || gc_nested_table_name;
- execute immediate 'drop type ' || gc_varray_name;
- end;
-
- procedure null_blob is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'to_be_null', 'blob', 'null' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure null_boolean is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'to_be_null', 'boolean', 'null' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure null_clob is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'to_be_null', 'clob', 'null' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure null_date is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'to_be_null', 'date', 'null' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure null_number is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'to_be_null', 'number', 'null' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure null_timestamp is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'to_be_null', 'timestamp', 'null' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure null_timestamp_with_ltz is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'to_be_null', 'timestamp with local time zone', 'null' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure null_timestamp_with_tz is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'to_be_null', 'timestamp with time zone', 'null' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure null_varchar2 is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'to_be_null', 'varchar2(4000)', 'null' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure null_anydata is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'to_be_null', 'anydata', 'null' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure uninit_object_in_anydata is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_object_block(
- 'to_be_null', gc_object_name, 'null', 'object'
- );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure uninit_nested_table_in_anydata is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_object_block(
- 'to_be_null', gc_nested_table_name, 'null', 'collection'
- );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure uninit_varray_in_anydata is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_object_block( 'to_be_null', gc_varray_name,
- 'null', 'collection' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure blob_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'to_be_null', 'blob', 'to_blob(''abc'')' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure empty_blob is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'to_be_null', 'blob', 'empty_blob()' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure boolean_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'to_be_null', 'boolean', 'true' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure clob_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'to_be_null', 'clob', 'to_clob(''abc'')' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure empty_clob is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'to_be_null', 'clob', 'empty_clob()' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure date_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'to_be_null', 'date', 'sysdate' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure number_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'to_be_null', 'number', '1234' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure timestamp_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'to_be_null', 'timestamp', 'systimestamp' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure timestamp_with_ltz_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block(
- 'to_be_null', 'timestamp with local time zone', 'systimestamp'
- );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure timestamp_with_tz_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block(
- 'to_be_null', 'timestamp with time zone', 'systimestamp'
- );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure varchar2_not_null is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_block( 'to_be_null', 'varchar2(4000)', '''abc''' );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure initialized_object is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_object_block(
- 'to_be_null', gc_object_name, gc_object_name || '(1)', 'object'
- );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure initialized_nested_table is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_object_block(
- 'to_be_null', gc_nested_table_name, gc_nested_table_name || '()', 'collection'
- );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure initialized_varray is
- begin
- --Act
- execute immediate ut3_tester_helper.expectations_helper.unary_expectation_object_block(
- 'to_be_null', gc_varray_name, gc_varray_name || '()', 'collection'
- );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
-end test_expect_to_be_null;
-/
diff --git a/test/ut3_user/expectations/unary/test_expect_to_be_null.pks b/test/ut3_user/expectations/unary/test_expect_to_be_null.pks
deleted file mode 100644
index f1758316e..000000000
--- a/test/ut3_user/expectations/unary/test_expect_to_be_null.pks
+++ /dev/null
@@ -1,97 +0,0 @@
-create or replace package test_expect_to_be_null
-is
- --%suite(to_be_null)
- --%suitepath(utplsql.test_user.expectations.unary)
-
- --%aftereach
- procedure cleanup_expectations;
-
- --%beforeall
- procedure create_types;
-
- --%afterall
- procedure drop_types;
-
- --%test(Gives success with null blob)
- procedure null_blob;
-
- --%test(Gives success with null boolean)
- procedure null_boolean;
-
- --%test(Gives success with null clob)
- procedure null_clob;
-
- --%test(Gives success with null date)
- procedure null_date;
-
- --%test(Gives success with null number)
- procedure null_number;
-
- --%test(Gives success null timestamp)
- procedure null_timestamp;
-
- --%test(Gives success with null timestamp with local time zone)
- procedure null_timestamp_with_ltz;
-
- --%test(Gives success with null timestamp with time zone)
- procedure null_timestamp_with_tz;
-
- --%test(Gives success with null varchar2)
- procedure null_varchar2;
-
- --%test(Gives success with null anydata)
- procedure null_anydata;
-
- --%test(Gives success with uninitialized object within anydata)
- procedure uninit_object_in_anydata;
-
- --%test(Gives success with uninitialized nested table within anydata)
- procedure uninit_nested_table_in_anydata;
-
- --%test(Gives success with uninitialized varray within anydata)
- procedure uninit_varray_in_anydata;
-
- --%test(Gives failure for not null blob)
- procedure blob_not_null;
-
- --%test(Gives failure with empty blob)
- procedure empty_blob;
-
- --%test(Gives failure for not null boolean)
- procedure boolean_not_null;
-
- --%test(Gives failure for not null clob)
- procedure clob_not_null;
-
- --%test(Gives failure with empty clob)
- procedure empty_clob;
-
- --%test(Gives failure for not null date)
- procedure date_not_null;
-
- --%test(Gives failure for not null number)
- procedure number_not_null;
-
- --%test(Gives failure for not null timestamp)
- procedure timestamp_not_null;
-
- --%test(Gives failure for not null timestamp with local time zone)
- procedure timestamp_with_ltz_not_null;
-
- --%test(Gives failure for not null timestamp with time zone)
- procedure timestamp_with_tz_not_null;
-
- --%test(Gives failure for not null varchar2)
- procedure varchar2_not_null;
-
- --%test(Gives failure for initialized object within anydata)
- procedure initialized_object;
-
- --%test(Gives failure for initialized nested table within anydata)
- procedure initialized_nested_table;
-
- --%test(Gives failure for initialized varray within anydata)
- procedure initialized_varray;
-
-end test_expect_to_be_null;
-/
diff --git a/test/ut3_user/expectations/unary/test_expect_to_be_true_false.pkb b/test/ut3_user/expectations/unary/test_expect_to_be_true_false.pkb
deleted file mode 100644
index c1067044b..000000000
--- a/test/ut3_user/expectations/unary/test_expect_to_be_true_false.pkb
+++ /dev/null
@@ -1,139 +0,0 @@
-create or replace package body test_expect_to_be_true_false
-is
-
- procedure cleanup_expectations is
- begin
- ut3_tester_helper.main_helper.clear_expectations( );
- end;
-
- procedure to_be_true_null_boolean is
- begin
- --Act
- ut3_develop.ut.expect( 1=null ).to_be_true();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure to_be_true_success is
- begin
- --Act
- ut3_develop.ut.expect( 1=1 ).to_be_true();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure to_be_true_failure is
- begin
- --Act
- ut3_develop.ut.expect( 1=2 ).to_be_true();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure to_be_true_bad_type is
- begin
- --Act
- ut3_develop.ut.expect( 1 ).to_be_true();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure not_to_be_true_null_boolean is
- begin
- --Act
- ut3_develop.ut.expect( 1=null ).not_to_be_true();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure not_to_be_true_success is
- begin
- --Act
- ut3_develop.ut.expect( 1=2 ).not_to_be_true();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure not_to_be_true_failure is
- begin
- --Act
- ut3_develop.ut.expect( 1=1 ).not_to_be_true();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
-
- procedure not_to_be_true_bad_type is
- begin
- --Act
- ut3_develop.ut.expect( 1 ).not_to_be_true();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure to_be_false_null_boolean is
- begin
- --Act
- ut3_develop.ut.expect( 1=null ).to_be_false();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure to_be_false_success is
- begin
- --Act
- ut3_develop.ut.expect( 1=2 ).to_be_false();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure to_be_false_failure is
- begin
- --Act
- ut3_develop.ut.expect( 1=1 ).to_be_false();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure to_be_false_bad_type is
- begin
- --Act
- ut3_develop.ut.expect( 1 ).to_be_false();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure not_to_be_false_null_boolean is
- begin
- --Act
- ut3_develop.ut.expect( 1=null ).not_to_be_false();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure not_to_be_false_success is
- begin
- --Act
- ut3_develop.ut.expect( 1=1 ).not_to_be_false();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure not_to_be_false_failure is
- begin
- --Act
- ut3_develop.ut.expect( 1=2 ).not_to_be_false();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure not_to_be_false_bad_type is
- begin
- --Act
- ut3_develop.ut.expect( 1 ).not_to_be_false();
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
-end;
-/
diff --git a/test/ut3_user/expectations/unary/test_expect_to_be_true_false.pks b/test/ut3_user/expectations/unary/test_expect_to_be_true_false.pks
deleted file mode 100644
index 28bbae6f7..000000000
--- a/test/ut3_user/expectations/unary/test_expect_to_be_true_false.pks
+++ /dev/null
@@ -1,58 +0,0 @@
-create or replace package test_expect_to_be_true_false
-is
- --%suite(to_be_true/false)
- --%suitepath(utplsql.test_user.expectations.unary)
-
- --%aftereach
- procedure cleanup_expectations;
-
- --%test(to_be_true - Gives failure with null boolean)
- procedure to_be_true_null_boolean;
-
- --%test(to_be_true - Gives success with true expression)
- procedure to_be_true_success;
-
- --%test(to_be_true - Gives failure with false expression)
- procedure to_be_true_failure;
-
- --%test(to_be_true - Gives failure with non-boolean data type)
- procedure to_be_true_bad_type;
-
- --%test(not_to_be_true - Gives failure with null boolean)
- procedure not_to_be_true_null_boolean;
-
- --%test(not_to_be_true - Gives failure with true expression)
- procedure not_to_be_true_success;
-
- --%test(not_to_be_true - Gives success with false expression)
- procedure not_to_be_true_failure;
-
- --%test(not_to_be_true - Gives failure with non-boolean data type)
- procedure not_to_be_true_bad_type;
-
- --%test(to_be_false - Gives failure with null boolean)
- procedure to_be_false_null_boolean;
-
- --%test(to_be_false - Gives failure with true expression)
- procedure to_be_false_success;
-
- --%test(to_be_false - Gives success with false expression)
- procedure to_be_false_failure;
-
- --%test(to_be_false - Gives failure with non-boolean data type)
- procedure to_be_false_bad_type;
-
- --%test(not_to_be_false - Gives failure with null boolean)
- procedure not_to_be_false_null_boolean;
-
- --%test(not_to_be_false - Gives success with true expression)
- procedure not_to_be_false_success;
-
- --%test(not_to_be_false - Gives failure with false expression)
- procedure not_to_be_false_failure;
-
- --%test(not_to_be_false - Gives failure with non-boolean data type)
- procedure not_to_be_false_bad_type;
-
-end;
-/
diff --git a/test/ut3_user/expectations/unary/test_expect_to_have_count.pkb b/test/ut3_user/expectations/unary/test_expect_to_have_count.pkb
deleted file mode 100644
index 2167c44ef..000000000
--- a/test/ut3_user/expectations/unary/test_expect_to_have_count.pkb
+++ /dev/null
@@ -1,210 +0,0 @@
-create or replace package body test_expect_to_have_count is
-
- procedure cleanup_expectations is
- begin
- ut3_tester_helper.main_helper.clear_expectations( );
- end;
-
- procedure success_have_count_cursor is
- l_cursor sys_refcursor;
- begin
- --Arrange
- open l_cursor for select * from dual connect by level <= 11;
- --Act
- ut3_develop.ut.expect(l_cursor).to_have_count(11);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure fail_have_count_cursor is
- l_cursor sys_refcursor;
- begin
- --Arrange
- open l_cursor for select * from dual where 0=1;
- --Act
- ut3_develop.ut.expect(l_cursor).to_have_count(1);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure fail_have_count_cursor_report is
- l_cursor sys_refcursor;
- l_actual_message varchar2(32767);
- l_expected_message varchar2(32767);
- begin
- --Arrange
- open l_cursor for select * from dual;
- --Act
- ut3_develop.ut.expect(l_cursor).to_have_count(2);
-
- l_expected_message := q'[Actual: (refcursor [ count = 1 ]) was expected to have [ count = 2 ]%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
-
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure success_not_have_count_cursor is
- l_cursor sys_refcursor;
- begin
- --Arrange
- open l_cursor for select * from dual;
- --Act
- ut3_develop.ut.expect(l_cursor).not_to_have_count(2);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure fail_not_have_count_cursor is
- l_cursor sys_refcursor;
- begin
- --Arrange
- open l_cursor for select * from dual where 1 = 2;
- --Act
- ut3_develop.ut.expect(l_cursor).not_to_have_count(0);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure success_have_count_collection is
- l_actual anydata;
- begin
- --Arrange
- l_actual := anydata.convertcollection(ora_mining_varchar2_nt());
- -- Act
- ut3_develop.ut.expect(l_actual).to_have_count(0);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure fail_have_count_collection is
- l_actual anydata;
- begin
- --Arrange
- l_actual := anydata.convertcollection(ora_mining_varchar2_nt('a'));
- -- Act
- ut3_develop.ut.expect(l_actual).to_have_count(0);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure success_not_have_count_coll is
- l_actual anydata;
- begin
- --Arrange
- l_actual := anydata.convertcollection(ora_mining_varchar2_nt('a'));
- -- Act
- ut3_develop.ut.expect(l_actual).not_to_have_count(2);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- end;
-
- procedure fail_not_have_count_coll is
- l_actual anydata;
- begin
- --Arrange
- l_actual := anydata.convertcollection(ora_mining_varchar2_nt());
- -- Act
- ut3_develop.ut.expect(l_actual).not_to_have_count(0);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure fail_have_count_null_coll is
- l_actual anydata;
- l_data ora_mining_varchar2_nt;
- begin
- --Arrange
- l_actual := anydata.convertcollection(l_data);
- -- Act
- ut3_develop.ut.expect(l_actual).to_have_count(0);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure fail_not_have_count_null_coll is
- l_actual anydata;
- l_data ora_mining_varchar2_nt;
- begin
- --Arrange
- l_actual := anydata.convertcollection(l_data);
- -- Act
- ut3_develop.ut.expect(l_actual).not_to_have_count(0);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure fail_have_count_object is
- l_actual anydata;
- begin
- --Arrange
- l_actual := anydata.convertObject(ut3_tester_helper.test_dummy_number(1));
- -- Act
- ut3_develop.ut.expect(l_actual).to_have_count(0);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure fail_have_count_null_object is
- l_actual anydata;
- l_data ut3_tester_helper.test_dummy_number;
- begin
- --Arrange
- l_actual := anydata.convertObject(l_data);
- -- Act
- ut3_develop.ut.expect(l_actual).to_have_count(0);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure fail_have_count_number is
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- -- Act
- ut3_develop.ut.expect( 1 ).to_( ut3_develop.have_count(0) );
- --Assert
- l_expected_message := q'[%The matcher 'have count' cannot be used with data type (number).%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure fail_not_have_count_object is
- l_actual anydata;
- l_expected_message varchar2(32767);
- l_actual_message varchar2(32767);
- begin
- --Arrange
- l_actual := anydata.convertObject(ut3_tester_helper.test_dummy_number(1));
- -- Act
- ut3_develop.ut.expect(l_actual).not_to_have_count(0);
- --Assert
- l_expected_message := q'[%The matcher 'have count' cannot be used with data type (ut3_tester_helper.test_dummy_number).%]';
- l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
- --Assert
- ut.expect(l_actual_message).to_be_like(l_expected_message);
- end;
-
- procedure fail_not_have_count_null_obj is
- l_actual anydata;
- l_data ut3_tester_helper.test_dummy_number;
- begin
- --Arrange
- l_actual := anydata.convertObject(l_data);
- -- Act
- ut3_develop.ut.expect(l_actual).not_to_have_count(0);
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
- procedure fail_not_have_count_number is
- begin
- -- Act
- ut3_develop.ut.expect( 1 ).not_to( ut3_develop.have_count(0) );
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
- end;
-
-end;
-/
\ No newline at end of file
diff --git a/test/ut3_user/expectations/unary/test_expect_to_have_count.pks b/test/ut3_user/expectations/unary/test_expect_to_have_count.pks
deleted file mode 100644
index b944d8800..000000000
--- a/test/ut3_user/expectations/unary/test_expect_to_have_count.pks
+++ /dev/null
@@ -1,61 +0,0 @@
-create or replace package test_expect_to_have_count is
-
- --%suite((not)to_have_count)
- --%suitepath(utplsql.test_user.expectations.unary)
-
- --%aftereach
- procedure cleanup_expectations;
-
- --%test(Gives success for an empty cursor)
- procedure success_have_count_cursor;
-
- --%test(Gives failure for a non empty cursor)
- procedure fail_have_count_cursor;
-
- --%test(Reports the content of cursor when cursor is not empty)
- procedure fail_have_count_cursor_report;
-
- --%test(Negated - Gives success for a non empty cursor)
- procedure success_not_have_count_cursor;
-
- --%test(Negated - Gives failure for an empty cursor)
- procedure fail_not_have_count_cursor;
-
- --%test(Gives success for an empty collection)
- procedure success_have_count_collection;
-
- --%test(Gives failure for a non empty collection)
- procedure fail_have_count_collection;
-
- --%test(Negated - Gives success for a non empty collection)
- procedure success_not_have_count_coll;
-
- --%test(Negated - Gives failure for an empty collection)
- procedure fail_not_have_count_coll;
-
- --%test(Gives failure for a NULL collection)
- procedure fail_have_count_null_coll;
-
- --%test(Negated - Gives failure for an empty collection)
- procedure fail_not_have_count_null_coll;
-
- --%test(Gives failure for an object)
- procedure fail_have_count_object;
-
- --%test(Gives failure for a null object)
- procedure fail_have_count_null_object;
-
- --%test(Gives failure for number)
- procedure fail_have_count_number;
-
- --%test(Negated - Gives failure for an object)
- procedure fail_not_have_count_object;
-
- --%test(Negated - Gives failure for a null object)
- procedure fail_not_have_count_null_obj;
-
- --%test(Negated - Gives failure for number)
- procedure fail_not_have_count_number;
-
-end;
-/
diff --git a/test/ut3_user/helpers/some_item.tps b/test/ut3_user/helpers/some_item.tps
deleted file mode 100644
index 336f44d9a..000000000
--- a/test/ut3_user/helpers/some_item.tps
+++ /dev/null
@@ -1,6 +0,0 @@
-create or replace type some_item force as object(
- item_id number(38),
- item_name varchar2(250)
-)
-/
-
diff --git a/test/ut3_user/helpers/some_items.tps b/test/ut3_user/helpers/some_items.tps
deleted file mode 100644
index 8b984f8a4..000000000
--- a/test/ut3_user/helpers/some_items.tps
+++ /dev/null
@@ -1,2 +0,0 @@
-create or replace type some_items force as table of some_item
-/
diff --git a/test/ut3_user/helpers/some_object.tps b/test/ut3_user/helpers/some_object.tps
deleted file mode 100644
index 024379974..000000000
--- a/test/ut3_user/helpers/some_object.tps
+++ /dev/null
@@ -1,7 +0,0 @@
-create or replace type some_object force as object(
- object_owner varchar2(250),
- object_name varchar2(250),
- create_time timestamp,
- items some_items
-)
-/
diff --git a/test/ut3_user/reporters.pkb b/test/ut3_user/reporters.pkb
deleted file mode 100644
index 031683615..000000000
--- a/test/ut3_user/reporters.pkb
+++ /dev/null
@@ -1,196 +0,0 @@
-create or replace package body reporters is
-
- procedure create_test_helper_package is
- pragma autonomous_transaction;
- begin
- execute immediate q'[create or replace package test_reporters
-as
- --%suite(A suite for testing different outcomes from reporters)
- --%suitepath(org.utplsql.tests.helpers)
-
- --%beforeall
- procedure beforeall;
-
- --%beforeeach
- procedure beforeeach;
-
- --%context(A description of some context)
- --%name(some_context)
-
- --%test
- --%beforetest(beforetest)
- --%aftertest(aftertest)
- procedure passing_test;
-
- --%endcontext
-
- procedure beforetest;
-
- procedure aftertest;
-
- --%test(a test with failing assertion)
- procedure failing_test;
-
- --%test(a test raising unhandled exception)
- procedure erroring_test;
-
- --%test(a disabled test)
- --%disabled(Disabled for testing purpose)
- procedure disabled_test;
-
- --%test(a disabled test with no reason)
- --%disabled
- procedure disabled_test_no_reason;
-
- --%aftereach
- procedure aftereach;
-
- --%afterall
- procedure afterall;
-
-end;]';
-
- execute immediate q'[create or replace package body test_reporters
-as
-
- procedure beforetest is
- begin
- dbms_output.put_line('');
- end;
-
- procedure aftertest
- is
- begin
- dbms_output.put_line('');
- end;
-
- procedure beforeeach is
- begin
- dbms_output.put_line('');
- end;
-
- procedure aftereach is
- begin
- dbms_output.put_line('');
- end;
-
- procedure passing_test
- is
- begin
- dbms_output.put_line('');
- ut3_develop.ut.expect(1,'Test 1 Should Pass').to_equal(1);
- end;
-
- procedure failing_test
- is
- begin
- dbms_output.put_line('');
- ut3_develop.ut.expect('number [1] ','Fails as values are different').to_equal('number [2] ');
- end;
-
- procedure erroring_test
- is
- l_integer_variable integer;
- begin
- dbms_output.put_line('');
- l_integer_variable := 'a string';
- end;
-
- procedure disabled_test
- is
- begin
- dbms_output.put_line('');
- ut3_develop.ut.expect(1,'this should not execute').to_equal(1);
- end;
-
- procedure disabled_test_no_reason
- is
- begin
- dbms_output.put_line('');
- ut3_develop.ut.expect(1,'this should not execute').to_equal(1);
- end;
-
- procedure beforeall is
- begin
- dbms_output.put_line('');
- end;
-
- procedure afterall is
- begin
- dbms_output.put_line('');
- end;
-
-end;]';
-
- execute immediate q'[create or replace package check_fail_escape is
- --%suitepath(core)
- --%suite(Check JUNIT XML failure is escaped)
-
- --%test(Fail Miserably)
- procedure fail_miserably;
-
- end;]';
-
- execute immediate q'[create or replace package body check_fail_escape is
- procedure fail_miserably is
- begin
- ut3_develop.ut.expect('test').to_equal('');
- end;
- end;]';
-
- end;
-
- procedure reporters_setup is
- begin
- create_test_helper_package;
- end;
-
- procedure drop_test_helper_package is
- begin
- execute immediate 'drop package test_reporters';
- execute immediate 'drop package check_fail_escape';
- end;
-
- procedure reporters_cleanup is
- pragma autonomous_transaction;
- begin
- drop_test_helper_package;
- end;
-
- procedure check_xml_encoding_included(
- a_reporter ut3_develop.ut_reporter_base,
- a_client_character_set varchar2
- ) is
- l_results ut3_develop.ut_varchar2_list;
- l_actual clob;
- begin
- --Act
- select *
- bulk collect into l_results
- from table(ut3_develop.ut.run('test_reporters', a_reporter, a_client_character_set => a_client_character_set));
- l_actual := ut3_tester_helper.main_helper.table_to_clob(l_results);
- --Assert
- ut.expect(l_actual).to_be_like('%');
- end;
-
- procedure check_xml_failure_escaped(
- a_reporter ut3_develop.ut_reporter_base
- ) is
- l_results ut3_develop.ut_varchar2_list;
- l_actual clob;
- begin
- --Act
- select *
- bulk collect into l_results
- from table( ut3_develop.ut.run( 'check_fail_escape', a_reporter ) );
- l_actual := ut3_tester_helper.main_helper.table_to_clob(l_results);
- --Assert
- ut.expect(l_actual).to_be_like('%' (varchar2)%]'
- ||q'[at "UT3_USER.CHECK_FAIL_ESCAPE%", line % ut3_develop.ut.expect('test').to_equal('');]'
- ||'%]]>%'
- );
- end;
-
-end reporters;
-/
diff --git a/test/ut3_user/reporters.pks b/test/ut3_user/reporters.pks
deleted file mode 100644
index 412091984..000000000
--- a/test/ut3_user/reporters.pks
+++ /dev/null
@@ -1,24 +0,0 @@
-create or replace package reporters is
-
- gc_support_line constant varchar2(200) := 'Using utPLSQL at work? Get support and help keep it maintained: https://utplsql.org/support';
-
- --%suite
- --%suitepath(utplsql.test_user)
-
- --%beforeall
- procedure reporters_setup;
-
- --%afterall
- procedure reporters_cleanup;
-
- procedure check_xml_encoding_included(
- a_reporter ut3_develop.ut_reporter_base,
- a_client_character_set varchar2
- );
-
- procedure check_xml_failure_escaped(
- a_reporter ut3_develop.ut_reporter_base
- );
-
-end reporters;
-/
diff --git a/test/ut3_user/reporters/test_coverage.pks b/test/ut3_user/reporters/test_coverage.pks
deleted file mode 100644
index 11bc6d480..000000000
--- a/test/ut3_user/reporters/test_coverage.pks
+++ /dev/null
@@ -1,14 +0,0 @@
-create or replace package test_coverage is
-
- --%suite
- --%suitepath(utplsql.test_user.reporters)
-
- --%beforeall(ut3_tester_helper.coverage_helper.create_test_results_table)
- --%beforeall(ut3_tester_helper.coverage_helper.create_dummy_coverage)
-
-
- --%afterall(ut3_tester_helper.coverage_helper.drop_dummy_coverage)
- --%afterall(ut3_tester_helper.coverage_helper.drop_test_results_table)
-
-end;
-/
diff --git a/test/ut3_user/reporters/test_coverage/test_cov_cobertura_reporter.pkb b/test/ut3_user/reporters/test_coverage/test_cov_cobertura_reporter.pkb
deleted file mode 100644
index 49e0410ba..000000000
--- a/test/ut3_user/reporters/test_coverage/test_cov_cobertura_reporter.pkb
+++ /dev/null
@@ -1,53 +0,0 @@
-create or replace package body test_cov_cobertura_reporter is
-
- procedure report_on_file is
- l_expected clob;
- l_actual clob;
- l_block_cov clob;
- l_name varchar2(250);
- l_file_path varchar2(250);
- begin
-
-
- --Arrange
- l_name := ut3_tester_helper.coverage_helper.covered_package_name;
- l_file_path := 'test/ut3_develop.'||ut3_tester_helper.coverage_helper.covered_package_name||'.pkb';
- l_block_cov := '';
- l_expected :=
- q'[
-
-
-
-]'||l_file_path||q'[
-
-
-
-
-
-
-]'||l_block_cov||q'[
-
-
-
-
-
-
-]';
- --Act
- l_actual :=
- ut3_tester_helper.coverage_helper.run_tests_as_job(
- q'[
- ut3_develop.ut.run(
- a_path => 'ut3_develop.test_dummy_coverage',
- a_reporter => ut3_develop.ut_coverage_cobertura_reporter( ),
- a_source_files => ut3_develop.ut_varchar2_list( ']'||l_file_path||q'[' ),
- a_test_files => ut3_develop.ut_varchar2_list( )
- )
- ]'
- );
- --Assert
- ut.expect(l_actual).to_be_like(l_expected);
- end;
-
-end;
-/
diff --git a/test/ut3_user/reporters/test_coverage/test_cov_cobertura_reporter.pks b/test/ut3_user/reporters/test_coverage/test_cov_cobertura_reporter.pks
deleted file mode 100644
index 365815964..000000000
--- a/test/ut3_user/reporters/test_coverage/test_cov_cobertura_reporter.pks
+++ /dev/null
@@ -1,10 +0,0 @@
-create or replace package test_cov_cobertura_reporter is
-
- --%suite(ut_cov_cobertura_reporter)
- --%suitepath(utplsql.test_user.reporters.test_coverage)
-
- --%test(reports on a project file mapped to database object)
- procedure report_on_file;
-
-end test_cov_cobertura_reporter;
-/
diff --git a/test/ut3_user/reporters/test_coverage/test_coverage_sonar_reporter.pkb b/test/ut3_user/reporters/test_coverage/test_coverage_sonar_reporter.pkb
deleted file mode 100644
index 9f2409637..000000000
--- a/test/ut3_user/reporters/test_coverage/test_coverage_sonar_reporter.pkb
+++ /dev/null
@@ -1,39 +0,0 @@
-create or replace package body test_coverage_sonar_reporter is
-
- procedure report_on_file is
- l_expected clob;
- l_actual clob;
- l_block_cov clob;
- begin
- --Arrange
- l_block_cov := '';
- l_expected := '
-
-
-'||l_block_cov||'
-
-
-';
- --Act
- l_actual :=
- ut3_tester_helper.coverage_helper.run_tests_as_job(
- q'[
- ut3_develop.ut.run(
- a_path => 'ut3_develop.test_dummy_coverage',
- a_reporter=> ut3_develop.ut_coverage_sonar_reporter( ),
- a_source_files => ut3_develop.ut_varchar2_list( 'test/ut3_develop.]'||ut3_tester_helper.coverage_helper.covered_package_name||q'[.pkb' ),
- a_test_files => ut3_develop.ut_varchar2_list( )
- )
- ]'
- );
- --Assert
- ut.expect(l_actual).to_equal(l_expected);
- end;
-
- procedure check_encoding_included is
- begin
- reporters.check_xml_encoding_included(ut3_develop.ut_coverage_sonar_reporter(), 'UTF-8');
- end;
-
-end;
-/
diff --git a/test/ut3_user/reporters/test_coverage/test_coverage_sonar_reporter.pks b/test/ut3_user/reporters/test_coverage/test_coverage_sonar_reporter.pks
deleted file mode 100644
index 7a98355cf..000000000
--- a/test/ut3_user/reporters/test_coverage/test_coverage_sonar_reporter.pks
+++ /dev/null
@@ -1,13 +0,0 @@
-create or replace package test_coverage_sonar_reporter is
-
- --%suite(ut_coverge_sonar_reporter)
- --%suitepath(utplsql.test_user.reporters.test_coverage)
-
- --%test(reports on a project file mapped to database object)
- procedure report_on_file;
-
- --%test(Includes XML header with encoding when encoding provided)
- procedure check_encoding_included;
-
-end;
-/
diff --git a/test/ut3_user/reporters/test_coverage/test_coverage_standalone.pkb b/test/ut3_user/reporters/test_coverage/test_coverage_standalone.pkb
deleted file mode 100644
index adf7b51d1..000000000
--- a/test/ut3_user/reporters/test_coverage/test_coverage_standalone.pkb
+++ /dev/null
@@ -1,97 +0,0 @@
-create or replace package body test_coverage_standalone is
-
- function run_coverage_twice(a_overage_run_id raw, a_object_name varchar2, a_charset varchar2) return clob is
- l_expected clob;
- l_block_cov clob;
- l_file_path varchar2(250);
- begin
- l_file_path := 'package body ut3_develop.'||a_object_name;
- --Arrange
- l_block_cov := '';
- l_expected :=
- q'[
-
-
-
-]'||l_file_path||q'[
-
-
-
-
-
-
-]'||l_block_cov||q'[
-
-
-
-
-
-
-]';
- --Act
- ut3_tester_helper.coverage_helper.run_coverage_job(a_overage_run_id, 1);
- ut3_tester_helper.coverage_helper.run_coverage_job(a_overage_run_id, 3);
- return l_expected;
- end;
-
- procedure coverage_without_ut_run is
- l_coverage_run_id raw(32) := sys_guid();
- l_actual ut3_develop.ut_varchar2_list;
- l_expected clob;
- l_name varchar2(250);
- l_charset varchar2(100) := 'ISO-8859-1';
- begin
- l_name := ut3_tester_helper.coverage_helper.covered_package_name;
-
- --Arrange and Act
- l_expected := run_coverage_twice(l_coverage_run_id, l_name, l_charset);
-
- select *
- bulk collect into l_actual
- from
- table (
- ut3_develop.ut_coverage_cobertura_reporter().get_report(
- a_coverage_options => ut3_develop.ut_coverage_options(
- coverage_run_id => l_coverage_run_id,
- include_objects => ut3_develop.ut_varchar2_rows(l_name),
- schema_names => ut3_develop.ut_varchar2_rows('UT3_DEVELOP')
- ),
- a_client_character_set => l_charset
- )
- );
-
- --Assert
- ut.expect(ut3_tester_helper.main_helper.table_to_clob(l_actual)).to_be_like( l_expected );
- end;
-
- procedure coverage_cursor_without_ut_run is
- l_coverage_run_id raw(32) := sys_guid();
- l_coverage_cursor sys_refcursor;
- l_actual ut3_develop.ut_varchar2_list;
- l_expected clob;
- l_name varchar2(250);
- l_charset varchar2(100) := 'ISO-8859-1';
- begin
- l_name := ut3_tester_helper.coverage_helper.covered_package_name;
-
- --Arrange and Act
- l_expected := run_coverage_twice(l_coverage_run_id, l_name, l_charset);
-
- l_coverage_cursor :=
- ut3_develop.ut_coverage_cobertura_reporter( ).get_report_cursor(
- a_coverage_options => ut3_develop.ut_coverage_options(
- coverage_run_id => l_coverage_run_id,
- include_objects => ut3_develop.ut_varchar2_rows(l_name),
- schema_names => ut3_develop.ut_varchar2_rows('UT3_DEVELOP')
- ),
- a_client_character_set => l_charset
- );
- fetch l_coverage_cursor bulk collect into l_actual;
- close l_coverage_cursor;
-
- --Assert
- ut.expect(ut3_tester_helper.main_helper.table_to_clob(l_actual)).to_be_like( l_expected );
- end;
-
-end;
-/
diff --git a/test/ut3_user/reporters/test_coverage/test_coverage_standalone.pks b/test/ut3_user/reporters/test_coverage/test_coverage_standalone.pks
deleted file mode 100644
index 1d5bb9a2c..000000000
--- a/test/ut3_user/reporters/test_coverage/test_coverage_standalone.pks
+++ /dev/null
@@ -1,12 +0,0 @@
-create or replace package test_coverage_standalone authid current_user is
-
- --%suite
- --%suitepath(utplsql.test_user.reporters.test_coverage)
-
- --%test(Coverage can be invoked standalone in multiple sessions and a combined report can be produced at the end)
- procedure coverage_without_ut_run;
-
- --%test(Coverage can be invoked standalone in multiple sessions and a combined report can be produced at the end as cursor)
- procedure coverage_cursor_without_ut_run;
-end;
-/
diff --git a/test/ut3_user/reporters/test_coverage/test_extended_coverage.pkb b/test/ut3_user/reporters/test_coverage/test_extended_coverage.pkb
deleted file mode 100644
index f6f76b62f..000000000
--- a/test/ut3_user/reporters/test_coverage/test_extended_coverage.pkb
+++ /dev/null
@@ -1,311 +0,0 @@
-create or replace package body test_extended_coverage is
-
- function get_block_coverage_line return clob is
- begin
- return '%';
- end;
- procedure coverage_for_object is
- l_expected clob;
- l_actual clob;
- begin
- --Arrange
- l_expected := '%' ||
- get_block_coverage_line||
- '%%';
- --Act
- l_actual :=
- ut3_tester_helper.coverage_helper.run_tests_as_job(
- q'[
- ut3_develop.ut.run(
- a_path => 'ut3_develop.test_dummy_coverage',
- a_reporter=> ut3_develop.ut_coverage_sonar_reporter( ),
- a_include_objects => ut3_develop.ut_varchar2_list( 'ut3_develop.]'||ut3_tester_helper.coverage_helper.covered_package_name||q'[' )
- )
- ]'
- );
- --Assert
- ut.expect(l_actual).to_be_like(l_expected);
- end;
-
- procedure coverage_for_schema is
- l_expected clob;
- l_actual clob;
- begin
- --Arrange
- l_expected := '%' ||
- get_block_coverage_line ||
- '%%';
- --Act
- l_actual :=
- ut3_tester_helper.coverage_helper.run_tests_as_job(
- q'[
- ut3_develop.ut.run(
- a_path => 'ut3_develop.test_dummy_coverage',
- a_reporter=> ut3_develop.ut_coverage_sonar_reporter( ),
- a_coverage_schemes => ut3_develop.ut_varchar2_list( 'ut3_develop' )
- )
- ]'
- );
- --Assert
- ut.expect(l_actual).to_be_like(l_expected);
- ut.expect(l_actual).to_be_like('%%%');
- end;
-
- procedure coverage_for_file is
- l_expected clob;
- l_actual clob;
- l_file_path varchar2(250);
- begin
- --Arrange
- l_file_path := 'test/ut3_develop.'||ut3_tester_helper.coverage_helper.covered_package_name||'.pkb';
- l_expected := '%' ||
- get_block_coverage_line ||
- '%%';
- --Act
- l_actual :=
- ut3_tester_helper.coverage_helper.run_tests_as_job(
- q'[
- ut3_develop.ut.run(
- a_path => 'ut3_develop.test_dummy_coverage',
- a_reporter=> ut3_develop.ut_coverage_sonar_reporter( ),
- a_source_files => ut3_develop.ut_varchar2_list( ']'||l_file_path||q'[' ),
- a_test_files => ut3_develop.ut_varchar2_list( )
- )
- ]'
- );
- --Assert
- ut.expect(l_actual).to_be_like(l_expected);
- end;
-
- procedure coverage_with_dbms_stats is
- l_expected clob;
- l_actual clob;
- begin
- --Arrange
- l_expected := '%' ||
- '%%';
- --Act
- l_actual :=
- ut3_tester_helper.coverage_helper.run_tests_as_job(
- q'[
- ut3_develop.ut.run(
- a_path => 'ut3_develop.test_stats',
- a_reporter=> ut3_develop.ut_coverage_sonar_reporter( ),
- a_coverage_schemes => ut3_develop.ut_varchar2_list( 'ut3_develop' ),
- a_include_objects => ut3_develop.ut_varchar2_list('stats')
- )
- ]'
- );
- --Assert
- ut.expect(l_actual).to_be_like(l_expected);
- end;
-
- procedure coverage_regex_include_schema is
- l_expected clob;
- l_not_expected clob;
- l_actual clob;
- begin
- --Arrange
- l_expected := '%' ||
- '%%';
- l_not_expected := '%' ||
- '%%';
- --Act
- l_actual :=
- ut3_tester_helper.coverage_helper.run_tests_as_job(
- q'[
- ut3_develop.ut.run(
- a_paths => ut3_develop.ut_varchar2_list('ut3_develop.test_regex_dummy_cov', 'ut3_tester_helper.test_regex_dummy_cov'),
- a_reporter=> ut3_develop.ut_coverage_sonar_reporter( ),
- a_include_schema_expr => '^ut3_tester_hel.*',
- a_include_objects => ut3_develop.ut_varchar2_list( 'ut3_develop.regex_dummy_cov' )
- )
- ]'
- );
-
- --Assert
- ut.expect(l_actual).to_be_like(l_expected);
- ut.expect(l_actual).not_to_be_like(l_not_expected);
- ut.expect(l_actual).not_to_be_like('%ut3_tester_helper.test_regex_dummy_cov%');
- end;
-
- procedure coverage_regex_include_object is
- l_expected clob;
- l_not_expected clob;
- l_actual clob;
- begin
- --Arrange
- l_expected := '%' ||
- '%%';
- l_not_expected := '%' ||
- '%%';
- --Act
- l_actual :=
- ut3_tester_helper.coverage_helper.run_tests_as_job(
- q'[
- ut3_develop.ut.run(
- a_paths => ut3_develop.ut_varchar2_list('ut3_develop.test_regex_dummy_cov', 'ut3_develop.test_regex123_dummy_cov'),
- a_reporter=> ut3_develop.ut_coverage_sonar_reporter( ),
- a_include_object_expr => 'regex123',
- a_include_objects => ut3_develop.ut_varchar2_list( 'ut3_develop.regex_dummy_cov' )
- )
- ]'
- );
- --Assert
- ut.expect(l_actual).to_be_like(l_expected);
- ut.expect(l_actual).not_to_be_like(l_not_expected);
- end;
-
- procedure coverage_regex_exclude_schema is
- l_expected clob;
- l_not_expected clob;
- l_actual clob;
- begin
- --Arrange
- l_expected := '%' ||
- '%%';
- l_not_expected := '%' ||
- '%%';
- --Act
- l_actual :=
- ut3_tester_helper.coverage_helper.run_tests_as_job(
- q'[
- ut3_develop.ut.run(
- a_paths => ut3_develop.ut_varchar2_list('ut3_develop.test_regex_dummy_cov', 'ut3_tester_helper.test_regex_dummy_cov'),
- a_reporter=> ut3_develop.ut_coverage_sonar_reporter( ),
- a_exclude_schema_expr => '^ut3_tester',
- a_exclude_objects => ut3_develop.ut_varchar2_list( 'ut3_develop.regex_dummy_cov' )
- )
- ]'
- );
- --Assert
- ut.expect(l_actual).to_be_like(l_expected);
- ut.expect(l_actual).not_to_be_like(l_not_expected);
- end;
-
- procedure coverage_regex_exclude_object is
- l_expected clob;
- l_not_expected clob;
- l_actual clob;
- begin
- --Arrange
- l_expected := '%' ||
- '%%';
- l_not_expected := '%' ||
- '%%';
- --Act
- l_actual :=
- ut3_tester_helper.coverage_helper.run_tests_as_job(
- q'[
- ut3_develop.ut.run(
- a_paths => ut3_develop.ut_varchar2_list('ut3_develop.test_regex_dummy_cov', 'ut3_develop.test_regex123_dummy_cov'),
- a_reporter=> ut3_develop.ut_coverage_sonar_reporter( ),
- a_exclude_object_expr => 'regex123',
- a_exclude_objects => ut3_develop.ut_varchar2_list( 'ut3_develop.regex_dummy_cov' )
- )
- ]'
- );
- --Assert
- ut.expect(l_actual).to_be_like(l_expected);
- ut.expect(l_actual).not_to_be_like(l_not_expected);
- end;
-
- procedure cove_rgx_inc_schema_norun is
- l_expected clob;
- l_not_expected clob;
- l_actual clob;
- begin
- --Arrange
- l_expected := '%UT3_DEVELOP.REGEX_DUMMY_COV%';
- l_not_expected := '%UT3_TESTER_HELPER.REGEX123_DUMMY_COV%';
- --Act
- l_actual := ut3_tester_helper.coverage_helper.gather_coverage_on_coverage(
- q'[ut3_develop.ut_coverage_options(
- coverage_run_id => l_coverage_run_id,
- include_schema_expr => '^ut3_develop'
- )]');
- --Assert
- ut.expect(l_actual).to_be_like(l_expected);
- ut.expect(l_actual).not_to_be_like(l_not_expected);
- end;
-
- procedure cove_rgx_inc_object_norun is
- l_expected clob;
- l_not_expected clob;
- l_actual clob;
- begin
- --Arrange
- l_expected := '%UT3_DEVELOP.REGEX123_DUMMY_COV%';
- l_not_expected := '%UT3_DEVELOP.REGEX_DUMMY_COV%';
- --Act
- l_actual := ut3_tester_helper.coverage_helper.gather_coverage_on_coverage(
- q'[ut3_develop.ut_coverage_options(
- coverage_run_id => l_coverage_run_id,
- include_object_expr => 'regex123'
- )]');
- --Assert
- ut.expect(l_actual).to_be_like(l_expected);
- ut.expect(l_actual).not_to_be_like(l_not_expected);
- end;
-
- procedure cove_rgx_exc_schema_norun is
- l_expected clob;
- l_not_expected clob;
- l_actual clob;
- begin
- --Arrange
- l_expected := '%UT3_DEVELOP.REGEX_DUMMY_COV%';
- l_not_expected := '%UT3_TESTER_HELPER.REGEX_DUMMY_COV%';
- --Act
- l_actual := ut3_tester_helper.coverage_helper.gather_coverage_on_coverage(
- q'[ut3_develop.ut_coverage_options(
- coverage_run_id => l_coverage_run_id,
- schema_names => ut3_develop.ut_varchar2_rows( 'UT3_DEVELOP','UT3_TESTER_HELPER' ),
- exclude_schema_expr => '^ut3_tester',
- exclude_objects => ut3_develop.ut_varchar2_rows( 'ut3_develop.regex_dummy_cov' )
- )]');
- --Assert
- ut.expect(l_actual).to_be_like(l_expected);
- ut.expect(l_actual).not_to_be_like(l_not_expected);
- end;
-
- procedure cove_rgx_exc_object_norun is
- l_expected clob;
- l_not_expected clob;
- l_actual clob;
- begin
- --Arrange
- l_expected := '%UT3_DEVELOP.REGEX_DUMMY_COV%';
- l_not_expected := '%UT3_DEVELOP.REGEX123_DUMMY_COV%';
- --Act
- l_actual := ut3_tester_helper.coverage_helper.gather_coverage_on_coverage(
- q'[ut3_develop.ut_coverage_options(
- coverage_run_id => l_coverage_run_id,
- schema_names => ut3_develop.ut_varchar2_rows( 'UT3_DEVELOP' ),
- exclude_object_expr => 'regex123',
- exclude_objects => ut3_develop.ut_varchar2_rows( 'ut3_develop.regex_dummy_cov' )
- )]');
- --Assert
- ut.expect(l_actual).to_be_like(l_expected);
- ut.expect(l_actual).not_to_be_like(l_not_expected);
- end;
-
- procedure cov_file_mapping_no_utrun is
- l_expected clob;
- l_not_expected clob;
- l_actual clob;
- begin
- --Arrange
- l_expected := '%UT3_DEVELOP.REGEX_DUMMY_COV%';
- --Act
- l_actual := ut3_tester_helper.coverage_helper.gather_coverage_on_coverage(
- q'[ut3_develop.ut_coverage_options(
- coverage_run_id => l_coverage_run_id,
- file_mappings => ut3_develop.ut_file_mappings( ut3_develop.ut_file_mapping('C:\tests\helpers\core.pkb','UT3_DEVELOP','REGEX_DUMMY_COV','PACKAGE BODY'))
- )]');
- --Assert
- ut.expect(l_actual).to_be_like(l_expected);
- end;
-
-end;
-/
diff --git a/test/ut3_user/reporters/test_coverage/test_extended_coverage.pks b/test/ut3_user/reporters/test_coverage/test_extended_coverage.pks
deleted file mode 100644
index 82b19fbed..000000000
--- a/test/ut3_user/reporters/test_coverage/test_extended_coverage.pks
+++ /dev/null
@@ -1,66 +0,0 @@
-create or replace package test_extended_coverage is
-
- --%suite
- --%suitepath(utplsql.test_user.reporters.test_coverage)
-
- --%test(Coverage is gathered for specified object - extended coverage type)
- procedure coverage_for_object;
-
- --%test(Coverage is gathered for specified schema - extended coverage type)
- procedure coverage_for_schema;
-
- --%test(Coverage is gathered for specified file - extended coverage type)
- procedure coverage_for_file;
-
- --%beforetest(ut3_tester_helper.coverage_helper.create_cov_with_dbms_stats)
- --%aftertest(ut3_tester_helper.coverage_helper.drop_cov_with_dbms_stats)
- --%tags(#1097,#1094)
- --%test(Extended coverage does not fail the test run then tested code calls DBMS_STATS)
- procedure coverage_with_dbms_stats;
-
- --%beforetest(ut3_tester_helper.coverage_helper.create_regex_dummy_cov)
- --%aftertest(ut3_tester_helper.coverage_helper.drop_regex_dummy_cov)
- --%test(Collect coverage for objects with schema regex include with ut_run)
- procedure coverage_regex_include_schema;
-
- --%beforetest(ut3_tester_helper.coverage_helper.create_regex_dummy_cov)
- --%aftertest(ut3_tester_helper.coverage_helper.drop_regex_dummy_cov)
- --%test(Collect coverage for objects with object regex include with ut_run)
- procedure coverage_regex_include_object;
-
- --%beforetest(ut3_tester_helper.coverage_helper.create_regex_dummy_cov)
- --%aftertest(ut3_tester_helper.coverage_helper.drop_regex_dummy_cov)
- --%test(Collect coverage for objects with schema regex exclude with ut_run)
- procedure coverage_regex_exclude_schema;
-
- --%beforetest(ut3_tester_helper.coverage_helper.create_regex_dummy_cov)
- --%aftertest(ut3_tester_helper.coverage_helper.drop_regex_dummy_cov)
- --%test(Collect coverage for objects with object regex exclude with ut_run)
- procedure coverage_regex_exclude_object;
-
- --%beforetest(ut3_tester_helper.coverage_helper.create_regex_dummy_cov)
- --%aftertest(ut3_tester_helper.coverage_helper.drop_regex_dummy_cov)
- --%test(Collect coverage for objects with schema regex include without ut_run)
- procedure cove_rgx_inc_schema_norun;
-
- --%beforetest(ut3_tester_helper.coverage_helper.create_regex_dummy_cov)
- --%aftertest(ut3_tester_helper.coverage_helper.drop_regex_dummy_cov)
- --%test(Collect coverage for objects with object regex include without ut_run)
- procedure cove_rgx_inc_object_norun;
-
- --%beforetest(ut3_tester_helper.coverage_helper.create_regex_dummy_cov)
- --%aftertest(ut3_tester_helper.coverage_helper.drop_regex_dummy_cov)
- --%test(Collect coverage for objects with schema regex exclude without ut_run)
- procedure cove_rgx_exc_schema_norun;
-
- --%beforetest(ut3_tester_helper.coverage_helper.create_regex_dummy_cov)
- --%aftertest(ut3_tester_helper.coverage_helper.drop_regex_dummy_cov)
- --%test(Collect coverage for objects with object regex exclude without ut_run)
- procedure cove_rgx_exc_object_norun;
-
- --%beforetest(ut3_tester_helper.coverage_helper.create_regex_dummy_cov)
- --%aftertest(ut3_tester_helper.coverage_helper.drop_regex_dummy_cov)
- --%test(Collect coverage for file mapping without ut_run)
- procedure cov_file_mapping_no_utrun;
-end;
-/
diff --git a/test/ut3_user/reporters/test_coverage/test_html_coverage_reporter.pkb b/test/ut3_user/reporters/test_coverage/test_html_coverage_reporter.pkb
deleted file mode 100644
index 883909eb5..000000000
--- a/test/ut3_user/reporters/test_coverage/test_html_coverage_reporter.pkb
+++ /dev/null
@@ -1,119 +0,0 @@
-create or replace package body test_html_coverage_reporter is
-
- procedure report_on_file is
- l_expected varchar2(32767);
- l_actual clob;
- l_block_cov clob;
- l_name varchar2(250);
- l_charset varchar2(100) := 'ISO-8859-1';
- begin
- --Arrange
- l_name := ut3_tester_helper.coverage_helper.covered_package_name;
- l_block_cov := '(including 1 lines partially covered ) ';
- l_expected := '%%