summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgligorisaev <34868628+gligorisaev@users.noreply.github.com>2022-08-30 15:58:13 +0200
committerGitHub <noreply@github.com>2022-08-30 15:58:13 +0200
commitfe3645a3fa0f30c459e7b2feea35eda89dfc8006 (patch)
treea54a43446e46da8ee88d9a74346ca371231e3f8a
parent7a5204a5ac16bcbb57a8e9648c41faf8c0f590a9 (diff)
parentfb1e555ecbf004e8a84ccac5767c3c71da05bf4e (diff)
Merge pull request #1319 from gligorisaev/feature/1255/create-rf-tests
Create Robotframework Automated Tests transfered from PySys
-rw-r--r--.gitignore9
-rw-r--r--tests/RobotFramework/tedge/call_tedge.robot63
-rw-r--r--tests/RobotFramework/tedge/call_tedge_config_list.robot149
-rw-r--r--tests/RobotFramework/tedge_connect/tedge_connect_test.robot49
4 files changed, 270 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 37b05777..47745b29 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,6 +12,15 @@
.venv/
.DS_Store
+### robotframework ###
+log.html
+output.xml
+report.html
+selenium-screenshot-*.png
+playwright-log.txt
+
+Results/
+
# Log files generated by PySys
tests/PySys/**/*.log
tests/PySys/**/*.out
diff --git a/tests/RobotFramework/tedge/call_tedge.robot b/tests/RobotFramework/tedge/call_tedge.robot
new file mode 100644
index 00000000..34228a70
--- /dev/null
+++ b/tests/RobotFramework/tedge/call_tedge.robot
@@ -0,0 +1,63 @@
+*** Settings ***
+Documentation Purpose of this test is to verify that the proper version number
+... will be shown by using the tedge -V command.
+... By executing the tedge -h command that USAGE, OPTIONS and SUBCOMMANDS
+... will be shown
+... By executing the tedge -h -V command combination of both previous
+... commands will be shown
+
+Library SSHLibrary
+Library String
+
+Suite Setup Open Connection And Log In
+Suite Teardown SSHLibrary.Close All Connections
+
+*** Variables ***
+${HOST} 192.168.99.110 #Insert the IP address if the default should not be used
+${USERNAME} pi #Insert the username if the default should not be used
+${PASSWORD} thinedge #Insert the password if the default should not be used
+${version}
+
+*** Tasks ***
+Install thin-edge.io
+ ${output}= Execute Command curl -fsSL https://raw.githubusercontent.com/thin-edge/thin-edge.io/main/get-thin-edge_io.sh | sudo sh -s #running the script for installing latest version of tedge
+ ${line} Get Line ${output} 2 #getting the version which is installed out of the log
+ ${version} Fetch From Right ${line} : #Cutting log output in order only to keep version number
+ Set Suite Variable ${version}
+ Log ${version} #log of the output
+ Log ${output} #log of the output
+
+call tedge -V
+ ${output}= Execute Command tedge -V #execute command to check version
+ Should Contain ${output} ${version} #checking that the output of tedge -V returns the version which was installed
+ Log ${output}
+
+call tedge -h
+ ${output}= Execute Command tedge -h #execute command to call help
+ Should Contain ${output} USAGE: #checks if USAGE: exists
+ Should Contain ${output} OPTIONS: #checks if OPTIONS: exists
+ Should Contain ${output} SUBCOMMANDS: #checks if SUBCOMMANDS: exists
+ Log ${output}
+
+call tedge -h -V
+ ${output}= Execute Command tedge -h -V #execute command to call help and check the version at same time
+ Should Contain ${output} ${version} #checking that the output of tedge -V returns the version which was installed
+ Should Contain ${output} USAGE: #checks if USAGE: exists
+ Should Contain ${output} OPTIONS: #checks if OPTIONS: exists
+ Should Contain ${output} SUBCOMMANDS: #checks if SUBCOMMANDS: exists
+ Log ${output}
+
+call tedge help
+ ${output}= Execute Command tedge help #execute command to call help
+ Should Contain ${output} USAGE: #checks if USAGE: exists
+ Should Contain ${output} OPTIONS: #checks if OPTIONS: exists
+ Should Contain ${output} SUBCOMMANDS: #checks if SUBCOMMANDS: exists
+ Log ${output}
+
+
+
+*** Keywords ***
+Open Connection And Log In
+ SSHLibrary.Open Connection ${HOST}
+ SSHLibrary.Login ${USERNAME} ${PASSWORD}
+ \ No newline at end of file
diff --git a/tests/RobotFramework/tedge/call_tedge_config_list.robot b/tests/RobotFramework/tedge/call_tedge_config_list.robot
new file mode 100644
index 00000000..5e5b3c08
--- /dev/null
+++ b/tests/RobotFramework/tedge/call_tedge_config_list.robot
@@ -0,0 +1,149 @@
+*** Settings ***
+Documentation Purpose of this test is to verify that the tedge config list and tedge config list --all
+... will result with Return Code 0
+... Set new device type and return to default value
+... Set new kay path and return to default value
+... Set new cert path and return to default value
+... Set new c8y.root.cert.path and return to default value
+... Set new c8y.smartrest.templates and return to default value
+... Set new az.root.cert.path and return to default value
+... Set new az.mapper.timestamp and return to default value
+... Set new mqtt.bind_address and return to default value
+... Set new mqtt.port and return to default value
+... Set new tmp.path and return to default value
+... Set new logs.path and return to default value
+... Set new run.path and return to default value
+
+Library SSHLibrary
+
+Suite Setup Open Connection And Log In
+Suite Teardown SSHLibrary.Close All Connections
+
+*** Variables ***
+${HOST} 192.168.99.110 #Insert the IP address if the default should not be used
+${USERNAME} pi #Insert the username if the default should not be used
+${PASSWORD} thinedge #Insert the password if the default should not be used
+
+*** Tasks ***
+tedge config list
+ ${rc} Execute Command tedge config list return_stdout=False return_rc=True #executing tedge config list and expect return code 0
+ Should Be Equal As Integers ${rc} 0
+ Log ${rc}
+tedge config list --all
+ ${rc} Execute Command tedge config list --all return_stdout=False return_rc=True #executing tedge config list --all and expect return code 0
+ Should Be Equal As Integers ${rc} 0
+ Log ${rc}
+set/unset device.type
+ Execute Command sudo tedge config set device.type changed-type #Changing device.type to "changed-type"
+ ${set} Execute Command tedge config list
+ Should Contain ${set} device.type=changed-type
+ Log ${set}
+ Execute Command sudo tedge config unset device.type #Undo the change by using the 'unset' command, value returns to default one
+ ${unset} Execute Command tedge config list
+ Should Contain ${unset} device.type=thin-edge.io
+ Log ${unset}
+set/unset device.key.path
+ Execute Command sudo tedge config set device.key.path /etc/tedge/device-certs1/tedge-private-key.pem #Changing device.key.path
+ ${set} Execute Command tedge config list
+ Should Contain ${set} device.key.path=/etc/tedge/device-certs1/tedge-private-key.pem
+ Log ${set}
+ Execute Command sudo tedge config unset device.key.path #Undo the change by using the 'unset' command, value returns to default one
+ ${unset} Execute Command tedge config list
+ Should Contain ${unset} device.key.path=/etc/tedge/device-certs/tedge-private-key.pem
+ Log ${unset}
+set/unset device.cert.path
+ Execute Command sudo tedge config set device.cert.path /etc/tedge/device-certs1/tedge-certificate.pem #Changing device.cert.path
+ ${set} Execute Command tedge config list
+ Should Contain ${set} device.cert.path=/etc/tedge/device-certs1/tedge-certificate.pem
+ Log ${set}
+ Execute Command sudo tedge config unset device.cert.path #Undo the change by using the 'unset' command, value returns to default one
+ ${unset} Execute Command tedge config list
+ Should Contain ${unset} device.cert.path=/etc/tedge/device-certs/tedge-certificate.pem
+ Log ${unset}
+set/unset c8y.root.cert.path
+ Execute Command sudo tedge config set c8y.root.cert.path /etc/ssl/certs1 #Changing c8y.root.cert.path
+ ${set} Execute Command tedge config list
+ Should Contain ${set} c8y.root.cert.path=/etc/ssl/certs1
+ Log ${set}
+ Execute Command sudo tedge config unset c8y.root.cert.path #Undo the change by using the 'unset' command, value returns to default one
+ ${unset} Execute Command tedge config list
+ Should Contain ${unset} c8y.root.cert.path=/etc/ssl/certs
+ Log ${unset}
+set/unset c8y.smartrest.templates
+ Execute Command sudo tedge config set c8y.smartrest.templates 1 #Changing c8y.smartrest.templates
+ ${set} Execute Command tedge config list
+ Should Contain ${set} c8y.smartrest.templates=["1"]
+ Log ${set}
+ Execute Command sudo tedge config unset c8y.smartrest.templates #Undo the change by using the 'unset' command, value returns to default one
+ ${unset} Execute Command tedge config list
+ Should Contain ${unset} c8y.smartrest.templates=[]
+ Log ${unset}
+set/unset az.root.cert.path
+ Execute Command sudo tedge config set az.root.cert.path /etc/ssl/certs1 #Changing az.root.cert.path
+ ${set} Execute Command tedge config list
+ Should Contain ${set} az.root.cert.path=/etc/ssl/certs1
+ Log ${set}
+ Execute Command sudo tedge config unset az.root.cert.path #Undo the change by using the 'unset' command, value returns to default one
+ ${unset} Execute Command tedge config list
+ Should Contain ${unset} az.root.cert.path=/etc/ssl/certs
+ Log ${unset}
+set/unset az.mapper.timestamp
+ Execute Command sudo tedge config set az.mapper.timestamp false #Changing az.mapper.timestamp
+ ${set} Execute Command tedge config list
+ Should Contain ${set} az.mapper.timestamp=false
+ Log ${set}
+ Execute Command sudo tedge config unset az.mapper.timestamp #Undo the change by using the 'unset' command, value returns to default one
+ ${unset} Execute Command tedge config list
+ Should Contain ${unset} az.mapper.timestamp=true
+ Log ${unset}
+set/unset mqtt.bind_address
+ Execute Command sudo tedge config set mqtt.bind_address 127.1.1.1 #Changing mqtt.bind_address
+ ${set} Execute Command tedge config list
+ Should Contain ${set} mqtt.bind_address=127.1.1.1
+ Log ${set}
+ Execute Command sudo tedge config unset mqtt.bind_address #Undo the change by using the 'unset' command, value returns to default one
+ ${unset} Execute Command tedge config list
+ Should Contain ${unset} mqtt.bind_address=127.0.0.1
+ Log ${unset}
+set/unset mqtt.port
+ Execute Command sudo tedge config set mqtt.port 8888 #Changing mqtt.port
+ ${set} Execute Command tedge config list
+ Should Contain ${set} mqtt.port=8888
+ Log ${set}
+ Execute Command sudo tedge config unset mqtt.port #Undo the change by using the 'unset' command, value returns to default one
+ ${unset} Execute Command tedge config list
+ Should Contain ${unset} mqtt.port=1883
+ Log ${unset}
+set/unset tmp.path
+ Execute Command sudo tedge config set tmp.path /tmp1 #Changing tmp.path
+ ${set} Execute Command tedge config list
+ Should Contain ${set} tmp.path=/tmp1
+ Log ${set}
+ Execute Command sudo tedge config unset tmp.path #Undo the change by using the 'unset' command, value returns to default one
+ ${unset} Execute Command tedge config list
+ Should Contain ${unset} tmp.path=/tmp
+ Log ${unset}
+set/unset logs.path
+ Execute Command sudo tedge config set logs.path /var/log1 #Changing logs.path
+ ${set} Execute Command tedge config list
+ Should Contain ${set} logs.path=/var/log1
+ Log ${set}
+ Execute Command sudo tedge config unset logs.path #Undo the change by using the 'unset' command, value returns to default one
+ ${unset} Execute Command tedge config list
+ Should Contain ${unset} logs.path=/var/log
+ Log ${unset}
+set/unset run.path
+ Execute Command sudo tedge config set run.path /run1 #Changing run.path
+ ${set} Execute Command tedge config list
+ Should Contain ${set} run.path=/run1
+ Log ${set}
+ Execute Command sudo tedge config unset run.path #Undo the change by using the 'unset' command, value returns to default one
+ ${unset} Execute Command tedge config list
+ Should Contain ${unset} run.path=/run
+ Log ${unset}
+
+*** Keywords ***
+Open Connection And Log In
+ SSHLibrary.Open Connection ${HOST}
+ SSHLibrary.Login ${USERNAME} ${PASSWORD}
+ \ No newline at end of file
diff --git a/tests/RobotFramework/tedge_connect/tedge_connect_test.robot b/tests/RobotFramework/tedge_connect/tedge_connect_test.robot
new file mode 100644
index 00000000..2a7b2d8f
--- /dev/null
+++ b/tests/RobotFramework/tedge_connect/tedge_connect_test.robot
@@ -0,0 +1,49 @@
+*** Settings ***
+Documentation Run connection test while being connected and check the positive response in stdout
+... disconnect the device from cloud and check the negative message in stderr
+... Run sudo tedge connect c8y and check
+
+Library SSHLibrary
+Library CryptoLibrary variable_decryption=True
+Library Dialogs
+
+Suite Setup Open Connection And Log In
+Suite Teardown SSHLibrary.Close All Connections
+
+
+*** Variables ***
+${HOST} 192.168.99.110 #Insert the IP address if the default should not be used
+${USERNAME} pi #Insert the username if the default should not be used
+${PASSWORD} thinedge #Insert the password if the default should not be used
+
+*** Tasks ***
+tedge_connect_test_positive
+ Execute Command sudo tedge connect c8y #Connecting to Cumulocity IoT
+ ${stdout}= Execute Command sudo tedge connect c8y --test #Testing the status of the connection
+ Should Contain ${stdout} Connection check to c8y cloud is successful. #Expected message
+ Log ${stdout}
+
+tedge_connect_test_negative
+ Execute Command sudo tedge disconnect c8y #Disonnecting from Cumulocity IoT
+ ${stdout} ${stderr}= Execute Command sudo tedge connect c8y --test return_stderr=True #Testing the status of the connection
+ Should Contain ${stderr} Error: failed to test connection to Cumulocity cloud. #Expected message
+ Log ${stderr}
+
+tedge_connect_test_sm_services
+ ${stdout} Execute Command sudo tedge connect c8y #Connecting to Cumulocity IoT
+ Should Contain ${stdout} Successfully created bridge connection! #Expected message
+ Should Contain ${stdout} tedge-agent service successfully started and enabled! #Expected message
+ Should Contain ${stdout} tedge-mapper-c8y service successfully started and enabled! #Expected message
+ Log ${stdout}
+tedge_disconnect_test_sm_services
+ ${stdout} Execute Command sudo tedge disconnect c8y #Disonnecting from Cumulocity IoT
+ Should Contain ${stdout} Cumulocity Bridge successfully disconnected! #Expected message
+ Should Contain ${stdout} tedge-agent service successfully stopped and disabled! #Expected message
+ Should Contain ${stdout} tedge-mapper-c8y service successfully stopped and disabled! #Expected message
+ Log ${stdout}
+
+*** Keywords ***
+Open Connection And Log In
+
+ SSHLibrary.Open Connection ${HOST}
+ SSHLibrary.Login ${USERNAME} ${PASSWORD}