0

I am doing some tests with zombie.js and phantom.js, I would like to display my active session name before each test. Which method can I use?

With behat 3.0 and mink 1.6.

Matthieu
  • 2,736
  • 4
  • 57
  • 87
nitche
  • 121
  • 3
  • 13

1 Answers1

1

You can use hooks. BeforeSuite, AfterSuite, BeforeFeature, AfterFeature, BeforeScenario, AfterScenario, BeforeStep, AfterStep

Example

/**
 * @BeforeSuite
 */
 public static function prepare(SuiteEvent $event)
 {
     // prepare system for test suite
     // before it runs
 }

 /**
  * @AfterScenario @database
  */
 public function cleanDB(ScenarioEvent $event)
 {
     // clean database after scenarios,
     // tagged with @database
 }

If your class extends MinkContext then you can dump your session with: $this->getSession().

If your class extends BehatContext then you can dump your session with: $this->getMainContext()->getSession()

BentCoder
  • 12,257
  • 22
  • 93
  • 165