Thursday, January 8, 2009

Setting up JWebUnit Step 54

So now I will show you how you can write some unit tests. First, we will set up JWebUnit which can be used to simulate the functions of a browser.

First, download JWebUnit from this site: http://sourceforge.net/project/showfiles.php?group_id=61302

The version we are using is JWebUnit-2.1.

After you have downloaded it, you should unzip it and copy the jwebunit-core-2.1.jar and the jwebunit-htmlunit-lugin-2.1.jar in your lib folder of your project. You should also copy all of the jar files from the lib folder of your webunit download. Set your build path in eclipse to point to these libraries. You will also need to make sure your eclipse is set for JUnit3 and not JUnit4. You can changed your JUnit configuration by selecting the right mouse button an a class->Run As->Run Configuration. Under TestRunner, you can select the version of JUnit you are using.

Create a package called com.testing and in that package create a class called FirstTest.java.

In my next post I will show you how to create some test cases to test your application.

Go To Step 55

0 comments: