requestSocket = new Socket("localhost", port);
System.out.println("Connected to localhost in port " + port);
out = new ObjectOutputStream(requestSocket.getOutputStream());
out.flush();
MunitSuiteRunner runner = new MunitSuiteRunner(resource);
runner.setNotificationListener(new NotificationListener()
{
public void notifyStartOf(MunitTest test)
{
try
{
out.writeObject("1;" + test.getName());
out.flush();
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void notify(TestResult testResult)
{
try
{
if (testResult.getError() != null)
{
out.writeObject("3;" + testResult.getTestName() + ";'" + testResult.getError().getFullMessage() + "'");
out.flush();
}
else if (testResult.getFailure() != null)
{
out.writeObject("2;" + testResult.getTestName() + ";'" + testResult.getFailure().getFullMessage() + "'");
out.flush();
}
else
{
out.writeObject("4;" + testResult.getTestName());
out.flush();
}
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public void notifyEnd(SuiteResult result)
{
// DO NOTHING
// TODO: FIX THIS
}
});
out.writeObject("0;" + runner.getNumberOfTests());
out.writeObject("5;" + path);
runner.run();
}
catch (IOException ioException)
{
ioException.printStackTrace();
}