Netbeans 配置文件 JUnit 4 问题
我有一个需要 200 秒才能运行的单元测试。我正在尝试使用 NetBeans 分析器来加快速度。但分析器不运行单元测试。它只是创建一个测试对象并退出。不运行实际的测试方法或@Before / @After 方法。
这是一个使用 Surefire 和 junit 4 的 Maven 项目。
部分输出如下。
Profiler Agent: Waiting for connection on port 5140, timeout 10 seconds (Protocol version: 9)
Profiler Agent: Established local connection with the tool
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.cris.puzzle.solvers.SudokuSolverTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.031 sec
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
Profiler Agent: Connection with agent closed
Profiler Agent: Connection with agent closed
Profiler Agent: Initializing...
Profiler Agent: Options: >C:/Program Files/NetBeans 6.8/profiler3/lib,5140,10<
Profiler Agent: Initialized succesfully
------------------------------------------------------------------------
BUILD SUCCESSFUL
------------------------------------------------------------------------
Total time: 14 seconds
有谁知道如何让它发挥作用?谢谢。
I have a unit test that takes 200 sec to run. I am trying to use NetBeans profiler to speed it up. But the profiler doesn't run the unit test. It just creates an object of the test and exits. Doesn't run the actual test methods or @Before / @After methods.
This is a maven project with surefire and junit 4.
And partial output is below.
Profiler Agent: Waiting for connection on port 5140, timeout 10 seconds (Protocol version: 9)
Profiler Agent: Established local connection with the tool
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.cris.puzzle.solvers.SudokuSolverTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.031 sec
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
Profiler Agent: Connection with agent closed
Profiler Agent: Connection with agent closed
Profiler Agent: Initializing...
Profiler Agent: Options: >C:/Program Files/NetBeans 6.8/profiler3/lib,5140,10<
Profiler Agent: Initialized succesfully
------------------------------------------------------------------------
BUILD SUCCESSFUL
------------------------------------------------------------------------
Total time: 14 seconds
Does anyone know how to make it work? Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有一个解决方法。暂时将测试代码移至应用程序代码中。对其进行分析并改进。完成后,将改进后的代码移回 JUnit 代码。
There is a workaround. Move your test code into application code temporarily. Profile it and improve it. Once finished, move back your improved code to JUnit code.
不知道,您的操作系统是什么,但是在 Win 7(也可能是 Vista)中,JUnit 存在问题,它需要对其目录具有写权限(该目录位于程序文件中 NetBeans 的默认安装中,并且在那里它没有此访问权限)。但在这种情况下,您可能从一开始就会遇到 JUnit 本身的问题。
Don't know, what is your OS, but in Win 7 (and probably also Vista), there is the problem with JUnit that it needs to have write permission to its directory (which is in default installation of NetBeans in Program files, and there it has not this access). But in that case, you would probably have problems with JUnit itself from the beginning.