Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Douglas Reith
    ok, so I worked it out, features/bootstrap/bootstrap.php is loading DotEnv but only if APP_ENV is not defined, I unset that in my local environment and now all is fine
    Jaroslav Rakhmatoullin
    Is there a way to force behat to write exceptions / errors / notices to the configured (php.ini) error_log instead (or in addition to) of rendering them in the output?
    Renato Marinho

    Hey guys, I'm GitScrum founder. I want to invite group members to get to know GitScrum. Site: https://site.gitscrum.com/

    GitScrum’s agile approach to project management has proven itself to be a time and money saving strategy with the flexibility to keep up with rapid changes.

    Victor Hugo
    Hi, I'm new to behat! I'm using transformers to get :card, :card1 and :card2. With this regular expression /^:card(\d*)$/ but not working.
    Bit Wombat
    @victorhsanjos_twitter post code :)

    Hi there, i have some issue whit Behat on Lumen 5.2

    this is my post on StackOverflow so if somebody can leave a comment i would be thankfull


    Christian Sciberras
    I've seen "exercise" mentioned in a few places around behat code and also some of the docs. What is it exactly? I couldn't find full documentation explaining it.
    Ciaran McNulty
    beforeExercise hook runs before the first suite
    And afterExercise after the end of the last suite
    Christian Sciberras
    ok, so exercise is a bit like a whole "profile" in behat.yml terms?
    Ciaran McNulty
    Yeah the whole shebang
    Christian Sciberras
    Thanks, good to know! My next question, if I may: I'm trying to set up some fixtures setup/teardown in before/after feature.
    The problem is that the hook has to be a static method.
    Since my context receives some dependencies (which may have to be passed to the fixture), I won't be able to pass them during these two hooks.
    So I went with a different approach which stinks of a hack.
    In beforeScenario I check if the scenario is the first one and if it is, then set up the fixture.
    Likewise, in afterScenario, if it is the last one, I teardown the fixture.
    Should I be concerned or is it passable?
    Ciaran McNulty
    That’s acceptable I think. The context is not instantiated until the scenario so they have to be static. Possibly we should support auto wiring in beforeScenario hooks if we do not already
    Moises Ruiz
    I am a beginner, how can install and configure behat in a project?
    I learning behat, but I difficult to understand pystrings. I don't know how to use it ?
    Alexandre Lemaire
    What's the right Behat\Testwork\EventDispatcher\Event\ event for start and finish of a feature?
    Christian Sciberras
    Hi! Maybe someone might find this useful: https://github.com/uuf6429/behat-breakpoint
    Raaghav Srinivasan

    Hi ! I am new to Behat, trying to understand if Behat can be used to write evil stories (https://www.owasp.org/index.php/Agile_Software_Development:_Don%27t_Forget_EVIL_User_Stories) .... has anyone seen this being used to perform security testing ?

    Also are there any lessons learned/gotchas you can share as part of getting Behat setup within the SDLC of your organization ? any resource would be helpful. Thanks in advance!

    Christian Sciberras
    They look like regular stories to me. You just need a different set of step definitions.
    Raaghav Srinivasan
    thanks ! fair point, was curious to see if anyone has taken this approach for security and has come across any issues/challenges... does integrating behat into the sdlc involve any code level changes on the application code base in order to support the tests ? or is it something which can be done standalone ?
    Christian Sciberras
    If someone develops a context to provide your steps, then you don't need any code. But this is unlikely, especially in this case.
    Behat doesn't provide navigation, for example. It's provided by mink instead.
    Raaghav Srinivasan

    I am not sure what you meant by "if someone develops a context" , if I understand correctly - with Behat, looks like that the functions need to annotated with the patterns ( @when etc..)... so is it fair to say that before I can start using behat, I need to manually annotate the existing functions in my code base which I tend to use as part of my scenario ?

    Behat uses php-doc annotations to bind patterns to FeatureContext methods:

    Christian Sciberras
    Yes, that's one way to put it.
    hi there
    i have a problem with too_many_redirects
    the test break while it the browser gets too_many_redirects
    how can i skip that?
    Michael Schröder
    Hello everyone, is it possible to write features and scenarios for behat in another language than english?
    Michael Schröder
    I found this post: https://stackoverflow.com/questions/27312612/change-behat-language; but there's no behat.yml in my project folder (I ran --init just before), and if I run behat -- lang de, then I still get Expected Feature, but got text: "Funktionalität [..]
    Michael Schröder

    Hi! Could you please help me to fix issue with behat.yml?
    I've create



        - FeatureContext
        - WebContext:
            defaultUrl: https://https://stackoverflow.com
            host: http://localhost:4444/wd/hub

    Project structure is features>bootstrap>FeatureContext+WebContext (2 files at the same level)
    behat.yml is located at the root directory

    When I lauch behat - error appeared: In UninitializedContextEnvironment.php line 44:

    FeatureContext context class not found and can not be used.
    I'm a newbie and have no idea how to fix it.

    Hi all. I am looking for a solution where one can run behat tests nightly? By that i mean, i want some set of tests to run automatically at a specific time interval. anyone has any experience with it?
    Philip Wong
    Hi all, I'm trying to run selenium + IEDriver on Windows 10 but I am getting "Could not open connection: Unable to create session". I hope someone can try to help me
    I wasn't sure the best place to get support for Behat
    @bharatahuja04 you can write and use some bash script for this and put it into cron.
    Other options is a use a some tools to CI
    @p2635 can yuou show your behat configuration file and packages which you use in project
    Philip Wong

    Hi @bakedev , thank you for your help, I've gone a bit further but I still have a problem with my test. I think that it's running the test too fast (before the page is fully loaded). See below (sorry for the long post!), some of the code was written by colleagues so I don't have a full understanding of how it works...

    Windows 10, WAMP, Git Bash, selenium-server-standalone-3.141.59.jar, geckodriver-v0.21.0-win32, IEDriverServer_Win32_3.9.0, ChromeDriver 2.44

    Git Bash

    When running test with GeckoDriver: Fatal error: Class 'Behat\Mink\Exception\ExpectationException' not found in C:\...ElementNotFoundException.php on line 21.

    When running test with IEDriver:

      ┌─ @BeforeScenario # FeatureContext::before()
      ╳  Invalid timeout type specified: ms
      ╳  Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
      ╳  System info: host: 'ANON', ip: 'ANON', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_191'
      ╳  Driver info: driver.version: unknown (Exception)


        /** @BeforeScenario */
        public function before(BeforeScenarioScope $scope)
            $tags = $scope->getScenario()->getTags();
            if (in_array('skip', $tags)) {
                throw new SkippedException();
           // Reduce the page timeout to expedite test for Selenium2Driver (seems to just work for Chrome)
           $this->getSession()->getDriver()->setTimeouts(['page load' => 60000]);


        "name": "my/test",
        "require": {
            "symfony/css-selector": "v3.4.19",
            "symfony/dom-crawler": "v3.4.19",
            "behat/mink": "1.7.1",
            "behat/mink-extension": "2.3.1",
            "behat/mink-goutte-driver": "1.2.1",
            "behat/mink-selenium2-driver": "1.3.1",
            "phpunit/phpunit": "6.5.13",
            "ramsey/uuid": "3.8.0"
        "autoload": {
            "psr-4": {
                "Jobs\\FunctionalTests\\Contexts\\": "features/bootstrap"


    # behat.yml
            tags: "~@manual_test_only"
        '': %paths.base%/features/bootstrap
                  browser: 'firefox'
                      acceptInsecureCerts: true
                      marionette: true;
                   browser: 'chrome'
                   capabilities: {
                     "browserName": "chrome",
                     "browser": "chrome",
                     "version": "70",
                     'chrome': {'switches':['--no-sandbox']}}
                   browser: 'internet explorer'
                   wd_host: http://localhost:4444/wd/hub
                   capabilities: {
                     "browserName": "internet explorer",
                     "browser": "internet explorer",
                     "version": "11"
    Philip Wong
    If I use the latest version of GeckoDriver, I get the same result as IEDriver. :(
    Donald Tyler
    Howdy! I'm writing a Behat Extension and I'm struggling with the dependency injection. I'm hoping you guys and gals can help me out.
    I've had success setting up DI services and injecting them via the behat.yml file, like so:
                  path: "%paths.base%/features"
                    - Chekote\BehatNounStoreExtension\Context\StoreContext:
                      - "@store"
                      - "@assert"
                    store: Chekote\NounStore\Store
                    assert: Chekote\NounStore\Assert
    But I don't want the extension users to have to manually define these services themselves. So instead, I'm trying to register them in the extension classes process() method. Like so:
    class BehatNounStoreExtension implements Extension
      const SERVICE_ID_ASSERT = 'noun.assert';
      const SERVICE_ID_ARGUMENT_TRANSFORMER = 'noun.argument_transformer';
      const SERVICE_ID_STORE = 'noun.store';
       * {@inheritdoc}
      public function process(ContainerBuilder $container)
        $container->register(self::SERVICE_ID_STORE, Store::class);
        $container->register(self::SERVICE_ID_ASSERT, Assert::class)->addArgument(new Reference(self::SERVICE_ID_STORE));
            ->addArgument(new Reference(self::SERVICE_ID_STORE))
            ->addArgument(new Reference(self::SERVICE_ID_ASSERT));