Search code examples
droolsjbpmkie

Drools Business Central Workbench - Test Scenario: List subproperty on object


Is there a way to populate a List property on an object being tested under the "new style" test scenario?

I see some "legacy" test cases which seem to achieve this so am wondering if the new style test scenario handles this.

I added the List model to my test case, which enabled me to expand the sub-property on the object, however there is only one field available there, "empty" (boolean). Is there a way to add an object here? If it makes any difference, the model is an external java dependency.

Update

The reason I wasn't able to add the List of objects was because I didn't explicitly import that object dependency into the test. Once you import it you can follow the steps given in the answer below.


Solution

  • It's definitely possible to manage a List property under the Test Scenario Editor. Please consider the following example: A Book class with a List<String> property named topics.

    enter image description here

    Creating a new Test Scenario assets, please select the column where you need to add the List property, and in the right part of the editor select the property expanding the Book class, as shown below:

    enter image description here

    Pressing Insert Data Ojbect button will assign the selected List property to the selected column:

    enter image description here

    To fill the data in the List property, please double click on the Insert value cell, in the first scenario data row. A popup will appear. Its aim is to fill data inside a collection

    enter image description here

    To add a value, please press the Add list value link in the bottom part of the popup. Here, you'll be able to fill a single item on the list

    enter image description here

    Repeat this step for all the items you need to add to the list. When completed, simply press to Save button

    enter image description here

    The popup will close and you should see the previously selected data cell filled with a label similar to List(2), the number represents the number of the items in the list.