[Appsunit-develop] [cvscommit] web/htdocs/testguide AppsUnit Test Guide.html, 1.3, 1.4
Status: Beta
Brought to you by:
jancumps
|
From: Jan C. <jan...@us...> - 2006-09-22 16:21:50
|
Update of /cvsroot/appsunit/web/htdocs/testguide In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv7657/web/htdocs/testguide Modified Files: AppsUnit Test Guide.html Log Message: Adding section on stored function testing. Index: AppsUnit Test Guide.html =================================================================== RCS file: /cvsroot/appsunit/web/htdocs/testguide/AppsUnit Test Guide.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AppsUnit Test Guide.html 18 Sep 2006 23:00:53 -0000 1.3 --- AppsUnit Test Guide.html 22 Sep 2006 16:21:47 -0000 1.4 *************** *** 4,10 **** --- 4,14 ---- + + <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> + + <title>AppsUnit Test Guide</title> *************** *** 15,35 **** --- 19,47 ---- + <h1 class="western">AppsUnit</h1> + <table class="" style="text-align: left; width: 712px; height: 132px;" border="1" cellpadding="2" cellspacing="2"> + <tbody> + <tr> + <td> + <div>This project is just starting (08-SEP-2006).</div> + + <div>The aim is to create a toolkit that will support unit *************** *** 38,41 **** --- 50,55 ---- + + <div>There's no need to install anything on the Apps *************** *** 43,60 **** --- 57,81 ---- + + <div><br> + Please refer to the <a href="http://sourceforge.net/projects/appsunit">project home on SourceForge.net</a> for more info.</div> + </td> + </tr> + + </tbody> *************** *** 62,74 **** --- 83,99 ---- + <p style="margin-bottom: 0cm;">Oracle ® e-business suite bespoke test toolkit</p> + <h1 class="western">Test Guide</h1> + <h2 class="western">Foreword</h2> + <p>Although automation of functional test for ERP software is becoming common practice, unit testing and test driven development *************** *** 76,113 **** --- 101,152 ---- + This project wants to promote unit testing, and test driven development, in the ERP community. We will do this by</p> + <ul> + <li> + <p>showing that it can be done,</p> + </li> + <li> + <p>providing usefull tools to facilitate testing.</p> + </li> + </ul> + <p>This document describes how you can test your code.</p> + <p>This is an open source project, independent from Oracle Corporation.</p> + <p>"Oracle, JD Edwards, PeopleSoft, and Siebel are registered trademarks of Oracle Corporation and/or its affiliates."</p> + <h2 class="western">Testing views</h2> + <p>When creating database views, the most common failures are missing *************** *** 115,118 **** --- 154,158 ---- + <p>A wrong record count is mostly caused by incorrect joins. If you *************** *** 123,130 **** --- 163,172 ---- + <p>You can avoid these mismatches by asserting that your view contains the correct number of records.<br> + Most of the time there is one table in the view that is the driving table. It's the core table *************** *** 133,136 **** --- 175,179 ---- + <p>When creating a view for order lines with additional item and customer info, the driver could be oe_order_lines_all. It's the *************** *** 141,156 **** --- 184,205 ---- + <table border="1" bordercolor="#000000" cellpadding="4" cellspacing="0" width="100%"> + <col width="256*"> <thead> <tr> + <td valign="top" width="100%"> + <p><u>How to test for missing or extra records in a view?</u></p> + + <p>Find the table that is the core of your view (the driving *************** *** 158,165 **** --- 207,217 ---- + Assert that the record count of the driving table matches the record count of your view.</p> + + <p><font face="Courier New, monospace">simpleCompare( *************** *** 167,215 **** --- 219,282 ---- + “select count(*) from xx_order_lines_view”);</font></p> + </td> + </tr> + </thead> </table> + <p><br> + <br> + </p> + <p>You can create this test at the very begin of your view design phase. Then start by creating your basic view:</p> + <p><font face="Courier New, monospace">create view xx_order_lines_view as <br> + select<br> + line_id <br> + from<br> + oe_order_lines_all<br> + with read only;</font></p> + <p>The tests will pass. You can now safely add extra fields and tables to the view. Run the tests again. If you forget an outer join, *************** *** 217,220 **** --- 284,288 ---- + <p>Validating the correctness of a field value in your view is straightforward. You write a quey that asserts wether your view *************** *** 222,225 **** --- 290,294 ---- + <p>If you want to validate the value for the customer, you could locate an example order line in your application and write down the *************** *** 228,231 **** --- 297,301 ---- + <p><font face="Courier New, monospace">select count(*) from *************** *** 233,261 **** --- 303,342 ---- + line_id = 25845<br> + and customer_name = 'SOURCEFORGE';</font></p> + <table border="1" bordercolor="#000000" cellpadding="4" cellspacing="0" width="100%"> + <col width="256*"> <thead> <tr> + <td valign="top" width="100%"> + <p><u>How to test for correct field values in a view?</u></p> + + <p>Locate an example that has a known value for the field.<br> + Assert that the view returns this expected value.</p> + + <p><font face="Courier New, monospace">simpleCompare( *************** *** 263,292 **** --- 344,382 ---- + “select count(*) from xx_order_lines_view where line_id = 23548<br> + and item_description = 'Feature Request'”);</font></p> + </td> + </tr> + </thead> </table> + <p><br> + <br> + </p> + <p>Add regression tests during the lifecycle of your view. Whenever *************** *** 295,298 **** --- 385,389 ---- + <p style="font-style: normal;">If the error report says that your view *************** *** 301,315 **** --- 392,410 ---- + <p style="font-style: normal;"><font face="Courier New, monospace">select count(*) from xx_order_lines_view where<br> + line_id = 12487 <br> + and closed_status = 'Y';</font></p> + <p>The test will pass when your bug is resolved. And because you add *************** *** 318,332 **** --- 413,433 ---- + <table border="1" bordercolor="#000000" cellpadding="4" cellspacing="0" width="100%"> + <col width="256*"> <thead> <tr> + <td valign="top" width="100%"> + <p><u>How to avoid regression?</u></p> + + <p>Create a regression test for each bug or error reported *************** *** 334,340 **** --- 435,444 ---- + Add the test to your test suite.</p> + + <p><font face="Courier New, monospace">simpleCompare( *************** *** 342,396 **** “select count(*) from xx_order_lines_view where line_id = 48574<br> and payment_date < order_date”);</font></p> </td> </tr> </thead> </table> <p><br> <br> </p> <h2 class="western">Testing functions</h2> ! <p>To be written</p> <h2 class="western">Testing concurrent requests</h2> <p>To be written</p> <br> Sister project: <a href="http://junitpdfreport.sourceforge.net" target="_blank">JUnit PDF Report</a> <br> <br> <br> <a href="http://sourceforge.net"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=176804&type=1" alt="SourceForge.net Logo" border="0" height="31" width="88"></a> </body> --- 446,562 ---- + “select count(*) from xx_order_lines_view where line_id = 48574<br> + and payment_date < order_date”);</font></p> + </td> + </tr> + </thead> </table> + <p><br> + <br> + </p> + <h2 class="western">Testing functions</h2> + <p>The smartest way to test a database function is to write a query + that validates if the function returns expected results.</p> ! <p>If you have a function that converts amounts from one currency to ! another, you can assert this as follows:</p> ! ! <p style="font-style: normal;"><font face="Courier New, monospace">select ! count(*) from dual where<br> ! xx_currency_spot_convert(<br> ! ! 1200, 'USD', 'EUR', '01-JAN-2001') = 1193;</font></p> ! ! <p>The test will pass when the function returns the correct value ! for these parameters,</p> ! ! <table border="1" bordercolor="#000000" cellpadding="4" cellspacing="0" width="100%"> ! ! <col width="256*"> ! <thead> ! <tr> ! ! <td valign="top" width="100%"> ! ! <p><u>How to test a stored function?</u></p> ! ! ! <p>Locate an example that has a known return value for a given ! set of parameters.<br> ! Assert that the function returns this ! expected value.</p> ! ! ! <p><font face="Courier New, monospace">simpleCompare( “select 1 ! from dual”,<br> ! “select count(*) from dual where <br> ! ! <span style="font-style: normal;">xx_currency_spot_convert(<br> ! ! 821.256, 'USD', 'USD', '19-JAN-2003') = 821.256</span>”)</font></p> + </td> + + </tr> + + </thead> + </table> + <p><br> + <br> + + </p> <h2 class="western">Testing concurrent requests</h2> + <p>To be written</p> + <br> + Sister project: <a href="http://junitpdfreport.sourceforge.net" target="_blank">JUnit PDF Report</a> <br> + <br> + <br> + <a href="http://sourceforge.net"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=176804&type=1" alt="SourceForge.net Logo" border="0" height="31" width="88"></a> </body> |