Eclipse:模拟测试平台

时间:2022-09-11 20:08:55

I am developing an Eclipse plugin and have tests for it. Some are regular JUnit tests, some are PDE tests (i.e. require starting an eclipse instance to be able to access eclipse internals).

我正在开发一个Eclipse插件并对其进行测试。有些是常规的JUnit测试,有些是PDE测试(即需要启动eclipse实例才能访问eclipse内部)。

I wonder if it would be a good idea to try to turn some of the PDE test into regular tests, by creating mock objects for the platform. It would be a lot of work, but I think it would save time because the tests will run faster and we will also be able to use Infinitest for more tests.

我想知道通过为平台创建模拟对象来尝试将某些PDE测试转换为常规测试是否是个好主意。这将是很多工作,但我认为这将节省时间,因为测试将运行得更快,我们也将能够使用Infinitest进行更多测试。

I would appreciate any feedback, so that I can make up my mind about how to proceed.

我希望得到任何反馈,以便我能够决定如何继续。

Thanks in advance!

提前致谢!

best regards, Vlad

最好的问候,弗拉德

2 个解决方案

#1


It will be a lot of work since you can't reuse much of the original code (which is riddled with lots of private final static for runtime data which you can't get rid of nor can you access it).

这将是一项很多工作,因为你不能重复使用大部分原始代码(对于运行时数据来说,这些代码很多都是你无法摆脱的,也无法访问它)。

I suggest to give it a try. If it seems feasible at all, you can implement what you need for your plugin and then hand the result over to the Eclipse community to extend.

我建议试一试。如果它看起来可行,您可以实现插件所需的内容,然后将结果交给Eclipse社区进行扩展。

#2


maybe this helps:

也许这有助于:

http://blog.srvme.de/2010/12/10/mock-eclipse-ifile/

#1


It will be a lot of work since you can't reuse much of the original code (which is riddled with lots of private final static for runtime data which you can't get rid of nor can you access it).

这将是一项很多工作,因为你不能重复使用大部分原始代码(对于运行时数据来说,这些代码很多都是你无法摆脱的,也无法访问它)。

I suggest to give it a try. If it seems feasible at all, you can implement what you need for your plugin and then hand the result over to the Eclipse community to extend.

我建议试一试。如果它看起来可行,您可以实现插件所需的内容,然后将结果交给Eclipse社区进行扩展。

#2


maybe this helps:

也许这有助于:

http://blog.srvme.de/2010/12/10/mock-eclipse-ifile/