TestProject Forum

Decompress Zip file, check files and its content

Hello,

Is it possible to decompress a downloaded ZIP file, verify the files and then check the content of one of the files?

I wanted to know if this was possible using any of the available addons for TestProject in order to verify the content of an xml file within the downloaded ZIP file.

Thanks!

Hello @luis.stolk
Using the Zip Actions addon you can unzip a zip file

image

Then get the contents of the XML file using File Operations addon -> Read File Action.

image

image

Many thanks Ran for your quick response.

This is great!

Now, I have a couple of questions:
1- Is it possible to verify if the zip file contains certain file names? for example: myfilexyz.xml and myfile123.xml?
2- Is there a way to verify that the content of the output file xml contains a specific phrase or word? for example, file myfile123.xml contains the following: “this is a test with numbers one two three”; and I want to verify if the words “one” and “three” are in.

Thanks again for all your help!

  1. You can list the contents of the zip using the List Zip File Contents action.
    Then validate if it contains those files using the String Contains? action.

image

image

  1. After extracting the files, read the XML file contents using the Read File action, and do the same thing as above, check if it contains “one” and “two”

Ran,

Thanks a lot for the fast response and all the help.
I tried it and now I am able to interact with the zip contents and its files.

I appreciate it!