Create the test case executable
Test case executables contain the test logic that you want to run. A test suite can contain multiple test case executables. For this tutorial, you will create only one test case executable.
-
Create the test suite file.
In the
MyTestSuite_1.0.0/suite/myTestGroup/myTestCase
folder, create amyTestCase.py
file with the following content:from idt_client import * def main(): # Use the client SDK to communicate with IDT client = Client() if __name__ == "__main__": main()
-
Use client SDK functions to add the following test logic to your
myTestCase.py
file:-
Run an SSH command on the device under test.
from idt_client import * def main(): # Use the client SDK to communicate with IDT client = Client()
# Create an execute on device request exec_req = ExecuteOnDeviceRequest(ExecuteOnDeviceCommand("echo 'hello world'")) # Run the command exec_resp = client.execute_on_device(exec_req) # Print the standard output print(exec_resp.stdout)
if __name__ == "__main__": main() -
Send the test result to IDT.
from idt_client import * def main(): # Use the client SDK to communicate with IDT client = Client() # Create an execute on device request exec_req = ExecuteOnDeviceRequest(ExecuteOnDeviceCommand("echo 'hello world'")) # Run the command exec_resp = client.execute_on_device(exec_req) # Print the standard output print(exec_resp.stdout)
# Create a send result request sr_req = SendResultRequest(TestResult(passed=True)) # Send the result client.send_result(sr_req)
if __name__ == "__main__": main()
-