【软件测试】JUnit、Hamcrest、Eclemma的安装

时间:2022-02-20 05:12:42

JUnit、Hamcrest、Eclemma的安装

JUnit

去JUnit的官网http://junit.org/junit4/下载junit的jar包

【软件测试】JUnit、Hamcrest、Eclemma的安装

点击“jar”下载junit的最新jar包。

下载成功后的图标

【软件测试】JUnit、Hamcrest、Eclemma的安装

Hamcrest

去hamcrest的官网http://hamcrest.org/下载hamcrest的jar包

【软件测试】JUnit、Hamcrest、Eclemma的安装

下载hamcrest-all的jar包。

下载成功后的图标

【软件测试】JUnit、Hamcrest、Eclemma的安装


在Eclipse中安装JUnit和Hamcrest

打开eclipse软件,新建一个java工程,在工程下面新建文件夹lib,如下图所示

【软件测试】JUnit、Hamcrest、Eclemma的安装

将下载好的junit-4.12.jar和hamcrest-all-1.3.jar放入文件夹lib中,如下图所示

【软件测试】JUnit、Hamcrest、Eclemma的安装

选中项目,点击右键,然后build path,如下图所示

【软件测试】JUnit、Hamcrest、Eclemma的安装

生成如下图所示的文件

【软件测试】JUnit、Hamcrest、Eclemma的安装

到此为止,JUnit和Hamcrest已经安装成功。


在Eclipse中安装Eclemma

 From your Eclipse menu select Help → Eclipse Marketplace.

 Search for "EclEmma".

 Hit Install for the entry "EclEmma Java Code Coverage".

 Follow the steps in the installation wizard.