Executing MOCA Commands
With an established MOCA connection, you can execute MOCA commands from within a Feature File. Use MOCA to create or load data, validate test results, retrieve variables for use in the Feature File, and more.
Executing MOCA commands
To execute a MOCA command, use the following Step:
I execute MOCA command "list printers where wh_id = 'WMD1'"
This Step supports any MOCA command, and it can also execute 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.
Checking status
To check the status of the MOCA command, use this Step:
I verify MOCA status is -1403
Getting a row count
To get the row count, access the variable row_count:
I echo $row_count
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 is 9, while $row_count after the execution of line 4 is 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 include several 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"