Giter VIP home page Giter VIP logo

oerpscenario's Introduction

OERPScenario - Business Driven Development (BDD) for OpenERP/Odoo

OERPScenario is a tool to allow Business Driven Development (BDD). It allows non-technical people to write real business cases, that will be tested in Odoo to ensure no regressions.

OERPScenario allows to detect regressions from one version to another by running a test suite composed of scenarios on a specified Odoo server (directly on the customer replication instance, or just on the lastest stable release).

It also includes in this brand new version written in Python and based on Erppeek (http://erppeek.readthedocs.org/en/latest/) a complete DSL that allows you to write tests at the speed of thought.

This means a business specialist can write something like the following:

Scenario: SO013 CREATION
    Given I need a "sale.order" with name: SO013 and oid: scenario.anglosaxon_SO013
    And having:
    | name                | value                    |
    | date_order          | %Y-03-15                 |
    | name                | SO013                    |
    | partner_id          | by name: Simpson         |
    | pricelist_id        | by id: 1                 |
    | partner_invoice_id  | by name: Simpson         |
    | partner_order_id    | by name: Simpson         |
    | partner_shipping_id | by name: Simpson         |
    | shop_id             | by name: a shop          |
    | company_id          | by oid base.main_company |
    Given I need a "sale.order.line" with oid: scenario.anglosaxon_SO013_line1
    And having:
    | name            | value                             |
    | name            | SO013_line1                       |
    | product_id      | by code: 2003                     |
    | price_unit      | 450                               |
    | product_uom_qty | 1.0                               |
    | product_uom     | by name: PCE                      |
    | order_id        | by oid: scenario.anglosaxon_SO013 |

OERPscenario allows you to connect to a remote or local instance using XMLRPC. For faster results or when working with huge data, OERPScenario can embed an Odoo/OpenERP service. This is possible if Odoo/OpenERP is available in syspath. Using the Anybox buildout recipe in conjunction with OERPScenario is a good way to achieve this http://pypi.python.org/pypi/anybox.recipe.openerp

Installation:

pip install oerpscenario

Usage

Checkout your own scenario branch, then run the following command

openerp_scenario  Scenario/OERPScenario.local/ -t backend -k --server-config etc/openerp.cfg

This will run an enhanced version of behave. The -k option will only show executed scenario, -t will filter specific scenarios from the tags.

For more information, please refer to behave documentation: http://packages.python.org/behave/

If you want to use pdb you have to set --no-capture option when launching openerp_scenario.

Configuration file

We try to be compatible with the Odoo configuration file Generated by the Anybox buildout recipe. A minimal configuration file should look like this:

[options]
# mandatory values
# database name
db_name = openerp_dev_mydatabase

# optional values (default value below)
# server public URL
server_url = http://localhost
# XMLRP Port
xmlrpc_port = 8069
# Password to manage database
admin_passwd = admin
# User that oerpscenario will use
admin_login = admin
# oerpscenario user password
admin_login_password = admin

Anatomy of a custom scenario folder

If you want to create your own custom scenario for your project, you should use the guidelines below. The folder should be organized as follows:

OERPScenario.local/
├── data
│   ├── account_chart.csv
│   └── logo.png
└── features
    ├── setup
    │   ├── 01_installation.feature
    │   └── 02_installation_after_import.feature
    ├── addons
    ├── steps
    ├── stories
    └── upgrade
  • data: contains non code related data for your scenarios.
  • features: mandatory folder, contains all features.
  • setup: contains features required to set up all required data to run your tests.
  • addons: contains addons specific tests, small independent scenarios.
  • stories: contains user/workflow tests that are related.
  • upgrade: scenario to update an instance.
  • steps: contains Python code implementing the Gherkin phrases

oerpscenario's People

Contributors

bguillot avatar charbeljc avatar damdam-s avatar esciara avatar guewen avatar gurneyalex avatar jgrandguillaume avatar lepistone avatar nbessi avatar rdeheele avatar rvalyi avatar sebastienbeau avatar vrenaville avatar yvaucher avatar

Watchers

 avatar  avatar  avatar

oerpscenario's Issues

`ImportError: No module named unittest2` on calling `openerp_scenario`

Trace:

Traceback (most recent call last):
  File "/Users/emmanuelsciara/odoo_scaramouche_bdd/bin/openerp_scenario", line 10, in <module>
    sys.exit(main())
  File "/Users/emmanuelsciara/Documents/Development/git-repos/other-third-party/em_refactored_oerpscenario/oerpscenario/openerp_scenario.py", line 44, in main
    sys.exit(__main__.main(args))
  File "/Users/emmanuelsciara/odoo_scaramouche_bdd/lib/python2.7/site-packages/behave/__main__.py", line 111, in main
    failed = runner.run()
  File "/Users/emmanuelsciara/odoo_scaramouche_bdd/lib/python2.7/site-packages/behave/runner.py", line 659, in run
    return self.run_with_paths()
  File "/Users/emmanuelsciara/odoo_scaramouche_bdd/lib/python2.7/site-packages/behave/runner.py", line 664, in run_with_paths
    self.load_hooks()
  File "/Users/emmanuelsciara/odoo_scaramouche_bdd/lib/python2.7/site-packages/behave/runner.py", line 623, in load_hooks
    exec_file(hooks_path, self.hooks)
  File "/Users/emmanuelsciara/odoo_scaramouche_bdd/lib/python2.7/site-packages/behave/runner.py", line 306, in exec_file
    execfile(filename, globals, locals)
  File "/Users/emmanuelsciara/Documents/Development/git-repos/other-third-party/em_refactored_oerpscenario/features/environment.py", line 8, in <module>
    from support import tools, behave_better
  File "/Users/emmanuelsciara/Documents/Development/git-repos/other-third-party/em_refactored_oerpscenario/features/support/__init__.py", line 2, in <module>
    from support import tools
  File "/Users/emmanuelsciara/Documents/Development/git-repos/other-third-party/em_refactored_oerpscenario/features/support/tools.py", line 93, in <module>
    from unittest2 import TestCase
ImportError: No module named unittest2

"error: can't copy 'features': doesn't exist or not a regular file" during `pip install`

Running pip install git+https://github.com/nbessi/oerpscenario.git@refactoring triggers the following error:

running install_data
    error: can't copy 'features': doesn't exist or not a regular file

Full stack:

Collecting git+https://github.com/nbessi/oerpscenario.git@refactoring
  Cloning https://github.com/nbessi/oerpscenario.git (to refactoring) to /var/folders/hd/yl60zq2d3llbq84t8946qsqh0000gn/T/pip-QODTVJ-build
Requirement already satisfied (use --upgrade to upgrade): behave==1.2.4 in /Users/emmanuelsciara/odoo_scaramouche_bdd/lib/python2.7/site-packages (from oerpscenario==0.7.1.dev53)
Requirement already satisfied (use --upgrade to upgrade): erppeek in /Users/emmanuelsciara/odoo_scaramouche_bdd/lib/python2.7/site-packages (from oerpscenario==0.7.1.dev53)
Requirement already satisfied (use --upgrade to upgrade): parse>=1.6.3 in /Users/emmanuelsciara/odoo_scaramouche_bdd/lib/python2.7/site-packages (from behave==1.2.4->oerpscenario==0.7.1.dev53)
Requirement already satisfied (use --upgrade to upgrade): parse-type>=0.3.4 in /Users/emmanuelsciara/odoo_scaramouche_bdd/lib/python2.7/site-packages (from behave==1.2.4->oerpscenario==0.7.1.dev53)
Requirement already satisfied (use --upgrade to upgrade): six in /Users/emmanuelsciara/odoo_scaramouche_bdd/lib/python2.7/site-packages (from behave==1.2.4->oerpscenario==0.7.1.dev53)
Requirement already satisfied (use --upgrade to upgrade): enum34 in /Users/emmanuelsciara/odoo_scaramouche_bdd/lib/python2.7/site-packages (from parse-type>=0.3.4->behave==1.2.4->oerpscenario==0.7.1.dev53)
Installing collected packages: oerpscenario
  Running setup.py install for oerpscenario
    Complete output from command /Users/emmanuelsciara/odoo_scaramouche_bdd/bin/python -c "import setuptools, tokenize;__file__='/var/folders/hd/yl60zq2d3llbq84t8946qsqh0000gn/T/pip-QODTVJ-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/hd/yl60zq2d3llbq84t8946qsqh0000gn/T/pip-HtH6x4-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/emmanuelsciara/odoo_scaramouche_bdd/include/site/python2.7/oerpscenario:
    running install
    [pbr] Writing ChangeLog
    [pbr] Generating ChangeLog
    [pbr] ChangeLog complete (0.0s)
    [pbr] Generating AUTHORS
    [pbr] AUTHORS complete (0.0s)
    running build
    running build_py
    creating build
    creating build/lib
    creating build/lib/oerpscenario
    copying oerpscenario/__init__.py -> build/lib/oerpscenario
    copying oerpscenario/openerp_scenario.py -> build/lib/oerpscenario
    running egg_info
    creating oerpscenario.egg-info
    writing requirements to oerpscenario.egg-info/requires.txt
    writing oerpscenario.egg-info/PKG-INFO
    writing top-level names to oerpscenario.egg-info/top_level.txt
    writing dependency_links to oerpscenario.egg-info/dependency_links.txt
    writing entry points to oerpscenario.egg-info/entry_points.txt
    writing pbr to oerpscenario.egg-info/pbr.json
    [pbr] Processing SOURCES.txt
    writing manifest file 'oerpscenario.egg-info/SOURCES.txt'
    warning: LocalManifestMaker: standard file '-c' not found

    [pbr] In git context, generating filelist from git
    warning: no previously-included files found matching '.gitreview'
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    writing manifest file 'oerpscenario.egg-info/SOURCES.txt'
    creating build/lib/oerpscenario/test
    creating build/lib/oerpscenario/test/config
    copying oerpscenario/test/config/odoo.conf -> build/lib/oerpscenario/test/config
    copying oerpscenario/test/config/oerpscenario.conf -> build/lib/oerpscenario/test/config
    running install_lib
    copying build/lib/oerpscenario/__init__.py -> /Users/emmanuelsciara/odoo_scaramouche_bdd/lib/python2.7/site-packages/oerpscenario
    copying build/lib/oerpscenario/openerp_scenario.py -> /Users/emmanuelsciara/odoo_scaramouche_bdd/lib/python2.7/site-packages/oerpscenario
    copying build/lib/oerpscenario/test/config/odoo.conf -> /Users/emmanuelsciara/odoo_scaramouche_bdd/lib/python2.7/site-packages/oerpscenario/test/config
    copying build/lib/oerpscenario/test/config/oerpscenario.conf -> /Users/emmanuelsciara/odoo_scaramouche_bdd/lib/python2.7/site-packages/oerpscenario/test/config
    byte-compiling /Users/emmanuelsciara/odoo_scaramouche_bdd/lib/python2.7/site-packages/oerpscenario/__init__.py to __init__.pyc
    byte-compiling /Users/emmanuelsciara/odoo_scaramouche_bdd/lib/python2.7/site-packages/oerpscenario/openerp_scenario.py to openerp_scenario.pyc
    running install_data
    error: can't copy 'features': doesn't exist or not a regular file

    ----------------------------------------
Command "/Users/emmanuelsciara/odoo_scaramouche_bdd/bin/python -c "import setuptools, tokenize;__file__='/var/folders/hd/yl60zq2d3llbq84t8946qsqh0000gn/T/pip-QODTVJ-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/hd/yl60zq2d3llbq84t8946qsqh0000gn/T/pip-HtH6x4-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/emmanuelsciara/odoo_scaramouche_bdd/include/site/python2.7/oerpscenario" failed with error code 1 in /var/folders/hd/yl60zq2d3llbq84t8946qsqh0000gn/T/pip-QODTVJ-build

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.