diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index c966ca93..fbb245dd 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -41,6 +41,7 @@ jobs: run: | pip3 install robotframework pip3 install RESTinstance + pip3 install robotframework-mqttlibrary python3 -m robot -P ft/ -d ft/reports ft #- uses: actions/upload-artifact@v2 diff --git a/ft/grp_config_mqtt_test.robot b/ft/grp_config_mqtt_test.robot new file mode 100644 index 00000000..28fd0ced --- /dev/null +++ b/ft/grp_config_mqtt_test.robot @@ -0,0 +1,44 @@ +*** Settings *** +Library Keyword.Neuron.Neuron +Library Keyword.Neuron.Tool +Library Keyword.Neuron.Node +Library Keyword.Neuron.GrpConfig +Library Keyword.Neuron.Subscribe +Resource error.robot +Resource neuron.robot +Library MQTTLibrary +Library REST http://127.0.0.1:7001 +Suite Setup Neuron Context Ready +Suite Teardown Stop Neuron + +*** Variables *** +${mqtt_node_name} mqtt-adapter + +*** Test Cases *** +Publish + ${mqtt_node_id} Get Node ID ${NODE_MQTT} ${mqtt_node_name} + + Connect ${MQTT_CONFIG_HOST} + Publish topic=${MQTT_CONFIG_REQ_TOPIC} message=test message + + [Teardown] Disconnect + +#Add group config under non-existent node, it should return failure +#Add group config under existent node, it should return success +#Delete a non-existent group config, it should return failure +#Delete a group config from non-existent node, it should return failure +#Delete a group config, it should return success +#Update a non-existent group config, it should return failure +#Update a group config from non-existent node, it should return failure +#Add a group config to the node, then get the group config from this node, it should return the group config +#Update the interval of the test group config, it should return success +#North APP subscribe non-existent group config, it should return failure +#North APP subscribe group config, it should return success +#Query the subscribers of the group config, it should return all nodes subscribed to this group +#Delete the subscribe group config, it should return failure +#North APP unsubscribe non-existent group config, it should return failure +#North APP unsubscribe group config, it should return success + +*** Keywords *** +Neuron Context Ready + Neuron Ready \ No newline at end of file diff --git a/ft/modbus_tcp_test.robot b/ft/modbus_tcp_test.robot new file mode 100644 index 00000000..79e340a7 --- /dev/null +++ b/ft/modbus_tcp_test.robot @@ -0,0 +1,40 @@ +*** Settings *** + +*** Variables *** + +*** Test Cases *** +#Read unsubscribed point, it should return failure +#Read a point in the coil area, and the data as bit type, it should return success +#Read a point in the input area, and the data as bit type, it should return success +#Read a point in the input reg area, and the data as int16, it should return success +#Read a point in the input reg area, and the data as uint16, it should return success +#Read a point in the input reg area, and the data as uint32, it should return success +#Read a point in the input reg area, and the data as int32, it should return success +#Read a point in the input reg area, and the data as float, it should return success +#Read a point in the hlod reg area, and the data as int16, it should return success +#Read a point in the hlod reg area, and the data as uint16, it should return success +#Read a point in the hlod reg area, and the data as int32, it should return success +#Read a point in the hlod reg area, and the data as uint32, it should return success +#Read a point in the hlod reg area, and the data as float, it should return success +#Read multiple points in the coil area, the point address includes continuous and non-continuous, and the data as bit type, it should return success +#Read multiple points in the input area, the point address includes continuous and non-continuous, and the data as bit type, it should return success +#Read multiple points in the input reg area, the point address includes continuous and non-continuous, and the data includes int16/uint16/int32/uint32/float type, it should return success +#Read multiple points in the hold reg area, the point address includes continuous and non-continuous, and the data includes int16/uint16/int32/uint32/float type, it should return success +#Read multiple points belonging to different areas(coil/input/input reg/hold reg), the point address includes continuous and non-continuous, and the data include int16/uint16/int32/uint32/float type, it should return success +#Read multiple points belonging to different areas(coil/input/input reg/hold reg) and different sites, the point address includes continuous and non-continuous, and the data include int16/uint16/int32/uint32/float type, it should return success +#Write a point in the coil area, and the data as bit type, it should return success +#Write a point in the input area, and the data as bit type, it should return success +#Write a point in the input reg area, and the data as int16, it should return success +#Write a point in the input reg area, and the data as uint16, it should return success +#Write a point in the input reg area, and the data as uint32, it should return success +#Write a point in the input reg area, and the data as int32, it should return success +#Write a point in the input reg area, and the data as float, it should return success +#Write a point in the hlod reg area, and the data as int16, it should return success +#Write a point in the hlod reg area, and the data as uint16, it should return success +#Write a point in the hlod reg area, and the data as int32, it should return success +#Write a point in the hlod reg area, and the data as uint32, it should return success +#Write a point in the hlod reg area, and the data as float, it should return success + +*** Keywords *** +Neuron Context Ready + Neuron Ready \ No newline at end of file diff --git a/ft/neuron.robot b/ft/neuron.robot index a179015a..896302bd 100644 --- a/ft/neuron.robot +++ b/ft/neuron.robot @@ -8,6 +8,11 @@ ${NODE_APP} 5 ${PLUGIN_MODBUS} modbus-tcp-plugin ${PLUGIN_MQTT} mqtt-plugin +${MQTT_CONFIG_HOST} broker.fengzero.com +${MQTT_CONFIG_REQ_TOPIC} test/mqtt_req +${MQTT_CONFIG_RES_TOPIC} test/mqtt_res +${MQTT_CONFIG} {"req-topic": "${MQTT_CONFIG_REQ_TOPIC}", "res-topic": "${MQTT_CONFIG_RES_TOPIC}", "ssl": false, "host": "${MQTT_CONFIG_HOST}", "port": 1883, "username": "", "password": "", "ca-path":"", "ca-file": ""} + *** Keywords *** Neuron Ready Start Neuron @@ -66,3 +71,9 @@ To Array [Arguments] ${str_array} ${tmp} Array ${str_array} [RETURN] ${tmp}[0] + +Node Setting + [Arguments] ${node_id} ${config} + + POST /api/v2/node/setting ${config} + Integer response status 200 \ No newline at end of file diff --git a/ft/node_mqtt_test.robot b/ft/node_mqtt_test.robot new file mode 100644 index 00000000..81718299 --- /dev/null +++ b/ft/node_mqtt_test.robot @@ -0,0 +1,74 @@ +*** Settings *** +Library Keyword.Neuron.Neuron +Library Keyword.Neuron.Node +Resource error.robot +Resource neuron.robot +Suite Setup Neuron Ready +Suite Teardown Stop Neuron + +*** Variables *** + +*** Test Cases *** +#Use the wrong body to crate a node, it should return failure +# +#Use a plugin name that does not exist to create a node, it should return failure +# +#Use a invalid node type to create a node, it should return failure +# +#Create a node with the correct body, it should return success +# +#Create an existing node, it should return failure +# +#Get node with wrong parameters, it will return failure +# +#Get DRIVER node, it should return all DRIVER node +# +#Get WEB node, it should return all WEB node +# +#Get MQTT node, it should return all mqtt node +# +#Get STREAM PROCESSOR node, it should return all STREAM PROCESSOR node +# +#Get APP node, it should return all APP node +# +#Get UNKNOWN type node, it should return empty node +# +#Delete the existing node, it will return success +# +#Delete a non-existent node, it will return failure +# +#Add setting to non-existent node, it should return failure +# +#Get setting from non-existent node, it should return failure +# +#Get setting from a node that has never been set, it should return failure +# +#Add the correct settings to the node, it should return success +# +#Get the setting of node, it should return to the previous setting +# +#Add wrong settings to node, it should return failure +# +#Update a node that does not exist, it should return failure +# +#Update the name of the node, it should return success + +#Start an unconfigured node, it should return failure + +#Start the configured node, it should return success + +#Start the stopped node, it should return success + +#Start the running node, it should restart + +#Stop node that is not running, it should return failure + +#Stop the running node, it should return success + +#When setting up an IDLE node, the node status should become READY + +#When setting up a READY/RUNNING/STOPED node, the node status will not change + +*** Keywords *** +Neuron Context Ready + Neuron Ready \ No newline at end of file diff --git a/ft/opcua_test.robot b/ft/opcua_test.robot new file mode 100644 index 00000000..d63bf193 --- /dev/null +++ b/ft/opcua_test.robot @@ -0,0 +1,34 @@ +*** Settings *** + +*** Variables *** + +*** Test Cases *** +#Read a point with data type of int8, it should return success +#Read a point with data type of uint8, it should return success +#Read a point with data type of int16, it should return success +#Read a point with data type of uint16, it should return success +#Read a point with data type of int32, it should return success +#Read a point with data type of uint32, it should return success +#Read a point with data type of int64, it should return success +#Read a point with data type of uint64, it should return success +#Read a point with data type of float, it should return success +#Read a point with data type of double, it should return success +#Read a point with data type of string, it should return success +#Read multiple points, including multiple data types(int8/uint8/int16/uint16/int32/uint32/int64/uint64/float/double/string), it should return success +#Write a point with data type of int8, it should return success +#Write a point with data type of uint8, it should return success +#Write a point with data type of int16, it should return success +#Write a point with data type of uint16, it should return success +#Write a point with data type of int32, it should return success +#Write a point with data type of uint32, it should return success +#Write a point with data type of int64, it should return success +#Write a point with data type of uint64, it should return success +#Write a point with data type of float, it should return success +#Write a point with data type of double, it should return success +#Write a point with data type of string, it should return success +#Write multiple points, including multiple data types(int8/uint8/int16/uint16/int32/uint32/int64/uint64/float/double/string), it should return success + + +*** Keywords *** +Neuron Context Ready + Neuron Ready \ No newline at end of file diff --git a/ft/tag_mqtt_test.robot b/ft/tag_mqtt_test.robot new file mode 100644 index 00000000..fe496301 --- /dev/null +++ b/ft/tag_mqtt_test.robot @@ -0,0 +1,45 @@ +*** Settings *** +Library Keyword.Neuron.Neuron +Library Keyword.Neuron.Tool +Library Keyword.Neuron.Node +Library Keyword.Neuron.Tag +Resource error.robot +Resource neuron.robot +Suite Setup Neuron Context Ready +Suite Teardown Stop Neuron + +*** Variables *** + +*** Test Cases *** +#Add different types of tags to the group, it should return success + +#Add tags to the non-existent group, the group will be created automatically + +#When the attribute of the tag added is incorrect, it should return partial success + +#Add tags to non-existent node, it should return failure + +#Delete tag from non-existent group config, it should return failure + +#Delete non-existent tags, it should return success + +#Query tag from non-existent node, it should return failure + +#After adding the tag, query the tag, it should return the added tag + +#Update tags, it should return success + +#Update non-existent tags, it should return partial success + +#Delete tags, it should return success + +#When the address format of the tag added does not match the driver, it should return failure + +#Add an existing tag(same name), it should return failure + +#When adding a tag of an unsupported type in node, it should return failure + +*** Keywords *** +Neuron Context Ready + Neuron Ready +