Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

How to verify whether a file is present in particular path or not.

Options

I have a scenario where after hitting the API, a File will be generated in particular path.
I need to validate whether a file(CSV) is present or not(Both positive and negative).

Can Some one help me how to do this.

Answers

  • williammccusker
    williammccusker Posts: 645 ✭✭✭
    Options

    Hi,

    Is this part of a virtual asset (Virtualize) scenario or is this part of a test case (SOAtest) scenario?

  • benken_parasoft
    benken_parasoft Posts: 1,235 ✭✭✭
    edited February 2022
    Options

    If this is a question about SOAtest, and the file is on a remote host, you could use the FTP or SFTP Client tool to execute an "ls" or "get" command to check the file on the remote host.

  • SahithReddy
    SahithReddy Posts: 3
    Options

    Hi William/benken,

    Thanks for the quick response.

    It's a SOA test scenario and its not on the remote host.

    I have used Groovy script in external tool and able to print in the console whether file is present or not.
    But Can you please help me how to pass or fail the test case based on the result.

  • williammccusker
    williammccusker Posts: 645 ✭✭✭
    Options

    Hi,

    On the extension tool there is a check box for "Exit code indicates success" enable that option and then the extension tool could return true when its passes and if it returns false then the test should report a failure.

  • SahithReddy
    SahithReddy Posts: 3
    Options

    Thanks William for quick response.
    It's working fine.

  • williammccusker
    williammccusker Posts: 645 ✭✭✭
    Options

    Glad it worked!