publicclass CLITest extends ComplexTestCase
{
@Override public String[] getTestMethodNames()
{ // TODO think about trigger of sub-tests from outside returnnew String[]
{ "runCLITests"
};
}
publicvoid runCLITests()
{ try
{
String testProgram = System.getProperty("cli_test", ""); if (testProgram.length() == 0)
failed("Check the make file. Java must be called with -Dcli_test=pathtoexe");
String arg1 = System.getProperty("cli_test_arg", ""); if (arg1.length() == 0)
failed("Check the make file. Java must be called with " + "-Dcli_test_arg=path_to_bootstrap_ini");
String[] cmdarray = new String[] {testProgram, arg1};
Process proc = null; try{
proc = Runtime.getRuntime().exec(cmdarray); new Reader(proc.getInputStream()); new Reader(proc.getErrorStream());
}
proc.waitFor(); int retVal = proc.exitValue(); if (retVal != 0)
failed("CLI test failed.");
} catch( java.lang.Exception e)
{
failed("Unexpected exception.");
}
}
}
/* This reads from an InputStream and discards the data.
*/ class Reader extendsThread
{ private InputStream is; public Reader(InputStream stream)
{
is = stream;
start();
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.