The Selenium framework that Liferay has implemented has several different components that any user or contributor should make himself familiar with. Individual test cases, which are comprised of: commands, locations, and values. Test suites, which are comprised of: individual test cases. For more information about writing individual test cases please see Liferay Selenium Conventions and Patterns.
Using the selenium scripts and suites of tests it is possible to test most common use cases and ensure functionality of the application under test (AUT). In Liferay's case this allowed us to establish a continuous integration server that will execute the suite of tests on every check in that occurs. Observe the server in action at http://hudson.liferay.com.
Articles related to Selenium:
Liferay Selenium Conventions and Patterns
![]() |
Selenium IDE is an intergrated development environment for Selenium. It works as a FireFox extension that allows you to record and edit tests. For more information about Selenium IDE and the program visit http://openqa.org/selenium-ide/
..\build\portal-web\test\com\liferay\portalweb
Inside the <b>portal</b> folder you can find the Portal Test Suite and general tests for Liferay Portal.
..\build\portal-web\test\com\liferay\portalweb\portalThe PortalWebTestSuite.java contains the test suites from all the tests. Tests are imported and organized by run order in the PortalWebtestSuite.java.
![]() |
Inside the <b>portlet</b> folder you can find all the tests.
..\build\portal-web\test\com\liferay\portalweb\portlet\When creating a new test create a folder to put the tests in and then create a test suite. In the image below the test suite is MessageBoardTests.java
No InterWiki reference defined in properties for Wiki called "image"!
Inside the test suite be sure to include all the tests within the folder and put them in order.
![]() |
..\build\portal-web>ant build-selenium
![]() |
Before running a Selenium test there are some prerequisites that must be met before beginning. Be sure to add the following line to your portal-ext.properties file:
captcha.max.challenges=-1Changing the captcha.max.challenges to -1 will eliminate any random text verifications that Selenium is unable to deal with.
browser.type=*firefox
browser.type=*iehta
browser.type=*chrome
portal.url=http://localhost:8080
selenium.host=localhost
selenium.port=4444
Note: To run file upload tests, which have been added to Document Library and Image Gallery, Selenium must be run in Firefox chrome mode.
Change:
<session-config> <session-timeout>30</session-timeout> </session-config>
To:
<session-config> <session-timeout>2</session-timeout> </session-config>
There are three components that must be running in order to run the Selenium Test Suite:
Start your application server. (Tomcat)
![]() |
Start Selenium Server
1. In the command line navigate to the /build/lib/development directory.
2. Execute the following line - java -jar selenium-server.jar
![]() |
Selenium server is now running and listening on port 4444.
Begin the test
ant test
![]() |
Please be aware that this test simulates the default omni-admin Joe Bloggs and will create at least 60 pages (one per portlet) in that private community.
This should start the test; you can monitor the commands that are being passed to the browser by observing the Selenium Server command line window, or you can directly view the commands being executed on the Firefox browser that is opened.
.../portal-web/test/com/liferay/portalweb/portlet/announcements
![]() |
![]() |
1. Have you deployed the plugins that are under test? Often times users will run the full suite of tests without examining what is being tested not realizing that Hot Deployable Plugins are part of the regular test suite. Either comment them out, or deploy them to the bundle you are testing.
2. Are you running tests that require Firefox Chrome mode? If you are running the Document Library, Image Gallery, Bookmarks, or the Remote Publishing portion of the Staging tests be sure you are running the tests in Chrome mode. As of this writing, these tests test file upload capabilities or navigating to seperate servers that based on JavaScript security would not function under regular Firefox and Internet Explorer.
3. Have you properly set Session Expiration? Please read above to properly set Session Expiration.
0 Attachments | Average (0 Votes) ![]() ![]() ![]() ![]() |