I am using PHPUnit 3.4.12 to test selenium tests. I would like to get a screenshot automatically when the test failed. This should be supported as described in http://www.phpunit.de/manual/current/en/selenium.html#selenium.seleniumtestcase.examples.WebTest2.php
class WebTest { protected $captureScreenshotOnFailure = true; protected $screenshotPath = 'C:\selenium'; protected $screnshotUrl = 'http://localhost/screenshots'; public function testLandingPage($selenium) { $selenium->open("http://www.example.com"); $selenium->fail("fail"); ... } }
As you can see, I am making the test unsuccessful and theoretically, when it does, it should take a screenshot and place it in C: \ selenium, since I am running the selenium RC server on Windows.
However, when I run the test, it just gives me the following:
[ root@testbox selenium]$ sh run PHPUnit 3.4.12 by Sebastian Bergmann. F Time: 8 seconds, Memory: 5.50Mb There was 1 failure: 1) WebTest::testLandingPage fail /home/root/selenium/WebTest.php:32 FAILURES! Tests: 1, Assertions: 0, Failures: 1.
I do not see screenshots in C: \ selenium. However, I can get a screenshot with $ selenium-> captureScreenshot ("C: /selenium/image.png");
Any ideas or suggestions are most welcome.
thanks
source share