Because the tests should simulate the real behaviour. When the tests tests a view, the middleware is called and the cache is created. If there is a bug in this middleware, that the cache would not be created, the tests could not detect it. Or if there was a but, that occur if the setup_cache() is called two times.