简体   繁体   English

JUnit-我的某些类方法没有出现Eclipse JUnit向导?

[英]JUnit - some of my class methods don't appear Eclipse JUnit wizard?

When I run the wizard in Eclipse, not all my methods appear in the list to add to the new test case. 当我在Eclipse中运行向导时,并非所有方法都出现在列表中以添加到新测试用例中。

Is this to say I can't test them? 这是说我无法测试它们吗? Or that if I somehow can, I shouldn't test them? 还是如果我可以的话,我不应该测试它们?

Thanks. 谢谢。

The Eclipse wizards won't show private methods - you can't call them directly hence you can't test them directly, which might be what you are seeing. Eclipse向导不会显示私有方法-您无法直接调用它们,因此无法直接测试它们,这可能就是您所看到的。

Instead of thinking about which methods you are testing, you might however want to start thinking of testing in terms of testing the behavior of the class. 但是,您可能不打算考虑要测试哪种方法,而是要开始考虑测试类的行为来考虑进行测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM