While leveraging Cloud Build for Docker image creation, you're tasked with integrating unit and integration tests into the build process. In the event of a failure, you aim for clear identification of the failing stage in the build history. What's the optimal strategy to achieve this?