3
votes

We try to test our portlets for Liferay 6.0.6 via Selenium. We have few liferay mvc portlets and vaadin portlets. In first approach we create test which do steps below:

  1. Restore database dump with basic structure and portlet placement
  2. Delete "data" folder and copy initial data to it
  3. Delete appropriate folders of portlets from "webapps" folder
  4. Copy our portlets (*.war) to "deploy" folder
  5. Start liferay
  6. Wait while portlets will have installed
  7. Go to Control panel -> Server Administration and click on "Clear content cached by this VM", "Clear the database cache.", "Reindex all search indexes."

After We start selenium tests (test portlets behavior, upload files via vaadin portlets, approving workflow (kaleo) tasks via vaadin portlets etc). And tests failed in different places:

  1. Some times DuplicateFileException occurs during uploading file via our portlet (but in document manager there are no files)
  2. Some times Selenium can not find elements on page
  3. Sometimes kaleo workflow can not approve all files without errors

More unstable behavior we get when start test on Jenkins node on VM.

How do you test your portlets? Is there a way to stable behavior of test? What is a best practice?

1
Hi @dimafeng, this is something I'm also extremely interested in. Have you guys managed to put something together? We also went through the road you mentioned (except we're using Maven and some custom scripts to publish successful builds from Jenkins to the test/demo/prod environment), have you wrote a blog or something about your experience? Thanks in advance!rlegendi

1 Answers

2
votes

Some times DuplicateFileException occurs during uploading file via our portlet (but in document manager there are no files)

it would be very useful to see the full stacktrace

Some times Selenium can not find elements on page.

I see 2 possible reasons/solutions:

  1. If a portlet is using ajax to load the content then your test should wait until the content has been loaded, try:

    waitForElementPresent(locator)

  2. If you do not use Vaadin TestBench then make sure you set debugId for vaadin elements:

    setDebugID("aButton");

How do you test your portlets?

We used selenium and cucumber, see: https://projects.savoirfairelinux.com/projects/ctr-liferay/wiki/Portal_-_Testing