A Tutorial on JUnit in Eclipse
A Tutorial on JUnit in Eclipse
Table of contents
- (一)System Environment
- (二)Prerequisite
- (三)Goal
- (四)Solution
- (五)Video
- (六)Attention
- (七)References
- (八)Command List
- (九)Download File pdf
(一)System Environment:
- J2SE Development Kit version 1.5 (abbr. JDK 1.5)
- Eclipse IDE version 3.2 (abbr. Eclipse 3.2)
- Windows OS or Linux OS
(二)Prerequisite:
- Your Computer must be online.
- Download the follow Packages
..Download JUnit version 4.1, here
..Download FunctionalJ version 0.8 JDK 1.5, here
..Download log4j version 1.2.14, here
(三)Goal:
- JUnit is a Java Test Framework, with which Java classes can originally be tested automated. That is a short introduction to JUnit.
- You can get this codes from Google Code Hosting:
svn co http://cnjava.googlecode.com/svn/trunk/testing/daoxi_junit/
(四)Solution:
- Create Eclipse Java Project daoxi_junit
- Add Packages to Project daoxi_junit
..Add JUnit junit-4.1.jar to Project daoxi_junit
..Add FunctionalJ functionalj-0.8-jdk15.jar and cglib-nodep-2.1_3.jar to Project daoxi_junit
..Add JUnit log4j-1.2.14.jar to Project daoxi_junit - Process Class Daoxi
..Add Package com.hhtong.examples.junit.step01
..Add Class Daoxi
..Add Class Daoxi Code
..Run Class Daoxi as Java Application - Process Class DaoxiTest
..Add Package com.hhtong.examples.junit.step01
..Add Class DaoxiTest as JUnit Test Case
..Add Class DaoxiTest Code
..Run Class DaoxiTest as Java Application
..Run Class DaoxiTest as JUnit Test - All other steps are as (3) and (4).
(五)Video:
(六)Attention:
- Note Project "daoxi_junit" to the test class methods
..The name must begin with “test”
..You may not have parameters
..You must be allowed "public" and not "static" to be
See German References 2 - Note JUnit version 4.1
..Es exists not the class junit.swingui.TestRunner. It appears that they've dropped that class.
See English References 3
(七)References:
- http://functionalj.sourceforge.net/ch01.html
- http://www.torsten-horn.de/techdocs/java-junit.htm
- http://forum.java.sun.com/thread.jspa?threadID=762667&messageID=4351924
(八)Command List:
(九)Download File pdf:
About this entry
You’re currently reading “A Tutorial on JUnit in Eclipse,” an entry on Mammox 【道喜技术日记】
- Published:
- October 26th 12:26 PM
- Updated:
- October 26th 04:43 PM
- Sections:
- Java Language

0 comments
Jump to comment form | comments rss [?]