Forum Discussion

mpartyka's avatar
mpartyka
Contributor
10 years ago

Property expansion in 'Create File' test step file name creation

Property expansion in 'Create File' test step file name creation does not seem to work, but works in same test step for creating the file contents.  Is this a bug or am I doing something wrong?   See image attached.   Trying to create file name as the name of an ID that is stored as Test Suite Property      ${#TestSuite#ExtractDefinitionId}.txt    Instead of using actual DefinitionId (stored in the test suite property)in the filename, I get a filename = "${#TestSuite#ExtractDefinitionId}.txt"   

 

Using ${Download - One Topic#Response} works great for the file content - gives me the test step response w/o the headers - exactly what I am looking for.  Now I need to be able the name the file correctly.

 

Thanks for any input.    

 

 

 

  • Tried the same in ReadyAPI 1.4.1 and got your problem. Let the Smartbear team look into this issue.

     

    Mean while, as workaround, use groovy script with following script and disable create file step

     

    //define the test case property for folder where you want to save file
    def filePath = context.testCase.getPropertyValue('FOLDER')+'/'+ context.testCase.testSuite.getPropertyValue('ExtractDefinitionId')+'.txt'
    def file = new File(filePath)
    file.write(context.expand('${Download - One Topic#Response}'))

    Hope this is useful

  • Hi Mheeke,

     

    Thanks for reporting this issue to our Support Team. I see that our R&D team is investigating it and they will provide us with some updates soon. For a while, please use the workaround suggested by nmrao.

  • nmrao's avatar
    nmrao
    Champion Level 3

    Tried the same in ReadyAPI 1.4.1 and got your problem. Let the Smartbear team look into this issue.

     

    Mean while, as workaround, use groovy script with following script and disable create file step

     

    //define the test case property for folder where you want to save file
    def filePath = context.testCase.getPropertyValue('FOLDER')+'/'+ context.testCase.testSuite.getPropertyValue('ExtractDefinitionId')+'.txt'
    def file = new File(filePath)
    file.write(context.expand('${Download - One Topic#Response}'))

    Hope this is useful

    • mpartyka's avatar
      mpartyka
      Contributor

      I'm at Ready! API 1.3.1.  Thanks for your response, I'll give it a try & also report issue to Smartbear, hopefully it's been addressed in a newer release!

       

      • TanyaYatskovska's avatar
        TanyaYatskovska
        SmartBear Alumni (Retired)

        Hi Mheeke,

         

        Thanks for reporting this issue to our Support Team. I see that our R&D team is investigating it and they will provide us with some updates soon. For a while, please use the workaround suggested by nmrao.