How to run selenium tests with maven?

i want to run selenium test with maven as part of build, so here's my configuration:

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1.1</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <executions> <execution> <goals> <goal>testCompile</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <version>1.1.4</version> <configuration> <wait>false</wait> <container> <containerId>tomcat7x</containerId> <home>${env.CATALINA_HOME}</home> <timeout>300000</timeout> <!-- 5 minutes --> </container> <configuration> <type>standalone</type> <home>target/tomcat7x</home> </configuration> <properties> <cargo.jvmargs>-XX:PermSize=256m -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled</cargo.jvmargs> </properties> </configuration> <executions> <execution> <id>start-container</id> <phase>pre-integration-test</phase> <goals> <goal>start</goal> <goal>deploy</goal> </goals> </execution> <execution> <id>stop-container</id> <phase>post-integration-test</phase> <goals> <goal>stop</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>selenium-maven-plugin</artifactId> <executions> <execution> <id>start</id> <phase>pre-integration-test</phase> <goals> <goal>start-server</goal> </goals> <configuration> <background>true</background> <logOutput>true</logOutput> </configuration> </execution> <execution> <id>stop</id> <phase>post-integration-test</phase> <goals> <goal>stop-server</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.8</version> <configuration> <junitArtifactName> org.junit:com.springsource.org.junit </junitArtifactName> <excludes> <exclude>**/unit/*Test.java</exclude> </excludes> </configuration> <executions> <execution> <id>integration-tests</id> <phase>integration-test</phase> <goals> <goal>test</goal> </goals> <configuration> <skip>false</skip> <excludes> <exclude>none</exclude> </excludes> <includes> <include>**/integration/*Test.java</include> </includes> </configuration> </execution> </executions> </plugin>

what happens is as follows:

  1. war file is created.
  2. integration test class runs (open the browser, then the browser close).
  3. tomcat server starts and deploys the application.
  4. ISSUE: after deploy i get java.lang.OutOfMemoryError: PermGen space although i increased the memory in catalina.bat and in cargo configuration, but i can see that the war is deployed in the cargo output folder, so i am wondering why i am getting this exception ?

UPDATE: LOGS

[WARNING] [talledLocalContainer] Jan 16, 2012 1:36:51 PM org.apache.catalina.startup.SetAllPropertiesRule begin [WARNING] [talledLocalContainer] WARNING: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'emptySessionPath' to 'true' did not find a matching property. [WARNING] [talledLocalContainer] Jan 16, 2012 1:36:51 PM org.apache.tomcat.util.digester.SetPropertiesRule begin [WARNING] [talledLocalContainer] WARNING: [SetPropertiesRule]{Server/Service/Engine/Host} Setting property 'xmlValidation' to 'false' did not find a matching property. [WARNING] [talledLocalContainer] Jan 16, 2012 1:36:51 PM org.apache.tomcat.util.digester.SetPropertiesRule begin [WARNING] [talledLocalContainer] WARNING: [SetPropertiesRule]{Server/Service/Engine/Host} Setting property 'xmlNamespaceAware' to 'false' did not find a matching property [WARNING] [talledLocalContainer] Jan 16, 2012 1:36:51 PM org.apache.coyote.AbstractProtocol init [WARNING] [talledLocalContainer] INFO: Initializing ProtocolHandler ["http-bio-8080"] [WARNING] [talledLocalContainer] Jan 16, 2012 1:36:51 PM org.apache.coyote.AbstractProtocol init [WARNING] [talledLocalContainer] INFO: Initializing ProtocolHandler ["ajp-bio-8009"] [WARNING] [talledLocalContainer] Jan 16, 2012 1:36:51 PM org.apache.catalina.startup.Catalina load [WARNING] [talledLocalContainer] INFO: Initialization processed in 600 ms [WARNING] [talledLocalContainer] Jan 16, 2012 1:36:51 PM org.apache.catalina.core.StandardService startInternal [WARNING] [talledLocalContainer] INFO: Starting service Catalina [WARNING] [talledLocalContainer] Jan 16, 2012 1:36:51 PM org.apache.catalina.core.StandardEngine startInternal [WARNING] [talledLocalContainer] INFO: Starting Servlet Engine: Apache Tomcat/7.0.22 [WARNING] [talledLocalContainer] Jan 16, 2012 1:36:51 PM org.apache.catalina.startup.HostConfig deployWAR [WARNING] [talledLocalContainer] INFO: Deploying web application archive cargocpc.war [WARNING] [talledLocalContainer] Jan 16, 2012 1:36:52 PM org.apache.catalina.startup.HostConfig deployWAR [WARNING] [talledLocalContainer] INFO: Deploying web application archive MyAPP.war [WARNING] [talledLocalContainer] java.lang.OutOfMemoryError: PermGen space [WARNING] [talledLocalContainer] Exception in thread "main" java.lang.OutOfMemoryError: PermGen space [WARNING] [talledLocalContainer] at java.lang.Throwable.getStackTraceElement(Native Method) [WARNING] [talledLocalContainer] at java.lang.Throwable.getOurStackTrace(Throwable.java:591) [WARNING] [talledLocalContainer] at java.lang.Throwable.printStackTrace(Throwable.java:462) [WARNING] [talledLocalContainer] at java.lang.Throwable.printStackTrace(Throwable.java:451) [WARNING] [talledLocalContainer] at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:469)

-------------Problems Reply------------

  • I am using now the following profile and it works fine, i run the integration test with

    mvn install -Pit

Profile:

<profile>
<id>it</id>
<build>
<plugins>

<plugin>

<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.1.4</version>
<configuration>

<wait>false</wait>
<container>
<containerId>tomcat7x</containerId>
<home>${env.CATALINA_HOME}</home>
<timeout>300000</timeout>
</container>

<configuration>
<type>standalone</type>
<home>target/tomcat7x</home>
<properties>
<cargo.jvmargs>-XX:PermSize=256m -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled</cargo.jvmargs>
</properties>
</configuration>

</configuration>
<executions>
<execution>
<id>start-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
<goal>deploy</goal>
</goals>

<configuration>
<deployer>
<deployables>
<deployable>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<type>war</type>
<pingURL>http://localhost:8080/${project.artifactId}</pingURL>
<pingTimeout>60000</pingTimeout>
<properties>
<context>${project.artifactId}</context>
</properties>
</deployable>
</deployables>
</deployer>
</configuration>

</execution>
<execution>
<id>stop-container</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start-server</goal>
</goals>
<configuration>
<background>true</background>
<logOutput>true</logOutput>
</configuration>
</execution>

<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop-server</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<executions>

<execution>
<id>default-test</id>
<configuration>
<skipTests>true</skipTests>
</configuration>
</execution>

<execution>
<id>surefire-it</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<includes>
<include>**/integration/*Test.java</include>
</includes>
<skipTests>false</skipTests>
</configuration>
</execution>
</executions>
<configuration>
<argLine>-Xms256M -Xmx768M -XX:MaxPermSize=256M</argLine>
</configuration>
</plugin>

</plugins>
</build>

<activation>
<property>
<name>it</name>
</property>
</activation>

</profile>

Try setting MAVEN_OPTS=-XX:MaxPermSize=384m (or some suitable number) in the environment variables of where you're running the maven build.

Category:java ee Views:0 Time:2012-01-16

Related post

  • Running selenium test with maven-surefire-plugin or maven-failsafe-plugin? 2012-01-16

    i am confused between the concept of using maven-surefire-plugin or maven-failsafe-plugin to run my selenium tests in integration test phase (without running unit tests) i see some examples uses maven-surefire-plugin and other examples uses maven-fai

  • Running Selenium RC with maven - having certificate issue for https site 2011-06-29

    I am trying to set up automatic java testing with Selenium RC. Since my site is using https, I get an annoying certificate popup that I have to remove before the test starts running. I thought trustAllSSLCertificates combined with *pifirefox would be

  • running selenium xvfb on ubuntu 11.04 2011-10-17

    i am trying to run selenium test using maven on ubuntu. i have the following configuration for maven : <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>selenium-maven-plugin</artifactId> <version>2.0</v

  • TestRunner not running automatically when running Selenium 2.0 HTML Selenese tests using Selenium-Maven Plugin 2011-06-06

    I am trying to run a series of HTML selenium tests using the selenese command through Selenium Maven plugin (version 1.1) in the hopes of coming up with a solution to able to run these tests across different browsers (Chrome, Firefox, Internet Explor

  • Running Selenium Tests through JUnit in Hudson 2009-12-14

    apologies for the somewhat confusing title :-) Basically, I've configured my Selenium tests to run through JUnit when I build the project through maven. If I start my Selenium Server in a command prompt and then run the maven build goal in another cm

  • Trying to run Selenium tests using Hudson - "Error: no display specified" 2010-06-16

    I'm trying to get Selenium tests to work when they are executed by Hudson, but I have not been successful so far. Hudson is running on Ubuntu, and Selenium is unable to open display. Command I use for launching the build is: mvn clean selenium:xvfb i

  • I want to run Selenium test case file from command line 2009-08-05

    When I use Selenium IDE that is extension of Firefox. After that I save some test case from Selenium IDE. Now I want to use command line to run this test case file. I try to do follow this how-do-i-launch-the-selenium-ide-from-the-command-line-with-a

  • Running Selenium headless without using xvfb 2009-12-27

    I'm trying to run Selenium headless (without the browser appearing). Other questions have pointed to xvfb as the tool to do this. However, it appears highly unstable, crashing all the time, so I'm looking for another alternative. Is there a non-xvfb

  • Running Selenium RC tests in firefox in offline mode 2010-07-01

    Is there a way to run Selenium test in offline mode? If I set the offline mode in the firefox profile, selenium is stuck at selenium.start(). I'm using the python client driver. The code is as below sel = selenium('localhost', 4444, '*firefox', 'file

  • How-to run Selenium tests written in PHP from the command-line 2010-11-04

    I am trying to run Selenium tests (PHP) from the command-line. I can only find ways to run HTML tests on stackoverflow. java -jar selenium-server.jar -htmlSuite "*firefox" "http://10.8.100.106" "C:\mytestsuite.html" "C:\results.html" Is there a way t

  • Running Selenium RC as a Windows Service 2010-11-12

    I'm trying to get Selenium setup to run as a windows service. It seems to be okay but, then does not seem to run properly. Using the windows toolkit I have done: "C:\Program Files\Windows Resource Kits\Tools\instsrv.exe" SeleniumRC "C:\Program Files\

  • How do I run Selenium IDE scripts in Selenium RC? 2010-12-06

    I am new to using the selenium testing tool and would like to know how to run selenium IDE scripts in selenium RC. I need examples and screenshots please --------------Solutions------------- As far as I know, to run the selenium IDE scripts in RC you

  • Running Selenium 2.0 tests siliently 2011-02-23

    How do you run Selenium 2.0 tests silently? I'm using it with Capybara. I find the window that pops up annoying. If pops up while I'm typing, I end up entering text in it. UPDATE: I don't mind if it runs with the browser still, I just want it to do a

  • Time out error running Selenium from Django 2011-02-24

    I'm having trouble running SeleniumRC from Django. I can run the sample code provided by the Selenium docs and the python selenium client docs just fine from in a Python shell without running Django (so no manage.py), but when I actually try to run S

  • Running JUnit tests with Maven under Eclipse 2011-03-27

    I just installed the plugin m2e for the first time on Eclipse. I wrote a simple JUnit (version 4) test. I can run it from Eclipse, but not from the pom.xml (alt-click, Run as, Maven Test). I suppose I need to tell Maven to search for that class, but

  • run selenium without opening a browser in cucumber 2011-04-29

    I have a question about using selenium in cucumber. here is the cucumber features: @selenium @javascript Scenario: Create forum Given I have a site named "hairclub" and I logged in as admin When I am on the "admin" page To run, I use this command: cu

  • Visual Studio 2010 hangs when running Selenium as Pre-Build event 2011-05-09

    I have created a bat file which calls selenium server called run-selenium-server.bat which has: java -jar D:\temp\selenium-server\selenium-server.jar Also I have added in my project properties "Build Events" the pre-build event command line: "$(Solut

  • Stuck to run Selenium RC script simultaneously in multiple browsers 2011-06-10

    I am working in selenium RC with Java+Junit+Eclipse. For my project I have developed script which will run in only one browser i.e Firefox through the below code.. public void setUp() throws Exception { selenium = new DefaultSelenium("localhost", 444

  • how to update already running selenium RC test from a Java client? 2011-06-13

    How to approach the following scenario? Say a test is already running in selenium rc node on a remote server using RemoteWebDriver. The test encounters a missing element (slightest xpath change across different pages). User provides the correct xpath

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.101 (s). 11 q(s)