0

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.

Vlad
  • 2,739
  • 7
  • 49
  • 100

2 Answers2

1

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 {
Community
  • 1
  • 1
asgoth
  • 35,552
  • 12
  • 89
  • 98
1

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"

Community
  • 1
  • 1
ddavison
  • 28,221
  • 15
  • 85
  • 110