Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Antonios Pavlakis:
Having a go at creating a Behat 3 extension
Jan 15, 2016 @ 18:42:10

In this post to his site Antonios Pavlakis "has a go" at creating an extension for the Behat (v3) testing tool. Behat is a testing tool written in PHP that helps with behavior-driven testing as opposed to unit testing with a tool like PHPUnit.

Ever since I got accepted to do a tutorial on Test legacy apps with Behat at the PHPNW15 conference, I’ve been meaning to look into creating custom extensions for Behat. I didn’t have enough time to research into this while preparing for the tutorial, so left it in my todo list in Trello.

During the PHPNW15 long weekend (Friday - Monday), at some point over lunch I was at the table where Matt Brunt (@themattbrunt) and Ciaran McNulty (@ciaranmcnulty) were having a conversation about this and Ciaran said (paraphrasing) “In order to be able to write an extension, you really need to understand how Behat works.”

So a few months later, sleeves up and I went into my vendor/bin/behat and started looking (and poking) around.

After looking in to two current extensions he started to get a feel for what was needed and the pieces that made up an extension. He then gets into detail on each of these pieces and shares some code/configuration he used to create the extension.

tagged: behat testing extension tutorial example behat3

Link: http://pavlakis.info/php/23-having-a-go-at-creating-a-behat-3-extension


Trending Topics: