Questions tagged [behat]

Behat is a php framework for autotesting your business expectations. It's a Behavior Driven Development (BDD) framework for PHP, initially inspired by Ruby's Cucumber project. Now it's not only accepted as a PHP implementation of Cucumber, but it provides some quite unique features the original didn't have.

Behat is a php framework for autotesting your business expectations. It's a Behavior Driven Development (BDD) framework for PHP, initially inspired by Ruby's Cucumber project. Now it's not only accepted as a PHP implementation of Cucumber, but it provides some quite unique features the original didn't have.

1099 questions
36
votes
3 answers

How do I run a specific Behat scenario

I'm trying to run a specific Behat scenario from the command line, here's what I'm doing: $ bin/behat features/features/baseline.feature:3 However this isn't picking up the scenario. If I run bin/behat features/features/baseline.feature I can get…
JeremyKirkham
  • 935
  • 2
  • 10
  • 18
32
votes
3 answers

PHPUnit & Behat; complementing or alternatives?

I have been looking around SO and Google, but I couldn't really get a definitive answer. PHPUnit is a framework for unittesting, like JUnit. I use it, also in combination with the Selenium-extension for functional testing. When browsing around I see…
qrazi
  • 1,376
  • 1
  • 14
  • 17
31
votes
1 answer

Behat & Mink : Use the test environment

I'm current using Behat with Mink & Goutte Driver. When i'm trying to use it with my dev environment, via the app_dev.php file, which is a typical app_dev.php file from a Symfony2 Standard Edition, my tests are working just fine (Gists). But, if I…
Talus
  • 754
  • 6
  • 18
27
votes
3 answers

Behat over Cucumber in PHP

Don't get me wrong. I think both projects are fantastic. But as both php and ruby developer I wonder if there are there any compelling reasons, besides possible language barrier, why would one choose Behat over Cucumber (with cuke4php) for BDD even…
Krule
  • 6,398
  • 3
  • 32
  • 53
24
votes
1 answer

Mink doesn't work with behat 3.0.12

I installed Behat, Mink and a few other related packages. Here is my composer.json file: "require":{ //... "behat/behat": "~3.0.6", "behat/symfony2-extension": "dev-master", "behat/mink": "dev-master", …
cute.S
  • 361
  • 3
  • 17
23
votes
5 answers

Mocking The Time used by all instances of DateTime for testing purposes

I'd like to be able to set the time for every instance of DateTime instantiated for the duration of a PHPUnit or Behat Test. I'm testing business logic relating to time. For example that a method in a class only returns events in the past or…
Ben Waine
  • 1,600
  • 3
  • 19
  • 34
17
votes
2 answers

It is possible to exclude a tag with Behat?

I know the way to run only the tests tagged with a chosen @tag: @invite Feature: As User I want to invite a friend to join on MySocial @mytag Scenario: Exists a Facebook user Given I go to "/" When I follow "Invite a friend" ... Is…
sensorario
  • 15,862
  • 24
  • 85
  • 131
16
votes
3 answers

Zend Framework integration with Behat BDD

Anyone has been using Behat with Zend Framework? Any examples on how to use both?
rizidoro
  • 11,367
  • 16
  • 53
  • 84
15
votes
2 answers

Scenario vs. Scenario Outline

Background: I'm currently writing behat tests (Mink/Selenium) for a Symfony2 webpage. I have a good deal of examples to go by, and actually writing them should be no problem. The step definitions are already written. However, in the examples, they…
Alec
  • 1,539
  • 4
  • 15
  • 37
14
votes
4 answers

How to rollback commits in Behat 3 functional tests with Symfony2 and Doctrine?

As the title, my goal is to rollback any commit made during Behat functional tests. I checked this answer very similar, but it is from two years ago and it seems impossible to do. Maybe with Behat 3 now it's possible. I know that with PHPUnit I can…
stuzzo
  • 1,032
  • 1
  • 12
  • 33
12
votes
4 answers

Behat authenticate Symfony2 user

I'm using Behat in Symfony2 / Doctrine2. Now, I have this scenario that boils down to the fact that "if I'm logged in and I go to /login, I shoud go to / instead": @login Scenario: Go to the login page while being logged in Given I am logged in …
tvlooy
  • 988
  • 9
  • 16
11
votes
1 answer

How to integrate Behat with PHPStorm / other IDE

Behat is the leading BDD framework for PHP. I use PHPStorm and want to integrate Behat into the IDE as an external tool. Question: How should I set up Behat as an external tool (ie, output filters, macros, etc) in PHPStorm or any other IDE for that…
JoshuaDavid
  • 7,423
  • 6
  • 41
  • 53
11
votes
3 answers

Is it possible to override step definitions in a behat context?

Is it possible to have have a subcontext class extend another subcontext and override functions? At present I have class TestContext extends BehatContext { /** * @Given /^a testScenarioExists$/ */ public function…
user2181503
  • 111
  • 1
  • 3
11
votes
1 answer

how to activate mink in behat

I'm trying to use behat and mink together, reading that link: http://docs.behat.org/cookbook/behat_and_mink.html#method-1-composer and trying to activate Mink in Behat framework, but it does not work for me :( here is text form manual And this…
user1016265
  • 2,169
  • 3
  • 26
  • 47
10
votes
1 answer

How to find a text node element with Mink?

I was wondering, i have this HTML :
  • sf_tristanb
    • 8,267
    • 16
    • 67
    • 114
  • 1
    2 3
    73 74