51Testing软件测试论坛

标题: FTP Server 上传,下载,删除文件脚本 [打印本页]

作者: zhenmaohui    时间: 2013-7-10 10:38
标题: FTP Server 上传,下载,删除文件脚本
1.选择FTP协议
2.手动录入脚本,脚本内容如下(红色字体需根据实际情况进行修改):
Action()
{
      //Define an FTP session identifier
      unsigned long *ftp1=NULL;


     // Login to the FTP server
      ftp_logon_ex(&ftp1,"Ftp_Logon","URL=ftp://name:password@ftp_server_ip", LAST );


     //Put a file on the FTP server
      ftp_put_ex(&ftp1,"Put_File","SOURCE_PATH=local_address/file_name","TARGET_PATH=ftp_address/file_name",
      "PASSIVE=TRUE","MODE=ASCII", ENDITEM ,  LAST );
      
    // Get a file back from the FTP server
    ftp_get_ex (&ftp1, "Get_Files", "SOURCE_PATH=ftp_address/file_name", "TARGET_PATH=local_address/file_name",
    "MODE=ASCII", ENDITEM , LAST );


    //delete the file on the FTP server
     ftp_delete_ex(&ftp1,"Del_File","PATH=ftp_address/file_name",ENDITEM,LAST);

    // Logout from the FTP server
    ftp_logout_ex(&ftp1);

   return 0;
}
3.进行参数化,插入事务、集合点,这里就不再赘述




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2