Wednesday 24 April 2013

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:


Solution

For this just below driver.close() give Thread.sleep(2000L);
So that it will wait to close the driver.

And some cases  check what ever data we are getting from excel sheet  is that data is valid or not.

Put some if condition as like this


 if(Stcode!=null && Stcode.equals("TestEnd"))
   {

  if(driver != null) driver.close();
  Thread.sleep(2000L);
   }





Error problem:


So if I use driver.close() in code, I am getting error like below why it is can any one help on this.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test) on project MavenSelenium: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\D23450277\workspace\MavenSelenium\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]

2 comments:

  1. Close will shut the current active window and if it is the last window will then perform a quit().

    It does however need to have a valid active session to be able to do this. If your test has failed that session is probably dead, so when you call a close it doesn't know where to send the command and doesn't do anything.

    Quit will shut down all clients if there are no active sessions so if you send a quit and have no active sessions it will just clean up, so in summary I would suggest changing all instances of driver.close() to driver.quit() unless you are closing down an additional window that has been opened up during your test.

    ReplyDelete
  2. just in case if you are not able to see any html reports on \workspace\MavenSelenium\target\site then

    go to command line and type mvn site it will generate html reports

    ReplyDelete