mercredi 19 août 2015

Skip or close a test using Selenium Webdriver PHP

Here's how I write my tests : a class with private methods and a single public method which runs all my others private methods.

<php
...
class MyTest extends PHPUnit_Framework_TestCase
{
    ...
    private function firstScenario() {
        $this->navigation = new Navigation($this->webDriver);
        $this->navigation->goToPointA();
        ...
    }

    private function secondScenario() {
        $this->navigation = new Navigation($this->webDriver);
        $this->navigation->goToPointA();
        ...
    }

    public function testRun() {
        ...
        $this->firstScenario();
        $this->secondScenario();
        ...
    }

I have in other classes some generic methods, whose one named Navigation.php. In this class, I have all my methods which enable me to go to a specific point of my application.

All I want to do is, according to a condition, to skip (close, quit, or whatever you want) my first test (firstScenario()) to my second (secondScenario()).

Thanks (sorry for bad english)

Aucun commentaire:

Enregistrer un commentaire