NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
King Lung Chiu Posted via mailing list.
|
Posted: Thu Jan 07, 2010 12:15 pm Post subject: maven single tests fail after 1st run |
|
|
Hi all,
I've noticed a very weird problem with Netbeans 6.7 and 6.8 Maven projects: 'Test File' always fails after the 1st run for tests that use JPA named queries, with error message "Named Query Not Found".
I've attached a minimal project for you to try. It uses:
- JUnit 4.4
- Hibernate 3.2.6 + HSQL db for in-memory DB
- Spring 2.5.6 to inject EntityManager into the test class AppTest
- JPA annotation to define a named query in DummyEntity.java
On my local machine, I'm using Maven 2.2.1 and have set Netbeans to use the external Maven.
You'll notice that the first time you Test-File AppTest.java (Ctrl-F6), all 3 test cases run fine. But testNamedQueries() fails on successive Ctrl-F6. If you clean your project, then the first Ctrl-F6 succeeds again, and the rest fail again. Also, whole project tests (Alt-F6) always succeed.
I've also tried running the single-file test via the Maven surefire plugin manually outside Netbeans: they always succeed. So the problem seems to be inside Netbeans.
Any ideas how to fix that?
thanks a lot, cheers.
King
| Description: |
|
 Download |
| Filename: |
springjpa.zip |
| Filesize: |
5.03 KB |
| Downloaded: |
67 Time(s) |
|
|
| Back to top |
|
 |
kchiu
Joined: 12 Jan 2010 Posts: 23
|
Posted: Tue Jan 12, 2010 12:47 am Post subject: |
|
|
Bump! Anyone?
Surely there are some NB Maven users that write tests for JPA code.
thanks again.
|
|
| Back to top |
|
 |
mkleint Posted via mailing list.
|
Posted: Tue Jan 12, 2010 5:08 am Post subject: maven single tests fail after 1st run |
|
|
could be related to compile on save being enabled for tests. if it
doesn't work for you, just disable it in project properties.
Milos
kchiu wrote:
| Quote: | Bump! Anyone?
Surely there are some NB Maven users that write tests for JPA code.
thanks again.
|
|
|
| Back to top |
|
 |
kchiu
Joined: 12 Jan 2010 Posts: 23
|
Posted: Tue Jan 12, 2010 5:37 am Post subject: |
|
|
Fixed! Thanks alot Milos.
Just wondering, why does compile on save cause problems here? (I had it on for Test Only which caused the problem)
thanks again, cheers,
King
|
|
| Back to top |
|
 |
mkleint Posted via mailing list.
|
Posted: Tue Jan 12, 2010 6:18 am Post subject: maven single tests fail after 1st run |
|
|
I cannot tell without actually examining the project. Generally, the
more configuration in the pom, the more likely the IDE's own test runner
will fail.
Milos
kchiu wrote:
| Quote: | Fixed! Thanks alot Milos.
Just wondering, why does compile on save cause problems here? (I had it on for Test Only which caused the problem)
thanks again, cheers,
King
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|