Monday, 6 September 2010

How to run selenium testing in liferay

Hello ALL,
In this blog i have explained briefly about selenium configuration with liferay, liferay source itself has its own selenium scripts in the following path.

D:\liferay-portal-src-5.2.3\portal-web\test\com\liferay\portalweb

Before running the selenium default liferay scripts, we need do some changes in properties files, like test-portal-web.properties and portal-ext.properties.

edit few lines in test-portal-web.properties file like following sample code.

selenium.host=localhost
selenium.port=4444

#browser.type=*chrome
#browser.type=*firefox
#browser.type=*iehta
browser.type=*iexplore

company.id=1
portal.url=http://localhost:8080


Edit portal-ext.properties(inside server you have to create this file)

In this file we need mention "captcha.max.challenges=-1" this sentence to avoid captcha.

after this we need to open a command prompt and execute the following command.

ant start from d:/portal-src

once build successful we need start selenium-server and also liferay's tomcat server.

Finally we need to execute one more command from command prompt.

ant test from D:\liferay-portal-src-5.2.3\portal-web

now you can able to see the selenium scripts are running in liferay portal successfully.

Hope this will help lot for liferay testers in selenium.

3 comments:

  1. Start selenium server: java -jar selenium-server.jar

    ReplyDelete
  2. Hi !

    Firstly thanks the configuration steps!

    i´m using Liferay6.0.2 with tomcat6.0.29

    and i can t run selenium on Liferay..

    i follow ur steps and at the final ant test,

    i got this following error :

    **********************************************
    javac] Compiling 10691 source files to D:\Development\eclipse-Projects\Workspaces\AGSM20\portal\portal-web\test-classes
    [javac] The system is out of resources.
    [javac] Consult the following stack trace for details.
    [javac] java.lang.OutOfMemoryError: Java heap space
    [javac] at com.sun.tools.javac.code.Scope$ImportScope.makeEntry(Scope.java:385)
    [javac] at com.sun.tools.javac.code.Scope.enter(Scope.java:196)
    [javac] at com.sun.tools.javac.code.Scope.enter(Scope.java:183)
    [javac] at com.sun.tools.javac.comp.MemberEnter.importAll(MemberEnter.java:132)
    [javac] at com.sun.tools.javac.comp.MemberEnter.visitTopLevel(MemberEnter.java:509)
    [javac] at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:446)
    [javac] at com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:387)
    [javac] at com.sun.tools.javac.comp.MemberEnter.complete(MemberEnter.java:819)
    [javac] at com.sun.tools.javac.code.Symbol.complete(Symbol.java:386)
    [javac] at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:763)
    [javac] at com.sun.tools.javac.comp.Enter.complete(Enter.java:464)
    [javac] at com.sun.tools.javac.comp.Enter.main(Enter.java:442)
    [javac] at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:819)
    [javac] at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727)
    [javac] at com.sun.tools.javac.main.Main.compile(Main.java:353)
    [javac] at com.sun.tools.javac.main.Main.compile(Main.java:279)
    [javac] at com.sun.tools.javac.main.Main.compile(Main.java:270)
    [javac] at com.sun.tools.javac.Main.compile(Main.java:69)
    [javac] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [javac] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    [javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    [javac] at java.lang.reflect.Method.invoke(Unknown Source)
    [javac] at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:56)
    [javac] at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1065)
    [javac] at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:882)
    [javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    [javac] at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    [javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    [javac] at java.lang.reflect.Method.invoke(Unknown Source)
    [javac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    [javac] at org.apache.tools.ant.Task.perform(Task.java:348)
    [javac] at org.apache.tools.ant.Target.execute(Target.java:357)

    BUILD FAILED
    D:\Development\eclipse-Projects\Workspaces\AGSM20\portal\build-common.xml:317: The following error occurred while executing this line:
    D:\Development\eclipse-Projects\Workspaces\AGSM20\portal\build-common.xml:286: Compile failed; see the compiler error output for details.

    Total time: 2 minutes 21 seconds

    Pls , can put some light there? i was successfull to run selenium rc onj Junit with
    my own code but when i try to run it with liferay´s source code . i get Error

    best regard

    Omar

    ReplyDelete
  3. HI Omer,
    I think you were trying to run selenium scripts from eclipse. so that you must increase your memory space in eclipse. Try to google it out so this error is nothing related to liferays selenium scripts.

    ReplyDelete