Skip to content

Commit f152304

Browse files
committed
Started Demos and Examples
1 parent 20e5155 commit f152304

File tree

4 files changed

+77
-5
lines changed

4 files changed

+77
-5
lines changed

docs/demo/Package-Test.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
# Test a PL/SQL Package
3+
4+
The majority of wtPLSQL testing is testing packages. In order to demonstrate wtPLSQL compatibility, this is an example from [utPLSQL V2.3.1 documentation]().

docs/demo/README.md

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,44 @@ Demonstrations and examples assume successful connection to an [Oracle database]
44
All demonstration and example code is included in the web pages below?
55

66
## Simple Stuff
7-
* [Get wtPLSQL Version](Version.md) (Not Ready)
8-
* [Ad-Hoc Test](Ad-Hoc-Test.md) (Not Ready)
97

10-
This example is a good test to ensure wtPLSQL is running properly.
8+
The simplest check for the wtplsql is to select the "version from dual".
9+
10+
Run this:
11+
```
12+
select wtplsql.show_version from dual;
13+
```
14+
and get this:
15+
```
16+
SHOW_VERSION
17+
------------
18+
1.1.0
19+
```
20+
21+
Another simple test is an ad-hoc assertion. This test requires DBMS_OUTPUT. The results of this test are not recorded.
22+
23+
Run this:
24+
```
25+
set serveroutput on size unlimited format word_wrapped
26+
27+
begin
28+
wt_assert.eq(msg_in => 'Ad-Hoc Test'
29+
,check_this_in => 1
30+
,against_this_in => '1');
31+
end;
32+
/
33+
```
34+
And get this:
35+
```
36+
PASS Ad-Hoc Test. EQ - Expected "1" and got "1"
37+
```
38+
39+
This ad-hoc test also demonstrates implicit data type conversion, which allows a wider variety of testing. Many data types are converted to VARCHAR2 before comparison. This ensures most results are captured and reported exactly as they were tested.
40+
41+
The majority of wtPLSQL testing uses a Test Runner. A Test Runner is a PL/SQL package written by the tester. [This page](Test-Runner.md) has an example of a very simple [Test Runner](Test-Runner.md). All the examples below will use Test Runners.
1142

1243
## Database Object Tests
44+
More interesting examples actually test database objects. Here is an example test of each database object supported by wtPLSQL.
1345
* [Package Test](Package-Test.md) (Not Ready)
1446
* [Procedure Test](Procedure-Test.md) (Not Ready)
1547
* [Function Test](Function-Test.md) (Not Ready)

docs/demo/Test-Runner.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
# Create a Simple Test Runner
3+
4+
Test Runner Package Spec:
5+
```
6+
create or replace package simple_test_runner authid current_user
7+
as
8+
procedure wtplsql_run;
9+
end;
10+
/
11+
```
12+
Test Runner Package Body:
13+
```
14+
create or replace package body simple_test_runner
15+
as
16+
17+
procedure wtplsql_run
18+
is
19+
begin
20+
wt_assert.eq(msg_in => 'Ad-Hoc Test'
21+
,check_this_in => 1
22+
,against_this_in => '1');
23+
end wtplsql_run;
24+
25+
end;
26+
/
27+
```
28+
This simple test runner contains the minimum elements of a test runner. It does the same test as the ad-hoc assertion in the [Demonstrations and Examples Page](README.md). However, the test results are not sent to DBMS_OUTPUT. The test results are saved in the wtPLSQL tables.
29+
30+
To execute the Test Runner, run this:
31+
```
32+
begin
33+
wtplsql_run(simple_test_runner);
34+
end;
35+
/
36+
```
37+
38+
The results can be queried from those tables. Alternatively, a default reporting package called

docs/demo/Version.md

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy