I'm not experienced with maven-surefire plugin (beyond simple use for unit
tests), but after merging configurations your execution looks as follows:
<execution>
<id>integration-test</id>
<configuration>
<groups>integration</groups>
<forkMode>always</forkMode>
<excludeGroups>integration</excludeGroups>
</configuration>
</execution>
So, integration group is added and excluded, that could be your problem.
You can see merged configuration by executing mvn help:effective-pom -N.
You can try the following:
<configuration> <!-- Affects all executions. -->
<forkMode>always</forkMode>
</configuration>
<executions>
<execution> <!-- Default execution defined lifecycle mapping. -->
<id>default-test</id>
<configuration>
<groups>unit</groups>
<excludeGroups>integration</excludeGroups>
</configuration>
</execution>
<execution>
<id>integration-test</id>
<configuration>
<groups>integration</groups>
</configuration>
</execution>
</execution>
Regards,
htfv (Aliaksei Lahachou)
On Thu, Jun 7, 2012 at 6:12 PM, Billy <[email protected]> wrote:
> I am trying to separate my unit and integration tests into testng groups. I
> have them separated into different executions the maven-surefire-plugin
> section of the pom (included at the bottom of this message).
>
> When forkMode is set to never, the grouping is obeyed however in the tests
> the @Before* methods are never executed.
>
> When forkMode is set to always the @Before* methods are executed exactly as
> expected, but the grouping is not obeyed (it runs the integration and unit
> groups as part of the default execution).
>
> This seems to be the way the plugin wants to behave since I cannot find
> anything to tweak that will make it work. My question is, how can I get the
> @Before* methods to work AND have it obey the groupings.
>
> Versions:
> maven 2.2.1
> testng 5.11
> surefire-plugin 2.7.1
>
> and finally, the plugin configuration:
> <plugin>
> <artifactId>maven-surefire-plugin</artifactId>
> <version>2.7.1</version>
> <configuration>
> <groups>unit</groups>
> <forkMode>always</forkMode>
> <excludeGroups>integration</excludeGroups>
> </configuration>
> <executions>
> <execution>
> <id>integration-test</id>
> <phase>integration-test</phase>
> <goals>
> <goal>test</goal>
> </goals>
> <configuration>
> <groups>integration</groups>
> </configuration>
> </execution>
> </executions>
> </plugin>
>
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/forkMode-always-ignores-groups-tp5710956.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>