我尝试从我的main()
方法运行 junit:
public static void main(String... args) throws ClassNotFoundException, IOException {
...
logger.debug("className " + className + "methodName " + methodName);
Request request = Request.method(Class.forName(className), methodName);
return new JUnitCore().run(request);
}
这是我的TestClass。
当我没有@BeforeClass
方法时,它被称为 OK
但是当我添加@BeforeClass
这条线时没有进入setup()
方法(我尝试调试)
// @BeforeClass
// public void classSetup()
// {
// logger = new Logger();
// stringUtils = new StringUtils(logger);
// }
@Before
public void setup() {
logger = new Logger();
stringUtils = new StringUtils(logger);
}
@Test
public void test1() throws Exception {..}
}