Most Windows users wish never to see a single blue screen of death (green screen of death on preview builds) since BSOD often indicates a critical system failure caused by faulty drivers, hardware issues, malware, botched Windows installation, and other PC nastiness. Still, you can use the BSOD mechanism for a better cause. Just make sure you are doing it right.
Windows enthusiasts are familiar with the keyboard shortcut that can trigger a user-initiated blue screen of death: hold the Ctrl key and press Scroll Lock two times. Boom, your system crashed, and all your unsaved data is gone. The shortcut exists so that developers can see how their software behaves upon system crash and gather dump files for further improvement and development.
Some developers thought that mashing keys was too much work, so they tried writing a simple app to automate the process by injecting "the magic key." Raymond Chen, a Microsoft veteran, explained in a blog post why that does not work. The gist is that the keyboard driver recognizes physical input on a much lower level in the input stack, which allows initiating a system crash. Using software to inject keyboard sequences is simply too high in the input chain.
Pressing two keys might indeed be too much when you need to automate testing. Luckily, those in need are not left dead in the waters. Microsoft has a handy tool called NotMyFault (part of the SysInternals software suite), which can trigger different crashes, hangs, or leaks. You can use it to test stack crashes, buffer overflows, high IRQL faults, and more.
Raymond Chen also warned against whacky tactics, like killing winlogon.exe, since approaches like that can create confusion and report non-existing bugs.
You can read more about how to properly crash Windows on Raymond"s "The Old New Thing" blog (via The Register).