')},success:function(c){a.one("#verifyUserPopUp .aui-dialog-bd").set("innerHTML","Thank you! A verification email has been sent.");document.getElementById("sendButton").classList.add("aui-helper-hidden");document.getElementById("closeButton").textContent="Dismiss"}}})},id:"sendButton",label:"Send\x20Verification\x20Email"},{handler:function(){this.close()},id:"closeButton",label:"Not\x20right\x20now"}];if("5"=="5"){return}if("false"=="true"){return}new a.Dialog({bodyContent:"In order to fight spam within our community, we are requesting that you verify your email address in order to contribute, review, and post to the Liferay community.",buttons:b,centered:false,draggable:false,id:"verifyUserPopUp",resizable:false,width:328}).render();positionOnPage();a.getWin().on("resize",function(){positionOnPage()})});/*]]>*/
While previous methods for running the suite of Selenium tests remain valid, over time we have made some inroads in helping automate, improve, and quicken the process of testing. As developers we found that it rapidly became tedious to have to manually start selenium-server.jar, make sure that session expiration was set to a test compatible 2 minutes, start Tomcat, deploy the plugins under test, start the tests, rebuild the hypersonic database that has been populated with test data, and start again. This often resulted in a long turnover time in testing and also represented hurdles to running the tests in a continuous integration environment.
To accomplish this end an ant task has been created to help automate these tasks and increase the speed at which the entire suite of tests are run while minimizing tedium that would be cumbersome to a developer. The ant task file can be found in
../build/build.xml
Before running the tests always make sure to close any Firefox or java processes that are open. There currently is a bug in the Selenium Server where, if the server does not shut down gracefully it may continue running as a background process and prevent future instances of Firefox from starting.
The ant task assumes several things are true about your current setup:
1. In addition to whatever version of Liferay you are running the test on, that you also have the Plugins trunk currently installed. If you do have the Plugins trunk installed on your machine be sure to define its location in the release.properties file. IF you are not interested in running tests on Liferay plugins you must comment out the following lines in build-test.xml:
<!--<replace file="${app.server.tomcat.portal.dir}/WEB-INF/web.xml" token="session-timeout>30<" value="session-timeout>2<" /> <exec dir="${lp.plugins.dir}" executable="cmd.exe" os="${os.windows}"> <arg line="/c svn update" /> </exec>-->
AND...
<!--<antcall target="test-tomcat-runtime"> <param name="test.class" value="Plugins1TestSuite" /> <param name="portlet.plugins.includes" value="alfresco-content-portlet,analog-clock-portlet" /> </antcall> <antcall target="test-tomcat-runtime"> <param name="test.class" value="Plugins2TestSuite" /> <param name="portlet.plugins.includes" value="sample-localized-portlet,sample-orbeon-forms-portlet" /> </antcall>-->
2. Your appserver is connected to a properly setup MySQL database. To learn how to setup Liferay with MySQL please read Database Configuration. If you would like to disable automatic rebuilding of the MySQL database comment out the following in build-test.xml:
<!--<ant dir="sql" target="rebuild-mysql" inheritAll="false" />-->
Please note also that there are multiple points where the database is rebuilt to prevent performance degradation from occurring throughout the duration of the tests.
By default running the command:
ant –buildfile build-test.xml test-tomcat
Will do the following tasks:
Normally this is ideal when you wan to run the entire suite of tests but for testing a few small changes or new tests without testing others it would not be as efficient. It is possible to comment out whatever portions of the ant task are not necessary and run the command in a quicker ‘lighter’ way.
For example: If I had just added new tests the message boards portlet and wanted to test and make sure those tests integrate well with the other message board tests I would do the following:
1. Comment out from build-test.xml the following:
<!--<replace file="${app.server.tomcat.portal.dir}/WEB-INF/web.xml" token="session-timeout>30<" value="session-timeout>2<" /> <exec dir="${lp.plugins.dir}" executable="cmd.exe" os="${os.windows}"> <arg line="/c svn update" /> </exec>-->
And
<!--<antcall target="test-tomcat-runtime"> <param name="test.class" value="Plugins1TestSuite" /> <param name="portlet.plugins.includes" value="alfresco-content-portlet,analog-clock-portlet," /> </antcall> <antcall target="test-tomcat-runtime"> <param name="test.class" value="Plugins2TestSuite" /> <param name="portlet.plugins.includes" value="sample-localized-portlet,sample-orbeon-forms-portlet" /> </antcall>-->
If I comment out those lines from build-test.xml my test will NOT set the session timeout, update plugins trunk, and ignore the plugins tests entirely.
However there’s still one more thing you would need to set to ensure that only your Message Board tests run.
2. Comment out the tests you do not want to run from PortalWebTestSuite.java (Be sure you leave the login test in as it is necessary to log into the portal to use the message board portlet).
3. Run the command ‘ant –buildfile build-test.xml test-tomcat’ 4. Voila! You should have a quick and efficient test for your new message board features!
Hopefully this section has familiarized you with utilizing the latest nuances we’ve added to our Selenium testing framework. Happy testing! Also please feel free to ask questions and add to this living document. Thanks all!