4

I'm working on test automation for a big project and I'm using Phpunit and as a server I'm using Selenium WebDriver.

In the source code I'm using asserts like :

$this->assertContains('Project Title', $this->webDriver->getTitle());

I'm wondering how can I add the if-else condition, that when it's false I can have a popup or to stop the test.

1
  • Assertions stop the test case already. Commented Jul 16 at 9:25

1 Answer 1

0

Solution :

  • For this situation, I have created an array which had only "Project Title"
  • When statement gets executed if its has expected title will continue otherwise execution will gets terminated
  • Provision has been made to add any condition for title, I just need to add in array

$this->assertContains($this->webDriver->getTitle(), array('Project Title');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.