This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
dongxiaoyan-tsg-autotest/02-Keyword/tsg_ui/FTPHandle.robot
2020-04-01 12:42:05 +08:00

95 lines
4.8 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

*** Settings ***
Library FtpLibrary
*** Keywords ***
checkFTPRecvReport
[Arguments] ${fURL} ${fport} ${fuser} ${fpwd} ${fpath} ${filename}
[Documentation] [fURL写法例如:192.168.1.1]
... [fport写法例如21]
... [fuser写法例如wxs]
... [fpwd要写ftp服务器的密码写法例如111111]
... [fpath要写ftp服务器的绝对路径写法例如/a/b/20200110/]
... [filename,是指系统下发report时对report起的名字在这里判断方法是ftp文件名称是否包含report名称所以在TSG系统上下发report时应尽量不要用重名以免判断失误写法例如长安街]
... [注意:该关键字无返回值,他是等同于一个用例,若字符串不包含则表示用例执行失败,会有相关信息打印]
[Tags] function FTP reportResult
Ftp Connect ${fURL} ${fuser} ${fpwd} ${fport}
sleep 1
cwd ${fpath}
sleep 1
@{dirname} Dir Names
sleep 1
${Strdirname} Evaluate ''.join(@{dirname})
Should Contain ${Strdirname} ${filename}
ftp close
FTPDownloadFile
[Arguments] ${fURL} ${fport} ${fuser} ${fpwd} ${SrcPath} ${SrcName} ${dstPathName}
[Documentation] [fUrl是FTP服务器地址例如:192.168.1.1]
... [fport是ftp服务器的端口号例如21]
... [fuser是用户名例如wxs]
... [fpwd是密码例如wqqq]
... [SrcPath是ftp服务器上的要下载的文件的路径文件包名称必须写例如/a/b/]
... [SrcName是ftp服务器上的要下载的文件名称文件名称不要太复杂(不要包含符号)否则无法识别例如teacher王.txt]
... [dstPathName是下载到本地时的本地路径名+名称名称可不写建议不写下载到本地的名称就会与FTP上文件一样写法1. D:/rfftppy/tmp/ 2.D:/rfftppy/tmp/b.txt \]
[Tags] function FTP downloadFile
Ftp Connect ${fURL} ${fuser} ${fpwd} ${fport}
cwd ${SrcPath}
sleep 1
download file ${SrcName} ${dstPathName}
ftp close
FTPUploadFileToTest
[Arguments] ${fURL} ${fport} ${fuser} ${fpwd} ${SrcPathName}
[Documentation] [fURL写法例如:192.168.1.1]
... [fport写法例如21]
... [fuser写法例如wxs]
... [fpwd要写ftp服务器的密码写法例如111111]
... [SrcPathName,本地待上传的文件的路径名例如E:/qqq.txt]
... [注意该关键字默认上传到ftp服务器的/test目录下若test目录不存在会自己创建]
[Tags] function FTP uploadFileToTest
${intest} Set Variable test
Run Keyword If '${fport}'!='21' Run Keyword Log 请注意FTP服务器端口号不是21默认端口号请继续登入
... AND Log 登入中...
Ftp Connect ${fURL} ${fuser} ${fpwd} ${fport}
@{dirnames} Dir Names
${result} checkListContainStirng ${intest} @{dirnames}
log ${SrcPathName}
Run Keyword If '${result}'=='${intest}' log /test目录存在
... ELSE Run Keyword log /test目录不存在已创建并上传文件
... AND Mkd ${intest}
Cwd ${intest}
Comment @{aa} Dir Names
Upload File ${SrcPathName}
checkListContainStirng
[Arguments] ${str} @{strlist}
FOR ${value} IN @{strlist}
Log ${value}
Return From Keyword If '${value}'=='${str}' ${value}
END
Return From Keyword ${value}
FTPUploadFile
[Arguments] ${fURL} ${fport} ${fuser} ${fpwd} ${SrcPathName}
[Documentation] [fURL写法例如:192.168.1.1]
... [fport写法例如21]
... [fuser写法例如wxs]
... [fpwd要写ftp服务器的密码写法例如111111]
... [SrcPathName,本地待上传的文件的路径名例如E:/qqq.txt]
... [注意该关键字默认上传到ftp服务器的root目录下]
[Tags] function FTP uploadFile
Run Keyword If '${fport}'!='21' Run Keyword Log 请注意FTP服务器端口号不是21默认端口号请继续登入
... AND Log 登入中...
Ftp Connect ${fURL} ${fuser} ${fpwd} ${fport}
Upload File ${SrcPathName}
FTPLogin
[Arguments] ${fURL} ${fport} ${fuser} ${fpwd}
[Documentation] [fURL写法例如:192.168.1.1]
... [fport写法例如21]
... [fuser写法例如wxs]
... [fpwd要写ftp服务器的密码写法例如111111]
[Tags] function FTP login
Ftp Connect ${fURL} ${fuser} ${fpwd} ${fport}
Get Welcome