Yii Framework Forum: Behat/Mink support for BDD? - Yii Framework Forum

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Behat/Mink support for BDD?

#1 User is offline   sensorario 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,986
  • Joined: 07-September 10
  • Location:Cesena (Italy)

Posted 20 February 2012 - 10:58 AM

Hi guys. I dont know if you know Behat. With Behat you can write test in natural language. And with Mink (a browser), you can run functional tests like

Scenario: User Activated can login
Given exists an activated user called "mario" with email "mario@mario.it" and password "password"
And I am on "/login"
When I fill in "Username" with "mario"
And I fill in "Password" with "password"
And I press "Login"
Then the response should contain "Welcome, mario!"
1

#2 User is offline   Jaggi 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 90
  • Joined: 05-September 11

Posted 21 February 2012 - 10:58 AM

Hi again sensorario, just gonna add this is based off Ruby's cucumber project.
See my development site @ www.CodeTheInter.net (BETA)

Posted Image Posted Image

Quote

If you make it idiot proof, they'll build a better idiot
0

#3 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 21 February 2012 - 12:51 PM

Why not write an extension / demonstration / tutorial / whatever - so that we can see how Behat and Mink works with Yii ?

If it's succesful, then chances are higher that it will make it's way into the official Yii package. :)
"Less noise - more signal"
0

#4 User is offline   sensorario 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,986
  • Joined: 07-September 10
  • Location:Cesena (Italy)

Posted 22 February 2012 - 09:35 AM

jacmoe, can you help me in this stuff? I've tryied. I can share the project on github.
0

#5 User is offline   fantgeass 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 22
  • Joined: 25-February 11

Posted 20 March 2012 - 11:34 PM

Can you share an example of the introduction of behat into Yii?


I have problems with include-warnings, like
Warning: include(): Failed opening 'PHPUnit_Framework_Comparator_MockObject.php'

42
0

#6 User is offline   ololo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 23-January 11
  • Location:Minsk, Belarus

Posted 13 May 2012 - 08:43 AM

hi guys, just noticed that there is Behat / YiiExtension in the official Behat github account, it looks like demostration of how to integrate behat with "other frameworks" (see this everzet's post) rather than ready-to-use yii extension, but anyway it should help you

btw, I didn't use behat with yii, but it shouldn't be a problem just to run behat on yii project: you just need to configure autoloader and provide yii app instance for the behat context
0

#7 User is offline   spamec 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 36
  • Joined: 19-February 09

Posted 26 June 2012 - 09:20 AM

Tryin to integrate behat yii extension without luck :/
0

#8 User is offline   sensorario 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,986
  • Joined: 07-September 10
  • Location:Cesena (Italy)

Posted 29 June 2012 - 09:10 AM

Yes! Me too.
0

#9 User is offline   Boontjie 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 14-September 12
  • Location:Cape Town

Posted 19 September 2012 - 04:20 AM

Have anyone made any progress on this? If not I'll get into it as well, missing a nice BDD testing framework for my Yii projects. I use it as a standard over my django projects.
0

#10 User is offline   acorncom 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 100
  • Joined: 25-February 11
  • Location:CO, USA

Posted 02 October 2012 - 11:42 PM

Take a look at the YiiBoilerplate wiki article: http://www.yiiframew...ure-in-seconds/

There isn't much info on Behat (you have to understand it / teach yourself how to use it), but the Boilerplate has Behat pre-setup and ready to use, along with all the Mink drivers
1

#11 User is offline   jcsmesquita 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 27-July 11

Posted 26 August 2013 - 06:01 PM

View Postacorncom, on 02 October 2012 - 11:42 PM, said:

Take a look at the YiiBoilerplate wiki article: http://www.yiiframew...ure-in-seconds/

There isn't much info on Behat (you have to understand it / teach yourself how to use it), but the Boilerplate has Behat pre-setup and ready to use, along with all the Mink drivers


+1 this. I've managed to setup behat by looking at the yiiboilerplate code and following behat's excellent guide http://docs.behat.org/#quick-intro

Couldn't get it to work with Selenium2. Sahi on the other hand works well and it seems like the better choice.
0

#12 User is offline   Boaz 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 366
  • Joined: 23-January 11

Posted 31 October 2013 - 09:05 AM

View Postjcsmesquita, on 26 August 2013 - 06:01 PM, said:

+1 this. I've managed to setup behat by looking at the yiiboilerplate code and following behat's excellent guide http://docs.behat.org/#quick-intro

Couldn't get it to work with Selenium2. Sahi on the other hand works well and it seems like the better choice.


Can you share a recipe for integrating Behat into Yii? I'm interested in Mink but will go for complete Behat.
Thanks.
Therapeutic PHP sessions My LinkedIn Profile
0

#13 User is offline   acorncom 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 100
  • Joined: 25-February 11
  • Location:CO, USA

Posted 31 October 2013 - 09:58 AM

I'd actually recommend using Codeception these days (http://codeception.com). It runs over top of Behat / Mink and has fairly decent Yii support (and at least partial backing of some well known Yii guys).
0

#14 User is offline   Boaz 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 366
  • Joined: 23-January 11

Posted 31 October 2013 - 10:31 AM

View Postacorncom, on 31 October 2013 - 09:58 AM, said:

I'd actually recommend using Codeception these days (http://codeception.com). It runs over top of Behat / Mink and has fairly decent Yii support (and at least partial backing of some well known Yii guys).


thanks, but all I need is Mink so in effect all technically needed, to the best of my understanding, is to put the Mink tree in some location, then make the two auto loaders sing along and viola! :-)
Unfortunately, I don't have the resources to learn what Codeception is, how to work with it, and little less importantly, a desire to integrate all the Codeception into Yii just to get Mink.
Or maybe did I miss your point? Can you point me (or share here) your instructions on integrating Mink (or even Behat) into Yii?

Thanks for the suggestion anyway.

Frustrating... Posted Image
Therapeutic PHP sessions My LinkedIn Profile
0

#15 User is offline   acorncom 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 100
  • Joined: 25-February 11
  • Location:CO, USA

Posted 31 October 2013 - 10:57 AM

Sadly, I don't have any instructions on integrating Mink and I did Behat stuff about 9 months ago, it wasn't working perfectly and I don't remember very clearly what I did :-). Hence the suggestion about Codeception, as they have good instructions and handle a lot of that for you.
0

#16 User is offline   Boaz 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 366
  • Joined: 23-January 11

Posted 31 October 2013 - 11:12 AM

ok. thanks for the update.
any quick tips/pointers regarding integrating codeception into Yii?
Therapeutic PHP sessions My LinkedIn Profile
0

#17 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,391
  • Joined: 17-January 09
  • Location:Russia

Posted 31 October 2013 - 01:54 PM

Check basic app, there are some tests.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#18 User is offline   Boaz 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 366
  • Joined: 23-January 11

Posted 03 November 2013 - 02:24 AM

Thanks @samdark but unfortunately this didn't help.
I think the complication stems from that composer autoloader. I'm unfamiliar with composer (inexperienced with) and its simply a bite to big to swallow, I guess.
Therapeutic PHP sessions My LinkedIn Profile
0

#19 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,391
  • Joined: 17-January 09
  • Location:Russia

Posted 03 November 2013 - 10:40 AM

What's the problem exactly? You have trouble getting basic app to run?
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#20 User is offline   Boaz 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 366
  • Joined: 23-January 11

Posted 03 November 2013 - 10:56 AM

Success!
I have managed to get Mink working in Yii by including vendor/autoload.php and then fully qualify a couple of classes I needed to instantiate on my code. The rest of the classes Mink needed were found by it automatically. So I now have it working.

@Samdark do you mean basic yii app? basic Mink app? (via composer, for example). Yii if obviously working and I've created an extension to encapsulate Mink integration details but after including Mink's autoloader like this (and I've tried many many other options... )
$driver = new SahiDriver('phantomjs');

It didn't work and I got an exception (IIRC) from php that complained that it could not locate the SahiDriver class.

After I changed the instantiation to fully qualified identifier with namespace, it worked:
$driver = new Behat\Mink\Driver\SahiDriver('phantomjs');


EDIT: just to complete the information, the other needed line is a 'require' statement:
</div><div>// obviously - update to your path</div><div>require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'vendor/autoload.php';</div><div>

Therapeutic PHP sessions My LinkedIn Profile
0

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users