This VSCode extension provides several useful features for iTAC.MES integrators.
Features
The snippets used for the autocompletion of the javascript code is integrated as basic functionality covering all API functions of version 9.50.
The extension will continously be updated with new features in future versions.
Requirements
The use of custom functions test tool requires access to an available iTAC.MES application server.
Extension Settings
The minimum configuration files will be autogenerated by the extension and should be updated with the correct settings to establish connection to iTAC.MES services.
For example:
imsConfig.json
{
"clusterNode": "https://hostname:8181/mes",
"scriptName": "vsc",
"scriptFile": "js/script.js",
"resultFile": "result.out",
"defaultStation": "01010010",
"userId": "VSCODE",
"userPw": "******",
"client": "01",
"sysIdentifier": "VSC Test",
"logPath": "C:/iTAC.MES.Suite",
"defaultLocale": "en_EN",
"majorVersion": 1,
"minorVersion": -1,
"upload": true,
"test": false
}
Test scenarios are placed in Test folder as folowing:
./
L test/
L usecase1/
L before_<use_case_name>.json
L totest_<use_case_name>.json
L usecase2/
L before_<use_case_name>.json
L totest_<use_case_name>.json
Each subfolder can contain test scenario files before and totest:
The scenario file prefixed with 'before_' is executed first and is used to initiate test data in MES system.
The scenario file prefixed with 'totest_' is executed after initiating data and will return execution result with dtata validation based on assertion constraint provided in the test scenarios.
imsScenarios.json
{
"project": "Project name",
"description": "Test scenarios for custom script",
"default": {
"scenario": "",
"name": "Default Test Use Case",
"method": "Test_GEN",
"args": []
},
"scenarios": [
{
"scenario": "Scenario 1: Get stations settings",
"name": "Test Use Case 1",
"method": "cfGetStationSettings",
"args": [
"01010010"
],
"outErrorCode": {
"assertGreaterOrEquals": -5,
"assertSmaller": 10
},
"outErrorString": {
"assertEquals": ""
},
"outArgSize": {
"assertEquals": 1
},
"outArgs": [
{
"assertMatches": {
"stationNumber": "",
"workOrderNumber": "",
"partNumber": "",
"serialNumberArray": []
}
}
],
"outCustomErrorString": {
"assertEquals": ""
}
},
{
"scenario": "Scenario 1: Activate workorder",
"name": "Test Use Case 2",
"method": "cfActivateWorkOrder",
"args": [
"01010010",
"WO100"
],
"outErrorCode": {
"assertEquals": 0
},
"outErrorString": {
"assertEquals": ""
},
"outArgSize": {
"assertEquals": 1
},
"outArgs": [
{
"assertMatches": {
"stationNumber": "",
"workOrderNumber": "",
"quantity": ""
}
}
],
"outCustomErrorString": {
"assertEqualsx": ""
}
}
]
}
The folowing sign can be used to build validation condtions:
Assertions |
Description |
Example (value vs assert) |
Result |
assertEquals |
If value is equal than asserted value |
"ABC" == "ABC" "123" == 123 |
True True |
assertNotEquals |
If value is different than asserted value |
"ABC" != "abc" |
True |
assertGreaterOrEquals |
If value is greater or equal than asserted value |
"123" >= 123 "123" >= 150 |
True False |
assertSmallerOrEquals |
If value is smaller or equal than asserted value |
"123" <= 123 "123" <= 150 |
True True |
assertGreater |
If value is greater than asserted value |
"123" > 123 "123" > 150 |
True False |
assertSmaller |
If value is smaller than asserted value |
"123" < 123 "123" < 150 |
True True |
assertContains |
If value contains asserted string |
"ABC" Contains "AB" "ABC" Contains "AC" |
True False |
assertNotContains |
If value dont contains asserted string |
"ABC" NotContains "AC" "ABC" NotContains "AB" |
True False |
assertMatches |
If value matches the asserted object |
{"key1":"val1"} Matches {"key1":"val1"} |
True |
assertNotMatches |
If value dont matches asserted object |
{"key1":"val1"} NotMatches {"key2":"val2"} |
True |
This extension contributes the following settings:
IMS API System login
: update connection to iTAC MES API service.
IMS API Get MES information
: get the actual iTAC MES version.
IMS API Execute default function
: execute default function.
IMS API Execute scenario function
: execute scenaro functions.
IMS API Execute scenario function with test validation
: execute scenaro functions with test coverage validation (enhanced).
IMS API Convert script file to Hex
: convert script file to readable hex codes.
IMS API Generate config file
: generate template config files.
IMS API Minify JS script
: generate minified JS script.
IMS API Open imsAPI log file
: open imsAPI log file.
IMS API Parse imsAPI log file
: parse imsAPI log file.
Release Notes
1.0.0 (October 2020)
2.0.0 (Aout 2021)
Add the auto-generation of session context ID.
Log the default test result in the output window (as IMS-Output).
Add function to convert script file to readable hex codes.
Auto generation of template config files.
Add the scenarios testing and display.
Add script minifier function.
Add the scenarios testing validation.
3.0.0 (September 2021)
Add the auto inspection of imsAPI log file.
Update scenario test using test folder.
Add auto generation of test folder and template scenario files.
Add handling of global variables in test scenarios.
4.0.0 (February 2022)
Enjoy working with iTAC MES!