Re: Tests run fine in NetBeans, but fail using command line Maven
Thanks a lot for your attempts to help me solve this problem. This appears to be unrelated to Maven, sorry to bother this group with a non-Maven issue. --James Geoffrey Wiseman wrote: On Tue, Dec 16, 2008 at 5:45 PM, James Adams monoco...@gmail.com wrote: Yes I get the same thing from within the IDE -- a full build fails with the same errors as when using command line. So, if you can run the same tests without Maven and get the same errors, that seems to point pretty conclusively to the tests themselves. I have confirmed this now, it appears to be an issue with the embedded HSQLDB not rolling back after each test. -- View this message in context: http://www.nabble.com/Tests-run-fine-individually%2C-but-some-fail-when-run-as-part-of-%27mvn-install%27-tp21019373p21058948.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Tests run fine in NetBeans, but fail using command line Maven
On Tue, Dec 16, 2008 at 12:48 AM, Marat Radchenko slonopotamusor...@gmail.com wrote: They should. Unless you managed to write them in such way that they don't. So it could be: - Issues with the isolation of your tests from each other - Issues with your Maven project configuration - Something that Maven enforces that Netbeans does not Hard to say without knowing a lot more about what's happening. - Geoffrey -- Geoffrey Wiseman http://www.geoffreywiseman.ca/
Re: Tests run fine in NetBeans, but fail using command line Maven
The tests run fine when I run them individually using Maven at the command line (or from within NetBeans or Eclipse -- I don't think the IDE is an issue since the same thing happens in the IDE as at the command line): $ mvn -Dtest=MultipleDaoTest test-compile surefire:test [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'surefire'. [INFO] [INFO] Building lifecycle-manager [INFO]task-segment: [test-compile, surefire:test] [INFO] [INFO] [compiler:compile] [INFO] Nothing to compile - all classes are up to date [INFO] [resources:testResources] [INFO] Using default encoding to copy filtered resources. [INFO] [compiler:testCompile] [INFO] Nothing to compile - all classes are up to date [INFO] [surefire:test] [INFO] Surefire report directory: c:\dev\projects\lifecycle-manager\target\surefire-reports --- T E S T S --- Running com.mycom.network.lifecycle.persistence.dao.MultipleDaoTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.282 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] BUILD SUCCESSFUL [INFO] However if I run a full build I get errors for the same tests which pass individually: $ mvn clean install ... Failed tests: testSaveDeleteFindAll(com.mycom.network.lifecycle.persistence.dao.MultipleDaoTest) I have a simple pom.xml with dependencies, etc., nothing unusual. My tests extend Spring's AbstractTransactionalDataSourceSpringContextTests class, which creates a transaction for each test method and rolls back when the test is complete. Seems pretty vanilla to me, which is why I'm so perplexed. --James Geoffrey Wiseman wrote: On Tue, Dec 16, 2008 at 12:48 AM, Marat Radchenko slonopotamusor...@gmail.com wrote: They should. Unless you managed to write them in such way that they don't. So it could be: - Issues with the isolation of your tests from each other - Issues with your Maven project configuration - Something that Maven enforces that Netbeans does not Hard to say without knowing a lot more about what's happening. - Geoffrey -- Geoffrey Wiseman http://www.geoffreywiseman.ca/ -- View this message in context: http://www.nabble.com/Tests-run-fine-individually%2C-but-some-fail-when-run-as-part-of-%27mvn-install%27-tp21019373p21043070.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Tests run fine in NetBeans, but fail using command line Maven
On Tue, Dec 16, 2008 at 5:20 PM, James Adams monoco...@gmail.com wrote: The tests run fine when I run them individually using Maven at the command line (or from within NetBeans or Eclipse -- I don't think the IDE is an issue since the same thing happens in the IDE as at the command line): [nod] So, sounds more like a problem with the tests themselves, at this point, rather than Maven vs. IDE; Can NB run the whole suite at once, and if so, does that exhibit the same result? Failed tests: testSaveDeleteFindAll(com.mycom.network.lifecycle.persistence.dao.MultipleDaoTest) What's the failure that's occurring? - Geoffrey -- Geoffrey Wiseman http://www.geoffreywiseman.ca/
Re: Tests run fine in NetBeans, but fail using command line Maven
Geoffrey Wiseman wrote: On Tue, Dec 16, 2008 at 5:20 PM, James Adams monoco...@gmail.com wrote: The tests run fine when I run them individually using Maven at the command line (or from within NetBeans or Eclipse -- I don't think the IDE is an issue since the same thing happens in the IDE as at the command line): [nod] So, sounds more like a problem with the tests themselves, at this point, rather than Maven vs. IDE; Can NB run the whole suite at once, and if so, does that exhibit the same result? Yes I get the same thing from within the IDE -- a full build fails with the same errors as when using command line. Failed tests: testSaveDeleteFindAll(com.mycom.network.lifecycle.persistence.dao.MultipleDaoTest) What's the failure that's occurring? I am getting errors such as the number of expected objects found in the database are greater than what was expected. I am running my DAO tests using an embedded HSQLDB database, so I expect to start with a fresh table every time, then do some inserts, etc., then do a find call to see how many are in the table, and then make an assertion based on the expected number, and this is where it fails when running a full build. I also get errors for a test which is listening to a message queue for messages to be consumed, and this one fails as often as not during a full build but passes every time when running by itself. -- View this message in context: http://www.nabble.com/Tests-run-fine-individually%2C-but-some-fail-when-run-as-part-of-%27mvn-install%27-tp21019373p21043481.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Tests run fine in NetBeans, but fail using command line Maven
On Tue, Dec 16, 2008 at 5:45 PM, James Adams monoco...@gmail.com wrote: Yes I get the same thing from within the IDE -- a full build fails with the same errors as when using command line. So, if you can run the same tests without Maven and get the same errors, that seems to point pretty conclusively to the tests themselves. I am getting errors such as the number of expected objects found in the database are greater than what was expected. I am running my DAO tests using an embedded HSQLDB database, so I expect to start with a fresh table every time, then do some inserts, etc., then do a find call to see how many are in the table, and then make an assertion based on the expected number, and this is where it fails when running a full build. I also get errors for a test which is listening to a message queue for messages to be consumed, and this one fails as often as not during a full build but passes every time when running by itself. If the tests leaving things in the database, I'm vaguely surprised that running a single test twice doesn't have the same problem. Although if you're using an Embedded HSQLDB, perhaps you're not persisting the database. You could try and verify the database state in an @AfterTransaction call if you're using the annotated spring test runner. Sounds like the database rollback isn't working as expected, to me -- although it's difficult to tell over an email conversation. ;) -- View this message in context: http://www.nabble.com/Tests-run-fine-individually%2C-but-some-fail-when-run-as-part-of-%27mvn-install%27-tp21019373p21043481.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org -- Geoffrey Wiseman http://www.geoffreywiseman.ca/
Re: Tests run fine in NetBeans, but fail using command line Maven
This seems odd -- shouldn't the tests either pass or fail regardless of whether or not they're being run as a suite within Maven or as individual tests? They should. Unless you managed to write them in such way that they don't. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org