Giter VIP home page Giter VIP logo

formfeaturegeneratorbundle's Introduction

ACSEOFormFeatureGeneratorBundle

A bundle use Behat and Mink to test your form from CSV Files #Installation using Composer Add the bundle in your composer.json

{
    "require": {
        "acseo/formfeaturegenerator-bundle": "dev-master"
    }
}

Download bundle by running the command:

$ php composer.phar update acseo/formfeaturegenerator-bundle

Composer will install the bundle in vendor/ACSEO directory.

#How to use We used selenium in our code, so you have to download Selenium server.

Update your app/AppKernel.php

new ACSEO\FormFeatureGeneratorBundle\ACSEOFormFeatureGeneratorBundle()

then, you have to execute the comamnd below. This command will create files in your Bundle/Features directory.

$ php app/console acseo:generate:feature YourBundleName GetUrl FormId --username=USERNAME --password=PASWORD --login-url=LOGINURL --login-form-id=LOGINFORMID --class-error=CLASSERROR 

####Required Argument

YourBundleName: The name of your Bundle (ex. AcmeDemoBundle)
GetUrl: the url contain the form to test (ex: /product/new)
FormId: id/class of your form in the page of GetUrl

####Optional

USERNAME: username to login (if you have to login before test your form)
PASSWORD: idem username
LOGINURL: url to login
LOGINFORMID: id/class of your form to login
CLASSERROR: Class of your message error.

The command will create behat.yml in your project directory. You have to put a value for base_url.

####Overload function

You can overload function by create your own function in your feature class

For example overload the function clientConnect

// YourBundle/Features/Context/FeatureContext
protected function clientConnect ()
{
    parent::clientConnect();
    // Your code
}

####Use entity manager

Also you can execute query from your feature.

Example:

// YourBundle/Features/Context/FeatureContext
//.....
protected function YourFunctionName()
{
    $doctrine = $this->kernel->getContainer()->get('doctrine');
    $em = $doctrine->getManager();
    $em->clear();
    $entity = $em->getRepository('YourBundleName:Entity')->find(1);
    // manage your entity
}
//.....

#Test your form In YourBundleName/Features/Data/ there is a CSV file created by the command acseo:generate:feature ...

You have to fill the CSV file by value and execute the command below to test your form

$ bin/behat src/YourBundleName/Features/demoTest.feature

You can create your own feature in /Features directory.

formfeaturegeneratorbundle's People

Contributors

npotier avatar safwanghamrawi avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.