Mac: If your Mac is having intermittent problems when it’s under a heavy load, you can perform a simple stress test in the terminal to try and reproduce the problem.
All you need to do is run the “yes” command, which will push the CPU until its limit:
yes > /dev/null &
If you have a CPU with multiple cores (which most modern Macs do), you'll have to run it as many times as you have cores. For example, if your CPU has four cores, you'd run:
yes > /dev/null & yes > /dev/null & yes > /dev/null & yes > /dev/null &
The fans will often kick in so you can see how loud they are, and see if indeed your Mac is crashing under a heavy load. Putting this much of a load will also help discharge the battery. Just remember to kill the process when done or you'll wonder why your Mac is running so slowly.
Stress Test a Mac by Maxing Out CPU [OS X Daily]