jespersh739124dI mock if I have something that acts outside the tests memory.
So if I need something from the disk, network or sensors
Component is a broad term. For UI tests, I generally do them in integrated e2e fashion. For methods, I'll test the public interface with a staged mockup for all happy path conditions and then edge cases.
My preferred approach is to run through a series of escalating processes that represent usage flows so you're exercising the system in a natural way.
If you're referring to mocked web apps like Sandbox, there's a huge difference between deep mocks (cumbersome, costly, rock headed stupid... the sort of thing contract QAs do to justify their existance) and broad mocks, where some condition (such as particular input, rather than latent state) gives rise to a wide variety of behaviour. Above all, they are and must be individually shallow. Mocks must be economical, easily groked and easily modified, which deep mocks will never be.