Debugging eclipse unit test code “Test class should have exactly one” and “Workspace is closed” error

筅森魡賤 提交于 2020-01-06 07:17:55

问题


I'm trying to build eclipse plugins (org.eclipse.jdt.ui.tests.refactoring).

Downloading the source from the git, and I could build the project. I wanted to debug into ExtractMethodTest routine, I just set a breakpoint in a setUP routine, and launch the debugger.

However, I got an initialization error.

Then, I tried to launch the debugger by right click on the ExtractMethodTests.java in package explorer to get Workspace is closed error.

What might be wrong? I just wanted to launch ExtractMethodTests.java unit test to trace the code line by line.

回答1:


Are you trying to run with the wrong version of JUnit? Eclipse ships with both JUnit 3 and Junit 4 compatible runtimes.

Secondly, does your unit test actually have a 0-arg constructor?

Clearly, I didn't check the code base to see if the Eclipse people know how to create the unit tests. I'm just assuming they do.




回答2:


"Test class should have exactly one" error

Using JUnit 3 as a test runner solved the first issue, but I still have the workspace issue. I'll open another post for it.

"Workspace is closed" error

From the hint of Workspace is closed error, I executed the test as a plugin test to make it work.



来源:https://stackoverflow.com/questions/13889273/debugging-eclipse-unit-test-code-test-class-should-have-exactly-one-and-works

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!