Omair-Inam Abdul-Matin wrote:
Well, without seeing the exact error messages, the next thing that I would suspect is that the static method is expecting something to have been initialized or some process to have been performed before it was invoked. This sounds more like a unit test issue or program construction issue than a Maven issue. Can you setup to run the tests, not in Eclipse, but outside of Maven from the command line? You might want to compare the order of the classpath as generated by Eclipse with the order of the classpath generated by Maven.Erik Husby wrote:
Omair-Inam Abdul-Matin wrote:
I'm facing a weird error. I have the following projects with the dependencies shown (a -> b means a depends on b)
storagemanager->util
stindex->util
stindex->storagemanager
I have made a unit test in the storagemanager project that uses a public static method in a class located in the util project. When I compile and run the test in Eclipse it works fine. Under maven, the source and unit test files compile fine, but if I run the tests the test cases invoking the method fail. If I copy the static method into the unit test itself, then the test passes.
Does anyone know what's going on? I don't want to duplicate utility methods in *all* my unit testcases because of this...
Sounds like a classpath problem to me.
Is the jar containing the class with the static method in your list of dependencies for the project whose tests fail?
Yes... I can run reactor and based on the inter-project dependencies it builds the individual subprojects correctly on the dependency tree (i.e. in the order util, storagemanager, stindex) In the pom for the storagemanager I have defined the util project as a dependency.
This is a portion of the test output given by maven
What is the exact error message you get?
test:test:
[junit] Running storagemanager.CommonsLRUBufferTest
[junit] Tests run: 7, Failures: 0, Errors: 3, Time elapsed: 1.402 sec
[junit] [ERROR] TEST storagemanager.CommonsLRUBufferTest FAILED
[junit] Running storagemanager.CommonsLRUBufferWithAppendTest
[junit] Tests run: 5, Failures: 0, Errors: 4, Time elapsed: 1.041 sec
[junit] [ERROR] TEST storagemanager.CommonsLRUBufferWithAppendTest FAILED
[junit] Running storagemanager.DiskStorageManagerTest
[junit] Tests run: 10, Failures: 0, Errors: 0, Time elapsed: 1.392 sec
[junit] Running storagemanager.MemoryStorageManagerTest
[junit] Tests run: 8, Failures: 0, Errors: 0, Time elapsed: 0.61 sec
[junit] Running storagemanager.TIntVirtualHashtableTest
[junit] Tests run: 5, Failures: 0, Errors: 0, Time elapsed: 1.321 sec
[junit] Running storagemanager.TLRUAppendBufferTest
[junit] Tests run: 5, Failures: 0, Errors: 4, Time elapsed: 1.171 sec
[junit] [ERROR] TEST storagemanager.TLRUAppendBufferTest FAILED
[junit] Running storagemanager.TLRUBufferTest
[junit] Tests run: 7, Failures: 0, Errors: 0, Time elapsed: 2.062 sec
[junit] Running storagemanager.TObjectVirtualHashtableTest
[junit] Tests run: 5, Failures: 0, Errors: 0, Time elapsed: 2.734 sec
[junit] Running storagemanager.TRandomEvictionsBufferTest
[junit] Tests run: 7, Failures: 0, Errors: 0, Time elapsed: 1.402 sec
The errors occur in those tests that invoke the static method... Again I reiterate... Dependencies have been set correctly... because otherwise the project would simply not compile... However I can't tell why the unit tests are giving an error...
Omair
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--
Erik Husby
Team Lead for Software Quality Automation
Broad Institute of MIT and Harvard Rm. 2192 320 Charles St
Cambridge, MA 02141-2023
mobile: 781.354.6669, office: 617.258.9227, [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]