I'm trying to test out the sample app for spring/roo/heroku here https://devcenter.heroku.com/articles/spring-mvc-hibernate
When I run 'mvn package' I get this output: http://pastie.org/8263189
Not sure what I am doing wrong.
org.apache.maven.BuildFailureException: There are test failures.
From the exception It seems your test data is not correct.
If you okay with skip the test please run the below command else you need to fix the test failures.
mvn package -Dmaven.test.skip=true
Related
I have a big java project. Using maven to automate the build and manage dependencies and JUnit for the unit testing.
When i'm running mvn clean install from Intellij the build fails because of one unit test that fails.
The test succeeds when ran manually.
Also, executing mvn clean install from the terminal succeeds. (all tests pass)
I'm not sure where to look for the problem here.
Thanks!
I have a test project built in Intellij IDEA 2021.1 using Selenium, Cucumber and Maven
The project runs fine from within Intellij but now I want to call the tests from the command line and only those with a specific tag. Below is the project layout
There is only 1 feature file at present and I only want to call the scenarios with the "regression" tag from the command line.
I have run command line with Visual Studio/Selenium in the past but this is my first go with Java so any advice on how to get this started would be great.
try to execute following
mvn verify -Dcucumber.options="--tags not #ignore"
Or
mvn verify -Dcucumber.options="--tags #runme"
where #runme is a tag over Scenario or Feature.
you can try this command:
mvn clean install "-Dcucumber.options=--tags #yourtagName"
I downloaded and successfully ran this project:
https://github.com/spring-guides/gs-accessing-data-mongodb
I noticed it has some test cases on the file:
https://github.com/spring-guides/gs-accessing-data-mongodb/blob/master/complete/src/test/java/hello/CustomerRepositoryTests.java
To run the main application from the command line, I do:
$ ./mvnw spring-boot:run
Now, I would like to know what command do I need to execute in order to run the test cases?
Thanks!
You just need to run this command to run your tests.
mvn test
https://spring.io/guides/gs/testing-web/ can give you more information about testing.
I have a large project that I am working on. I recently checked out our evolution branch, did a git pull and tried to deploy the app locally. It doesn't seem to recognize some libraries or jars in one Java class, so subsequently errors halt me from running. Basically, the import statements go unrecognized in the class.
Turns out I forgot to rebuild maven. When I ran mvn clean install from the command prompt, the build fails (even when I do mvn clean install -fn) as there are tests that fail. I don't often work with maven, or the command line, but here is my full stack trace when I run mvn clean install -e:
I'm running my project in the IntelliJ environment.
When I ran mvn clean install -fn, 'talent-app' was successful, but talent-core still failed and I still got
[INFO] BUILD FAILURE
Please let me know if you have any input, I appreciate it!
I'm not sure I understand your question correctly.
Basically, regarding your first paragraph, you said you had library issues but that after a clean rebuild - of your project, I suppose not of Maven itself - everything is fine?
Regarding the rest of your post, your build is failing because of a failing test case. This is shown by the line:
talent-core ............................... FAILURE
and by the output:
Failed to execute goal [...]. There are test failures.
If you go into the target/surefire-reports folder, you will find some files containing the output and error traces of each test, including the one that failed.
By scrolling up in your terminal, you should also be able to see which test was failing for talent-core.
From then on, by order of preference:
either look at the test reports as mentioned in the output, and attempt to figure our why the test is failing, and either fix the test or the code;
or skip the tests, you can add -DskipTests to the command-line. But you shouldn't skip your tests, really.
Basically the header says it all, imagine I ran a testsuite, now some of the test have failed and I want to rerun those tests. I know that there is testng-failed.xml file generated by surefire plugin but I don't know how to pass that file as a parameter to TestNG through Maven. This is what I tried but unfortunately none of these commands have worked (they run all the tests again).
mvn verify -DsuiteXmlFile=testng-failed.xml
mvn verify -DsuiteXmlFile=target/surefire-reports/testng-failed.xml
Assuming you are at the root of the project and it has a standard layout, you can run:
mvn -Dsurefire.suiteXmlFiles=target/surefire-reports/testng-failed.xml test
You should try the correct parameter which is based on the documentation
mvn -Dsurefire.suiteXmlFiles=testng-failed.xml
A little bit late but for all who also stumble upon this question, khmarbaise answer works if you add the appropriate maven lifecycle.
mvn -Dsurefire.suiteXmlFiles=<path to testng-failed.xml> test