github.com/leonlxy/hyperledger@v1.0.0-alpha.0.20170427033203-34922035d248/bddtests/README.md (about)

     1  # Welcome to the Behavioral Driven Development (BDD) subsytem for Fabric
     2  Developers will find these mechanisms useful for both exploratory and verification purposes.
     3  
     4  ## Getting started
     5  
     6  ### Installation
     7  
     8  #### Setup python virtual environment wrapper usage
     9  
    10  ```
    11      sudo pip install virtualenv
    12      sudo pip install virtualenvwrapper
    13      export WORKON_HOME=~/Envs
    14      source /usr/local/bin/virtualenvwrapper.sh
    15  ```
    16  
    17  #### Setup your virtual environment for behave
    18  [Virtual Environment Guide](http://docs.python-guide.org/en/latest/dev/virtualenvs/)
    19  
    20  
    21  ```
    22      mkvirtualenv -p /usr/bin/python2.7 behave_venv
    23  ```
    24  
    25  This will automaticall switch you to the new environment if successful.  In the future, you can switch to the virtual environment using the workon command as shown below.
    26  
    27  ```
    28      workon behave_venv
    29  ```
    30  
    31  
    32  #### Now install required modules into the virtual environment
    33  
    34  **NOTE**: If you have issues installing the modules below, and you are running the vagrant environment, consider performing a **vagrant destroy** followed by a **vagrant up**.
    35  
    36  ```
    37      pip install behave
    38      pip install grpcio-tools
    39      pip install "pysha3==1.0b1"
    40      pip install b3j0f.aop
    41      pip install jinja2
    42      # The pyopenssl install gives errors, but installs succeeds
    43      pip install pyopenssl
    44      pip install ecdsa
    45      pip install python-slugify
    46      pip install pyyaml
    47  ```
    48  
    49  ### Running behave
    50  
    51  #### Peer Executable and Docker containers
    52  
    53  Behave requires the peer executable for packaging deployments.  To make the peer execute the following command.
    54  
    55  
    56  ```
    57  #Change to the root fabric folder to perform the following commands.
    58  cd ..
    59  
    60  # Optionally perform the following clean if you are unsure of your environments state.
    61  make clean
    62  make peer
    63  ```
    64  
    65  The behave system also uses several docker containers.  Execute the following commands to create the required docker containers.
    66  
    67  ```
    68      make peer-docker
    69      make orderer-docker
    70  ```
    71  
    72  Change back to the bddtests folder (Where this readme is located) to execute subsequent behave commands.
    73  
    74  ```
    75      cd bddtests
    76  ```
    77  
    78  #### Running all of the behave features and suppressing skipped steps (-k)
    79  
    80  The following behave commands should be executed from within this folder.
    81  
    82  ```
    83      behave -k -D cache-deployment-spec
    84  ```
    85  
    86  #### Running a specific feature
    87  
    88  ```
    89      behave -k -D cache-deployment-spec features/bootstrap.feature
    90  ```
    91  
    92  ### Deactivating your behave virtual environment
    93  Once you are done using behave and you wish to switch back to your normal
    94  python environment, issue the following command.
    95  
    96  ```
    97      deactivate
    98  ```