Ranadheer Reddy Ranadheer Reddy - 6 months ago 21
Java Question

Working with JUnit Framework

i have a Java program like this. (Which is exported from Selenium IDE.)

package com.example.tests;

import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;

public class NewTest extends SeleneseTestCase {
public void setUp() throws Exception {
setUp("http://www.google.com/", "*firefox");
public void testNew() throws Exception {
selenium.type("q", "selenium rc");
assertTrue(selenium.isTextPresent("Results * for selenium rc"));

I want to run this program in EditPlus.

I have installed JDK and executed some other Java programs (in command prompt). But this programs giving errors.

I have to add JUnit framework some where to run this program. Where should I add? And any other things I have to do? Please help me...


It seems that the compiler can't find Selenium in your classpath.

You will have to download the newest and shiniest Selenium-Java package from here: http://code.google.com/p/selenium/downloads/list and extract it somewhere (example below extracted to lib/ folder in the project). That should contain everything you need, including JUnit.

I don't know how EditPlus works, but you should then reference the extracted .jar files in your classpath somehow. There should be an option to add libraries to your project. If there's no such thing, then add those into your .classpath file manually:

<classpathentry kind="lib" path="lib/selenium-java-2.20.0.jar" sourcepath="lib/selenium-java-2.20.0-srcs.jar"/>
<classpathentry kind="lib" path="lib/libs/apache-mime4j-0.6.jar"/>
<classpathentry kind="lib" path="lib/libs/bsh-1.3.0.jar"/>
<classpathentry kind="lib" path="lib/libs/cglib-nodep-2.1_3.jar"/>
<classpathentry kind="lib" path="lib/libs/commons-codec-1.6.jar"/>
<classpathentry kind="lib" path="lib/libs/commons-collections-3.2.1.jar"/>

...yadda yadda yadda, all of those libs that selenium needs.