[FAQ]如何安装JUnit?

发表于:2009-09-23来源:作者:点击数: 标签:junitJunitJUnitJUNITFAQ
[FAQ]如何安装JUnit? 软件测试工具 First, download the latest version of JUnit, referred to below as junit .zip. Then install JUnit on your platform of choice: 1.Windows To install JUnit on Windows, follow these steps: Unzip the junit.zip di

[FAQ]如何安装JUnit?  软件测试工具

First, download the latest version of JUnit, referred to below as junit.zip.

Then install JUnit on your platform of choice:

1.Windows

To install JUnit on Windows, follow these steps:

Unzip the junit.zip distribution file to a directory referred to as %JUNIT_HOME%.

Add JUnit to the classpath:
set CLASSPATH=%CLASSPATH%;%JUNIT_HOME%\junit.jar

2.Unix (bash)

To install JUnit on Unix, follow these steps:

Unzip the junit.zip distribution file to a directory referred to as $JUNIT_HOME.

Add JUnit to the classpath:

export CLASSPATH=$CLASSPATH:$JUNIT_HOME/junit.jar

(Optional) Unzip the $JUNIT_HOME/src.jar file.

Test the installation by using either the textual or graphical test runner to run the sample tests distributed with JUnit.

Note: The sample tests are not contained in the junit.jar, but in the installation directory directly. Therefore, make sure that the JUnit installation directory is in the CLASSPATH.

For the textual TestRunner, type:

java junit.textui.TestRunner junit.samples.AllTests
For the graphical TestRunner, type:

java junit.swingui.TestRunner junit.samples.AllTests
All the tests should pass with an "OK" (textual) or a green bar (graphical).

If the tests don't pass, verify that junit.jar is in the CLASSPATH.

Finally, read the documentation.

Fp:

Junit安装步骤分解

01:首先将 Junit压缩包解压到一个物理目录中(例如C:\Junit3.8.1)

02:记录Junit.jar文件所在目录名(例如 C:\Junit3.8.1\Junit.jar)

03:进入操作系统(以Windows2000操作系统为准),按照次序点击“开始 -> 设置 -> 控制面板”

04:在控制面板选项中选择“系统”,点击“环境变量”,在“系统变量”的“变量”列表框中选择“CLASS_PATH”关键字(不区分大小写),如果该关键字不存在则添加

05:双击“CLASS_PATH” 关键字添加字符串“C:\Junit3.8.1\Junit.jar”(注意,如果已经有别的字符串请在该字符串的字符结尾加上分号“;”),这样确定修改后Junit就可以在集成环境中应用了

Junit的卸载步骤如

01:首先将 Junit压缩包删除。

02:进入操作系统(以Windows2000操作系统为准),按照次序点击“开始 -> 设置 -> 控制面板”。

03:在控制面板选项中选择“系统”,点击“环境变量”,在“系统变量”的“变量”列表框中选择“CLASS_PATH”关键字(不区分大小写)。

原文转自:http://www.ltesting.net