{"id":244,"date":"2008-05-31T08:07:11","date_gmt":"2008-05-31T07:07:11","guid":{"rendered":"http:\/\/bar-solutions.com\/wordpress\/?p=244"},"modified":"2008-05-31T09:27:19","modified_gmt":"2008-05-31T08:27:19","slug":"testing-rulegen-using-codetester","status":"publish","type":"post","link":"https:\/\/blog.bar-solutions.com\/?p=244","title":{"rendered":"Testing Rulegen using Codetester"},"content":{"rendered":"<p>When I was confronted with the possibilities of <a title=\"RuleGen.com\" href=\"http:\/\/www.rulegen.com\" target=\"_blank\">Rulegen<\/a> it made me wonder: How can these rules<a href=\"http:\/\/bar-solutions.com\/wordpress\/wp-content\/codetestlogo1.jpg\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px\" height=\"40\" alt=\"codetest-logo\" src=\"http:\/\/bar-solutions.com\/wordpress\/wp-content\/codetestlogo-thumb.jpg\" width=\"43\" align=\"right\" border=\"0\"\/><\/a> be <a href=\"http:\/\/bar-solutions.com\/wordpress\/wp-content\/rulegen-logo2.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px\" height=\"30\" alt=\"RuleGen_Logo\" src=\"http:\/\/bar-solutions.com\/wordpress\/wp-content\/rulegen-logo-thumb1.png\" width=\"244\" align=\"left\" border=\"0\"\/><\/a>tested. I have some experience using <a title=\"Unit Test Community\" href=\"http:\/\/unittest.inside.quest.com\/\" target=\"_blank\">CodeTester<\/a> but as the name says, it\u2019s a code tester where <a title=\"RuleGen.com\" href=\"http:\/\/www.rulegen.com\" target=\"_blank\">rulegen<\/a> builds rules in the database that can actually only be tested using SQL statements (insert, update, delete).<\/p>\n<p><!--more--><\/p>\n<p>When I still want to use <a title=\"Unit Test Community\" href=\"http:\/\/unittest.inside.quest.com\/\" target=\"_blank\">CodeTester<\/a> to perform the actual testing I need to encapsulate the insert, update and delete statements in simple procedures. I don\u2019t want to have all the values for the record as parameters, but I figured I can create a record based on the table layout in which I can put all my values. That way I can populate this record in the pre-execution code of the test and then have the insert (or update or delete) be called in the test itself. I have build my test set around a simple table and a simple rule to be evaluated.  <\/p>\n<p>The rule to be enforced is: We only allow a single PRESIDENT in the table at a certain time.  <\/p>\n<p>Consider the following table:  <\/p>\n<p>I built this rule in the <a title=\"RuleGen.com\" href=\"http:\/\/www.rulegen.com\" target=\"_blank\">RuleGen<\/a> Front-End:  <\/p>\n<p>Details of rule ONEPRESIDENT <\/p>\n<table cellspacing=\"0\" cellpadding=\"2\" width=\"600\" border=\"0\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"174\">Rule:<\/td>\n<td valign=\"top\" width=\"422\">ONEPRESIDENT<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"174\">Description (short):<\/td>\n<td valign=\"top\" width=\"422\">Just one president allowed in the entire table&#8230;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"174\">Documentation:<\/td>\n<td valign=\"top\" width=\"422\">We don\u2019t want to have more than one president in the emp table. We can have less than one president, but no more than that. This means we have to check when inserting or updating rows but not when deleting them.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"174\">Involved columns:<\/td>\n<td valign=\"top\" width=\"422\">DEMO.EMP.JOB <\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Transition Effect Queries for Rule ONEPRESIDENT <\/p>\n<table cellspacing=\"0\" cellpadding=\"2\" width=\"600\" border=\"0\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"179\">Description:<\/td>\n<td valign=\"top\" width=\"419\">Just one president allowed in the entire table&#8230;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"179\">Violation case:<\/td>\n<td valign=\"top\" width=\"419\">1<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"179\">Insert TE-query:<\/td>\n<td valign=\"top\" width=\"419\">select distinct \u2018x\u2019 as NO_PARAMS<br \/>&nbsp; from inserted_rows<br \/>where job = \u2018PRESIDENT\u2019<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"179\">Update TE-query:<\/td>\n<td valign=\"top\" width=\"419\">select distinct \u2018x\u2019 as NO_PARAMS <br \/>&nbsp; from updated_rows <br \/>where new_job=\u2019PRESIDENT\u2019 <br \/>&nbsp;&nbsp; and old_job&lt;&gt;\u2019PRESIDENT<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"179\">Delete TE-query:<\/td>\n<td valign=\"top\" width=\"419\">select distinct \u2018x\u2019 as NO_PARAMS <br \/>&nbsp; from deleted_rows <br \/>where 0=1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Constraint Validation Query for Rule ONEPRESIDENT<\/p>\n<table cellspacing=\"0\" cellpadding=\"2\" width=\"600\" border=\"0\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"181\">Description:<\/td>\n<td valign=\"top\" width=\"417\">Just one president allowed in the entire table&#8230;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"181\">Violation case:<\/td>\n<td valign=\"top\" width=\"417\">1<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"181\">Constraint validation query:<\/td>\n<td valign=\"top\" width=\"417\">select \u2018At most one PRESIDENT allowed (found \u2018||to_char(num_presidents)||\u2019).\u2019 as msg <br \/>&nbsp; from (select count(*) as num_presidents <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from emp <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; where job=\u2019PRESIDENT\u2019)<br \/>&nbsp; where num_presidents &gt; 1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>I need to create a package which holds a record based on this table: <br \/>TYPE EMP_rt IS RECORD(<br \/>&nbsp;&nbsp;&nbsp; EMPNO EMP.EMPNO%type,<br \/>&nbsp;&nbsp;&nbsp; ENAME EMP.ENAME%type,<br \/>&nbsp;&nbsp;&nbsp; JOB EMP.JOB%type,<br \/>&nbsp;&nbsp;&nbsp; MGR EMP.MGR%type,<br \/>&nbsp;&nbsp;&nbsp; HIREDATE EMP.HIREDATE%type,<br \/>&nbsp;&nbsp;&nbsp; SAL EMP.SAL%type,<br \/>&nbsp;&nbsp;&nbsp; COMM EMP.COMM%type,<br \/>&nbsp;&nbsp;&nbsp; DEPTNO EMP.DEPTNO%type<br \/>&nbsp; );  <\/p>\n<p>And I need to create some procedures to perform the DML for me: <br \/>&nbsp; PROCEDURE ins; <br \/>&nbsp; PROCEDURE upd; <br \/>&nbsp; PROCEDURE del;  <\/p>\n<p>And the implementation of these procedures: <br \/>PROCEDURE ins<br \/>IS<br \/>BEGIN<br \/>&nbsp; &#8212; insert the values in the rec record into the table<br \/>&nbsp; INSERT INTO EMP (<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EMPNO,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENAME,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; JOB,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MGR,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HIREDATE,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SAL,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMM,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DEPTNO<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) VALUES (<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rec.EMPNO,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rec.ENAME,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rec.JOB,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rec.MGR,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rec.HIREDATE,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rec.SAL,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rec.COMM,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rec.DEPTNO<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; );<br \/>END ins;  <\/p>\n<p>PROCEDURE upd<br \/>IS<br \/>BEGIN<br \/>&nbsp; &#8212; update the values in the table with the values in the rec record<br \/>&nbsp; &#8212; based on the primary key<br \/>&nbsp; UPDATE EMP<br \/>&nbsp;&nbsp;&nbsp;&nbsp; SET<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EMPNO = rec.EMPNO,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENAME = rec.ENAME,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; JOB = rec.JOB,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MGR = rec.MGR,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HIREDATE = rec.HIREDATE,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SAL = rec.SAL,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMM = rec.COMM,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DEPTNO = rec.DEPTNO<br \/>&nbsp;&nbsp; WHERE<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EMPNO = rec.EMPNO<br \/>&nbsp;&nbsp; ;<br \/>END upd;  <\/p>\n<p>PROCEDURE del<br \/>IS<br \/>BEGIN<br \/>&nbsp; &#8212; remove a record from the table<br \/>&nbsp; &#8212; based on the primary key<br \/>&nbsp; DELETE FROM EMP<br \/>&nbsp;&nbsp; WHERE<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EMPNO = rec.EMPNO<br \/>&nbsp; ;<br \/>END del;  <\/p>\n<p>Now I can create a couple of tests in <a title=\"Unit Test Community\" href=\"http:\/\/unittest.inside.quest.com\/\" target=\"_blank\">CodeTester<\/a> (click the link to see the pre-execution code to be added in <a title=\"Unit Test Community\" href=\"http:\/\/unittest.inside.quest.com\/\" target=\"_blank\">CodeTester<\/a>):  <\/p>\n<ul>\n<li>ins <!--- ins --->\n<div> <script language=\"javascript\" type=\"text\/javascript\">function showHide(ADiv) {if (document.getElementById) {  divhandle = document.getElementById(ADiv).style;} else { if (document.layers) {  divhandle = document.ADiv;} else {  divhandle = document.all.ADiv.style; }}if (divhandle.display == \"\") { divhandle.display = \"none\";} else { divhandle.display = \"\"; } }<\/script> <a href=\"javascript:showHide('b6e95972-3d56-4341-a655-ed6d4181a90c')\">[One President] Insert that violates the rule<\/a>  <\/p>\n<div id=\"b6e95972-3d56-4341-a655-ed6d4181a90c\" style=\"display: none\">&nbsp; &#8212; Pre-execution code<br \/>&nbsp; &#8212; empty the table<br \/>&nbsp; delete from emp;<br \/>&nbsp; &#8212; insert a president<br \/>&nbsp; insert into emp (empno, ename, job, mgr, hiredate, sal, comm, deptno)<br \/>&nbsp; values (2, \u2018KOPPELAARS\u2019,&#8217;PRESIDENT\u2019,NULL,TO_DATE (\u201901-01-2008\u2032, \u2018MM-DD-YYYY\u2019),<br \/>&nbsp; 5000,NULL,10);<br \/>&nbsp; &#8212; setup a record in the codetester package<br \/>&nbsp; emp_ctp.rec.empno := 1;<br \/>&nbsp; emp_ctp.rec.ename := \u2018BAREL\u2019;<br \/>&nbsp; emp_ctp.rec.job := \u2018PRESIDENT\u2019;<br \/>&nbsp; emp_ctp.rec.mgr := null;<br \/>&nbsp; emp_ctp.rec.hiredate := to_date(\u201901-01-2008\u2032,\u2019MM-DD-YYYY\u2019);<br \/>&nbsp; emp_ctp.rec.sal := 5000;<br \/>&nbsp; emp_ctp.rec.comm := null;<br \/>&nbsp; emp_ctp.rec.deptno := 10;<\/div>\n<\/div>\n<div> <script language=\"javascript\" type=\"text\/javascript\">function showHide(ADiv) {if (document.getElementById) {  divhandle = document.getElementById(ADiv).style;} else { if (document.layers) {  divhandle = document.ADiv;} else {  divhandle = document.all.ADiv.style; }}if (divhandle.display == \"\") { divhandle.display = \"none\";} else { divhandle.display = \"\"; } }<\/script> <a href=\"javascript:showHide('3417ad75-1664-494a-b324-ca91e220f561')\">[One President] Insert that works<\/a>  <\/p>\n<div id=\"3417ad75-1664-494a-b324-ca91e220f561\" style=\"display: none\">&nbsp; &#8212; Pre-execution code<br \/>&nbsp; &#8212; empty the table<br \/>&nbsp; delete from emp;<br \/>&nbsp; &#8212; setup a record in the codetester package<br \/>&nbsp; emp_ctp.rec.empno := 1;<br \/>&nbsp; emp_ctp.rec.ename := \u2018BAREL\u2019;<br \/>&nbsp; emp_ctp.rec.job := \u2018PRESIDENT\u2019;<br \/>&nbsp; emp_ctp.rec.mgr := null;<br \/>&nbsp; emp_ctp.rec.hiredate := to_date(\u201901-01-2008\u2032,\u2019MM-DD-YYYY\u2019);<br \/>&nbsp; emp_ctp.rec.sal := 5000;<br \/>&nbsp; emp_ctp.rec.comm := null;<br \/>&nbsp; emp_ctp.rec.deptno := 10;<\/div>\n<\/div>\n<\/li>\n<li>upd <!--- upd --->\n<div> <script language=\"javascript\" type=\"text\/javascript\">function showHide(ADiv) {if (document.getElementById) {  divhandle = document.getElementById(ADiv).style;} else { if (document.layers) {  divhandle = document.ADiv;} else {  divhandle = document.all.ADiv.style; }}if (divhandle.display == \"\") { divhandle.display = \"none\";} else { divhandle.display = \"\"; } }<\/script> <a href=\"javascript:showHide('36226936-d276-4d65-87e8-a9465df3fb00')\">[One President] Update that fails (promote to president)<\/a>  <\/p>\n<div id=\"36226936-d276-4d65-87e8-a9465df3fb00\" style=\"display: none\">&nbsp; &#8212; Pre-execution code<br \/>&nbsp; &#8212; empty the table<br \/>&nbsp; delete from emp;<br \/>&nbsp; &#8212; insert a president<br \/>&nbsp; insert into emp (empno, ename, job, mgr, hiredate, sal, comm, deptno)<br \/>&nbsp; values (1, \u2018BAREL\u2019,&#8217;MANAGER\u2019,NULL,TO_DATE (\u201901-01-2008\u2032, \u2018MM-DD-YYYY\u2019),<br \/>&nbsp; 5000,NULL,10);<br \/>&nbsp; insert into emp (empno, ename, job, mgr, hiredate, sal, comm, deptno)<br \/>&nbsp; values (2, \u2018KOPPELAARS\u2019,&#8217;PRESIDENT\u2019,NULL,TO_DATE (\u201901-01-2008\u2032, \u2018MM-DD-YYYY\u2019),<br \/>&nbsp; 5000,NULL,10);<br \/>&nbsp; &#8212; setup a record in the codetester package<br \/>&nbsp; emp_ctp.rec.empno := 1;<br \/>&nbsp; emp_ctp.rec.ename := \u2018BAREL\u2019;<br \/>&nbsp; emp_ctp.rec.job := \u2018PRESIDENT\u2019;<br \/>&nbsp; emp_ctp.rec.mgr := null;<br \/>&nbsp; emp_ctp.rec.hiredate := to_date(\u201901-01-2008\u2032,\u2019MM-DD-YYYY\u2019);<br \/>&nbsp; emp_ctp.rec.sal := 5000;<br \/>&nbsp; emp_ctp.rec.comm := null;<br \/>&nbsp; emp_ctp.rec.deptno := 10;<\/div>\n<\/div>\n<div> <script language=\"javascript\" type=\"text\/javascript\">function showHide(ADiv) {if (document.getElementById) {  divhandle = document.getElementById(ADiv).style;} else { if (document.layers) {  divhandle = document.ADiv;} else {  divhandle = document.all.ADiv.style; }}if (divhandle.display == \"\") { divhandle.display = \"none\";} else { divhandle.display = \"\"; } }<\/script> <a href=\"javascript:showHide('c3bf83aa-f661-425d-9eab-4629ad9a7605')\">[One President] Update that works (demote the president)<\/a>  <\/p>\n<div id=\"c3bf83aa-f661-425d-9eab-4629ad9a7605\" style=\"display: none\">&nbsp; &#8212; Pre-execution code<br \/>&nbsp; &#8212; empty the table<br \/>&nbsp; delete from emp;<br \/>&nbsp; &#8212; insert a president<br \/>&nbsp; insert into emp (empno, ename, job, mgr, hiredate, sal, comm, deptno)<br \/>&nbsp; values (1, \u2018BAREL\u2019,&#8217;PRESIDENT\u2019,NULL,TO_DATE (\u201901-01-2008\u2032, \u2018MM-DD-YYYY\u2019),<br \/>&nbsp; 5000,NULL,10);<br \/>&nbsp; insert into emp (empno, ename, job, mgr, hiredate, sal, comm, deptno)<br \/>&nbsp; values (2, \u2018KOPPELAARS\u2019,&#8217;MANAGER\u2019,NULL,TO_DATE (\u201901-01-2008\u2032, \u2018MM-DD-YYYY\u2019),<br \/>&nbsp; 5000,NULL,10);<br \/>&nbsp; &#8212; setup a record in the codetester package<br \/>&nbsp; emp_ctp.rec.empno := 1;<br \/>&nbsp; emp_ctp.rec.ename := \u2018BAREL\u2019;<br \/>&nbsp; emp_ctp.rec.job := \u2018MANAGER\u2019;<br \/>&nbsp; emp_ctp.rec.mgr := null;<br \/>&nbsp; emp_ctp.rec.hiredate := to_date(\u201901-01-2008\u2032,\u2019MM-DD-YYYY\u2019);<br \/>&nbsp; emp_ctp.rec.sal := 5000;<br \/>&nbsp; emp_ctp.rec.comm := null;<br \/>&nbsp; emp_ctp.rec.deptno := 10; <\/div>\n<\/div>\n<div> <script language=\"javascript\" type=\"text\/javascript\">function showHide(ADiv) {if (document.getElementById) {  divhandle = document.getElementById(ADiv).style;} else { if (document.layers) {  divhandle = document.ADiv;} else {  divhandle = document.all.ADiv.style; }}if (divhandle.display == \"\") { divhandle.display = \"none\";} else { divhandle.display = \"\"; } }<\/script> <a href=\"javascript:showHide('92e14008-bcc4-4ce5-9087-25f17ca7ce68')\">[One President] Update that works (promote to president)<\/a>  <\/p>\n<div id=\"92e14008-bcc4-4ce5-9087-25f17ca7ce68\" style=\"display: none\">&nbsp; &#8212; Pre-execution code<br \/>&nbsp; &#8212; empty the table<br \/>&nbsp; delete from emp;<br \/>&nbsp; &#8212; insert a president<br \/>&nbsp; insert into emp (empno, ename, job, mgr, hiredate, sal, comm, deptno)<br \/>&nbsp; values (1, \u2018BAREL\u2019,&#8217;MANAGER\u2019,NULL,TO_DATE (\u201901-01-2008\u2032, \u2018MM-DD-YYYY\u2019),<br \/>&nbsp; 5000,NULL,10);<br \/>&nbsp; insert into emp (empno, ename, job, mgr, hiredate, sal, comm, deptno)<br \/>&nbsp; values (2, \u2018KOPPELAARS\u2019,&#8217;MANAGER\u2019,NULL,TO_DATE (\u201901-01-2008\u2032, \u2018MM-DD-YYYY\u2019),<br \/>&nbsp; 5000,NULL,10);<br \/>&nbsp; &#8212; setup a record in the codetester package<br \/>&nbsp; emp_ctp.rec.empno := 1;<br \/>&nbsp; emp_ctp.rec.ename := \u2018BAREL\u2019;<br \/>&nbsp; emp_ctp.rec.job := \u2018PRESIDENT\u2019;<br \/>&nbsp; emp_ctp.rec.mgr := null;<br \/>&nbsp; emp_ctp.rec.hiredate := to_date(\u201901-01-2008\u2032,\u2019MM-DD-YYYY\u2019);<br \/>&nbsp; emp_ctp.rec.sal := 5000;<br \/>&nbsp; emp_ctp.rec.comm := null;<br \/>&nbsp; emp_ctp.rec.deptno := 10;<\/div>\n<\/div>\n<\/li>\n<li>del <!--- del --->\n<div> <script language=\"javascript\" type=\"text\/javascript\">function showHide(ADiv) {if (document.getElementById) {  divhandle = document.getElementById(ADiv).style;} else { if (document.layers) {  divhandle = document.ADiv;} else {  divhandle = document.all.ADiv.style; }}if (divhandle.display == \"\") { divhandle.display = \"none\";} else { divhandle.display = \"\"; } }<\/script> <a href=\"javascript:showHide('cab16977-e10d-4da7-b9d4-d27468d948f6')\">[One President] Delete that works (remove the manager)<\/a>  <\/p>\n<div id=\"cab16977-e10d-4da7-b9d4-d27468d948f6\" style=\"display: none\">&nbsp; &#8212; Pre-execution code<br \/>&nbsp; &#8212; empty the table<br \/>&nbsp; delete from emp;<br \/>&nbsp; &#8212; insert a president<br \/>&nbsp; insert into emp (empno, ename, job, mgr, hiredate, sal, comm, deptno)<br \/>&nbsp; values (1, \u2018BAREL\u2019,&#8217;PRESIDENT\u2019,NULL,TO_DATE (\u201901-01-2008\u2032, \u2018MM-DD-YYYY\u2019),<br \/>&nbsp; 5000,NULL,10);<br \/>&nbsp; insert into emp (empno, ename, job, mgr, hiredate, sal, comm, deptno)<br \/>&nbsp; values (2, \u2018KOPPELAARS\u2019,&#8217;MANAGER\u2019,NULL,TO_DATE (\u201901-01-2008\u2032, \u2018MM-DD-YYYY\u2019),<br \/>&nbsp; 5000,NULL,10);<br \/>&nbsp; &#8212; setup a record in the codetester package<br \/>&nbsp; emp_ctp.rec.empno := 2;<\/div>\n<\/div>\n<div> <script language=\"javascript\" type=\"text\/javascript\">function showHide(ADiv) {if (document.getElementById) {  divhandle = document.getElementById(ADiv).style;} else { if (document.layers) {  divhandle = document.ADiv;} else {  divhandle = document.all.ADiv.style; }}if (divhandle.display == \"\") { divhandle.display = \"none\";} else { divhandle.display = \"\"; } }<\/script> <a href=\"javascript:showHide('17be7649-4d5e-47a7-aa40-520165554d9c')\">[One President] Delete that works (remove the president)<\/a>  <\/p>\n<div id=\"17be7649-4d5e-47a7-aa40-520165554d9c\" style=\"display: none\">&nbsp; &#8212; Pre-execution code<br \/>&nbsp; &#8212; empty the table<br \/>&nbsp; delete from emp;<br \/>&nbsp; &#8212; insert a president<br \/>&nbsp; insert into emp (empno, ename, job, mgr, hiredate, sal, comm, deptno)<br \/>&nbsp; values (1, \u2018BAREL\u2019,&#8217;PRESIDENT\u2019,NULL,TO_DATE (\u201901-01-2008\u2032, \u2018MM-DD-YYYY\u2019),<br \/>&nbsp; 5000,NULL,10);<br \/>&nbsp; insert into emp (empno, ename, job, mgr, hiredate, sal, comm, deptno)<br \/>&nbsp; values (2, \u2018KOPPELAARS\u2019,&#8217;MANAGER\u2019,NULL,TO_DATE (\u201901-01-2008\u2032, \u2018MM-DD-YYYY\u2019),<br \/>&nbsp; 5000,NULL,10);<br \/>&nbsp; &#8212; setup a record in the codetester package<br \/>&nbsp; emp_ctp.rec.empno := 1;<\/div>\n<\/div>\n<\/li>\n<\/ul>\n<p>Of course I can create the code by hand every time I need it, but I don\u2019t like doing the same thing over and over again. That is where <a title=\"Quest CodeGen Utility Community\" href=\"http:\/\/codegen.inside.quest.com\/index.jspa\" target=\"_blank\">CodeGen<\/a> comes into play. Using this generation tool I can easily create the packages based on the table structure.&nbsp; (the ctp extension in the package name is for Code Tester Package) <\/p>\n<div> <script language=\"javascript\" type=\"text\/javascript\">function showHide(ADiv) {if (document.getElementById) {  divhandle = document.getElementById(ADiv).style;} else { if (document.layers) {  divhandle = document.ADiv;} else {  divhandle = document.all.ADiv.style; }}if (divhandle.display == \"\") { divhandle.display = \"none\";} else { divhandle.display = \"\"; } }<\/script> <a href=\"javascript:showHide('4dc5e0b8-885a-40c2-8c44-3a4c863dd13a')\">script to create the package header:<\/a>  <\/p>\n<div id=\"4dc5e0b8-885a-40c2-8c44-3a4c863dd13a\" style=\"display: none\">CREATE OR REPLACE PACKAGE [objname]_ctp<br \/>IS<br \/>&nbsp; &#8212; Author&nbsp; : [thisuser]<br \/>&nbsp; &#8212; Created : [rightnow]<br \/>&nbsp; &#8212; Purpose : CodeTester Package for [objname]  <\/p>\n<p>&nbsp; &#8212; Public type declarations<br \/>&nbsp; TYPE [objname]_rt IS RECORD(<br \/>[foreach]col[between],<br \/>&nbsp;&nbsp;&nbsp; [colname] [objname].[colname]%type<br \/>[endforeach]<br \/>&nbsp; );  <\/p>\n<p>&nbsp; &#8212; Public variable declarations<br \/>&nbsp; rec&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [objname]_rt;  <\/p>\n<p>&nbsp; &#8212; Public function and procedure declarations<br \/>&nbsp; PROCEDURE ins;  <\/p>\n<p>&nbsp; PROCEDURE upd;  <\/p>\n<p>&nbsp; PROCEDURE del;<br \/>END [objname]_ctp; <\/p>\n<\/div>\n<\/div>\n<div> <script language=\"javascript\" type=\"text\/javascript\">function showHide(ADiv) {if (document.getElementById) {  divhandle = document.getElementById(ADiv).style;} else { if (document.layers) {  divhandle = document.ADiv;} else {  divhandle = document.all.ADiv.style; }}if (divhandle.display == \"\") { divhandle.display = \"none\";} else { divhandle.display = \"\"; } }<\/script> <a href=\"javascript:showHide('b2b6e3f7-a5a1-4a14-b3e8-e7631673fb50')\">script to create the package body:<\/a>  <\/p>\n<div id=\"b2b6e3f7-a5a1-4a14-b3e8-e7631673fb50\" style=\"display: none\">\n<p>CREATE OR REPLACE PACKAGE BODY [objname]_ctp<br \/>IS<br \/>&nbsp; &#8212; Function and procedure implementations<br \/>&nbsp; PROCEDURE initialization<br \/>&nbsp; IS<br \/>&nbsp; BEGIN<br \/>&nbsp;&nbsp;&nbsp; NULL;<br \/>&nbsp; END initialization;  <\/p>\n<p>&nbsp; PROCEDURE ins<br \/>&nbsp; IS<br \/>&nbsp; BEGIN<br \/>&nbsp;&nbsp;&nbsp; &#8212; insert the values in the rec record into the table<br \/>&nbsp;&nbsp;&nbsp; INSERT INTO [objname] (<br \/>[foreach]col[between],<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [colname]<br \/>[endforeach]<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) VALUES (<br \/>[foreach]col[between],<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rec.[colname]<br \/>[endforeach]<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; );<br \/>&nbsp; END ins;<br \/>&nbsp; PROCEDURE upd<br \/>&nbsp; IS<br \/>&nbsp; BEGIN<br \/>&nbsp;&nbsp;&nbsp; &#8212; update the values in the table with the values in the rec record<br \/>&nbsp;&nbsp;&nbsp; &#8212; based on the primary key<br \/>&nbsp;&nbsp;&nbsp; UPDATE [objname]<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SET<br \/>[foreach]col[between],<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [colname] = rec.[colname]<br \/>[endforeach]<br \/>&nbsp;&nbsp;&nbsp;&nbsp; WHERE<br \/>[foreach]pkycol[between],<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [colname] = rec.[colname]<br \/>[endforeach]<br \/>&nbsp;&nbsp;&nbsp;&nbsp; ;<br \/>&nbsp; END upd;<br \/>&nbsp; PROCEDURE del<br \/>&nbsp; IS<br \/>&nbsp; BEGIN<br \/>&nbsp;&nbsp;&nbsp; &#8212; remove a record from the table<br \/>&nbsp;&nbsp;&nbsp; &#8212; based on the primary key<br \/>&nbsp;&nbsp;&nbsp; DELETE FROM [objname]<br \/>&nbsp;&nbsp;&nbsp;&nbsp; WHERE<br \/>[foreach]pkycol[between],<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [colname] = rec.[colname]<br \/>[endforeach]<br \/>&nbsp;&nbsp;&nbsp; ;<br \/>&nbsp; END del;<br \/>BEGIN<br \/>&nbsp; initialization;<br \/>END [objname]_ctp; <\/p>\n<\/div>\n<\/div>\n<p>The full (generated) source code for the package is:  <\/p>\n<div> <script language=\"javascript\" type=\"text\/javascript\">function showHide(ADiv) {if (document.getElementById) {  divhandle = document.getElementById(ADiv).style;} else { if (document.layers) {  divhandle = document.ADiv;} else {  divhandle = document.all.ADiv.style; }}if (divhandle.display == \"\") { divhandle.display = \"none\";} else { divhandle.display = \"\"; } }<\/script> <a href=\"javascript:showHide('24eaef82-1f85-447b-b66c-d50995a5e2f5')\">Header:<\/a>  <\/p>\n<div id=\"24eaef82-1f85-447b-b66c-d50995a5e2f5\" style=\"display: none\">\n<p>CREATE OR REPLACE PACKAGE EMP_ctp<br \/>IS<br \/>&nbsp; &#8212; Author&nbsp; : DEMO<br \/>&nbsp; &#8212; Created : May 31, 2008 9:18:50<br \/>&nbsp; &#8212; Purpose : CodeTester Package for EMP  <\/p>\n<p>&nbsp; &#8212; Public type declarations<br \/>&nbsp; TYPE EMP_rt IS RECORD(<br \/>&nbsp;&nbsp;&nbsp; EMPNO EMP.EMPNO%type,<br \/>&nbsp;&nbsp;&nbsp; ENAME EMP.ENAME%type,<br \/>&nbsp;&nbsp;&nbsp; JOB EMP.JOB%type,<br \/>&nbsp;&nbsp;&nbsp; MGR EMP.MGR%type,<br \/>&nbsp;&nbsp;&nbsp; HIREDATE EMP.HIREDATE%type,<br \/>&nbsp;&nbsp;&nbsp; SAL EMP.SAL%type,<br \/>&nbsp;&nbsp;&nbsp; COMM EMP.COMM%type,<br \/>&nbsp;&nbsp;&nbsp; DEPTNO EMP.DEPTNO%type<br \/>&nbsp; );  <\/p>\n<p>&nbsp; &#8212; Public variable declarations<br \/>&nbsp; rec&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EMP_rt;  <\/p>\n<p>&nbsp; &#8212; Public function and procedure declarations<br \/>&nbsp; PROCEDURE ins;  <\/p>\n<p>&nbsp; PROCEDURE upd;  <\/p>\n<p>&nbsp; PROCEDURE del;<br \/>END EMP_ctp; <\/p>\n<\/div>\n<\/div>\n<div> <script language=\"javascript\" type=\"text\/javascript\">function showHide(ADiv) {if (document.getElementById) {  divhandle = document.getElementById(ADiv).style;} else { if (document.layers) {  divhandle = document.ADiv;} else {  divhandle = document.all.ADiv.style; }}if (divhandle.display == \"\") { divhandle.display = \"none\";} else { divhandle.display = \"\"; } }<\/script> <a href=\"javascript:showHide('76094732-7513-4dbf-b06c-d51ae0ed7ca5')\">Body:<\/a>  <\/p>\n<div id=\"76094732-7513-4dbf-b06c-d51ae0ed7ca5\" style=\"display: none\">\n<p>CREATE OR REPLACE PACKAGE BODY EMP_ctp<br \/>IS<br \/>&nbsp; &#8212; Function and procedure implementations<br \/>&nbsp; PROCEDURE initialization<br \/>&nbsp; IS<br \/>&nbsp; BEGIN<br \/>&nbsp;&nbsp;&nbsp; NULL;<br \/>&nbsp; END initialization;  <\/p>\n<p>&nbsp; PROCEDURE ins<br \/>&nbsp; IS<br \/>&nbsp; BEGIN<br \/>&nbsp;&nbsp;&nbsp; &#8212; insert the values in the rec record into the table<br \/>&nbsp;&nbsp;&nbsp; INSERT INTO EMP (<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EMPNO,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENAME,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; JOB,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MGR,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HIREDATE,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SAL,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMM,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DEPTNO<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) VALUES (<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rec.EMPNO,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rec.ENAME,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rec.JOB,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rec.MGR,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rec.HIREDATE,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rec.SAL,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rec.COMM,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rec.DEPTNO<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; );<br \/>&nbsp; END ins;  <\/p>\n<p>&nbsp; PROCEDURE upd<br \/>&nbsp; IS<br \/>&nbsp; BEGIN<br \/>&nbsp;&nbsp;&nbsp; &#8212; update the values in the table with the values in the rec record<br \/>&nbsp;&nbsp;&nbsp; &#8212; based on the primary key<br \/>&nbsp;&nbsp;&nbsp; UPDATE EMP<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SET<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EMPNO = rec.EMPNO,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENAME = rec.ENAME,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; JOB = rec.JOB,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MGR = rec.MGR,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HIREDATE = rec.HIREDATE,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SAL = rec.SAL,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMM = rec.COMM,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DEPTNO = rec.DEPTNO<br \/>&nbsp;&nbsp;&nbsp;&nbsp; WHERE<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EMPNO = rec.EMPNO<br \/>&nbsp;&nbsp;&nbsp;&nbsp; ;<br \/>&nbsp; END upd;  <\/p>\n<p>&nbsp; PROCEDURE del<br \/>&nbsp; IS<br \/>&nbsp; BEGIN<br \/>&nbsp;&nbsp;&nbsp; &#8212; remove a record from the table<br \/>&nbsp;&nbsp;&nbsp; &#8212; based on the primary key<br \/>&nbsp;&nbsp;&nbsp; DELETE FROM EMP<br \/>&nbsp;&nbsp;&nbsp;&nbsp; WHERE<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EMPNO = rec.EMPNO<br \/>&nbsp;&nbsp;&nbsp; ;<br \/>&nbsp; END del;<br \/>BEGIN<br \/>&nbsp; initialization;<br \/>END EMP_ctp; <\/p>\n<\/div>\n<\/div>\n<p>After running the tests I get this result:<\/p>\n<p><a href=\"http:\/\/bar-solutions.com\/wordpress\/wp-content\/code-tester-results1.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px\" height=\"176\" alt=\"Code Tester Results\" src=\"http:\/\/bar-solutions.com\/wordpress\/wp-content\/code-tester-results-thumb1.png\" width=\"244\" border=\"0\"\/><\/a> <\/p>\n<p>This means that <a title=\"RuleGen.com\" href=\"http:\/\/www.rulegen.com\" target=\"_blank\">RuleGen<\/a> rules can be tested using <a title=\"Unit Test Community\" href=\"http:\/\/unittest.inside.quest.com\/\" target=\"_blank\">CodeTester<\/a> to run the tests and <a title=\"Quest CodeGen Utility Community\" href=\"http:\/\/codegen.inside.quest.com\/index.jspa\" target=\"_blank\">CodeGen<\/a> to create a simple package around the table being tested. It will take some time to build all your business rules into the database, but like Toon says: That&#8217;s where they are supposed to be. It&#8217;s probably the only constant factor in a system. And, if you build the rules at table level, then it doesn&#8217;t matter what front-end you build against it and what tool you are using for this.It will also take some time to build all the test cases, but at least the will be repeatable. Please note that all other rules must be valid to get a correct result. Try to test only one rule at a time. If you add a rule to the RuleGen repository, it is possible that you have to change some of your existing test cases to reflect this change.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When I was confronted with the possibilities of Rulegen it made me wonder: How can these rules be tested. I have some experience using CodeTester but as the name says, it\u2019s a code tester where rulegen builds rules in the database that can actually only be tested using SQL statements (insert, update, delete).<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,13,2,5,4],"tags":[],"class_list":["post-244","post","type-post","status-publish","format-standard","hentry","category-codegen","category-codetester","category-oracle","category-plsql","category-tools"],"_links":{"self":[{"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/posts\/244","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=244"}],"version-history":[{"count":0,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/posts\/244\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=244"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=244"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=244"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}