Junit4 架构设计系列(2): Runner.run()与Statement
Overall## 系列入口: Junit4 架构设计系列(1): Request,ClassRequest 和 RunnerBuilder 前文中,我们基本理清了Junit4执行Case大体上的Flow: Request -> ClassRequest.getRunner() -> AllDefaultPossibilitiesBuilder.safeRunnerForClass() -> runner.run() 并且介绍了类Request,ClassRequest,和RunnerBuilder,剩下runner.run()没讲,那本文就从这说起。 Runner.run()是如何执行Case的?## run()方法是抽象类Runner定义的一个方法,目的就是执行Case。各个Runner的子类都要实现这个方法。 /** * Run the tests for this runner. * * @param notifier will be notified of events while tests are being run--tests being * started, finishing, and failing */ public abstract void run(RunNotifier notifier); 从前文知道