PHPUnit Selenium captureScreenshotOnFailure does not work? -


I am using PHPUnit 3.4.12 to run my Selenium tests. When a test fails, I want to be able to get the screenshot taken automatically. It should be explained as

  class WebTest {protected $ captureScreenshotOnFailure = true; Protected $ screenshotPath = 'C: \ selenium'; Protected $ screnshotUrl = 'http: // local host / screenshot'; Public function testLandingPage ($ Selenium) {$ selenium- & gt; Open ("http://www.example.com"); $ Selenium- & gt; Unsuccessful ("unsuccessful"); ...}}  

As you can see, I am making the test to fail and in theory when it takes a screenshot and puts it in C: \ selenium , As I am running Selenium RC server on Windows.

However, when I run the test, it only gives me the following:

  [root @ testbox selenium] $ sh run by PHPiannit 3.4.12 F Time by Sebastian Bergman : 8 seconds, Memory: 5.50 MB 1 was a failure: 1) WebTystem :: Test Landing Page Failure / Home / White / Selainium / WebTest Php: 32 Failures! Test: 1, convergence: 0, failures: 1.  

I do not see any screenshots in C: \ selenium. I might get a screenshot though with $ selenium-> captureScreenshot ("C: /selenium/image.png");

Any suggestions or suggestions are most welcome.

Thanks

The error handling of this is bad on the part of phpunit; If everything is not right, then he will ignore his other options silently without warning.

As Dave has been mentioned, if any variable is misspelled, then he will not work quietly, and you can try to work them too. Example in your set up.

Also, not every condition triggers the screenshot. Try your $ Selenium-> Failed () instead of

Selenium-> Asserted Present ("Fobrebus").

Comments