r1219@thor:  alex | 2006-12-08 19:07:20 +0200
 @BeforeGroups and @AfterGroups specifying the groups() attribute will auto-include the method into those groups by default (previously you had to also provide the value() attribute).

diff --git a/CHANGES.txt b/CHANGES.txt
index 498c66c..a715b6e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,8 @@
 ===========================================================================
 5.4
 
+Added: for @BeforeGroups and @AfterGroups specifying the groups() attribute will auto-include the method
+			 into those groups by default (previously you had to also provide the value() attribute).
 Added: the load @Tests (invocationCount + threadPoolSize) are triggered simultaneous
 Fixed: reports are correctly displaying the thread info
 Added: @DataProvider name defaults to method name
diff --git a/src/jdk15/org/testng/annotations/AfterGroups.java b/src/jdk15/org/testng/annotations/AfterGroups.java
index 3b24014..e412f77 100644
--- a/src/jdk15/org/testng/annotations/AfterGroups.java
+++ b/src/jdk15/org/testng/annotations/AfterGroups.java
@@ -7,7 +7,8 @@
 @Target(java.lang.annotation.ElementType.METHOD)
 public @interface AfterGroups {
   /**
-   * The list of groups that this configuration method will run before.
+   * The list of groups that this configuration method will run before. If specified it overrides the
+   * list of groups provided through {@link #groups()} attribute.
    * This method is guaranteed to run shortly before the first test method that
    * belongs to any of these groups is invoked.
    */
@@ -19,7 +20,8 @@
   public boolean enabled() default true;  
   
   /**
-   * The list of groups this class/method belongs to. 
+   * The list of groups this class/method belongs to. The list also describes the groups
+   * that this configuration method will be run after (if no {@link #value()} attribute is defined).
    */
   public String[] groups() default {};
 
diff --git a/src/jdk15/org/testng/annotations/BeforeGroups.java b/src/jdk15/org/testng/annotations/BeforeGroups.java
index 6106886..abd9edc 100644
--- a/src/jdk15/org/testng/annotations/BeforeGroups.java
+++ b/src/jdk15/org/testng/annotations/BeforeGroups.java
@@ -7,7 +7,8 @@
 @Target(java.lang.annotation.ElementType.METHOD)
 public @interface BeforeGroups {
   /**
-   * The list of groups that this configuration method will run before.
+   * The list of groups that this configuration method will run before. If specified it overrides the
+   * list of groups provided through {@link #groups()} attribute.
    * This method is guaranteed to run shortly before the first test method that
    * belongs to any of these groups is invoked.
    */
@@ -19,7 +20,8 @@
   public boolean enabled() default true;  
   
   /**
-   * The list of groups this class/method belongs to. 
+   * The list of groups this class/method belongs to. This list also describes the groups
+   * that this configuration method will run before (if no {@link #value()} attribute is defined).
    */
   public String[] groups() default {};
 
diff --git a/src/jdk15/org/testng/internal/annotations/JDK15TagFactory.java b/src/jdk15/org/testng/internal/annotations/JDK15TagFactory.java
index a8ff30c..ec226ce 100644
--- a/src/jdk15/org/testng/internal/annotations/JDK15TagFactory.java
+++ b/src/jdk15/org/testng/internal/annotations/JDK15TagFactory.java
@@ -132,10 +132,11 @@
     }
     else if (annotationClass == IBeforeGroups.class) {
       BeforeGroups bs = (BeforeGroups) a;
+      final String[] groups= bs.value().length > 0 ? bs.value() : bs.groups();
       result = createConfigurationTag(cls, a, 
           false, false,
           false, false, 
-          bs.value(), new String[0], 
+          groups, new String[0], 
           false, false, 
           false, false,
           bs.alwaysRun(),
@@ -145,10 +146,11 @@
     }
     else if (annotationClass == IAfterGroups.class) {
       AfterGroups bs = (AfterGroups) a;
+      final String[] groups= bs.value().length > 0 ? bs.value() : bs.groups();
       result = createConfigurationTag(cls, a, 
           false, false,
           false, false, 
-          new String[0], bs.value(),
+          new String[0], groups,
           false, false, 
           false, false,
           bs.alwaysRun(),
diff --git a/src/main/org/testng/internal/annotations/JDK14TagFactory.java b/src/main/org/testng/internal/annotations/JDK14TagFactory.java
index c8dd438..1f8fbde 100644
--- a/src/main/org/testng/internal/annotations/JDK14TagFactory.java
+++ b/src/main/org/testng/internal/annotations/JDK14TagFactory.java
@@ -126,8 +126,8 @@
     boolean enabled = Converter.getBoolean(dt.getNamedParameter("enabled"), result.getEnabled());
     String[] groups = Converter.getStringArray(dt.getNamedParameter("groups"), result.getGroups());
     boolean inheritGroups = Converter.getBoolean(dt.getNamedParameter("inheritGroups"), result.getInheritGroups());
-    String[] beforeGroups = Converter.getStringArray(dt.getNamedParameter("before-groups"), result.getBeforeGroups());
-    String[] afterGroups = Converter.getStringArray(dt.getNamedParameter("after-groups"), result.getAfterGroups());
+    String[] beforeGroups = Converter.getStringArray(dt.getNamedParameter("before-groups"), groups);
+    String[] afterGroups = Converter.getStringArray(dt.getNamedParameter("after-groups"), groups);
 //    String parameters = Converter.getString(dt.getNamedParameter("parameters"), result.getParameters());
 
     if (BEFORE_SUITE.equals(dt.getName())) {
diff --git a/test/testng-single2.xml b/test/testng-single2.xml
index ac422c3..fa852ef 100644
--- a/test/testng-single2.xml
+++ b/test/testng-single2.xml
@@ -1,16 +1,31 @@
-<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
   
-<suite name="Single" verbose="3" parallel="false"  >
-  
-  <test name="JUnit" junit="true">
+<suite name="Single" verbose="3" parallel="false"  >  
+  <test name="BeforeGroups-AfterGroups-1" >
     <classes>
-      <class name="test.sample.JUnitSample1" />
-      <class name="test.sample.JUnitSample2" />
-      <!-- <class name="test.sample.AllJUnitTests" /> -->
-      <class name="test.sample.JUnitSample3" />
+      <!--<class name="test.configuration.ConfigurationGroups1SampleTest" />
+      <class name="test.configuration.ConfigurationGroups2SampleTest" />-->
+      <class name="test.configuration.ConfigurationGroups3SampleTest" />
+      <!--
+      <class name="test.configuration.ConfigurationGroups4SampleTest" />
+      <class name="test.configuration.ConfigurationGroups5SampleTest" />
+      <class name="test.configuration.ConfigurationGroups6SampleTest" />
+      <class name="test.configuration.ConfigurationGroups7SampleTest" />
+      -->
     </classes>
   </test>
-
-
+  <!--
+  <test name="BeforeGroups-AfterGroups-2" >
+    <groups>
+      <run>
+        <include name="A" />
+        <include name="B" />
+      </run>
+    </groups>
+    <classes>
+      <class name="test.configuration.ConfigurationGroups8SampleTest" />
+    </classes>
+  </test>
+  -->
 </suite>