Change behaviour of test suite name and test name defaults in test annotations, so that if not explicitly specified, the test name will be set by the test runner.

This means that the command line can set the suite and test names, if there is no more specific name in the @Test annotation.
diff --git a/src/jdk15/org/testng/annotations/Test.java b/src/jdk15/org/testng/annotations/Test.java
index dde1542..2153cb0 100644
--- a/src/jdk15/org/testng/annotations/Test.java
+++ b/src/jdk15/org/testng/annotations/Test.java
@@ -125,13 +125,13 @@
    * The name of the suite this test class should be placed in.  This
    * attribute is ignore if @Test is not at the class level.
    */
-  public String suiteName() default TestNG.DEFAULT_SUITE_NAME;
+  public String suiteName() default "";
 
   /**
    * The name of the test  this test class should be placed in.  This
    * attribute is ignore if @Test is not at the class level.
    */
-  public String testName() default TestNG.DEFAULT_TEST_NAME;
+  public String testName() default "";
   
   /**
    * If set to true, all the methods on this test class are guaranteed to run
diff --git a/src/main/org/testng/TestNG.java b/src/main/org/testng/TestNG.java
index bda12a7..13e9da7 100644
--- a/src/main/org/testng/TestNG.java
+++ b/src/main/org/testng/TestNG.java
@@ -90,10 +90,10 @@
   private static final Logger LOGGER = Logger.getLogger(TestNG.class);
   
   /** The default name for a suite launched from the command line */
-  public static final String DEFAULT_SUITE_NAME = "Command line suite";
-
+  public static final String DEFAULT_COMMAND_LINE_SUITE_NAME = "Command line suite";
+ 
   /** The default name for a test launched from the command line */
-  public static final String DEFAULT_TEST_NAME = "Command line test";
+  public static final String DEFAULT_COMMAND_LINE_TEST_NAME = "Command line test";
 
   /** The default name of the result's output directory. */
   public static final String DEFAULT_OUTPUTDIR = "test-output";
@@ -163,8 +163,8 @@
   private boolean m_useParallelMode;
   private Class[] m_commandLineTestClasses;
   
-  private String m_defaultSuiteName=DEFAULT_SUITE_NAME;
-  private String m_defaultTestName=DEFAULT_TEST_NAME;
+  private String m_defaultSuiteName=DEFAULT_COMMAND_LINE_SUITE_NAME;
+  private String m_defaultTestName=DEFAULT_COMMAND_LINE_TEST_NAME;
 
   /**
    * Default constructor. Setting also usage of default listeners/reporters.
@@ -403,8 +403,14 @@
       String suiteName = getDefaultSuiteName();
       String testName = getDefaultTestName();
       if (test != null) {
-        suiteName = test.getSuiteName();
-        testName = test.getTestName();    
+        final String candidateSuiteName = test.getSuiteName();
+        if (candidateSuiteName!=null&&!"".equals(candidateSuiteName)) {
+          suiteName = candidateSuiteName;
+        }
+        final String candidateTestName = test.getTestName();
+        if (candidateTestName!=null&&!"".equals(candidateTestName)) {
+		  testName = candidateTestName;   
+        }
       }  
       XmlSuite xmlSuite = suites.get(suiteName);
       if (xmlSuite == null) {
@@ -915,7 +921,7 @@
     if (TestRunner.getVerbose() > 0) {
       StringBuffer allFiles = new StringBuffer();
       for (XmlSuite s : m_suites) {
-        allFiles.append("  ").append(s.getFileName() != null ? s.getFileName() : DEFAULT_SUITE_NAME).append("\n");
+        allFiles.append("  ").append(s.getFileName() != null ? s.getFileName() : getDefaultSuiteName()).append("\n");
       }
       Utils.log("Parser", 0, "Running:\n" + allFiles.toString());
     }
diff --git a/src/main/org/testng/internal/annotations/TestAnnotation.java b/src/main/org/testng/internal/annotations/TestAnnotation.java
index a5b6453..0cd292c 100644
--- a/src/main/org/testng/internal/annotations/TestAnnotation.java
+++ b/src/main/org/testng/internal/annotations/TestAnnotation.java
@@ -18,8 +18,8 @@
   private String m_dataProvider = "";
   private boolean m_alwaysRun = false;
   private Class[] m_expectedExceptions = {};
-  private String m_suiteName = TestNG.DEFAULT_SUITE_NAME;
-  private String m_testName = TestNG.DEFAULT_TEST_NAME;
+  private String m_suiteName = "";
+  private String m_testName = "";
   private boolean m_sequential = false;
   private boolean m_reentering = false;
   private Class m_dataProviderClass = null;
diff --git a/src/main/org/testng/xml/XmlSuite.java b/src/main/org/testng/xml/XmlSuite.java
index 4921a8c..5e2333f 100644
--- a/src/main/org/testng/xml/XmlSuite.java
+++ b/src/main/org/testng/xml/XmlSuite.java
@@ -40,7 +40,7 @@
   private String m_test;
   
   /** The default suite name TODO CQ is this OK as a default name. */
-  private static final String DEFAULT_SUITE_NAME = TestNG.DEFAULT_SUITE_NAME;
+  private static final String DEFAULT_SUITE_NAME = "";
   
   /** The suite name (defaults to DEFAULT_SUITE_NAME) */
   private String m_name = DEFAULT_SUITE_NAME;
diff --git a/src/main/org/testng/xml/XmlTest.java b/src/main/org/testng/xml/XmlTest.java
index d742d3e..0931307 100644
--- a/src/main/org/testng/xml/XmlTest.java
+++ b/src/main/org/testng/xml/XmlTest.java
@@ -19,7 +19,7 @@
  */
 public class XmlTest implements Serializable, Cloneable {
   private final XmlSuite m_suite;
-  private String m_name = TestNG.DEFAULT_TEST_NAME;
+  private String m_name = null;
   private Integer m_verbose;
   private Boolean m_isJUnit;
   private List<XmlClass> m_xmlClasses = new ArrayList<XmlClass>();
diff --git a/test/ant/DontOverrideSuiteNameTest.java b/test/ant/DontOverrideSuiteNameTest.java
new file mode 100644
index 0000000..b70e6d1
--- /dev/null
+++ b/test/ant/DontOverrideSuiteNameTest.java
@@ -0,0 +1,15 @@
+
+import org.testng.annotations.Test;
+
+/**
+ * @author Filippo Diotalevi
+ */
+@Test
+public class NoPackageTest {
+	private boolean m_run = false;
+
+	@Test(groups = {"nopackage"})
+	public void test() {
+	   m_run = true;
+	}
+}
diff --git a/test/ant/build.xml b/test/ant/build.xml
index be39a02..c7f87e4 100644
--- a/test/ant/build.xml
+++ b/test/ant/build.xml
@@ -40,6 +40,22 @@
   	<available file="test-output/Test Ant Suite/Test Ant Test.xml" type="file" property="test.exists"/>

   	<fail unless="test.exists" message="The appropriately named output should have been created"/>

   	

+    <testng classpath="build;${testng.jar}"

+            outputdir="test-output"

+	    dumpCommand = "true"

+    	listeners = "org.testng.reporters.FailedReporter, org.testng.reporters.DotTestListener"

+    	haltonfailure="true"

+    	suitename="Test Ant Suite 2"

+    	testname="Test Ant Test 2"

+    	>

+        <classfileset dir="build">

+        	<include name="DontOverrideSuiteNameTest.class" />

+         </classfileset>

+    </testng>

+  	

+  	<available file="test-output/Test Ant Suite 2/Test Ant Test 2.xml" type="file" property="test.exists"/>

+  	<fail unless="test.exists" message="The appropriately named output should have been created"/>

+  	

 

   </target>

 </project>