|
From: Adonis El F. <ad...@ay...> - 2012-12-20 05:13:31
|
Hi Perrick, Thanks a lot. I believe that is what I need. I had not explored the experimental code yet, will try this. Regards Adonis On Dec 19, 2012, at 11:26 PM, Perrick Penet-Avez wrote: Have you tried to use the Recorder ? http://simpletest.org/en/experimental_recorder.html It could prove useful. Yours, Perrick On 19/12/12 21:53, Adonis El Fakih wrote: > Hi, > > I am trying to do something a little different than usual with simpletest. > > I am embedding tests in existing code that is used on a web environment, and most of our code is procedural so at certain checkpoints we execute the tests. > > Our code already outputs text that goes to the web interface, and what we would like to do is have the simpletest reports be sent to a file, that we can open from a different interface and if it is xml, can be fed to an xUnit parser. Right now when we execute the tests, the output is clearly seen in the web page, so we are looking for a way to make the simpletest report message go to a file or a variable. > > Right now I call the code simply like this > > $test = new test_smarty_punto_display_menu($punto_object,$params,$time_start,$time_end); > $test->run(new HtmlReporter()); > > where the class file has this > > require_once(dirname(__FILE__) . '/simpletest/unit_tester.php'); > require_once(dirname(__FILE__) . '/simpletest/reporter.php'); > > class test_smarty_punto_display_menu extends UnitTestCase > { > var $punto_object; // pass the punto_object to do some sanity tests on it > var $params; //pass the params coming in to see if they are complete > var $time_start; > var $time_end; > > function test_smarty_punto_display_menu($punto_object,$params,$time_start,$time_end) { > $this->punto_object = $punto_object; > $this->params = $params; > $this->time_start=$time_start; > $this->time_end=$time_end; > } > > function setUp() { } > > function testIfPuntoObjectNotNull() > { > $this->assertNotNull($this->punto_object); > } > > function testIfParamsDebugIsFalse() > { > $params = $this->params; > $this->assertFalse($params['debug']); > } > > function testIfParamsLocaleIsTrue() > { > $params = $this->params; > $this->assertTrue($params['locale']); > } > > function testIfExecTimeIsLessThanHalfASecond() > { > $value = $this->time_end - $this->time_start ; > $this->assertTrue($value < 0.5); > } > > function testIfParamsLayoutIsVerticalOrHorizontal() > { > if ( $this->params['layout'] == 'vertical' || $this->params['layout'] == 'horizontal' ) { > $is_valid = TRUE; > } else { > $is_valid = FALSE; > } > $this->assertTrue($is_valid); > } > > function tearDown() { } > } > > > Since our code is already called from web, and it has output, I would like to get the reporter send it to a log file. > > I have poked around in code, documentation and web searches and no luck in finding hints on how to do this. Is it possible? How can I run the test and be able to direct the output to a variable to be printed or saved to a log file. It would be awesome if I can still use the three report styles text, html and xml so we can use the output format that is best for the occasion. > > Please note that I can not run the code on command line. Any help would be GREATLY appreciated! > > Adonis > > > > > ------------------------------------------------------------------------------ > LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial > Remotely access PCs and mobile devices and provide instant support > Improve your efficiency, and focus on delivering more value-add services > Discover what IT Professionals Know. Rescue delivers > http://p.sf.net/sfu/logmein_12329d2d > _______________________________________________ > Simpletest-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpletest-support > -- ----- Opentime.fr : logiciel web de gestion du temps et suivi d'activité http://opentime.fr/ ------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d _______________________________________________ Simpletest-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simpletest-support |