Permalink
Browse files

Added: "-usedefaultlisteners true/false" to command line and ant

  • Loading branch information...
cbeust
cbeust committed Sep 11, 2006
1 parent b69fe9c commit ae5699794ff45c2fe78287918c8adbbf123303f6
View
@@ -6,7 +6,8 @@ TODO
===========================================================================
5.2
-Added: EmailableReported (from Paul Mendelson)
+Added: "-usedefaultlisteners true/false" to command line and ant
+Added: EmailableReporter (from Paul Mendelson)
Added: parallel can now be "methods" or "tests". Boolean version deprecated
Added: TestNGAntTask now uses the @ syntax to invoke TestNG
Added: Command line understands @ syntax
View
@@ -162,6 +162,11 @@ <h2 align="center">TestNG Ant Task</h2>
under.</td>
<td>&nbsp;</td>
</tr>
+ <tr>
+ <td><tt>useDefaultListeners</tt></td>
+ <td>Whether the default listeners and reporters should be used.</td>
+ <td>Defaults to true.</td>
+ </tr>
<tr>
<td><tt>workingDir</tt></td>
<td>The directory where the ant task should change to before running
@@ -1038,6 +1038,11 @@ public static TestNG privateMain(String[] argv, ITestListener listener) {
result.setTestSuites(testNgXml);
}
+ String useDefaultListeners = (String) cmdLineArgs.get(TestNGCommandLineArgs.USE_DEFAULT_LISTENERS);
+ if (null != useDefaultListeners) {
+ result.setUseDefaultListeners("true".equalsIgnoreCase(useDefaultListeners));
+ }
+
result.setGroups((String) cmdLineArgs.get(TestNGCommandLineArgs.GROUPS_COMMAND_OPT));
result.setExcludedGroups((String) cmdLineArgs.get(TestNGCommandLineArgs.EXCLUDED_GROUPS_COMMAND_OPT));
result.setTestJar((String) cmdLineArgs.get(TestNGCommandLineArgs.TESTJAR_COMMAND_OPT));
@@ -96,10 +96,15 @@
protected String m_includedGroups;
protected String m_excludedGroups;
protected String m_threadCount;
+ public String m_useDefaultListeners;
public void setThreadCount(String threadCount) {
m_threadCount = threadCount;
}
+
+ public void setUseDefaultListeners(String f) {
+ m_useDefaultListeners = f;
+ }
// Ant task settings
public void setHaltonfailure(boolean value) {
@@ -346,9 +351,16 @@ public void execute() throws BuildException {
argv.add(m_verbose.toString());
}
- if(m_assertEnabled) {
+ if (m_assertEnabled) {
cmd.createVmArgument().setValue("-ea");
}
+
+ if (m_useDefaultListeners != null) {
+ boolean useDefaultListeners = "yes".equalsIgnoreCase(m_useDefaultListeners)
+ || "true".equalsIgnoreCase(m_useDefaultListeners);
+ cmd.createVmArgument().setValue(TestNGCommandLineArgs.USE_DEFAULT_LISTENERS);
+ cmd.createVmArgument().setValue(new Boolean(useDefaultListeners).toString());
+ }
if((null != m_outputDir)) {
if (! m_outputDir.exists()) {
@@ -54,6 +54,7 @@
public static final String SLAVE_OPT = "-slave";
public static final String HOSTFILE_OPT = "-hostfile";
public static final String THREAD_COUNT = "-threadcount";
+ public static final String USE_DEFAULT_LISTENERS = "-usedefaultlisteners";
/**
* When given a file name to form a class name, the file name is parsed and divided
@@ -277,6 +278,13 @@ else if (THREAD_COUNT.equalsIgnoreCase(argv[i])) {
i++;
}
}
+ else if (USE_DEFAULT_LISTENERS.equalsIgnoreCase(argv[i])) {
+ if ((i + 1) < argv.length) {
+ arguments.put(USE_DEFAULT_LISTENERS, argv[i + 1]);
+ i++;
+ }
+ }
+
//
// Unknown option

0 comments on commit ae56997

Please sign in to comment.