首页 > 解决方案 > Easy way to run JUnit testcase over and over with @Before and @After method for every run

问题描述

The question here is a variant of Easy way of running the same junit test over and over?

The above mentioned link nicely answered how to run a test repetitively through IntelliJ.

However, I need a way to run the entire test suite multiple times, with @Before and @After for every run.

Any help is appreciated.

标签: intellij-ideajunittest-suite

解决方案


您好,您可以为此目的使用junit Rule

以下是示例链接:

https://www.testwithspring.com/lesson/introduction-to-junit-4-rules/

这是文档链接:

https://junit.org/junit4/javadoc/4.12/org/junit/Rule.html


推荐阅读