Total Pageviews

Saturday, June 17, 2006

Maven2 and surefire plugin issues with TestNG test cases

I was facing problems executing my TestNG unit tests under Maven 2.0.4 with the maven-surefire-plugin 2.2. The tests were not started and I got the following result from the plugin:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running de.rquebbemann.jgig.util.SqlUtilsTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.047 sec
Running de.rquebbemann.jgig.entity.impl.EntityBaseImplTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec
Running de.rquebbemann.jgig.entity.music.impl.PerformanceImplTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.032 sec
Running de.rquebbemann.jgig.entity.person.artist.impl.MemberImplTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running de.rquebbemann.jgig.entity.music.impl.GigImplTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
Running de.rquebbemann.jgig.entity.music.impl.SongImplTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running de.rquebbemann.jgig.common.sql.DefaultSqlFormatterTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec
Running de.rquebbemann.jgig.util.ExceptionUtilsTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running de.rquebbemann.jgig.entity.music.impl.TrackImplTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
Running de.rquebbemann.jgig.common.sql.StatementFactoryTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
Running de.rquebbemann.jgig.util.DateUtilsTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running de.rquebbemann.jgig.entity.person.impl.PersonImplTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running de.rquebbemann.jgig.entity.impl.ModifiableEntityImplTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running de.rquebbemann.jgig.entity.person.impl.UserImplTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
Running de.rquebbemann.jgig.dao.customizing.HibernateCustomizingDaoTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running de.rquebbemann.jgig.test.TestUtils
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running de.rquebbemann.jgig.util.StringUtilsTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running de.rquebbemann.jgig.entity.customizing.impl.CustomizingImplTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running de.rquebbemann.jgig.entity.music.impl.RecordingImplTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
Running de.rquebbemann.jgig.entity.person.artist.impl.ArtistImplTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running de.rquebbemann.jgig.common.sql.DebuggableStatementTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec

Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

I did not specify a testng.xml file because the surefire plugin docs say it is not necessary. And exactly that is the problem! If I provide a testng.xml file my unit tests are executed! Hm, so I digged a little bit further and found
the Issue http://jira.codehaus.org/browse/MSUREFIRE-117 in Jira.



I tried the fix and it solves the problem. Now my TestNG unit tests are executed even if I do not specify a testng.xml file.
Maybe this will help others. I hope the bug will be fixed very soon (I voted for it).