Huy Hóm Hỉnh
Huy Hóm Hỉnh

Reputation: 617

Remove file from remote server with Robot framework

I'm making an automation testcase that need to upload a file to SFTP server, do something and remove this file on teardown. It quite easy for me to upload file by using Put File on SSH Library but meet trouble with removal. SSH Library not supports keyword to remove file and I can't find something useful for this subject anywhere.

Tks a lot!

Upvotes: 0

Views: 2519

Answers (1)

Shijo
Shijo

Reputation: 9721

As mentioned by @Pekka, you can use Execute Command to remove files from remote server

*** Settings ***
Library           SSHLibrary 

*** Test Cases ***
Open Connection And Remove files
    Open Connection    ${HOST}
    Login    ${USERNAME}    ${PASSWORD}
    ${FileList}=    List Directory    ${DIR}
    log    ${FileList}
    ${rc}=    Execute Command    rm ${DIR}/${FILE}
    Should Be Equal    ${rc}    ${0}
    Close All Connections

Upvotes: 3

Related Questions