Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Is there any way to have profile information show up in a JUnit report. I found that I can echo information into the standard output, but if I switch to the JUnit formatter, that information is lost. Any way to get additional information into the JUnit report?
    Eduard Sukharev
    @ZathrasOne I guess you could extend JUnit formatter and add required info to generated output XML (or whatever format it uses) and then use your formatter (say, 'junit-profile') instead of 'junit'
    Lucas Ruggiero
    Hey guys, I have a project using symphony and behat framework running inside a container. I would like to add this framework inside of the project. Is there any specific place that I should add this?
    Hi there is it possible to select an pseudo element in Behat with Symfony?

    I am working on test scripts for a website, but I came across a pseudo element that I unfortunately cannot work around.

    The HTML looks similar to the following:

    <a class = 'something', href='link', data-post = 'somesortofaction' ::before <span>Remove this Item</span>

    The a-element is not clickable, since in this case its exactly 0 pixels wide, so I need to use the :before pseudo-element.
    Whenever I try, behat gives me back either an error if I do not use the ::before or "pseudo-elements are not supported"

    I know pseudo-elements are not part of the DOM, but does anyone have a simple workaround?

    Thank you so much in advance!

    @gvanduijn Another option would be to just add a class or data-attribute on <span> to directly reference it
    Waiting on Smash

    Hello :). I'm discovering Behat and I seem to have an issue with Google. I'm following Grafikart's tutorial ( h ttps://www.youtube.com/watch?v=SiB8OlaptGU ) and to explain how to use the tag @javascript , he does something like this
    "Scenario: Search
    Given I am on the homepage
    When I fill in "lst-ib" with "Grafikart"
    And I wait for 1 seconds
    Then I should see "Grafikart.fr" "

    The fill in's field here is my Google's id but no page is opened when I trigger it. Any idea why? I have this error :
    When I fill in "lst-ib" with "Grafikart" # WebContext::fillField()
    Form field with id|name|label|value|placeholder "lst-ib" not found. (Behat\Mink\Exception\ElementNotFoundException)

    Tom Cappetta
    From a gherkin mapping to code perspective, does anyone know how to get multiple gherkin statements to be recognize for 1 function of code?
    ive added them above the method but I'm still seeing that they are undefined...

    following this tutorial: https://knpuniversity.com/screencast/behat/install and probobly having different versions of symfony in tutorial and on my side I get next error:
    Given I am on "/" # FeatureContext::iAmOn()
    Fatal error: Class 'PendingException' not found (Behat\Testwork\Call\Exception\FatalThrowableError)
    When I fill in "searchTerm" with "Samsung" # FeatureContext::iFillInWith()
    And I press "search_submit" # FeatureContext::iPress()
    Then I should see "Samsung Galaxy S II"

    my composer file is:
    "require": {
    "php": ">=5.5.9",
    "symfony/symfony": "3.1.*",
    "doctrine/orm": "^2.5",
    "doctrine/doctrine-bundle": "^1.6",
    "doctrine/doctrine-cache-bundle": "^1.2",
    "symfony/swiftmailer-bundle": "^2.3",
    "symfony/monolog-bundle": "^2.8",
    "symfony/polyfill-apcu": "^1.0",
    "sensio/distribution-bundle": "^5.0",
    "sensio/framework-extra-bundle": "^3.0.2",
    "incenteev/composer-parameter-handler": "^2.0",
    "knplabs/knp-markdown-bundle": "^1.4",
    "doctrine/doctrine-migrations-bundle": "^1.1",
    "ramsey/uuid": "^3.7"

    "require-dev": {
        "sensio/generator-bundle": "^3.0",
        "symfony/phpunit-bridge": "^3.0",
        "nelmio/alice": "^2.1",
        "doctrine/doctrine-fixtures-bundle": "^2.3",
        "behat/mink-extension": "^2.3",
        "behat/mink-goutte-driver": "^1.2"
    Eduard Sukharev
    @cappetta multiple sentence regexps in phpdoc of implementation method should work just fine. Each should start with @Given, @When or @Then as usual.
    Hello does the DocumentElement is updated if the page DOM is changed during a step?
    During a step, i need to wait until an ajax call is made to check that page content match a pattern so I use spin method described here http://docs.behat.org/en/v2.5/cookbook/using_spin_functions.html and $this->assertSession()->pageTextMatches($this->fixStepArgument($pattern)); but I think DOM Content is not updated
    it's not updated
    Sam Tuke
    Hi all, does it make sense to use behat + selenium for measuring page load speed? E.g. to determine whether over time a web app is loading more quickly or slowly?
    Christophe Coevoet
    I would not use Behat for that. A Gherkin scenario does not seem the right way to check this
    and I'm not even sure Selenium allows to measure that easily
    Thread Reader Bot 🤖
    hello everyone, i looked all the doc i can found about it but still no luck
    I'm wondering how/if it is possible to pass an argument on the behat command line that I can get in my context after?
    for example behat --colors --my-arg=my-value
    I kind of see that it may be possible to pass through env var but this is not so flexible
    Ciaran McNulty
    I don’t think this functionality is built in
    Christophe Coevoet
    you will need to write a Behat extension for that
    Thread Reader Bot 🤖
    thank you both for your help :)
    Hola quisiera me aclaran una duda sobre el contralador Mink Cheat Sheet. Soy profesora de una universidad y sobre BDD tengo una duda. Si empleo las palabras reservadas de Mink Cheat Sheet, no tengo que implementar los Step Definitions. Por favor me urge
    Hola quisiera me aclaran una duda sobre el contralador Mink Cheat Sheet. Soy profesora de una universidad y sobre BDD tengo una duda. Si empleo las palabras reservadas de Mink Cheat Sheet, no tengo que implementar los Step Definitions. Por favor me urge
    Hola, es exactamente como dices, por defecto existen implementados los step definitions mas comunes para ahorrar tiempo, pues al final ese codigo se puede reutilizar. Acciones como pinchar un link, o presionar un boton, o llenar un campo, etc... Claro que de cierta manera eso te limita pues entonces no podrias reutilizar los mismo scenarios en varias implementaciones, como por ejemplo utilziar un scenario de autenticacion para hacer pruebas d UI automatizadas, usar el mismo scenario para hacer pruebas de integracion, o probar diferentes roles, etc...
    Christian Sciberras
    PHPUnit has a feature where one can define suites in the XML file and these will be run sequentially (unless the suite to run is specified from CLI). I tried something similar with Behat 3, but instead of running the suites, it seemed to run everything (it looked like it took the default settings).
    1. Is this the correct behaviour, or did I do something wrong?
    2. Is there a way to make it work like PHPUnit without requiring extensions?
      A little context on what I need: I'm testing a system and there are two types of tests: (a) should run during setup and (b) should run after setup (possibly more will come up in the future).
      I'm controlling this with the use of tags/filtering, but it would be nice to avoid having to run behat --tags=before-setup && behat --tags=after-setup (also because it would be great to have one unified output)
    David Lorite Fernández
    hello everyone! I’m using Selenium (3.8.1), Chromedriver (2.33), Behat (3.4.3) and Chrome (64)…when the tests run, an error appears randomly. The error: "no such window: target window already closed from unknown error: web view not found”, Selenium is running in standalone….any ideas?
    Which mink-extension version do you use?
    David Lorite Fernández
    Mink-extension version 2.3.0
    Christophe Coevoet
    @uuf6429 Behat also have this concept of suites, and they also run sequentially (unless you use the --suite option to run only one of them). Are you sure you were defining suites ?
    Hello All, I am trying to figure out how to script click on tabs with Behat. I can click buttons, links, and elements, but having problems with tabs. I've tried to use Element thinking that may work, but no luck yet. Any help would be greatly appreciated. Thanks!
    I think we figured it out. Correct syntax is to call the element with something similar to: And I click the ".StepListViewTabsItem[data-tab='Complete']" element
    Shaun Moss
    Hi - I am trying to use behat to set the value of a Body field on a form, except the field is a CKEditor rich text WYSIWYG field, which uses an iframe. Any tips?
    Shaun Moss
    solved. Happy to relay answer if anyone else is interested.

    Hello all, I am trying to figure out if I can use custom parameters from .yaml file from one context to another. For ex:


                - CustomWebContext:
                    user: asdf
                    pass: 1234
                - CustomAPIContext:
                     user: asdf
                    pass: 1234

    The problem is: I have 2 context files which use same parameters. Should I define parameters for both context ?
    Any help will be appreciated. Thanks all.

    Hello again :) , I found the solution here we go :
                  user: &user asdf
                  pass: &pass 1234
                  - CustomWebContext:
                      sfEmail:              *user
                      sfPassword:     *pass
                  - CustomApiContext:
                      sfEmail:              *user
                      sfPassword:     *pass
    Jose Cornide
    hello! I'm thinking about creating an html version of my behat tests some business people can read them even easier, so I was wondering if there's any way to get all the tests info
    and then iteract throw them to generate the output
    Hi all. I use multiple suite and custom parameters. I retrieve my parameters using the scope. But I didn't find a way to retrieve these parameters in @BeforeSuite hook. How can I do that. Thanks in advance
    Hi everyone. Is anyone aware of a Behat feature, or maybe even an extension, which would summarize in some form of a report the amount of time it took to execute each scenario?
    Ciaran McNulty
    @ciaranmcnulty Thanks for the suggestion. I'll certainly look into this.
    Ben Plummer

    Hi all, I'm working on a project that will follow DDD with layers and patterns but I also want to use BDD for acceptance testing outside-in.

    With this approach, I wondered whether the Behat scenarios would mainly concentrate on the UI? And what the best practices are?

    I've read that ideally we don't want to couple scenarios to a UI that could easily change but I'm not sure what the alternative would be when I want to write scenarios in a TDD fashion before any code/layers/patterns exist. I imagine it'd be quite difficult to write scenarios for DDD related code that does not exist yet whereas the UI is more predictable.

    Paul Gibbs
    Does the BeforeScenario event hook trigger before Background steps, or only actuall Scenarios? I'm looking for something that fires before scenarios and backgrounds, but not BeforeFeature (can't use static function).
    Chris Lock
    @paulgibbs AFAIK it triggers before the Background too
    Hi all, I'm having a bit of an issue tryiong to get Behat to register a namespaced context file linking with Symfony 4, if anyone has an example I'd appreciate it