当被测试类被重命名时,eclipse会自动重命名单元测试类吗? [英] Can eclipse automatically rename the unit test class when the class under test is renamed?

查看:105
本文介绍了当被测试类被重命名时,eclipse会自动重命名单元测试类吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常在eclipse中使用重构 - >重命名功能,我也有习惯命名关联的单元测试TestedClassNameTest。但是当我重命名测试类时,我不能忘记重命名我的unitTest。重新命名测试类时,自动重命名我的单元测试非常有用。



我想这样做并不难,但是也许这不是必要的吗?

解决方案

经过几次谷歌搜索和eclipse搜索,似乎这样的功能还不可用。



今天在Eclipse中没有类被单元测试的概念。我的意思是,你可以创建一个单元测试类来测试你想要的任何东西:一个完整​​的包,一个类,一个方法,一个完整的插件....



为了获得更准确的结果,您的测试类与相关单元测试之间存在Eclipse关系模式。



我完全同意您的看法,Eclipse中的这样一个功能将会很好。要进一步,能够生成单元测试框架非常酷,因此将这些测试类与测试类相关联。



可能你可以讨论讨论在Eclipse Buzilla上,也许在PDE类别。



Manu


I often use the refactor -> rename functionality in eclipse and I also have the habit of naming the associated unit test TestedClassNameTest. But when I rename my tested class I must not forget to rename my unitTest. It would be extremely useful to rename my unit test automatically when the tested class is renamed.

I guess it wouldn't be that difficult to create a plugin that does the job but maybe that isn't even necessary?

解决方案

After several googling and eclipse searches, it seems such feature is not yet available.

Today there is no notion of "class being unit tested" in Eclipse. What I mean here, is that you can create a Unit test classes testing anything you want: a full package, a single class, a single method, a full plugin ....

To get more accurate, there is "NO relation in Eclipse's model" between your tested class and the associated unit test.

I totally agree with you that it would be nice to such a feature in Eclipse. To go further it would be really cool to be able to generate Unit tests skeletons and thus have these tests classes linked to the tested ones.

May be you can laucnh the discussion on Eclipse Buzilla, maybe in the PDE category.

Manu

这篇关于当被测试类被重命名时,eclipse会自动重命名单元测试类吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆