I was trying to test a session handler and when i use session_start() in the testcase the test outputs an exception 'headers already sent' so i added ob_start to the start of the main test suite and the exception was still there.
Then i commented out the line 52 of reporter.php of Simpletest framework which was:
flush();
now it works.