📄 testall.java
字号:
/*
* Copyright (C) 1999-2004 <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</a>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package test.org.mandarax.testsupport;
import java.lang.reflect.Method;
import junit.framework.TestSuite;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Category;
import org.apache.log4j.Level;
/**
* Executable class to run all mandarax test suites together.
* To avoid glueing packages together, test suites (class defining
* a static method <code>suite()</code>) are referenced by name.
* @author <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</A>
* @version 3.4 <7 March 05>
* @since 1.2
*/
public class TestAll {
/**
* Get an array of all mandarax classes defining
* a static suite method.
* @return an array of class names
*/
public static String[] getAllTestSuites() {
String[] classes = {
"test.org.mandarax.lib.math.IntArithmeticTests",
"test.org.mandarax.lib.math.DoubleArithmeticTests",
"test.org.mandarax.lib.date.DateArithmeticTests",
"test.org.mandarax.reference.ResolutionInferenceEngineTests",
"test.org.mandarax.reference.KnowledgeBaseTests",
"test.org.mandarax.reference.AdvancedKnowledgeBaseTests",
"test.org.mandarax.reference.ClauseSetEventsTests",
"test.org.mandarax.reference.NAFTests",
"test.org.mandarax.util.AutoFactsTests",
"test.org.mandarax.reference.SimpleLoopCheckerTests",
"test.org.mandarax.xkb.XKBTests",
"test.org.mandarax.ser.SerializationTests",
"test.org.mandarax.reference.CutTests",
"test.org.mandarax.reference.derivationeventlisteners.DerivationEventListenerTests",
"test.org.mandarax.zkb.ZKBTests",
"test.org.mandarax.zkb.ZKBValidationTests",
"test.org.mandarax.util.WildcardMatcherTests",
"test.org.mandarax.util.resultsetfilters.GroupByTests",
"test.org.mandarax.util.resultsetfilters.OrderByTests",
"test.org.mandarax.util.resultsetfilters.WhereTests",
/* jdbc has been moved into separate module in v 3.3.1
"test.org.mandarax.jdbc.CreateConnectionTests",
"test.org.mandarax.jdbc.QueryTests1",
"test.org.mandarax.jdbc.QueryTests2",
"test.org.mandarax.jdbc.NetQueryTests1",
"test.org.mandarax.jdbc.ResultSetMetaDataTests",
"test.org.mandarax.jdbc.parser.SQLValidationTestCases",
"test.org.mandarax.jdbc.parser.SQLParserTestCasesForSelectAndFromClause",
"test.org.mandarax.jdbc.parser.SQLParserTestCasesForSimpleConditions",
"test.org.mandarax.jdbc.parser.SQLParserTestCasesForCompoundConditions",
*/
};
return classes;
}
/**
* Launch the test suite. See TestRunner for interpretation
* of command line parameters.
* @see test.org.mandarax.testsupport.TestRunner
* @param args parameters
*/
public static void main(String[] args) {
BasicConfigurator.configure();
Category.getRoot ().setLevel (Level.WARN);
// disable next line if you dont want to see logs on System.out !
Category.getRoot ().removeAllAppenders();
test.org.mandarax.testsupport.TestRunner.run (TestAll.class, args,false);
}
/**
* Get a test suite. This suite is the result of merging
* all test suites defined in the classes registered in
* getAllTestSuites().
* @return a test suite
*/
public static TestSuite suite() {
TestSuite suite = new TestSuite ("All mandarax test cases");
String[] classNames = getAllTestSuites ();
for(int i = 0; i < classNames.length; i++) {
try {
Class clazz = Class.forName (classNames[i]);
Method m = clazz.getMethod ("suite", new Class[0]);
TestSuite part = (TestSuite) m.invoke (null, new Object[0]);
suite.addTest (part);
} catch(Exception x) {
System.err.println (
"Cannot add class " + classNames[i] + " to merged test suite, check whether this class is in the class path and defines a static method suite() returning a test suite !");
x.printStackTrace (System.err);
}
}
return suite;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -