Sort:  

I found this stack exchange post with a list of possibilities. I've not used any of them and have no idea how well they work.

The complicated side of emulating Arduino's is that you need to emulate the chip, and not all boards use the same one. An Uno uses a different chip to a Mega, for example. That complicates things. I've always said to myself if I ever end up a squadrillionaire (that's more zero's than there are atoms in the observable universe), I'd write one. It'd be a fun project, but not for the faint of heart.

But in all honesty these things are so cheap ($50 or so) you don't lose much if it ends up collecting dust in a cupboard. For me an emulator would help with automated testing.