Test File Manager
When I'm writing apps that usually means I'm using files to test the app with. Some of the files are mine, occasionally I'll need to use someone else's (like when writing PeekIt). I often need to have a test file of a certain size, or with some interesting content . I usually end up duplicating an existing file and modifying it manually (with PeekIt). That gets tedious. So I just wrote Test File Manager (TFM) for myself to manage the files I use for testing.
TFM is a central management app for all your test files. It also can create test files of any size, corrupt test files (to see how an app manages bad data), and places bytes in files to simulate certain conditions. All of these actions can be done repeatedly through Preset, and preset actions can be chained to make life a little easier. I still have quite a few more things I want to add to TFM, so check back regularly!
Download Test File Manager version 2.0 copyright © 2013 C.K. Haun & Ravenware Industries, all rights reserved worldwide.
Version 2.0 notes
- Added actual file management. Major change for this release
- Added a seperate byte placer action
- Test file management
- Test File Creation
- Test file actions
- Test File Corruption
- Test file byte placement
- Preset Management
- Additional notes
- Version history
TFM will, surprisingly, manage test files for you. The top left list is for all the test files you want to use during development.
To add a test file for TFM to manage, either click the plus button and select a file, or drag files from the Finder onto the list.
When you add a file to TFM, TFM makes a copy of the file and places it in the TFM cache area (~/Users/Library/Application Support/Test File Manager/CachedFiles/). TFM keeps clean copies of that file forever on, and never operates on that original file, helpful if you need to recover the original in the future.
To work with that file, select the file and click use. TFM will prompt you for the location you want the file to be placed, and copy and place the file. If you click the automatically overwrites checkbox in the TFM window or in the save panel, TFM will always place the file at the last location selected and not prompt you if it's going to overwrite an existing file. Use with caution, of course.
The file list also will contain any File generators you have created in the Generator section. Select a file generator in the file list, click use, and the file will be created for you.
The right hand list contains all the Presets you have created (except file generators). This allows you to execute those presets on the files in the Files list.
To use, select a file. Then check the checkbox for all the presets that you would like to have applied to that file. When you click the use button, the file will be moved or created as above, then the presets you have checked for that file will be applied to that file. Note: The presets will not be applied in a defined order currently. They might be in list order, they might be in the order you clicked them, they might be in some other order. If this is a big deal let me know and I'll change this to allow you to define an order.
Remove files from TFM's management by selecting a file and clicking the minus button. The file will be deleted from the TFM cache folder permenently, use with caution. Note that you cannot remove file generators this way, to remove a file generator go to the presets pane and remove it there.
The rebuild list button should never be needed, but if the file list looks funky, click it.
The actions panel is where you create and manage TFM presets
To create a test file, select the Generator tab. Then select one of the Contents buttons and click Generate.
Random creates a file filled with random numbers (using arc4random). BTW, if you do file compression this is a easy way to see how your compression algorythm works in the worst-case scenario of no perceptable patterns.
Sequence lets you pick a starting number and increments that number the amount of times you specify, then restarts the sequence.
Repeating pattern lets you specify the byte pattern you want repeated throughout the file.
Please let me know what you think the maximum pattern you'd like to use might be. I give you a small edit box, you might want more.
Size lets you pick from a variety of file sizes, or enter a specific byte count you need.
With any option, you can ask TFM to place a byte pattern at a specific location
TFM will do the file creation based on the main settings, then place this byte pattern in the file.
File extension lets you set the file extension. Of course, TestFileMaker does not care about the file extension for the content of the file, it just tacks it onto the file name. So if you put "png" you do not get a png file, you get a mess of bytes that calls itself a "png" but ain't. This is actually very useful for tracking error handling in your own app to see if you can handle a corrupted file.
Then click "generate" and the file will be generated. Note that file sizes above 500 mbyte might take a while to generate, be patient, I create the file in 100k chunks.
Version 1.1 of TFM brings the ability to corrupt a test file. This can be very useful in stress-testing your application to see how well you can handle a file that has been damaged in some way.
CAUTION! Using this feature irrevocably damages the file you tell it to damage! Always work with copies! Don't blame me if you don't.
- The first option goes through the entire file and changes every byte.
- The second option picks random locations in a file to corrupt, you pick how many.
- The third option asks you to enter a location in a file to corrupt, and indicate how many bytes to corrupt
- The fourth option allows you to enter a byte pattern, TFM will then find that byte pattern in the file and corrupt that pattern.
Version 2.0 adds a dedicated byte placer action. Pretty simple, place a series of bytes at a specified location, or search the file for a byte pattern and place the bytes at the location of that pattern.
Version 1.2 adds Presets.
Presets simply and easily capture the current file generator or corruption setting your working with and save it for later. Just click on the Make preset button at the bottom of the window, you'll be prompted for a name and description of this preset, and it will be added to the preset list.
To use a preset, click the Preset tab, select a preset, and click Activate. The appropriate pane will display, ready for you to click to make the action happen.I'm not doing the action for you, I wanted to (particularly for corruptors) allow you the chance to change your mind after you saw the settings. Let me know if you just want it to happen automatically.
Double-click on the name or description to edit them. Select a preset and click the minus button to delete. If a preset is currently in use for a file (see file management) you'll be alerted and double-checked to see if you really want to delete it.
If you look in the source window you might notice that the preset object looks a little more multi-level than it needs to be, that's because I have Ideas. Also usually confuses me, so I might flatten them in the future too.
Presets are automatically saved when you quit, and reloaded on next launch.
I have quite a few ideas for this feature of TFM, so please check back periodically. And send me suggestions.
TFM currently creates the files , CachedPresets.tfmcache and CachedFilesTOC.tfmcache , as well as creating copies of test files, in Application Support/Test File Manager.
And as usual much of the source is available in the Window menu Window>show source.
C.K. Haun <TR>
Version 1.2 notes 24 Jan 2013
- Added Presets pane, see docs
- added a file name box to the generator
- Made the hex boxes really restrict to hex
- Make the default buttons respond to return key
- Added byte pattern placement for file creation
- New file corruption feature
- Changed the name again. This thing is going to continue to grow, so "manager" seems more appropriate.
- Added a lame icon. Send me a good one, please. 1024x1024 png with alpha and an embedded sRGB profile.
1.0 Initial release