0

I am able to run my test cases through Eclipse IDE. It is not working when I try to run them through the command prompt/terminal.I get the following error.I have attached the screenshot below.

Please help me on this issue.Quick response will be of great help.Test Image

4
  • Looks like a dependency issue, please add the error as actual text instead of a picture and include in the command you use to run this from terminal. Commented Sep 29, 2016 at 1:42
  • This is the error I get-javac dm_login_pass.java dm_login_pass.java:3: error: package org.testng.annotations does not exist import org.testng.annotations.Test; ^ dm_login_pass.java:5: error: package org.openqa.selenium does not exist import org.openqa.selenium.By; ^ dm_login_pass.java:7: error: package org.openqa.selenium does not exist import org.openqa.selenium.WebDriver; ^ command- javac -classpath selenium-server-standalone-2.48.0.jar dm_login_pass.java Commented Sep 29, 2016 at 2:01
  • Please edit this information in your question, as it's very difficult to read from comments. Also, is using a build tool like Maven an option or will you want a purely manual dependency management solution? Commented Sep 29, 2016 at 5:00
  • check this: stackoverflow.com/questions/33701682/… Commented Sep 29, 2016 at 6:57

2 Answers 2

1

You can use maven selenium plugin to run all the integration test by using selenium

In pom.xml, add this dependency

<dependency>
  <groupid>org.seleniumhq.selenium</groupid>
  <artifactid>selenium-java</artifactid>
  <version>2.25.0</version>
</dependency>

And in commandline, execute the test via maven

mvn clean test -Dwebdriver.base.url=http://www.example.com
Sign up to request clarification or add additional context in comments.

2 Comments

Hi Dang.When I compile the files again I get this error: --- maven-compiler-plugin:2.0.2:testCompile (default-testCompile) @ selenium_mvn_drivermile --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ selenium_mvn_drivermile --- [INFO] No tests to run. Please note:- The build is successful. Please guide as what should I do.This is strange.
Hi @Dishant, I think you might not follow the maven structure, please access to maven home page for more information. - Here is one example, hopefully it could help you to investigate your issue github-example-link - To run the selenium test: mvn clean install -DbaseUrl=localhost:9090/spring-selenium-integration-test
0

You can run your scripts thru command prompt using Apache Ant. It uses build.xml which runs your testng.xml. Just the difference is that you run it from command prompt and not from eclipse or any other IDE. You can find more info on Apache Ant & build.xml from - http://ant.apache.org/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.