Selenium in Liferay

1. Selenium IDE is an intergrated development environment for Selenium. It works as a FireFox extension that allows you to record and edit tests.
2.For the Liferay given source code Selenium Tests are located in the following location.
portal\portal-web\test\com\liferay\portalweb
3. Inside the portal\portal-web\test\com\liferay\portalweb\portal folder we can find the Portal Test Suite and general tests for Liferay Portal.
4.The PortalWebTestSuite.java contains the test suites from all the tests. Tests are imported and organized by run order in the PortalWebtestSuite.java.
5.Inside the portal\portal-web\test\com\liferay\portalweb\portlet folder you can find all the tests.
6.When we creating a new test create a folder to put the tests in and then create a test suite. Inside the test suite be sure to include all the tests within the folder and put them in order.
Test suite means bundle a few unit test cases and run it together.
7. Selenium IDE records the tests then we will saving them in HTML format, then we have to convert them into JAVA with the Selenese converter.Selenese coverter converts tests written in HTML into JAVA. To convert the HTML code into JAVA Selenese Coverter enter the command ant build-selenium in portal-web.
\portal\portal-web>ant build-selenium

How to run selenium tests?
Before running a Selenium test there are some prerequisites.

1. Be sure to add the following line to your portal-ext.properties file:
2.captcha.max.challenges=-1.Changing the captcha.max.challenges to -1 will eliminate any random text verifications that Selenium is unable to deal with.

3.If you would like to alter the default testing environment you can alter the test-portal-web.properties file located in "/portal/portal-web/test/".

4.If you do decide to alter the default testing environment you can make create a test-portal-web-ext.properties and override any of the following:
browser.type=iexplore
browser.type=firefox
browser.type=iehta
browser.type=chrome
portal.url=http://localhost:8080
selenium.host=localhost
selenium.port=4444
5.To run file upload tests, which have been added to Document Library and Image Gallery, Selenium must be run in Firefox chrome mode.

6. To run the Session Expiration test it is required that one alter the web.xml file located in bundle/tomcat/webapps/ROOT/WEB-INF.
Change: 30
To: 2

Run the Selenium Test Suite:

There are three components that must be running in order to run the Selenium Test Suite:
1.Tomcat
2.Selenium Server
3.Selenium RC
1.Start your application server. (Tomcat)
2.Start Selenium Server
a. In the command line navigate to the /portal/lib/development directory.
b. Execute the following line - java -jar selenium-server.jar
c.Selenium server is now running and listening on port 4444.
d.In a new command line window navigate to the /build/portal-web/ directory.

e.Execute the following line:
ant test
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.
Troubleshooting Selenium Tests:
1.Check your individual test files for errors in coding the test.
2.Modify your xxxxTests.java file in ...portal/portal-web/test/com/lifera/portalweb/portlet#

Search This Blog

All the rights are reserved to this blog is belongs to me only.. Powered by Blogger.