Forum Discussion

tomovermeers's avatar
tomovermeers
Occasional Contributor
7 years ago

FTP with dynamic Port values

Hi community,   I have a script that loads dynamic values in TestSuite properties. It looks like this:   import com.thoughtworks.xstream.mapper.Mapper log.info("Initialize TestSuite for Pr...
  • tomovermeers's avatar
    tomovermeers
    7 years ago

    No it just doesn't want to do the ftp. But I found a workaround :

     

    I added this script and it works:

     

    // Get the test step objects
    def tsFTP1 = testRunner.testCase.getTestStepByName("03_FTP_file1")
    def tsFTP2 = testRunner.testCase.getTestStepByName("04_FTP_file2")
    def tsFTP3 = testRunner.testCase.getTestStepByName("05_FTP_file3")
    def tsFTP4 = testRunner.testCase.getTestStepByName("06_FTP_file4")
    def tsFTP5 = testRunner.testCase.getTestStepByName("07_FTP_file5")

    //Get the port number
    def tmpFtpPort = context.expand( '${#TestSuite#tmpFtpPort}' )

    // Set the ports
    tsFTP1.setPort(tmpFtpPort)
    tsFTP2.setPort(tmpFtpPort)
    tsFTP3.setPort(tmpFtpPort)
    tsFTP4.setPort(tmpFtpPort)
    tsFTP5.setPort(tmpFtpPort)