Vlad
Vlad

Reputation: 2773

Run java-exported tests generated from selenium ide on selenium server standalone

Is i possible to run java exported tests from selenium ide on selenium-server.jar trough command line/terminal?

So far I have used this command:

java -jar lib/selenium-server-standalone-2.28.0.jar -htmlsuite *firefox http://localhost:4444/wd/hub src/NewTest.java NewTest-result.html

It works ok until the firefox is lanuched and I see the code of this test in firefox but it doesn't show that it has run the test at all. It says 0 test run, 0 tests failed, 0 tests successful.

Is it my command wrong or selenium server is not supposed to be used this way?

I even tried to use the html version of NewTest instead of java but same result.

Upvotes: 0

Views: 2902

Answers (2)

ddavison
ddavison

Reputation: 29032

This is a duplicate of I want to run Selenium test case file from command line

Make sure your command line matches -

java -jar selenium-server.jar -htmlSuite "*<browser>" "http://<ip>" "<suite to run>.html" "<path to results>.html"

Upvotes: 1

asgoth
asgoth

Reputation: 35829

The converted tests are JUnit tests. So you should have two processes:

Your selenium server process:

java -jar lib/selenium-server-standalone-2.28.0.jar

Your JUnit test runner

java -cp /usr/share/java/junit.jar org.junit.runner.JUnitCore [test class name]

If you have several test classes, it might be better to create a TestSuite with the Suite annotation:

@RunWith(Suite.class)
@SuiteClasses({
   MyTestClass1.class,
   MyTestClass2.class})
public class TestSuite {
   ...

If you are using Spring, you can setup config containing selenium server address, browser, ...

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:my/package/seleniumConfig.xml"})
public abstract class SeleniumTestSuite {

Upvotes: 1

Related Questions