Forum Discussion

stefankranz's avatar
stefankranz
Occasional Contributor
5 years ago

TestCase Soap with Content PDF File

Hi, i have been build a testcase that works god with the same Contentfile each. For now i would send up a different file to the Soap Service. Its have the same name like in my datasource. 

Example: id=123456789 File=123456789.pdf

Any idea ?

Thanks,

Stefan

  • nmrao's avatar
    nmrao
    5 years ago

    stefankranz 

    Please check the screen shot.

    Define the directory(where the file are available in the system) at suite level (You can use test case level as well, but my sample defines at suite level so that the same can be used in other test cases) with property DIRECTORY; and define FILE property at test case level.

    Now, once you read the value from data source, assign that value to FILE property

     

    By now, the FILE will have different value each time as you are modifying before Request step.

     

    Use appropriate content type. Just focus on directory and file names, I would say.

    Please refer documentation
    https://www.soapui.org/scripting-properties/working-with-properties.html
    https://www.soapui.org/scripting-properties/property-expansion.html

  • nmrao's avatar
    nmrao
    Champion Level 3
    Use custom property for the file name such as ${#TestCase#FILENAME} instead of specific file name in the attachment section, before that save the file name in custom property.
    • stefankranz's avatar
      stefankranz
      Occasional Contributor

      Thanks, i dont understand it ? Do you know a Example for this ?

      How i can set the relation between Filename / Filepath and Name in a Excel Sheet ?

      • nmrao's avatar
        nmrao
        Champion Level 3

        stefankranz 

        Please check the screen shot.

        Define the directory(where the file are available in the system) at suite level (You can use test case level as well, but my sample defines at suite level so that the same can be used in other test cases) with property DIRECTORY; and define FILE property at test case level.

        Now, once you read the value from data source, assign that value to FILE property

         

        By now, the FILE will have different value each time as you are modifying before Request step.

         

        Use appropriate content type. Just focus on directory and file names, I would say.

        Please refer documentation
        https://www.soapui.org/scripting-properties/working-with-properties.html
        https://www.soapui.org/scripting-properties/property-expansion.html