Cost Engine/Case I
- 1 Testing Goals
- 2 Setting Up
- 3 Testing Tool
- 4 Input Parameters
- 5 Output Format
- 6 Testing Steps
- 7 Results
- 8 Issues
- 9 How To Use
- 10 Reported Test Cases
- Test Generate Cost Transaction to produce Cost Details from past transaction records.
- Test Purchases, Material Receipts, Credit Sales (with Shipments), Reversal of Receipts, View Sales Shipments, Movements, Physical Inventory and Internal Use.
- Test Transactions under Average Invoice for Material Cost Element.
- Test generating of Transaction Valuation Report and Inventory Valuation Report saved in PDF format.
- Test comparison with Standard Cost on same Test Data as control. (TODO).
- Using ExpDat.dmp from LiberoCE.jar which is a fresh 360LTS DB upgraded from Libero Cost Engine code and DB changes.
- Then run the Fitnesse Costing Engine suite:
- Standard Cost is deactivated and Transaction Update is executed on Oak item.
- Transactions carried out according to CostEngineTestStory shown below.
- A Transaction Valuation Report and a InventoryValuation Report are produced.
- You can download the ExpDat.dmp, Libero jars, and Fitnesse suite at the Download section.
- All source and documentation are committed under SVN/branches/FitnesseSlim
- FitnesseSlim framework is used to take input parameters or data for testing the Cost Engine.
- As each Testing Step row below is executed, the respective Cost Detail output is asserted green when repeated as true.
- This can then be repeated after every change of code or function in the Cost Engine.
- The full test takes about 42 secs to excute on a 2Mb RAM MacBook Pro running on Java6 and PostgreSQL 8.
User Setup Data
- Product: Oak
- Vendor: SeedFarm
- CostType: Average Costing
- Starting Date: Jan 1, 2010
(You can see the setup data screen here)
- Days from Today: Added to Starting Date
- Qty: Quantity in transaction
- Price: Purchase or Sales Price
- Transaction Type:
- Purchase/Receipt - Purchase Order and Material Receipt of the same order
- Credit Sales - Sales Order which results in immediate Shipment
- Invoice Receipt - Invoice Vendor of a previous Material Receipt
- View Shipment - Access of a previous Sales Shipment record
- Reverse Receipt - Reverse-Correct of a previous Material Receipt
- Movement - creation of an Inventory Movement
- Physical Inventory - creation of a Physical Inventory with Book Qty taken from the last Cost Detail's Accumulated Qty
- Internal Use - taking from inventory for internal use, minus qty is the qty taken
- Ref: Reference count of previous transactions passed to present transaction
- Initiate Transaction - Assert of Transaction success.
From MCost table
- Current Cost Price
- Cumulative Qty
- Cumulative Amt
From CostDetail table
- Cost Detail Amt
- CD Adjust
- CD Qty
- CD Current Cost
- CD Cumulative Qty
- CD Cumulative Amt
(see Fig. 4)
- Purchase of 10 Oaks at $36 each and Material Receipt all of them
- Credit Sales of 5 Oaks at $45
- Purchase of 10 Oaks at $34 each and Material Receipt all of them
- Credit Sales of 5 Oaks at $45
- Invoice Vendor issued on the first receipt of 10 Oaks at $38 each
- View Shipment of first Sales Order
- Reverse the first Material Receipt
- View the Reversal Record
- Purchase of 10 Oaks at $37 each and Material Receipt all of them
- Movement of 5 Oaks from HQ to Store
- Physical Inventory count of 20 Oaks and book qty from Movement Cost.accumulatedQty
- Internal Use of 5 Oaks
(please see Fig. 1,2,3)
- Movement is not giving right figures and affects Physical Inventory's Cost Details. (reviewing with Victor)
- Resolved by Victor's subsequent patch.
How To Use
- Is there an easier way? Yes, over here. You get all the files in one go and follow the README.txt inside it.
- LiberoCE_Jars.zip containing Libero CE upgrade
- ExpDat.dmp upgraded with LiberoCE scripts
- Fixture Classes in fitnesseCE.jar.
- Story Test text in AverageInvoiceCostTestData.txt or take the whole folder here. (Unzip the folder into your FitnesseRoot)
Setup Cost Engine in ADempiere
- You should have your own working ADempiere instance setup in a server.
- Take the LiberoCE.jars, unzip into ADempiereHome/lib folder
- Take the ExpDatCE.jar, unzip into ADempiereHome/data folder
Setup Fitnesse Server
- Refer to FitnesseSlim till the step of java -jar fitnesse.jar -p 8080.
- Get your browser to point to http://localhost:8080/CostEngine
- Edit wiki and put the contents of AverageInvoiceCostTestData.txt in.
- Save it.
- Note the paths as shown on the right here. Edit them to point to your instance.
- Save, and click on Test.
- Replace the blank columns in each row with the same figures or corrected figures and the test will compare and colour the values with green if true and red if false.
Reported Test Cases
The following are test cases submitted in SourceForge forums as referenced in Cost Engine/Testing. If you have more test cases you think are significant and needed please post in SourceForge and add to the wiki reference. - Redhuan D. Oon
Yogan Naidoo's Case
- There is a simple case that Yogan Naidoo posted and asserted that the final cost was wrong in the old engine. See end of this thread.
- I try to replicate in the Test here by creating a new product 'Apple' with zero pricelists (script to create Apple and set Post Immediate Accounting).
- Then i feed the following Story Test text (text for this and accounting consequence test):
!|Costing Transaction for | |Item|Days from today|Qty|Price|Transaction Type|Ref|Initiate Transaction?|Current Cost Price?|Cumulative Qty?|Cumulative Amt?|Cost Detail Amt?|CD Adjust?|CD Qty?|CD Current Cost?|CD Cumulative Qty?|CD Cumulative Amt?|Get Account?| |1 |0 |10 |40 |Purchase/Receipt |0 |true |40.0000 |10 |400 |400.0000 |0 |10 |0 |0 |0 |true| |2 |1 |30 |20 |Purchase/Receipt |0 |true |25.0000 |40 |1000 |750.0000 |0 |30 |40.0000 |10 |400 |true| |3 |2 |5 |80 |Credit Sales |0 |true |25.0000 |35 |875.0000 |125.0000 |0 |-5 |25.0000 |40 |1000 |true| |4 |0 |0 |0 |Reverse Receipt |1 |true |20.0000 |25 |500.0000 |400.0000 |0 |10 |0 |0 |0 |true|
- The output here gives a correct result confirmed back by Yogan.
- To achieve this, you have to Login as SystemAdmin and manually setup CLIENT_ACCOUNTING as I - Immediate.
- Fitnesse can also obtain black box information for Accounting Consequence during the transactions.
- They are placed in an array and produced at the end of the test.
- Above is the sample output based on the above Yogan Naidoo's case.
- Below is the accounting consequence of the complete CASE I test.