Thursday, March 3, 2011

Running a Selenium RC - JUnit Test Case in Eclipse IDE

1. Create a JUnit test case as illustrated here

2. Select the test case which you want to run individually (.java file), right click on it.

3. Select Run As -> JUnit Test (see below figure)
Figure: Running JUnit Test Case
4. The test results can be viewed under JUnit window (see below screen shot)
Figure: JUnit Test Result

Creating a Selenium RC - JUnit Test Case in Eclipse IDE

1. Open Eclipse IDE
2. Create a project
3. Create a package
4. Add JUnit, selenium-server jar files to build path
5. Right click on the project and select New -> JUnit Test Case (as shown in following figure)
Figure: JUnit Test case
6. In the "New JUnit Test Case" window, enter "Source folder", "Package" and "Name". Here name is java class name.
Figure: New JUnit Test Case
7. Now, copy and paste the following code into your test case
Figure: JUnitTestCase_01
8. Similarly, create the following test cases
Figure: JUnitTestCase_02
Figure: JUnitTestCase_03