lara8818's avatar

Using Behat to test RESTful APIs

I've been trying to set up Behat to work with a Laravel 5 project my team is working on. The reason we've decided to go with Behat over something more traditional like PHPUnit or PHPSpec is because the Gherkin syntax is something that our product team can write for us and can be directly posted in our project management tool.

While the Laravel-specific extension for Mink works great, it's obviously intended more for testing an entire interface rather than REST calls. Does anyone have any advice for setting up Laravel 5 to work with, say, the Behat WebApiExtension? While still providing support for stubs and mocking?

Thanks!

0 likes
5 replies
lara8818's avatar

Hi Bobby, thanks for getting back to me. Unfortunately, I've already read through those articles (as well as several others) and have looked at a variety of different libraries and examples on GitHub. They all seem to be focused on Laravel 4, while I'm trying to run it against Laravel 5.

It's looking like I might need to write a custom extension that incorporates the Laracast and WebApi extensions. Though I'd love to avoid this extra overhead if possible.

bobbybouwmann's avatar

I think you can just try it out in Laravel 5 and it should work as far as I can see!

waled's avatar

@NickGlenn Hi Nick, Did you finaly write a custom extension that incorporates the Laracast and WebApi extensions, our what you did do please ?

Please or to participate in this conversation.