Contributions
Re: Connecting to SSH using TestComplete (Used Paramiko but is erroring out)
sonya_mAlexKaras Finally I was able to implement Paramiko on Test Complete (Python 3.6) successfully. Please find the instructions below (Readability is better if theinstructions file is opened using Notepad++) :- Note:- The understanding is that Test Complete is running Python 3.6 Running Test Complete from the Desktop shortcut defaults to opening the 64-bit version of Test Complete. The instructions here explains how to Implement Paramiko on the 64-bit version of Test Complete. (1) Copy all the contents from "Required Libs for Paramiko" and paste it to the below path:- C:\Program Files (x86)\SmartBear\TestComplete 14\x64\Bin\Extensions\Python\Python36\Lib (2) Copy the file "_cffi_backend.cp36-win_amd64.pyd" from the folder "Copy the content to DLL" and paste it to the below path:- C:\Program Files (x86)\SmartBear\TestComplete 14\x64\Bin\Extensions\Python\Python36\DLLs (3) Done, the required files for Paramiko have been successfully loaded. (4) Please find a sample Paramiko script below. Feel free to use any script as desired. =========================================================== import paramiko def execSSH(host, user, passwd, command, filename): ssh_client = paramiko.SSHClient() ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) #Establishes a SSH connection with the given details. ssh_client.connect(hostname=host, username=user, password=passwd) #The SSH commands are executed one by one. Please note that only the last command's #output is saved to the output file. The file is currently saved to the current #present-working-directory (pwd) of the remote server. stdout = ssh_client.exec_command(command + " > " + filename) #SFTP connection is opened. This is for copying the file from the remote server to our #local machine. sftp_client = ssh_client.open_sftp() #The created output file is copied from the remote server to our local machine. #Please note that the remote-server-path is the present-working-directory (pwd), if #you give otherwise the file-save will fail. #Syntax:- #sftp_client.get("<remote-server-path>" + filename, "<local-machine-path>" + filename) sftp_client.get("/mnt/AMPBackup/" + filename, "C:\\Users\sabraham\Desktop\\" + filename) #The output file is deleted from the remote server since it was copied over to the #local machine. sftp_client.remove("/mnt/AMPBackup/" + filename) #Close the SFTP and SSH connections sftp_client.close() ssh_client.close() if __name__ == '__main__': #The variable command holds the various SSH commands we would like to execute one-by- #one on the remote server. #Syntax:- command = 'command_1; command_2; command_3; etc....' command = 'cd /mnt/AMPBackup/; ls' #SSH function call execSSH("121.0.0.1", "user_auth", "pass1",command,"outputfile.txt") ===========================================================3.2KViews2likes1CommentTestComplete and Paramiko (with gss_auth=True) - Steps
Hi, I am able to connect TestComplete and Paramiko (with gss_auth=True) So wanted to share the knowledge here with the community. Hope it helps. Note: >> The understanding is that Test Complete is running Python 3.6 >> TestComplete x64 version is being executed. >> The directory "paramiko_gssapi_py36" is the parent directory where the respective "paramiko-gssapi" installation was performed. >> To achieve the "paramiko-gssapi" installation, we just need to trigger the "pip install" command as below :- pip install paramiko[gssapi] Files required to be moved from one folder to another folder :- =========================================================== 1) _win32sysloader.pyd (from win32 folder to parent paramiko_gssapi_py36 dir) 2) win32security.pyd (from win32 folder to parent paramiko_gssapi_py36 dir) 3) win32api.pyd (from win32 folder to parent paramiko_gssapi_py36 dir) 4) win32timezone.py (from win32/lib folder to parent paramiko_gssapi_py36 dir) 5) pywintypes.py (from win32/lib folder to parent paramiko_gssapi_py36 dir) 6) sspicon.py (from win32/lib folder to parent paramiko_gssapi_py36 dir) 7) sspi.py (from win32/lib folder to parent paramiko_gssapi_py36 dir) 8 ) pythoncom36.dll (from pywin32_system32 folder to parent paramiko_gssapi_py36 dir) 9) pywintypes36.dll (from pywin32_system32 folder to parent paramiko_gssapi_py36 dir) Please find a sample python script below, which uses the Paramiko (gss_auth=True) code. Note:- If you want to ignore using the "sys.path.insert(....)" function line, you can copy-paste the entire contents from "paramiko_gssapi_py36" to the below path :- C:\Program Files (x86)\SmartBear\TestComplete 14\x64\Bin\Extensions\Python\Python36\Lib ######################### Paramiko and GSSAPI ###################### import sys import os sys.path.insert(0, "C:\\paramiko_gssapi_py36") import paramiko def test101(): execSSH("test_server", "user01", "pwd") def execSSH(host, user, my_command): #Establishes a SSH connection with the given details. ssh_client = paramiko.SSHClient() ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh_client.connect(hostname=host, username=user, gss_auth=True) stdin, stdout, stderr = ssh_client.exec_command(my_command, get_pty = True) Log.message("O/P: "+str(stdout.read().decode('utf-8').strip('\n'))) ######################### Paramiko and GSSAPI ######################878Views3likes1CommentMake it possible for 'Execution Plan Editor' to work with 'tags'
Hi, The request is to have the 'Execution Plan Editor' to work with Automation tests that has 'tags' on them. Currently if the "Run @tag" option is selected, the tests will run in no apparent order, ie. the'Execution Plan Editor' feature does not work along with it. Hope that the feature request can have some priority, since it would definitely help a lot of Projects that utilize the Automation tests to run on CI/CD Pipeline. Thank you in advance.Re: Connecting to SSH using TestComplete (Used Paramiko but is erroring out)
Hi Alex, I have placed the libraries such as "cryptography" and "bcrypt" in the Test Complete path (C:\Program Files (x86)\SmartBear\TestComplete 14\Bin\Extensions\Python\Python36\Lib\). I do not know from where can I get a "_bcrypt" library file. Thanks.3.4KViews0likes6CommentsConnecting to SSH using TestComplete (Used Paramiko but is erroring out)
Hi all, I would like to establish a SSH connection using Test Complete. My scripts are in Python so Paramiko was the candidate that I wanted to proceed with. I downloaded the package from pypi.org and saved it to the below path -> C:\Program Files (x86)\SmartBear\TestComplete 14\Bin\Extensions\Python\Python36\Lib\ My script:- =========================================================== import paramiko import sys sys.path.insert(0,"C:\\Program Files (x86)\\SmartBear\\TestComplete 14\\Bin\\Extensions\\Python\\Python36\\Lib") def test02(): host = "test.server2.net" port = 22 username = "demo" password = "password" command = "ls" ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(host, port, username, password) stdin, stdout, stderr = ssh.exec_command(command) lines = stdout.readlines() Log.message(lines) =========================================================== When I run the script, I get an error as below :- Python runtime error. ImportError: cannot import name '_bcrypt' Please can someone help on the same. Thanks in advance.Solved3.5KViews0likes8Comments