私はsymfonyでbehatを使ってテストを行いましたが、動作していません。function ipst in behatは動作しません
これは私の機能である:
Feature: dossiertest
@javascriptシナリオ:ディレクトリ内の一覧2つのファイル
Given I am on the homepage
Then I should see "hello"
When I go to "/ajoutermed"
Then I should see "ajouter"
And I wait 2 seconds
And I fill in "test_medbundle_med_section" with "tes nom"
And I fill in "test_medbundle_med_info" with "tes nom"
And I press "Ajouter Med"
Then I should see "ajouter"
これはAjouterContext.phpです:
<?php
namespace test\MedBundle\Behat\Context;
use Behat\Behat\Context\Context;
use Behat\Behat\Context\BehatContext;
use Behat\Behat\Exception\PendingException;
use Behat\Gherkin\Node\PyStringNode;
use Behat\Gherkin\Node\TableNode;
use Behat\MinkExtension\Context\MinkContext;
use test\MedBundle\Entity\Apps;
use test\MedBundle\Entity\Product;
/**
* Defines application features from the specific context.
*/
class AjouterContext extends MinkContext
{
/**
* @When I press :arg1
*/
public function iPress($arg1)
{
self::$driver->findElement(WebDriverBy::cssSelector($arg1))->click();
//$element = $page->find('css',"input[value='$arg1']");
}
/**
* @Then I wait :arg1 seconds
*/
public function iWaitSeconds($arg1)
{
$this->getSession()->wait($arg1 * 1000);
}
}
behat.yml:
default:
suites:
default:
bundle: MedBundle
contexts:
- test\MedBundle\Behat\Context\FeatureContext
- test\MedBundle\Behat\Context\AjouterContext
extensions:
Behat\Symfony2Extension: ~
Behat\MinkExtension:
base_url: http://localhost/test/web/app_dev.php
goutte: ~
javascript_session: selenium2
selenium2:
wd_host: http://localhost:4444/wd/hub
sessions:
default:
symfony2: ~
、これは私がテストをlaunche時に私の問題です:
は私を助けてくださいとあなたのエラーメッセージについて、あなた
ページオブジェクトを使用し、必要な場合にいくつかのメソッドをオーバーライドして新しい共通オブジェクトを追加することができる 'Page'を拡張する基本ページオブジェクトを用意する必要があります。必要な複雑さを加えてデバッグするのが難しくなるようにする前に、適切な構造を持っていることを確認してください。ここをクリックしてくださいhttp://behat-page-object-extension.readthedocs.io/en/latest/guide/introduction.htmlこの機能を持つ – lauda