2

Im tryig to get a simple valid login test build in maven to later run in a jenkins server.

The thing is: everytime I build (clean install) i get the following error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project validLogin: There are test failures.
[ERROR] 
[ERROR] Please refer to C:\Users\Me\workspace\validLogin\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

I litteraly losing my hair here, how to fix this? (the error not the hair)

Luna Paglarelli
  • 129
  • 1
  • 2
  • 10

2 Answers2

4

You can use

mvn clean install -DskipTests

Instead to skip tests if you don't want them to be executed.

T.Tony
  • 495
  • 3
  • 15
2

There are failing tests for your build which need to be fixed. To see which tests are failing, In the surefire plugin configuration section of your pom.xml, check that the printSummary option is set to true.

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.19</version>
            <configuration>
                <printSummary>true</printSummary>
            </configuration>
        </plugin>

Once this option is set, you should see the full list of test results (including failures) in your command-line output.

The test failures are also listed inside C:\Users\Me\workspace\validLogin\target\surefire-reports

Ashutosh Jindal
  • 18,501
  • 4
  • 62
  • 91
  • What I do not understand is why the tests run fine in firefox in my local but they dont when I use htmlunitdriver, which I need since the tests are meant to a headless server on amazon – Luna Paglarelli Oct 25 '16 at 12:16
  • Now that is a separate question altogether :). Do you know which test is failing and where? It might be worth creating a separate question for that. Ideally, if you can post snippets of code where the problem is, then it helps SOers to figure out what the problem might be _and_ also shows that you have done your homework :) – Ashutosh Jindal Oct 25 '16 at 12:33