8

Intellij IDEA 执行 JUnit 单元测试的正确姿势

 1 year ago
source link: https://iecho.cc/2018/12/23/Intellij-IDEA-%E6%89%A7%E8%A1%8C-JUnit-%E5%8D%95%E5%85%83%E6%B5%8B%E8%AF%95%E7%9A%84%E6%AD%A3%E7%A1%AE%E5%A7%BF%E5%8A%BF/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Intellij IDEA 执行 JUnit 单元测试的正确姿势

Intellij IDEA 执行 JUnit 单元测试的正确姿势

2018-12-23 12:41:01

# 编程

  1. 安装 JUnit 插件

    File -> settings -> Plugins -> Browse repositories -> JUnit -> JUnit Generator V2.0,安装后需重启 Intellij IDEA。

  2. 为当前项目添加依赖

    File -> Project Structure -> Libraries,找到 Jetbrain Intellij IDEA 的安装目录下的 lib 文件夹,添加 hamcrest-core-1.3.jarjunit-4.12.jar 以及 junit.jar

  3. 为待测试类添加测试样例

    在待测类中按 ALT + INSERT,选中 JUnit Test

2018-12-23 12:41:01

# 编程


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK