Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

How to start SeleniumRC in Java IDE?

View previous topic View next topic Go down

How to start SeleniumRC in Java IDE?

Post by zea on Sat Sep 26, 2009 11:58 am

Hello,

I have trouble to run my test with NetBean as below:

public class MercuryTourTest extends SeleneseTestCase {
public static void main (String [] Args)throws Exception{
TestRunner.run(new MercuryTourTest());
}
}

I got the error:
1) MercuryTourTest(com.core.testscripts.MercuryTourTest)junit.framework.AssertionFailedError: TestCase.fName cannot be null
at com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:212)
at com.core.testscripts.MercuryTourTest.main(MercuryTourTest.java:40)

Can anybody please help me with it?

What do you use in main to start your testXXX method?

If using below instead of TestRunner.run(new MercuryTourTest()), it would work.

MercuryTour obj = new MercuryTour();
obj.setUp();
obj.testMercuryTour();

Thanks,

Zea

zea

Posts : 7
Join date : 2009-09-26

Back to top Go down

Re: How to start SeleniumRC in Java IDE?

Post by Adviser on Sun Sep 27, 2009 10:25 pm

Hi,

To start RC through java IDE you have tofirst link your selenium-java jar and junit to your project folder. Next your selenium server must be started before executing code.

I have one simple code created on google site and it is easy to understand and working fine.

Snnipet of code:

import com.thoughtworks.selenium.*;

public class testElementProperty
{
private Selenium browser;


public static void main(String args[])
{
testElementProperty obj = new testElementProperty();
obj.setUp();
}



public void setUp()
{
browser = new DefaultSelenium("localhost",4444,"*chrome", "http://www.google.co.in/");
browser.start();
browser.open("http://www.google.co.in/");
browser.type("q", "selenium rc");
browser.click("btnG");


}


}


Try this and you will get some hint to regarding your problem. Best of luck.

Bye

Adviser
------------------------
------------------------

Posts : 379
Join date : 2009-07-30
Location : India

http://seleniumforum.forumotion.net

Back to top Go down

Re: How to start SeleniumRC in Java IDE?

Post by zea on Sat Oct 03, 2009 11:49 am

Hi,

Thanks a lot for the above code and it works with Java IDE running as a Java application.

Suppose I want to use the same code to set up Selenium RC with TestNG so I can use TestNG's flexibility. I have read TestNG's documentation and tried some pure testNG class, but I had trouble to set up the above simple steps with testNG...

Please help me and thank you,

Zea

zea

Posts : 7
Join date : 2009-09-26

Back to top Go down

Re: How to start SeleniumRC in Java IDE?

Post by zea on Sat Oct 03, 2009 12:36 pm

Hi all,

I just made it working.

from Selelium IDE export as Java TestNG, I got my test class with only one method as below:

package com.example.tests;

import com.thoughtworks.selenium.*;
import org.testng.annotations.*;
import static org.testng.Assert.*;
import java.util.regex.Pattern;

public class GoogleTest extends SeleneseTestNgHelper {

@Test public void testGoogle () throws Exception {

selenium.selectWindow("name=null");
browser.type("q", "selenium rc");
browser.click("btnG");

}

In Eclipse, I needed to modify the above a little:

public class Tour_NG extends SeleneseTestNgHelper {

private Selenium browser;

@Test public void testTour_NG() throws Exception {

browser = new DefaultSelenium("localhost",4444,"*chrome", "http://www.google.com/");
browser.start();
browser.open("http://www.google.com/");
browser.type("q", "selenium rc");
browser.click("btnG");

}

and configured a testNG run configuration and ran it successfully. It was simple and I got a nice report set in the file system under the test directory.

A big thanks to Adviser for your tips!

Zea

zea

Posts : 7
Join date : 2009-09-26

Back to top Go down

Re: How to start SeleniumRC in Java IDE?

Post by uma maheswari on Fri Oct 22, 2010 2:02 pm

hi,
-This is uma.
-i am new in this selenium tools.
-I use selenium rc in java language-Eclipse sdk.
-i try to run the test suite using selenium commands.
-But i dont know exactly use of command other than the command open,click.waitforpagetoload,type,select,assertTextPresent,verifyTextPresent,storeTextPresent,assertElementPresent.....
-can any one send me the sample that how to use the selenium commands to run the test suites.


uma maheswari
Active particpant
Active particpant

Posts : 12
Join date : 2010-10-19

Back to top Go down

Re: How to start SeleniumRC in Java IDE?

Post by Sponsored content Today at 4:47 am


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum