Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7087139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:38:13+00:00 2026-05-28T07:38:13+00:00

i am trying to run integration test in separate maven profile, so i need

  • 0

i am trying to run integration test in separate maven profile, so i need to do it in following steps:

  1. Run tomcat server.
  2. Run Selenium server.
  3. Run integration tests.

i run the integration test as follows:

mvn install -Pit

but what happens is that integration test runs first before server starts, which will cause test to fail, following is my configuration:

<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>
                    </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>
              </plugins>
            </build>

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

        </profile>

please advise what’s wrong with my configuration.

UPDATE: Maven Logs

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building My APP
[INFO]    task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [jaxws:wsimport {execution: default}]
[debug] execute contextualize
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 7 resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[debug] execute contextualize
[INFO] [resources:testResources {execution: default-testResources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test {execution: default-test}]
[INFO] Surefire report directory: C:\Workspace\MyAPP\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running integration.MyTest

UPDATE3:

it worked fine after removing replacing the old surefire plugin with the following:

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

BUT there’s a problem with cargo plugin, is that it deploys the war file then runs the integration test, and before invoking any test method it un-deploys the war file ??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:38:13+00:00Added an answer on May 28, 2026 at 7:38 am

    Based on the log, it is evident that the failure is because surefire is running the integration test in the test phase and not integration-test phase.

    This link says, how to use surefire only for integration testing.

    This documentation gives more insights into best practices of maven and integration testing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am trying to run selenium tests as part of maven build, and this
I'm trying to use Maven Failsafe Plugin to run my functional/integration tests, according to
I'm using Maven 2.2 with Grails 1.2.1. When trying to run the integration-test target,
I am trying to run integration tests against a REST web service process that
I'm trying to run a very simple integration test and keep getting this error:
I am trying to run a series of HTML selenium tests using the selenese
I am trying to implement some integration tests for my application to test a
Im trying to understand maven profiles and have run into the following issue. This
I use NUnit integration tests. I am trying to test to make sure that
I'm trying to create automated integration tests for this hardware+software test subject which runs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.