Few months back my company placed me in a java project. I wanted to work with some automation tool not exactly play back and recording. There for I tried my hand in selenium RC. Recently I successfully managed to install RC with
I have seen many of us seeking help to configure RC in their project. All they want to run very first test case. for that, I decided to write some thing which may help to begin with the very first etst case in RC.
Here in my article I will explain how to configure RC with
I am assuming that you are good in using IDE record and playback.
So once you done your recording with IDE convert your recorded script in java. for this click on OPTIONS->FORMAT and choose java. save this test case as simple java file.
so you have your test case say test.java.
Now follow the steps to configure Rc and java client driver with
1- Download Selenium-RC from the SeleniumHQ downloads page and save this some where you want.
2- launch
3- Create a new java project (I guess you are aware of creating a new project in
4- Add external jar files. (from the location where you have already saved downloaded selenium rc)
5- Add your saved java file(which you have saved after recording in IDE) to this project
6- Now run this as Junit test
here I am giving some explanation which might help you to get the things easily.
This is the java code which i have recorded using IDE to test the search in Google.
import junit.framework.*;
import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;
import com.thoughtworks.selenium.SeleneseTestCase;
public class test1 extends SeleneseTestCase {
public void setUp() throws Exception {
setUp("http://www.google.co.in/", "*firefox");
}
public void testVishal() throws Exception {
selenium.open("/");
selenium.type("q", "vishal sachan");
selenium.click("btnG");
selenium.waitForPageToLoad("30000");
verifyTrue(selenium.isTextPresent("vishal sachan"));
}
}
Running your test in multiple browser:
You can now run this test in different browse by initializing the desired browser info like firefox, iexplorer, chrome..
setUp("http://www.google.co.in/", "*firefox") ;
I hope this will help you to get started with you very first test using selenium RC.