Liferay source code contains many JUnit and Integration tests. It wasn't easy to setup my environment to run the tests so here is little guide for those how want to try it too.
Basic info is at http://www.liferay.com/community/wiki/-/wiki/Main/Liferay+Testing+Infrastructure
I have Liferay sources in /opt/liferay.git/portal, let's call this directory SRC_ROOT for now.
Prerequisites:
* I have MySQL installed and run with Ubuntu defaults (at localhost, user root, empty password)
* Download run-tests.sh from https://gist.github.com/3706003
* Save it into SRC_ROOT
* Change permissions of the script file: chmod u+x run-tests.sh
* Note: I don't have any extra settings in any *.properties file
Running:
* Execute ./run-tests.sh inside SRC_ROOT
* Wait, it takes minutes to finish
* Ignore any exceptions during the tests, the important ones will be shown at the end
* At the end you should see
BUILD SUCCESSFUL
Total time: 6 minutes 42 seconds
**************************************
* FOUND ERRORS *
**************************************
./portal-impl/test-results/integration/TEST-com.liferay.portlet.wiki.trash.WikiNodeTrashHandlerTest.xml: <error message="No AssetEntry exists with the key {classNameId=10149, classPK=18905}" type="com.liferay.portlet.asset.NoSuchEntryException">com.liferay.portlet.asset.NoSuchEntryException: No AssetEntry exists with the key {classNameId=10149, classPK=18905}
./portal-impl/test-results/integration/TEST-com.liferay.portlet.wiki.trash.WikiNodeTrashHandlerTest.xml: <error message="No AssetEntry exists with the key {classNameId=10149, classPK=18910}" type="com.liferay.portlet.asset.NoSuchEntryException">com.liferay.portlet.asset.NoSuchEntryException: No AssetEntry exists with the key {classNameId=10149, classPK=18910}
./portal-impl/test-results/integration/TEST-com.liferay.portlet.wiki.trash.WikiNodeTrashHandlerTest.xml: <error message="No AssetEntry exists with the key {classNameId=10149, classPK=18915}" type="com.liferay.portlet.asset.NoSuchEntryException">com.liferay.portlet.asset.NoSuchEntryException: No AssetEntry exists with the key {classNameId=10149, classPK=18915}
./portal-impl/test-results/integration/TEST-com.liferay.portlet.wiki.trash.WikiPageTrashHandlerTest.xml: <error message="No WikiNode exists with the primary key 19001" type="com.liferay.portlet.wiki.NoSuchNodeException">com.liferay.portlet.wiki.NoSuchNodeException: No WikiNode exists with the primary key 19001
./portal-impl/test-results/integration/TEST-com.liferay.portlet.wiki.trash.WikiPageTrashHandlerTest.xml: <error message="No WikiNode exists with the primary key 19006" type="com.liferay.portlet.wiki.NoSuchNodeException">com.liferay.portlet.wiki.NoSuchNodeException: No WikiNode exists with the primary key 19006
./portal-impl/test-results/integration/TEST-com.liferay.portlet.wiki.trash.WikiPageTrashHandlerTest.xml: <error message="No WikiNode exists with the primary key 19011" type="com.liferay.portlet.wiki.NoSuchNodeException">com.liferay.portlet.wiki.NoSuchNodeException: No WikiNode exists with the primary key 19011
******************************************
* FOUND TEST FAILURES *
******************************************
./portal-impl/test-results/integration/TEST-com.liferay.portal.staging.StagingImplTest.xml: <failure message="expected:<Title[]en_US> but was:<Title[2]en_US>" type="junit.framework.AssertionFailedError">junit.framework.AssertionFailedError: expected:<Title[]en_US> but was:<Title[2]en_US>
Which means success! :)
Hello,
ReplyDeleteThe informative Article on Running Liferay Unit and Integration Tests is good. It gives detailed information about it .Thanks for Sharing the information on Unit Testing and Integration Testing. Software Testing Company