Here is a free software called FileGen that lets you create many files for testing quickly. The test files can have a fixed or variable content. You can even choose to create files of a fixed size. You can also choose to create files in sub-directories. And you can even define pattern that the filenames of the created files will follow.
FileGen is a completely free and portable software to quickly generate lot of files for testing. It is very easy to use and has just 1 screen of user interface.
What I find most powerful about this freeware is that it lets you add content to files based on variables. So, you can define variables for file content, and then provide values of the variables from other files. Consider it like mail merge for creating test files.
We earlier covered a similar software called FileFiller that is also meant to create dummy files of any size quickly. Even though that software is also good, but it did not give an option to specify file content, or place test files in different sub-directories. This is where FileGen exceeds.
Let’s see in detail how to use this software.
How to Generate Lot of Files for Testing Quickly:
If you are a developer who needs to test the software on a large number of files, then it is always tricky to create such files manually. Even though there are options out there to just create files with empty or random content quickly, but if you want some meaningful content in those files, then it is not easy. For example, you might be working on a software to find and replace multiple text strings together. In that scenario, not only you need to generate a lot of files, but you also want to add variable content to them, so that not all the content is same. All this is possible using this freeware to generate test files quickly.
Start by downloading this software from here. The software is very small in size; just 43 KB! Once you have downloaded the zip file, extract it, and run the exe. As I mentioned earlier, it is a portable software, and nothing is required to be installed. When you run it, you will see interface like below:
As you can see, the interface of this software is pretty intuitive. Let me still quickly walk you through the interface, and then I’ll let you know how to use this software to generate a lot of test files with different criteria quickly.
- At the top of the interface, you will provide the path where you want the files to be created. Do note that the path has to be correct, otherwise the software will crash.
- Below that you can choose to create random filename or define string of filename. In latter case, this software will append number like 1,2,3 etc. to end of the filename string while creating test files.
- In the same row, you can choose or specify extension of the files that you want to create.
- Below that you can specify number of files to create. Next to that, you can choose if you want to create sub-folders also. Now, this sub-folder thing is pretty confusing. I will talk about it a bit later.
- Below that you can choose to have random file contents or fixed file content. If you choose random content, you can specify filesize in bytes.
- Below that you can give the content that should go in your files. You can also choose to add variables to the content, and then specify the values for those variables in the table below.
- Once you are done with everything, click on “Generate” button to quickly create files. The time taken to create files will depend on the complexity of settings that you did. In my testing, I was able to generate 1,000 test files in just a few seconds. That’s pretty quick!
Now let’s see how you can use the above features to generate a lot of dummy test files quickly. I will cover 3 different cases here:
- Generate lot of test files of fixed size
- Generate lot of test files with same content
- Generate lot of test files with variable content
1. How to Create Lot of Test Files of Fixed File Size:
If you are looking to just create a lot of test files of a fixed filesize, then this software makes that pretty easy. Do following settings in the software for that:
- Specify the number of files you want to create.
- Choose option “Random Contents”.
- This will enable the File size box. Specify filesize in bytes.
After this, just click on “Generate” button and this software will create those number of files with random text in them. The size of all files will be same, and will be exactly what you defined.
This option is useful if you want to generate very large files for testing. Just give a large filesize to generate large dummy test files.
It is worthwhile to mention here that the above can also be achieved using fsutil command of Windows, by just putting that command in a loop. To do the same what I did above, the command would like below:
For /L %i in (1,1,1000) do fsutil file createnew E:/Temp/ILoveFreeSoftware%i.txt 1024
and this can be executed from command prompt. You can read more details of this method here.
2. How to Create Many Test Files with Same Content:
This is another use of this freeware: create lots and lots of test files quickly, with same content. Make following settings in the software for that:
- Specify number of files to be created
- Uncheck the “Random Contents” option. When you do that, you will see that File size option has been disabled, because now the size of the file would be determined by the content that you decide to add in the files.
- Also, you will see that the big text box below the File Contents has enabled now. This is where you can add the content that you want to go in your files. I am not sure of the limit of the content that you can add in the files, but I was able to add around 850 lines of content.
After that, click on “Generate” button to generate test files with same content.
As you can see in the screenshot above, the files have exactly same content. This process was also quite fast.
Now, if you want to add a lot of text in your files, then there might be some limit added by this software. In that case, you could do a clever thing. Use this software to create files with as much content as this lets you. After that, use some free software to replace text in multiple files to replace any text with the remaining text that you wanted to add.
3. How to Generate Lot of Test Files with Variable Content:
I personally believe this is the most powerful feature of this software. You can generate variable file content by using different variables in your content. And the best part is that the values of those variables could be provided via separate files. For example, let’s say you want to generate 100 test files with same content, but in each file you want to put a different employee name and also name of the city where the employee lives. Then, you can define two variables in your content: one for employee name and another for city name. Then you can make separate files which will have names of all the employees and names of all the cities for those employees.
After that, you can use this software to generate those 100 test files with correct employee names and city names. This is like basically doing a mail merge on content.
Let’s go through steps to see how it is done. I will take the same example of employee name and employee city that I mentioned above.
- First of all, you need to decide which variables you need to have. For each variable, make a separate file which will have values for those variables. The file could be in txt, lst, or log format. In our example, we need to make one file with employee name, and another file with employee city.
Do note that it is not necessary to have same number of values for the variable as the number of files you want to create. If you are trying to create 100 files, and only give 5 values for a variable, then those 5 values will be reused.
- Then start the FileGen software. In this, you need to make the same settings as for the fixed content. So, specify filename, file type, number of files, etc. The main thing here is the content. Write the content that you want to add to your test files. Wherever you want to have variable content, add variables like “%1”, “%2”. etc.
- Below that, you will see section where you can add variables. Click on “Add” button to add a variable. Then double click on it to specify the source of data for this variable. As I mentioned earlier, you can specify any txt, lst, or log file. Similarly, add all the variables that you added to your content earlier. The interface of software would look something like below:
- Now click on Generate button. This will generate test files with variable content. Data from the files that you specified will be used.
Now, when I did this, I expected that data from all the files will be used in same sequence, especially if both the files have same number of values for the data. However, turns out that FileGen actually uses data in some random manner and does not preserve the order of data that is provided in the files. See the screenshot below.
The data in final files is not in the same order as in input files. I even tried giving exactly same number of data points as the number of files I was trying to create, still the variable replacement was pretty random. First variable could be replaced by first data point in the file, while second variable could be replaced by third data point. I did not expect that. I have even sent an email to the developer to confirm if this is the expected behavior and if there is a way around that, but haven’t heard from him yet. However, if you have just 1 variable in your data, and want to replace that dynamically with data in your list, then this should work fine.
Create Test files in Sub-Folders:
I mentioned earlier that it has an option to create many test files inside sub-folders. Only parameter that you can specify for sub-directories is a number. I initially thought it would indicate how many sub-directories would be created and test files would be created inside them. However, this number actually denotes depth of sub-folders. So, if you give number 2, then it would create a sub-folder inside another sub-folder. However, it would create sub-folders randomly, so there would be some sub-folders which don’t have any sub-folder and some would have upto the depth you specified. So, it takes a random approach to that. I can see how that can be useful while testing.
My Final Verdict:
I really like this software because it makes the process of creating lot of test files very easy. The software is easy to use and the interface is intuitive. When I started testing this software, I was most excited by its variable replacement feature, but when I discovered that the feature does not work as intended for more than 1 variable, I was disappointed. Nevertheless, you can still use this for adding just 1 variable and getting correct data in your test data. Or, if you want to get a lot of random data for different variables, then you can use substitution for multiple variables too.
All in all, definitely a useful software.