FileDocCategorySizeDatePackage
Framework.javaAPI DocphoneME MR2 API (J2ME)4544Wed May 02 18:00:00 BST 2007com.sun.midp.i3test

Framework

public class Framework extends MIDlet implements Runnable
The Integrated Internal Interface (i3) test framework.

Fields Summary
String[]
argv
boolean
listmode
boolean
selftest
boolean
verbose
boolean
error
String
testClass
String
filterString
private boolean
started
Indicates whether a thread running test cases has been started.
Constructors Summary
public Framework()

        final int argc = 3;

        argv = new String[argc];
        argv[0] = getAppProperty("arg-0");
        argv[1] = getAppProperty("arg-1");
        argv[2] = getAppProperty("arg-2");

        for (int a = 0; a < argc; a++) {
            if (argv[a] == null) {
                break;
            } else if (argv[a].startsWith("-filter:")) {
                filterString = argv[a].substring(8);
            } else if ("-list".equals(argv[a])) {
                listmode = true;
            } else if ("-selftest".equals(argv[a])) {
                selftest = true;
            } else if ("-verbose".equals(argv[a])) {
                verbose = true;
            } else if (argv[a].startsWith("-")) {
                System.err.print(
                    "usage: i3test [option] [testclass]\n" +
                    "options:\n" +
                    "  -filter:pattern  " +
                            "runs tests whose names contain pattern\n" +
                    "  -list            prints a list of known tests\n" +
                    "  -selftest        runs the framework's self test\n" +
                    "  -verbose         enables verbose output\n" +
                    "Given a testclass argument, runs just that test.\n" +
                    "Without a testclass argument, runs all known tests.\n");
                error = true;
                break;
            } else {
                testClass = argv[a];
            }
        }

        TestCase.setVerbose(verbose);
    
Methods Summary
public voiddestroyApp(boolean unconditional)

    
java.lang.String[]doFilter(java.lang.String[] nameArray, java.lang.String filter)

        Vector vec = new Vector();

        for (int i = 0; i < nameArray.length; i++) {
            if (filter == null || (nameArray[i].indexOf(filter) >= 0)) {
                vec.addElement(nameArray[i]);
            }
        }

        String[] ret = new String[vec.size()];
        vec.copyInto(ret);
        return ret;
    
voidlistTestCases(java.lang.String[] nameArray)

        for (int i = 0; i < nameArray.length; i++) {
            System.out.println(nameArray[i]);
        }
    
public voidpauseApp()

    
public voidrun()

        if (listmode) {
            listTestCases(doFilter(Repository.testNames, filterString));
        } else if (selftest) {
            SelfTest.run();
        } else if (testClass != null) {
            runTestCases(new String[] { testClass });
        } else {
            runTestCases(doFilter(Repository.testNames, filterString));
        }

        notifyDestroyed();
    
voidrunTestCases(java.lang.String[] nameArray)


       
        for (int i = 0; i < nameArray.length; i++) {
            TestCase.runTestCase(nameArray[i]);
        }
        TestCase.report();
    
public voidstartApp()

        if (error) {
            notifyDestroyed();
        } else if (!started) {
            started = true;
            new Thread(this).start();
        }