How do I run a PHPUnit Selenium test without having a new browser window run for each function?

前端 未结 5 1838
逝去的感伤
逝去的感伤 2021-01-13 05:06

I am trying to run a selenium test case using PHPUnit. And the first thing I do is trying the login function, this works perfect but then I want to run a function to check i

5条回答
  •  太阳男子
    2021-01-13 05:29

    You can call PHPUnit_Extensions_SeleniumTestCase::shareSession(true) to enable browser window reuse.

    In the manual it says:

    From Selenium 1.1.1, an experimental feature is included allowing the user to share the session between tests. The only supported case is to share the session between all tests when a single browser is used. Call PHPUnit_Extensions_SeleniumTestCase::shareSession(true) in your bootstrap file to enable session sharing. The session will be reset in the case of not successul tests (failed or incomplete); it is up to the user to avoid interactions between tests by resetting cookies or logging out from the application under test (with a tearDown() method).

提交回复
热议问题