Executing MOCA commands

With an established MOCA connection, executing MOCA commands from within a Feature File is simple. Use MOCA to create/load data, validate test results, retrieve variables for use in the Feature File, and more.

To call a MOCA command, use the following Step:

I execute MOCA command “list printers where wh_id = ‘WMD1’”

This Step supports any MOCA command, as well as executes Local Syntax or piped MOCA commands. Any data retrieved from the execution can be iterated through to a specific row and column, and the value can be stored in a variable for use within the Feature File. There is also a standard Step to check the status of the MOCA command for validation purposes.

To check the status of the MOCA command, use this Step:

I verify MOCA status is -1403

To get the row count, access the variable "row_count":

I echo $row_count

Note: row_count only stores the row count for the last MOCA command executed. Using the following Steps, $row_count after the execution of line 2 will be 9 while $row_count after the execution of line 4 will be 14.

1  And I execute moca command "list inventory where rownum < 10"
2  And I echo $row_count
3  And I execute moca command "list inventory where rownum < 15"
4  And I echo $row_count

In addition to allowing execution of a MOCA command, Steps can be defined to allow non-technical users to use MOCA commands without having to understand MOCA. The standard product Steps have quite a few of these already defined. There are predefined Steps that can be used for checking MOCA execution status, validating attributes of a given order, validating the location of a given inventory identifier, or validating the quantity of a given SKU on a given inventory identifier. See the Step Guide available via the Help menu in the Cycle client for a searchable list.

An example would be something like the following:

Then I verify LOAD with inventory identifier “L123” is in location “ABC”

results matching ""

    No results matching ""