Netbeans 配置文件 JUnit 4 问题

发布于 2024-09-02 20:37:48 字数 1120 浏览 3 评论 0原文

我有一个需要 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

葬花如无物 2024-09-09 20:37:48

有一个解决方法。暂时将测试代码移至应用程序代码中。对其进行分析并改进。完成后,将改进后的代码移回 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.

我很OK 2024-09-09 20:37:48

不知道,您的操作系统是什么,但是在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文