AnsweredAssumed Answered

Unit testing: Various notes

Question asked by ianpriest on Dec 9, 2005
Latest reply on Dec 9, 2005 by davidc
I've been getting the unit-tests to run on the released version for both Windows and Linux. Here are some notes on the problems I found. I've raised bugs for most of the things I've found, so I've provided links from here and the bug report contains the detail. Hopefully this'll be of help to anyone else trying to run the unit tests.

Core

org.alfresco.util.exec.RuntimeExecTest
Will fail on Linux. Details in http://www.alfresco.org/jira/browse/AR-306

Repository

org.alfresco.repo.content.AbstractContentReadWriteTest.testGetReader()
Will fail on Linux. Details in http://www.alfresco.org/jira/browse/AR-307

org.alfresco.repo.content.AbstractContentReadWriteTest.testDelete()
Will fail on Linux. Details in http://www.alfresco.org/jira/browse/AR-308

org.alfresco.repo.content.metadata.OfficeMetadataExtracterTest
org.alfresco.repo.content.metadata.TextMiningContentTransformerTest.testBugFixAR1()
Missing files quick.doc and farmers_markets_list_2003.doc cause these to fail. See http://www.alfresco.org/forums/viewtopic.php?t=489, and thanks to Robin Bramley for his helpful response.

org.alfresco.repo.content.metadata.UnoMetadataExtractorTest
Failed on my Linux system as I had OpenOffice 1.1.2 installed. Upgrading  to 2.0 fixed it. Note that this test won't run and will report success unless the open office demon is accepting connections.

org.alfresco.repo.content.transform.AbstractContentTransformerTest.testAllConversions()
Will fail on Linux. Details in http://www.alfresco.org/jira/browse/AR-309

org.alfresco.repo.content.transform.StringExtractingContentTransformerTest.testDirectTransform()
This failure turned out to be related to the default encoding that I was using on Linux. I was using UTF-8 and the javac was using that encoding when compiling. Running "export LANG=en_GB.ISO-8859-1" and recompiling fixed the problem.

org.alfresco.repo.policy.ClassBehaviourBinding
General error that the tests showed up. See http://www.alfresco.org/jira/browse/AR-310

org.alfresco.repo.search.SearcherComponentTest.testLikeAndContains()
Will fail on all systems. Details at http://www.alfresco.org/jira/browse/AR-311

org.alfresco.repo.search.ISO9075Test.test*()
As for StringExtractingContentTransformerTest, this test failed due to the encoding in use for my user on Linux. Running "export LANG=en_GB.ISO-8859-1" and recompiling fixed the problem.

org.alfresco.repo.search.impl.lucene.LuceneSearch
Causes a sigsegv error on my Linux system. I've removed the test for now pending further investigation. I'll post more when I get it.

org.alfresco.repo.lock.LockBehaviourImplTest.testVersionServiceLockBehaviour01()
Caused all following tests to fail by leaving the details for goodUser and badUser in the database, despite the transaction being rolled back. This turned out to be caused by my MySQL Db using InnoDB as the table type when the Alfresco tables were created. I dropped the database, changed MySQL so that the the default engine type was InnoDB and ran the test again and all was fine. See http://dev.mysql.com/doc/refman/5.0/en/storage-engines.html for more info. I'm running MySQL version 4.1.12.

I think that was about the lot. The tests now run through, with the exception of the segv error.

A couple of other test tips. You can run all the tests for a single project as follows:

cd projects/<project-name>
ant -f project-build.xml run-tests

where project name might be "repository" or "core".

You can run a single test case like this:

cd projects/<project-name>
ant -f project-build.xml run-test -Dtestcase=full.name.of.TestClass

Hope all this helps.

Ian.

Outcomes