Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Joga Krish
Automated test for liferay portlet
January 23, 2013 1:38 AM
Answer

Joga Krish

Rank: Junior Member

Posts: 38

Join Date: January 8, 2013

Recent Posts

Hallo Everyone,
I am new to liferay. Do you have any simple examples or links or vedios where I could get more
information about "How to do an automated test for a liferay portlet". I have not done any automated tests before.
If you could share all the details regarding the automated test may from the scratch would be much appreciated.

Thank you

Cheers,
Krishna.
Jan Geißler
RE: Automated test for liferay portlet
January 23, 2013 2:54 AM
Answer

Jan Geißler

Rank: Expert

Posts: 358

Join Date: July 5, 2011

Recent Posts

What kind of automated test should this be?
Unit test, GUI tests, Integration Tests.....

There are so many things you might be considering to test. Any additional Information would be really helpfull. But for the first shot:
JUnit, Selenium.
As for Automated builds and Testing try Jenkins.

Hope this gets you on track.
Joga Krish
RE: Automated test for liferay portlet
January 23, 2013 3:09 AM
Answer

Joga Krish

Rank: Junior Member

Posts: 38

Join Date: January 8, 2013

Recent Posts

Hai jan,
Thank you soo much for the reply.
I want to start with Junit test.
Are there any simple examples available ?
I have found couple of links with some information but they seems complicated to me.
Jan Geißler
RE: Automated test for liferay portlet
January 23, 2013 3:21 AM
Answer

Jan Geißler

Rank: Expert

Posts: 358

Join Date: July 5, 2011

Recent Posts

Well, actually there is no easy way AFAIK, because you would have to set up a complete ApplicationContext with Spring to get the UnitTests working.

So long
Jan
Joga Krish
RE: Automated test for liferay portlet
January 23, 2013 3:26 AM
Answer

Joga Krish

Rank: Junior Member

Posts: 38

Join Date: January 8, 2013

Recent Posts

Thanks Jan. Well eventhough if there is no other way to start simple , I have to do it.
I do not have any other option.
If you dont mind could you please suggest me any references to set up a complete ApplicationContext with Spring to get the UnitTests.
That might me helpful for me to start.
Siby Mathew
RE: Automated test for liferay portlet
January 23, 2013 6:29 AM
Answer

Siby Mathew

Rank: Expert

Posts: 261

Join Date: March 4, 2011

Recent Posts

Hi Joga,
Liferay has a class called BaseServiceTestCase available in the liferay source code.
For testing purpose, you can add the source to your project and extend this class and call the setup() method which does all the spring initializations.
This loads all the necessary properties files as well.
Try to understand how the initializations are done and go ahead with your testing.

All the best !

Thanks,
Siby
Joga Krish
RE: Automated test for liferay portlet
January 24, 2013 2:17 AM
Answer

Joga Krish

Rank: Junior Member

Posts: 38

Join Date: January 8, 2013

Recent Posts

Hi Siby,

Tons of thanks for your reply.
I will start doing it now.
I have a small doubt.
Is it necessary to install a seperate database SQL for liferay or Can I use simply HSQL.
Currently I am using default database HSQL along with Tomcat.

Cheers,
joga.
Siby Mathew
RE: Automated test for liferay portlet
January 25, 2013 6:24 AM
Answer

Siby Mathew

Rank: Expert

Posts: 261

Join Date: March 4, 2011

Recent Posts

Hi Joga,
You can use anything based on your requirement.
You can easily switch to MySQL by specifying it in the portal-ext.properties.
Liferay automatically creates all the necessary tables

Thanks,
Siby
Dimitri Tischenko
RE: Automated test for liferay portlet
February 11, 2013 2:46 AM
Answer

Dimitri Tischenko

Rank: New Member

Posts: 22

Join Date: November 10, 2011

Recent Posts

We are using exactly this combination:
  • Jenkins - automatically start a build / test run after a commit of a project. We use Debian Squeeze with iceweasel. We use the Xvfb plugin in Jenkins which enables us to run iceweasel's Firefox without an actual screen.
  • Selenium - we use selenium to write integration tests for the portlets. We do not use unit testing.
  • JUnit - we use JUnit to write and run the tests.

Links:
  • http://en.wikipedia.org/wiki/Mozilla_Corporation_software_rebranded_by_the_Debian_project
  • http://en.wikipedia.org/wiki/Xvfb

Jan Geißler:
What kind of automated test should this be?
Unit test, GUI tests, Integration Tests.....

There are so many things you might be considering to test. Any additional Information would be really helpfull. But for the first shot:
JUnit, Selenium.
As for Automated builds and Testing try Jenkins.

Hope this gets you on track.