< Previous | Next >

Task 1: Selecting a constructor

You select the constructor that you want to use for the tests.

About this task

The Scenarios sheet of the Excel scenario file template contains both required and optional columns, which are defined by the ruleset input parameters. The BOM classes that make up the input parameters have constructors whose arguments correspond to the required columns in the Scenarios sheet. When there are several constructors for the same class, you must select the constructor that generates the correct columns.

In this task, you select a new constructor for the Borrower class that includes the same arguments as the original constructor, but with an additional creditScore argument.

Important:

If you have already imported the loanvalidation-xom and loanvalidation-rules project into your workspace, delete them or use a new workspace.

Procedure

  1. Import the start project:

    You must validate the project and configure the BOM to generate the Excel scenario file template.

    1. Open the Samples Console in the en_US (American English) locale (see Running samples from the Samples Console).
    2. In the Samples and Tutorials view, navigate to Rule Designer > Tutorials > Configuring the BOM for Excel testing > start, and then click Import projects.

      The imported projects are displayed in the Rule Explorer:

      • The Java™ project loanvalidation-xom defines an execution object model (XOM).
      • The rule project loanvalidation-rules defines the business object model (BOM).
  2. Validate the project:

    You can now select the constructor that will be used to create the required columns in the Excel scenario file template.

    1. In the Rule Explorer, right-click the loanvalidation-rules project, and then click Decision Validation Services > Check Project.

      The DVS Project Validation view opens and reports that you have not identified the DVS Constructor.

    2. Double-click the error displayed in the DVS Project Validation view.

      The Borrower class opens in the BOM editor.

  3. Select the constructor to use for the testing:
    1. In the Members area of the Class tab, double-click the Borrower (String, String, Date, String, int) constructor.
    2. In the General Information area, select the DVS constructor check box.
    3. Save your changes.

      To check that you have selected the right constructor, you generate the Excel scenario file template and make sure that the correct columns appear in the Scenarios sheet.

  4. Generate the Excel scenario file template:
    1. In the Rule Explorer, right-click the loanvalidation-rules project, and then click Decision Validation Services > Generate Excel Scenario File Template.

      The Generate Excel Scenario File Template wizard opens.

    2. Make sure that the selected rule project is loanvalidation-rules, and then click Next.
    3. Make sure that the selected decision operation is loanvalidation-rulesOperation, and then click Next.
    4. Select your version of Excel, make sure that Default Excel Format is selected, and then click Next.
    5. On the Expected Results page, click Next because you do not need to include any tests for now.
    6. Click Finish. A dialog opens because the parameters have generic names. You will edit these names in the next task. Click OK to close the dialog.

      By default, the Excel scenario file template is generated in the loanvalidation-rules project.

      If the Excel scenario file template does not appear in the project, right-click the project, and click Refresh.

    7. In the Rule Explorer, double-click testsuite.xls to open it.

      It has five columns (with bold headings) named arg1, arg2, arg3, arg4, and arg5. The number of columns corresponds to the selected constructor: Borrower (String, String, Date, String, int).

    8. Close testsuite.xls.

What to do next

In the next task, you give meaningful names to the arguments of the constructor.

< Previous | Next >