in reply to Unit testing OS rich code
I think I would create a temporary directory & files and just run your code against that.
That way you don't have to mock the os functions at all. In your example it looks easy enough - just touch some file names. Of course if you need to do more complex things, maybe reading info from the files, you may have to keep a set of test files that you copy into your temp dir before you begin the tests.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Unit testing OS rich code
by Voronich (Hermit) on Oct 12, 2011 at 15:54 UTC | |
by chromatic (Archbishop) on Oct 12, 2011 at 20:20 UTC | |
by Voronich (Hermit) on Oct 12, 2011 at 20:30 UTC | |
|
Re^2: Unit testing OS rich code
by DrHyde (Prior) on Oct 17, 2011 at 10:14 UTC |