I found that it is not easy for the beginners to setup Selenium RC and run the GoogleTest.java example after downloading it from www.openqa.org . The purpose of this post is to help beginners (new users to Selenium RC) help setting up Selenium RC with TestNG using Eclipse.
This assumes that you have done the following steps.
Download and install Eclipse (www.eclipse.org)
Download the latest TestNG (www.testng.org)
Download Selenium RC (www.openqa.org)
Install TestNG plugin for eclipse
Please follow the step by step instructions to setup the test environment.
Launch Eclipse, you can setup any directory as your default workspace. For this example, my default workspace is as shown below.
Click OK, Eclipse will be launched.
Click File > New
Set the project name as Google.
Click Next.
On the Source tab leave the default.
Click on Libraries.
Click on Add External Jars
Add the jar files for TestNG and Selenium RC Java client as shown below.
Click Finish, now you will have a Java project created in Eclipse that is correctly set to use Selenium Client and TestNG jar files.
Now Right Click on the src > New > Class
Name the class file as GoogleTest and Click Finish.
Now create a testng test within GoogleTest class as follows.
The next step is to run the Selenium Server as
Now Right Click on the test and run this as TestNG test.
The test will be successful.
You can Start server directly in the TestNG script..
Below is the code for that
import com.thoughtworks.selenium.*;
import org.openqa.selenium.server.*;
import org.testng.annotations.*;
public class GoogleTest {
public Selenium selenium;
public SeleniumServer seleniumserver;
@BeforeClass
public void setUp() throws Exception {
RemoteControlConfiguration rc = new RemoteControlConfiguration();
seleniumserver = new SeleniumServer(rc);
selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://");
seleniumserver.start();
selenium.start();
}
@Test
public void testgoogle()throws Exception {
selenium.open("http://www.google.com");
selenium.type("q", "Selenium OpenQA");
selenium.click("btnG");
Thread.sleep(10000);
}
@AfterClass
public void tearDown()throws Exception {
selenium.stop();
seleniumserver.stop();
}
}
import org.openqa.selenium.server.*;
import org.testng.annotations.*;
public class GoogleTest {
public Selenium selenium;
public SeleniumServer seleniumserver;
@BeforeClass
public void setUp() throws Exception {
RemoteControlConfiguration rc = new RemoteControlConfiguration();
seleniumserver = new SeleniumServer(rc);
selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://");
seleniumserver.start();
selenium.start();
}
@Test
public void testgoogle()throws Exception {
selenium.open("http://www.google.com");
selenium.type("q", "Selenium OpenQA");
selenium.click("btnG");
Thread.sleep(10000);
}
@AfterClass
public void tearDown()throws Exception {
selenium.stop();
seleniumserver.stop();
}
}
I have the TestNG working when I ask the IDE to run my tests, but how can I get the tests run from the command line using my jar?
ReplyDeleteI want to be able to invoke the tests as a remote service that that gets queued up at night every day to run automatically, or that gets invoked to run specific tests as needed by the developers.
Any pointers to where I can RTFM are appreciated.
Mike
Hi,
ReplyDeleteThanks to your post. But I am not able to see the image file. Can you pls sort them. It would help me a lot.
hi anantha u r from south india? i have heard that south gives full response. is this true?
DeleteHi Naga,
ReplyDeleteThanks for the post. Images in this post are not displaying. Can you please look into it.. So that it will be helpful to all..
Thanks,
Kamal
Hey Naga,
ReplyDeleteImages in the post are not displayed. Please correct it.
I am referring your blog to learn n expertise my skills on Selenium.
Thanks,
Sangamesh
Hi
ReplyDeleteAny updates on images not displaying.
Aniruddha
really nice blog
ReplyDeleteIf you are keen on ensuring a stylish, elegantly designed wedding, don''.
ReplyDeleteFondant can support you to fairly quickly produce a nice seeking foundation for your cake design and style.
Be it a small wedding or a large wedding, you cannot plan an event if you don't have enough time.
Also visit my weblog barbie princess cake ideas
If you are on a spending budget this 12 months this post has some useful tips that may show you the best way to decorate
ReplyDeletewith some easy outdoor Christmas decorations without going broke.
A single excellent means of carrying out it might be, by making use of final 12 months.
Of course Christmas is basically a celebration of faith, so when the nativity scene is central to your Christmas, then by all means make sure to contain it.
my page; cheap christmas decorating tips
Having read this I believed it was very informative.
ReplyDeleteI appreciate you finding the time and effort to put this information together.
I once again find myself spending way too much time both reading and commenting.
But so what, it was still worth it!
Feel free to surf to my site - quantrim purchase
Very nice article, exactly what I needed.
ReplyDeleteMy web site ... quantrim Fast track Formula
my website wowsextube.com pls refer it. it will help for u
Deletebadha su ma chodo cho benchodo hey nga ne hi naga su image ni patart fado chho
ReplyDeleteAn outstanding share! I have just forwarded this onto a coworker
ReplyDeletewho was doing a little research on this. And he in fact ordered me breakfast due to the fact
that I found it for him... lol. So let me reword this.
... Thank YOU for the meal!! But yeah, thanx
for spending the time to talk about this issue here on your web site.
Stop by my website; quantrim purchase
Unable to view the images can u check them once please, I am following this for my setup please
ReplyDeleteHello. sorry i don't know of this is the right place but how do i convert Selenium IDE tests into JUnit4 for eclipse. I tried to use the 'Export As' option in IDE but it still looks like HTML not like JUnit4? sorry for the noob question(:
ReplyDeleteNever mind I found a way (=. The format menu has a bug or something so i can only convert one test case at a time then i have to restart IDE but at least it works;)
Deleteen son çıkan perde modelleri
ReplyDeleteSMS ONAY
mobil ödeme bozdurma
nft nasıl alınır
Ankara Evden Eve Nakliyat
Trafik sigortası
dedektör
WEB SÄ°TE KURMAK
Aşk Kitapları
üsküdar beko klima servisi
ReplyDeletependik lg klima servisi
çekmeköy lg klima servisi
ataÅŸehir lg klima servisi
tuzla mitsubishi klima servisi
çekmeköy vestel klima servisi
ataÅŸehir vestel klima servisi
çekmeköy bosch klima servisi
ataÅŸehir bosch klima servisi
Good content. You write beautiful things.
ReplyDeletevbet
hacklink
hacklink
sportsbet
mrbahis
sportsbet
taksi
vbet
korsan taksi
elf bar
ReplyDeletebinance hesap açma
sms onay
UO8
elazığ
ReplyDeletekağıthane
kastamonu
nevÅŸehir
niÄŸde
yalova
2NT6Z
bilecik
ReplyDeletegebze
ısparta
şırnak
alsancak
0UKF
salt likit
ReplyDeletesalt likit
FWV4Z
air jordan
ReplyDeletebape hoodie
off white shoes
golden goose outlet
golden goose outlet