When you only want to change the pom (not the tests), a set of executionblocks will do the trick:

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.18.1</version>
        <executions>
          <execution>
            <id>unit-tests</id>
            <configuration>
            <includes>
              <include>**/*Unit*.java</include>
            </includes>
            </configuration>
          </execution>
          <execution>
            <id>functional-tests</id>
            <configuration>
            <includes>
              <include>**/*WebDriver*.java</include>
            </includes>
            </configuration>
          </execution>
          <execution>
            <id>integration-tests</id>
            <configuration>
            <includes>
              <include>**/*Integration*.java</include>
            </includes>
            </configuration>
          </execution>
        <executions>
      </plugin>

On Thu, 16 Feb 2017 11:22:37 +0100, João Cabrita <joao.r.cabr...@gmail.com> wrote:

I'd say you could add executions to the surefire plugin with different
categories:
https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit.html#Using_JUnit_Categories

Look at this gist (I've omitted some details):
https://gist.github.com/kewne/2b909ab5e8035a4e44e406fa35e3276c

AFAIK, even if the executions are all bound to the same phase in the
lifecycle, they execute in the order specificied in the POM.
Beware this is the behavior I've observed and can't confirm it is specified
behavior.



João Cabrita

On 16 February 2017 at 10:06, Paul Hammant <p...@hammant.org> wrote:

Hi folks,.

I've a fast WebDriver using build that I blogged about: A 16 Second Java
Webapp Build (Including WebDriver Tests)
<http://paulhammant.com/2017/02/05/a-16-second-java-webapp-
build-including-webdriver-tests/>
.

Jooby (like SpringBoot and SparkJava) give new options for testing - it can
be instantiated in a JUnit test. Everything can be done in Surefire now,
and the Failsafe plugin isn't needed for these. Don't believe me - watch
the video in the blog entry above, it's not long.

New problem. I want unit tests to run in this order:

1. unit
2. integration (may invoke service calls headlessly)
3. function (will use WebDriver)


I can't work out what magic I have to do with executions to allow that to
happen.

Here is how far I got:


https://github.com/paul-hammant/todobackend-jooby/blob/master/pom.xml#L74

It is all a bit second class, because I'd have to do ...

mvn clean test -Punit-tests
mvn test -Pintegration-tests
mvn test -Pfunctional-tests

... to simulate a pipeline, and I would be happy to just rely on
annotations for classifications.

I really want to do ...

mvn clean test -DexecutionOrder=unit,integration,functional
-DstopBuildAtExecutionBoundariesForTestFailures


... and shave seconds off the build.

How do I configure that tersely and elegantly in the surefire plugin today?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to