I need to test my web app in a scenario where there’s no disk space remaining, i.e. I cannot write any more files. But I don’t want to fill my hard drive with junk just to make
A quick and easy solution would be setting up a Quota for a specialized user account. Quota support on Mac OS X
If you don't mind the hassle to set it up, and the fact that you probably need a second license for your operating system, a Virtual Machine is probably the best idea with the most long-term possibilities.