-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.htm
More file actions
72 lines (70 loc) · 3.77 KB
/
Copy pathREADME.htm
File metadata and controls
72 lines (70 loc) · 3.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<p><a href="../README.htm">Website Home Page</a></p>
<h1 id="demonstrations-and-examples">Demonstrations and Examples</h1>
<hr />
<p>Demonstrations and examples assume successful connection to an <a href="http://www.oracle.com/technetwork/database/database-technologies/express-edition/overview/index.html">Oracle database</a> with wtPLSQL installed. <a href="https://github.com/DDieterich/wtPLSQL/releases">wtPLSQL Installation instructions</a> are available on the <a href="https://github.com/DDieterich/wtPLSQL/releases">wtPLSQL Releases page</a>.</p>
<p>Test results from assertions can be queried from a set of wtPLSQL tables. The examples here will use the default reporting package called WT_TEXT_REPORT. This package displays test results using DBMS_OUTPUT.</p>
<h2 id="the-basics">The Basics</h2>
<p>A login, or database session, is required to interact with the Oracle database. The SQL below will create a user that can run these examples. If you already have a database login, this is not necessary.</p>
<pre><code>create user wtp_demo identified by wtp_demo
default tablespace users
quota unlimited on users
temporary tablespace temp;
grant create session to wtp_demo;
grant create type to wtp_demo;
grant create sequence to wtp_demo;
grant create table to wtp_demo;
grant create trigger to wtp_demo;
grant create view to wtp_demo;
grant create procedure to wtp_demo;
</code></pre>
<p>The simplest check for a wtPLSQL installation is to select the "version from dual".</p>
<p>Run this:</p>
<pre><code>select wtplsql.show_version from dual;
</code></pre>
<p>And get this:</p>
<pre><code>SHOW_VERSION
-----------------------------------------------------------
1.1.0
</code></pre>
<p>This shows the wtPLSQL version as 1.1.0.</p>
<p>Another simple test is an ad-hoc assertion. This test requires DBMS_OUTPUT. The results of this test are not recorded.</p>
<p>Run this:</p>
<pre><code>set serveroutput on size unlimited format word_wrapped
begin
wt_assert.eq(msg_in => 'Ad-Hoc Test'
,check_this_in => 1
,against_this_in => '1');
end;
/
</code></pre>
<p>And get this:</p>
<pre><code>PASS Ad-Hoc Test. EQ - Expected "1" and got "1"
</code></pre>
<p>This indicates:</p>
<ul>
<li>the assertion passed</li>
<li>the assertion had the message "Ad-Hoc Test"</li>
<li>the assertion name is "EQ"</li>
<li>the assertion details which may include the values tested</li>
</ul>
<p>Note: This ad-hoc test also demonstrates implicit data type conversion.</p>
<h2 id="create-a-test-runner-package">Create a Test Runner Package</h2>
<p>A test runner package is central to running tests in wtPLSQL. The <a href="Test-Runner.htm">Test Runner</a> page covers all the basics of creating a test runner package.</p>
<h2 id="database-object-tests">Database Object Tests</h2>
<p>More interesting examples actually test database objects. Here are some examples.</p>
<ul>
<li><a href="Package-Test.htm">Package Test</a></li>
<li><a href="Table-Test.htm">Table Constraints Test</a></li>
<li><a href="Trigger-Test.htm">Trigger Test</a></li>
<li><a href="Type-Test.htm">Type Test</a></li>
</ul>
<h2 id="utplsql-23-examples">utPLSQL 2.3 Examples</h2>
<p>wtPLSQL was built with the utPLSQL "ut_assert" API. These examples were created from the original utPLSQL 2.3 examples without modifying the "ut_assert" calls</p>
<ul>
<li><a href="ut_betwnstr.htm">ut_betwnstr</a> - Choose a program to test</li>
<li><a href="ut_calc_secs_between.htm">ut_calc_secs_between</a> - Test a Simple Procedure</li>
<li><a href="ut_truncit.htm">ut_truncit</a> - Test a Table Modification Procedure</li>
<li><a href="ut_str.htm">ut_str</a> - Test a Simple Function</li>
</ul>
<hr />
<p><a href="../README.htm">Website Home Page</a></p>