behat

Step definitions in external files in Behat

五迷三道 提交于 2019-12-04 03:21:06
Behat by default looks for the step definitions in file named FeatureContext (all steps in one file). Having a lot of steps, it's hard to maintain such a big file. I'd like to have one definition file per feature file. How can I have step definitions in external files? e.g. homepage.feature HomepageContext extends FeatureContext Use class inheritance and separate contexts. # /features/contexts/ AbstractContext extends BehatContext {} FeaturenameContext extends AbstractContext {} Then in /feature/FeatureContext.php import the context files: /** * Initializes context. * Every scenario gets it's

How to communicate between contexts in behat 3?

烂漫一生 提交于 2019-12-03 16:00:29
I can't use getMainContext() and getSubcontext($alias) in version 3 any more. What is the way to communicate between context in version 3. Are context traits the only way? # behat.yml default: suites: guest_features: paths: [ %paths.base%/features/web ] filters: { role: guest } contexts: [ GuestContext ] user_features: paths: [ %paths.base%/features/web ] filters: { role: member } contexts: [ MemberContext ] groupled_features: paths: [ %paths.base%/features/web ] filters: { role: grouplead} contexts: [ GroupleadContext ] admin_features: paths: [ %paths.base%/features/web ] filters: { role:

Behat authenticate Symfony2 user

谁说胖子不能爱 提交于 2019-12-03 10:12:48
问题 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 When I go to "/login" Then I should be on "/" For the @login, I created the following: /** * @BeforeScenario @login */ public function loginUser() { $doctrine = $this->getContainer()->get('doctrine'); $userRepository = $doctrine->getRepository(

Mink doesn't work with behat 3.0.12

杀马特。学长 韩版系。学妹 提交于 2019-12-03 08:25:41
问题 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", "behat/mink-browserkit-driver": "dev-master", "behat/mink-goutte-driver": "dev-master", "behat/mink-selenium2-driver": "dev-master", "phpunit/php-code-coverage": "dev-master", "phpunit/phpunit-mock-objects": "dev-master", "phpunit/phpunit": "dev-master" } And here is my behat.yml file: default:

Zend Framework integration with Behat BDD

让人想犯罪 __ 提交于 2019-12-03 04:24:56
问题 Anyone has been using Behat with Zend Framework? Any examples on how to use both? 回答1: I got it working. It works with PHPUnit and Zend_Test so you can use all those nifty assertXYZ() methods. First, make sure you've got behat installed and available in your system $PATH . I did the following: sudo pear channel-discover pear.symfony.com sudo pear channel-discover pear.behat.org sudo pear install behat/behat Now, create a directory structure like so: features application ControllerTestCase.php

Mink doesn't work with behat 3.0.12

三世轮回 提交于 2019-12-02 22:08:45
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", "behat/mink-browserkit-driver": "dev-master", "behat/mink-goutte-driver": "dev-master", "behat/mink-selenium2-driver": "dev-master", "phpunit/php-code-coverage": "dev-master", "phpunit/phpunit-mock-objects": "dev-master", "phpunit/phpunit": "dev-master" } And here is my behat.yml file: default: extensions: Behat\Symfony2Extension: mink_driver: true kernel: env: test debug: true Behat

How would I make a fake signature with behat

为君一笑 提交于 2019-12-02 20:23:13
问题 Picture of tested code / Picture of working signature Hello I am using behat with the selenium driver integrated with mink and I am trying to write a test that inputs a fake signature. We use the mouse to draw the signature on the screen so I want to be able to have selenium do that for me. I tried grabbing the Id of the field and using dragTo('another element on my page'), but it only clicks inside the signature box and doesnt do anything else. The framework I am using is laravel for php.

How to stop Behat tests in the middle to run element inspector?

拜拜、爱过 提交于 2019-12-02 19:02:49
问题 I'm using Chrome driver and currently to pause the browser in the middle of the tests I do: And I ... And I wait for 3600 seconds And I ... given the following method: /** * @Given I wait for :number seconds */ public function iWaitForSeconds($number) { $this->getSession()->wait($number * 1000); } so I can freely use DevTools to inspect the objects of the given page at specific place in my tests. The problem is that when opening DevTools , the script stops with error: And I wait for 3600

Zend Framework integration with Behat BDD

…衆ロ難τιáo~ 提交于 2019-12-02 17:39:19
Anyone has been using Behat with Zend Framework? Any examples on how to use both? curtisdf I got it working. It works with PHPUnit and Zend_Test so you can use all those nifty assertXYZ() methods. First, make sure you've got behat installed and available in your system $PATH . I did the following: sudo pear channel-discover pear.symfony.com sudo pear channel-discover pear.behat.org sudo pear install behat/behat Now, create a directory structure like so: features application ControllerTestCase.php bootstrap FeatureContext.php homepage.feature The features/application/ControllerTestCase.php

Symfony2 Extension - Behat Mink

邮差的信 提交于 2019-12-02 11:12:24
问题 I installed a Symfony2 extension for Behat Mink from here When I run test, an error occurs [ReflectionException] Class AppKernel does not exist. What am I doing wrong? behat.yml default: extensions: Behat\MinkExtension\Extension: base_url: http://localhost/behat goutte: ~ selenium2: ~ Behat\Symfony2Extension\Extension: ~ 回答1: First run these commands to install the dependencies: composer require behat/behat composer require behat/symfony2-extension composer require behat/mink composer require