I have multiple tests with same name but under different packages
com.private.db.dao.pf.ent.DAOBaseFuncTest
com.private.db.dao.internal.pf.ent.DAOBaseFuncTest
com.private.db.dao.core.ent.DAOBaseFuncTest
I wanted to run com.private.db.dao.pf.ent.DAOBaseFuncTest. Usually I run a test with this command,
mvn -Prun-tests -pl test/func -Dit.test=DAOBaseFuncTest verify
But I was surprised to see 3 test suites running one after another. Is it possible to run a particular test suite instead of running all the three?
Never mind. I tried giving the specific test suite and it worked.
mvn -Prun-tests -pl test/func -Dit.test=com.private.db.dao.pf.ent.DAOBaseFuncTest verify
Related
I'm trying to configure a Maven job with tests that should do two things:
Generate HTML report with test results.
Fail if at least 1 test was failed during the run.
I thought it was a simple case and was stuck because one of the conditions always blocks the second. For example:
mvn surefire-report:report site - Maven result is always successful, not depending on the tests failures.
mvn test surefire-report:report site - the 'test' step generates an error, the following steps are ignored, and the report isn't generated. '--fail-at-end' flag didn't change anything in this case.
Is there any way to keep both my conditions in a single run: to generate a report and have some exit code on the tests failures?
So, I didn't find any way to do this except by using two different calls to maven:
mvn clean test <my params>
result=$?
mvn surefire-report:report-only site
exit $result
In this case, the first call gets and saves the exit code, which equals 1 if at least one failed test. The second call publishes reports and always returns the successful result, which I ignore.
I am using Evosuite to generate test cases for my app via Maven and I've followed all of the steps that are outlined in the Evosuite documentation.
I see that all of the test classes have been generated and the export copy the classes to the test folder of my project, so I should be able to run mvn test to run the tests, but when I do, I get a series of errors that it cannot find a bunch of classes (it looks like it can't find any of the Evosuite classes from the runtime even though I have the evosuite runtime defined as a dependency in my POM.)
I would love to use Evosuite for all of our apps but if I cannot get the mvn test to run without errors then the product is useless. Can anybody help with this? I have gone over the documentation several times and checked everything and it all appears to be configured correctly. Thank you.
If you have already run mvn evosuite:export to move them to the ./src/test folder then you may need to compile them using javac so they can be executed by maven. Try using this article to compile them all within one command: How to compile multiple Java files when there are Java files in other packages?
I am using spring-boot. I have my tests segregated in the following manner
tests
|java
|endtoend
|org.mycompany.tests
|integration
|org.mycompany.tests
|unit
|org.mycompany.tests
When I run a mvn test or package everything inside tests folder are running. I want to run the test within individual folders. Intellij is able to run unit, integaration and endtoend separately.
I saw posts for running tests within a package. All my different test folders have the same package structure. So filtering by test packages will not help me.
If intellij is able to run the folders individually, I think I am just missing the command to run it from the cmd line. Please advise.
I know how to configure Jenkins to run a particular test class using mvn -Dtest = nameoftest test in my windows batch command. However, how can I run a xml script that contains many tests?
for anyone who stumbles upon this, you run an xml file via jenkins like this..
mvn test -DsuiteXmlFile = src/whatever/path/my_file.xml
Are there any form to run unit test with surefire in parallel but by module? For example, we are using build in parallel by defining number of threads. Can we apply this techniques by defining number of threads to execute test in parallel by module. For example, firstly, the project is compiled. Secondly, we can use compiled project for run our tests by following form: mvn -T 4 test?
There is a different between running the build parallelized and the tests parallelized. The first one is done by using the -T option but the test can be configured in maven-surefire-plugin.