Oracle by Example brandingLogic Extension Assertions

section 0Before You Begin

This 20-minute OBE (Oracle By Example) shows you how to use the Logic Extension Assertions feature.

In this OBE, you will:

  • Create a logic extension to calculate simple mathematical statements using the If Else and assignment statements.
  • Test the logic extension and then save the test cases with different inputs and outputs.
  • Change the assignment statement to simulate an unexpected change and test the logic extension again using the saved test case.

Background

Logic extensions are a key component of the JD Edwards extensibility framework. They enable nontechnical business analysts as well as JD Edwards developers to use the familiar syntax of EnterpriseOne event rules to create logic without the need for a development client and without the need to build and deploy a package. Logic extensions provide a no-code way to manipulate numerical, date, and string data. Logic extensions can also read and write data to EnterpriseOne tables.

You can validate a logic extension by saving a set of inputs and a set of outputs using the built-in framework provided by the JD Edwards Orchestrator Studio. You can save multiple test cases and run them individually or as a set. This feature enables you to test and revalidate the logic whenever something changes, for example, after applying a software update.

What Do You Need?

To perform the steps in this OBE, you will need:

  • Access to a JD Edwards EnterpriseOne environment with Tools Release 9.2.7.4 or later. JD Edwards EnterpriseOne Trial Edition running on Oracle Cloud Infrastructure is suitable, but you can use any environment with the proper Tools release.
  • Security access to use Orchestrator Studio.

section 1Creating a Logic Extension

  1. Sign in to the Orchestrator Studio.
  2. Click Logic Extensions.
  3. Click the New button.
  4. In the Name field, enter Logic Extension Assertions.
  5. In the Description field, enter Demo to test the logic extension assertions feature.
  6. To add a data dictionary item, click the +Data Dictionary button. The Data Dictionary window is displayed.
  7. In the Alias field, enter MATH01 and click the + button.
  8. Change the name of the new data dictionary item to Input Number.
  9. Click +Data Dictionary.
  10. In the Data Dictionary window, enter MATH01 in the Alias field and click the + button.
  11. Change the name of the data dictionary item to Output Number.
  12. From the IO Type drop-down list, select Output Only.
  13. Logic
                      Extension- Data Structure Tab
    Logic Extension- Data Structure Tab
  14. Click Save. The system displays the Logic tab.
  15. In the design panel, hover over the line between the Start and the End node and click the + icon.
  16. From the context menu, select If Else. The system displays an If Else statement along with the branch labels in the design panel and an If Else panel on the right.

    Note: You can also drag and drop the If Else option from the Statements tab to the + icon between the Start and End node in the design panel.
  17. In the If Branch section, in the Branch Label field, enter Input = 1.
  18. Click the Launch Criteria Builder icon.
  19. In the Criteria Builder window, you can see that the Pencil icon is highlighted in the Left Operand column. Create this statement by selecting the values from the right panel: Input Number = 1.
  20. Criteria
                      Builder Window
    Criteria Builder Window
  21. Click Close.
  22. Logic
                      Extension - If Else Branch
    Logic Extension - If Else Branch
  23. In the design panel, hover over the line after the Input = 1 label and click the + icon.
  24. If Branch
                      Criteria: Input Number = 1
    If Branch Criteria: Input Number = 1
  25. From the context menu, select Assignment. The Assignment panel is displayed on the right.
  26. In the Label field, enter 1 + 1 = 2.
  27. Click the Launch Assignment Mapping Wizard icon.
  28. In the Assignment Builder window, you can see that the Pencil icon is highlighted in the Target column. Create this statement by selecting the values from the right panel: Output Number <- Input Number + Input Number.
  29. Assignment
                      Builder Window
    Assignment Builder Window
  30. Click Close.
  31. Assignment
                      Block
    Assignment Block
  32. Hover between the Input=1 and Else label, and click the + icon to insert an Else If Branch.
  33. Insert Else
                      If Branch
    Insert Else If Branch
  34. In the Else If Branch section, in the Branch Label field field, enter Input = 2, and click the Launch Criteria Builder icon.
  35. Else If
                      Branch: Launch Criteria Builder icon
    Else If Branch: Launch Criteria Builder icon.
  36. In the Criteria Builder window, you can see that the Pencil icon is highlighted in the Left Operand column. Create this statement by selecting the values from the right panel: Input Number = 2.
  37. Criteria
                      Builder Window
    Criteria Builder Window
  38. Click Close.
  39. Hover over the line after the Input = 2 label, click the + icon.
  40. From the context menu, select Assignment.
    The Assignment Block side panel is displayed on the right.
  41. In the Label field, enter 2 x 2 = 4.
  42. Click the Launch Assignment Mapping Wizard icon.
  43. In the Assignment Builder window, you can see that the Pencil icon is highlighted in the Target column.
    Create this statement by selecting the values from the right panel:
    Output Number <- Input Number x Input Number.
  44. Assignment
                      Builder Window
    Assignment Builder Window
  45. Click Close.
  46. Logic
                      Extension Assertions
    Logic Extension Assertions
  47. Click Save.

section 2Testing the Logic Extension Using Assertions

  1. Click the Test tab.
  2. In the Input field for Input Number, enter 1.
  3. Click Test. The system processes the Output Number->Input Number + Input Number (2=1+1) assignment statement and displays the test result in the Output field correctly as 2.
  4. Logic
                      Extension Assertions Test Tab
    Logic Extension Assertions Test Tab
  5. To save this test case with the current input and output, click Save As. The system displays the Save As window.
  6. In the Name field, enter Case Input=1 and click OK.
  7. Test Case
                      Selection: Case Input =1
    Test Case Selection: Case Input =1
  8. Change the value in the input field from 1 to 2.
  9. Click Test.
    The system processes the Output Number->Input Number X Input Number (4=2X2) assignment statement and displays the test result in the Output field correctly as 4.
    The status is displayed as Failed since the expected Output is 2 from the previous test.
  10. Logic
                      Extension Assertions: Test Tab
    Logic Extension Assertions: Test Tab
  11. To save this test case with the new input and output, click Save As. The system displays the Save As window.
  12. In the Name field, enter Case Input=2 and click OK.
  13. Test Case
                      Selection: Case Input =2
    Test Case Selection: Case Input =2
    Now, we have saved two test cases with this logic extension representing two inputs and two expected outputs.
    To understand how the assertion feature works when something changes in the logic extension, we will simulate some change by changing the logic extension assignment statement in the next steps.

  14. Click the Logic tab.
  15. Click the 2 x 2 = 4 assignment statement.
  16. In the Assignment Block side panel, click the Launch Assignment Mapping Wizard icon.
    The Assignment Builder window is displayed.
  17. Click the value in the Source field, and from the right-side panel, click -.
  18. DAssignment
                      Builder Window
    Assignment Builder Window
  19. Verify that the assignment statement is displayed  as Output Number <- Input Number - Input Number.
  20. Assignment
                      Builder Window
    Assignment Builder Window
  21. Click Close.
  22. Click the Test tab.
  23. From the Test Case Selection drop-down list, select Case Input=2.
  24. Click Test.

    The Case Input=2 test case fails because the expected output value for the assertion test case is 4, but the actual output is 0.

    Note: You can run assertion cases in a batch by clicking Run all tests in this object from the Menu drop-down list. The system displays the Test Report window where you can verify the progress and status of the assertion cases. To download the assertion report in CSV format, click Create Report.

  25. Logic
                      Extension Assertions: Test Tab
    Logic Extension Assertions: Test Tab
    In this exercise, we simulated an unexpected change by changing the assignment statement. There might be other changes, such as changes in the inputs to the logic extension from external systems, table input/output values, and so on. Any change that creates an output value other than what the assertion case is expecting will cause the assertion to fail.

more informationWant to Learn More?