如何在Eclipse中创建存根Junit测试? [英] How can I create stub Junit tests in Eclipse?

查看:67
本文介绍了如何在Eclipse中创建存根Junit测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

解决方案

在Eclipse(伽利略)中有一个简单的方法为Junit4测试创建存根? Package Explorer 视图,右键单击要为其创建JUnit测试的文件。在打开的上下文菜单中,选择新建 - > 其他... 。在选择向导对话框中,选择 Java - > JUnit - > JUnit测试用例

然后打开一个对话框。如果您有默认的 Maven Gradle 项目,您可能需要从提供的源文件夹 > $ {PROJECT_NAME} / src / main / java 至 $ {PROJECT_NAME} / src / test / java 。如果您单击下一步,该对话框允许您检查哪些方法可以自动创建存根。


Is there a simple way of creating stubs for Junit4 tests in Eclipse (Galileo)?

解决方案

In the Package Explorer view, right-click on the file that you would like to create a JUnit test for. In the opened context menu, select New -> Other... . In the Select a wizard dialog, select Java -> JUnit -> JUnit Test Case .

Then a dialog opens. In case you have a default Maven or Gradle project, you will probably have to change the default Source folder from the provided ${PROJECT_NAME}/src/main/java to ${PROJECT_NAME}/src/test/java. If you click Next, the dialog allows you to check which methods to automatically create stubs for.

这篇关于如何在Eclipse中创建存根Junit测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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