Tutorial‎ > ‎

Explore BusLogicIntro

BusLogicIntro the core database for training and documentation.  It is described in the Tutorial.  This describes how to explore it by running the Use Cases described in the Tutorial.


Setup

If you have completed the Download process, you will have
This includes the database, the logic, the jUnit tests, and LogicDoc scripts (there is no User Interface Application)
Locate the BusLogicIntro/build/runAllTests_x.xml file (where x is either hsql or MySQL -- you'll want to use hsql at first), and select Run As > Ant Build.  The console should report that all tests run.

You can examine the generated logs under the logs folder, an important debugging tool that shows all the rules that were executed. 


jUnit tests for each Use Case

The Tutorial uses a case study approach to enable you to learn how to utilize Business Logic.  There is a jUnit test for each Use Case (example).  So, in addition to viewing the logic, you can run the test - set breakpoints, examine the log, and so forth.  The sections below explain how to run a specific test, and how to correlate the Use Cases to jUnit tests.

Operations

Run Specific Test
You can run any of the tests individually as jUnit tests (Eclipse screen shot below, where we are about the run the Payment_save_test: Add Payment - allocate to orders), in which case the log is directed to the console:


In most cases, you will need to reload test data prior to running a test.  To do so, locate the BusLogicIntro/build/runAllTests.xml file (open in the editor window above), and open it.  Use the Outline view, select loadData, right click and Run As > Ant Build
  • Reload data - required for most tests

  • Run test - locate the test as shown below, and right-click to Debug As > jUnit test
This is a particularly effective way to test your business logic, since it provides convenient Console Log output, works well with the debugger (and, where possible, Hot Method Replace), and requires no deploy time.

Review Log, Sample Application, Debugger

The Tutorial described BusLogicIntro - its structure, a Case Study of its Use Cases, Requirements and Logic. It is an integral part of training, and required reading for business logic developers.

As part of your Verification, follow the Run Specific Test procedure above, and review the log - further described here.  You might also want to try the debugger with Business Logic (e.g., set some breakpoints, and examine variables).

Logicdoc for Bus Logic Intro

The BusLogicIntro/build/LogicDoc.xml ant script is provided to run Logicdoc.  After setup verification (described below), you can run it as shown in LogicDoc Installation

Locating Tests

The table below lists the Use Cases, and the corresponding jUnit test.  They are in packages under test/buslogicintrotest.

 Use Case jUnit Test

 Check Credit Purchaseorder_save_test.groovy

 No Empty Orders Purchaseorder_save_noEmptyOrder_test.groovy

 Document Processing LineitemUsage_save_test.groovy

 Make Order Ready Purchaseorder_update_makeReady_test.groovy

 Add Payment Payment_save_test

 Bill of Materials Price Rollup Product_save_computeKitPrice_test.groovy

 Bill of Materials Kit Explosion Purchaseorder_save_ExplodeBillOfMaterials_test.groovy

 Budget Rollup Department_save_budgetRollup_test.groovy

 Audit Salary Changes Employee_update_auditSalary_test.groovy

 Deep Copy Purchaseorder and Items Purchaseorder_clone_test.groovy



Comments