0

I have generated a Selenium test for testing a web service and exported that as a Java/Junit4/Remote Control test file. The file looks as follows :

package com.example.tests;

import com.thoughtworks.selenium.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
import java.util.regex.Pattern;

public class RemoteControl {

    private Selenium selenium;

    @Before
    public void setUp() throws Exception {
        selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://rrrtttwwweee.com:8080/xxxx/vvvv/servers");
        selenium.start();
    }

    @Test
    public void testRemoteControl() throws Exception {
        selenium.open("/boingo-object-model/vpn/servers");
        verifyTrue(selenium.isTextPresent("{\"servers\":[{\"name\":\"automatic\",\"dns\":\"auto.ssl.boingovpn.com\"},{\"name\":\"us_west\",\"dns\":\"california.ssl.boingovpn.com\"},{\"name\":\"europe\",\"dns\":\"ireland.ssl.boingovpn.com\"},{\"name\":\"asia\",\"dns\":\"singapore.ssl.boingovpn.com\"}]}"));
        assertTrue(selenium.isTextPresent("{\"servers\":[{\"name\":\"automatic\",\"dns\":\"auto.ssl.boingovpn.com\"},{\"name\":\"us_west\",\"dns\":\"california.ssl.boingovpn.com\"},{\"name\":\"europe\",\"dns\":\"ireland.ssl.boingovpn.com\"},{\"name\":\"asia\",\"dns\":\"singapore.ssl.boingovpn.com\"}]}"));
    }

    @After
    public void tearDown() throws Exception {
        selenium.stop();
    }
}

I now want to use this test file in my eclipse project. I know I will have to download a jar that contains thoughtworks.selenium somehow.

Wondering if someone already has experienced doing something similar before and if they know how to step through the process?

Thanks!

acdcjunior
  • 132,397
  • 37
  • 331
  • 304
Radz
  • 543
  • 2
  • 10
  • 22

1 Answers1

0
  • Create a lib/ folder under your project's root folder.
  • Download Selenium's Java JARs and put them in that lib/ folder.
  • In Eclipse, go to Project -> Properties -> Java Build Path -> Libraries -> Add JARs... and add the JARs from the lib/ folder.

This will enable Selenium inside Eclipse.

If you have an Ant script, don't forget to update it's classpath with something like this (assuming ${lib} points to your lib/ folder):

<javac srcdir="${src.dir}" destdir="${classes.dir}">
    <classpath>
           <fileset dir="${lib}">
              <include name="**/*.jar" />
           </fileset>
     </classpath>
</javac>
acdcjunior
  • 132,397
  • 37
  • 331
  • 304