Right now I have both type of tests but when I say "mvn test" it only executes TestNG tests and not Junit. I want to execute both one after another. Any Idea ?
相关问题
- Dependencies while implementing Mocking in Junit4
- How to unit test a reactive component where ngCont
- Access for global variables JavaScript unit testin
- Googletest Parametrized tests crash
- How to resolve Maven exec plugin: classpath too lo
相关文章
- How to replace file-access references for a module
- How to mock methods return object with deleted cop
- What is a good way of cleaning up after a unit tes
-
EF6 DbSet
returns null in Moq - React testing library: Test attribute / prop
- React/JestJS/Enzyme: How to test for ref function?
- TestNG skipping tests - why?
- python unit testing methods inside of classes
Thanks to this link (http://jira.codehaus.org/browse/SUREFIRE-377), here is a solution to my previous problem (having 3 executions instead of 2)
Based on previous solutions. I found this worked best for us. One more issue we were facing was TestNG trying to run old JUnit tests. We avoided this by naming all TestNG tests differently (e.g. *TestNG.java). Below is the configuration with two executions of surefire-plugin.
There is another wayout for this. You could ask TestNG to run Junit test cases as well. Below is the sample testng.xml to run all test cases
I have a better solution.
The idea is to create two executions of the
maven-surefire-plugin
, one for JUnit, one for TestNG. You can disable one of TestNG or JUnit per execution by specifying nonexistingjunitArtifactName
ortestNGArtifactName
:Official way with selecting providers.
More info about this: Mixing TestNG and JUnit tests in one Maven module – 2013 edition
Current Link for this in the maven-surefire-plugin examples. Search for "Running TestNG and JUnit Tests".
You will want to configure the testng provider to ignore the junit tests like so: