Tuesday, November 11, 2014

How to create a file with exact amount of bytes to test the boundary value

Once I need to create a file with exact amount of bytes (file size) to test the boundary value of a file upload event in my project. Requirement is to be able to upload a file < or = 100MB. So I tried to create a file to test this scenario.

To create a file less than 100MB is very simple. But, according to the QA principles, we need to check the boundary value of that feature with the file size 99MB, 100MB and 101MB won't be an easy task as we have to create 3 files with exact amount of bytes. We called it as Boundary Value Analysis.

Then I found a nice command line to create such files without wasting our valuable time.

What you need to do is just create a .bat file with following command line and execute it.

fsutil file createnew filename length 

Ex: Let say if you need to create a file with 100 MB (1024 * 1024 * 100)

fsutil file createnew 100MB_File 104857600


No comments:

Post a Comment