Tests are not fun.

I don't think I have ever run into anyone who had a love for tests. And if I by some way I am suffering a form of amnesia and HAVE met someone who loved tests I would have derided and mocked that person as a masochist. A masochist who had no love for life. Of course a big part of our lives are determined by tests, or could even be defined by tests. Knowing this, in my former life before Life(ray), one could say I have a profound and deep distaste for all things structured.

God does have a sense of humor. (Or at least, that sense of humor can often coincide with sanctification). Because I have spent the past three weeks immersed in tests. Reading tests, writing tests, failing tests, and learning tests. Selenium tests to be more specific.

With the latest release of Liferay 4.4.0 have come a slew of automated Selenium testing scripts that any user can use and run to regressively test their developments on Liferay. Up front I will say that you may run into some problems running the tests; primarily that Selenium tests are extremely fragile, and that is by design. If you have any feedback on the tests, ways to streamline or improve them, reduce bugs within the tests please feel free to drop me some mail at jhoun@liferay.com. Following are some directions for running the tests that I have mirrored up on the Liferay Wiki.

 

How to Run Selenium Tests

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=-1

Changing the captcha.max.challenges to -1 will eliminate any random text verifications that Selenium is unable to deal with.


If you would like to alter the default testing environment you can alter the test-portal-web.properties file located in "/build/portal-web/test/". 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
portal.url=http://local host:8080
selenium.host=localhost
selenium.port=4444

There are three components that must be running in order to run the Selenium Test Suite:

  1. Tomcat
  2. Selenium Server
  3. Selenium RC

Start your application server. (Tomcat)

 Image:Croppedtomcat.JPG

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

Image:Croppedserver111.JPG 

Selenium server is now running and listening on port 4444.

Begin the test

  1. In a new command line window navigate to the /build/portal-web/ directory.
  2. Execute the following line:
ant test

Image:Anttest.JPG

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.

-jr out

Plus d'entrées de blog

Blogues
Good,But You haven't mentioned how to write our own test and where to place those tests.Please add more info about this...