Wednesday, February 16, 2011

OERP Scenario

       In OpenERP a time consuming task is to check all the modules by entering data to each field and checking whether the view is changing according to the data given in the field or changing according to our plan. It is also not possible to check all the information given in the fields. And also testing is important in locating a bug and fixing an error. For this purpose we are using OERPScenario. OERPScenario do the same process as the database query do. OERPScenario search for the condition data from the database satisfying the scenario statements.

      OERPScenario allowing to write business oriented test cases in OpenERP. OERPScenario is a framework based on the Cucumber Library and the Ruby Language; it uses the Ooor connector developed by Akretion to make Business Driven Development (BDD) among OpenERP. It is a tool that can execute plain-text functional descriptions as automated tests.

 OERPScenario splits tasks in two, allowing business individuals to write and describe the different test scenarios, while technical individuals code the tests.

Install and Configure OERPScenario in Ubuntu 10.04

==$sudo apt-get install ruby irb ri rdoc rubygems
==$sudo gem install cucumber -v0.6.3
==$sudo gem install rspec
==$sudo gem install parseconfig
==$sudo gem install ooor --source http://gemcutter.org
==$sudo apt-get install libopenssl-ruby
==$sudo gem install rake
==$sudo gem install htmlentities
==$# Optional for pdf output only
==$sudo gem install prawn --version 0.6.3
==$sudo gem install prawn-format --version 0.2.3
==$# Finally add '/var/lib/gems/1.8/bin' to your PATH :
==$export PATH=$PATH:/var/lib/gems/1.8/bin

Then install the "bzr" for downloading the OERPScenario. After installing "bzr" retrieve the stable branch:
==$bzr branch lp:oerpscenario

Configure

We need to instruct OERPScenario on how to connect to the OpenERP server in a
configuration file. In order to do that, copy the file « sample_base.conf » as «base.conf » into the OERPScenario folder and change the following information according to your settings:
port = 8069
user = «username »
#if it is administrator then provide "admin"
database = «mydatabasename »
password = «secrete »
host = localhost

Once it's done, go into the OERPScenario folder and run the following command to test the connection:
==$rake compile
You should then have an output confirming everything is alright.

As the tests are running under a specific user, you can always change the one that has been set-up as default (by default, all tests are running with the user defined in the config file). If you need to run the tests under another user, edit the following file:
« /features/_basic/_init.feature » and change the sentence according to your needs

The configuration is done!

Using tags

 The tag system implemented in Cucumber is very powerful and allows you to run complex test cases according to your own OpenERP settings. Basically, the following tag types are present in OERPScenario:
• Bazaar branch (like @addons), which tests all existing modules in that branch;
• Modules (likes @account), which tests everything having to do with a specific
   module;
• Bugs related (like @bug452854), which launches the related scenario;
• Business oriented (like @invoicing), which runs every related scenario;
• System (like @init, @demo), which executes a set of tasks in OpenERP.

Launching the OERPScenario
 You can launch the test suite from the OERPScenario folder with the following commands:
cucumber feature --tag=@account
This will execute all scenarios related to the OpenERP account module (notice that tags can be set on features or scenarios). The feature tags are true for all included scenarios, where the scenario tags are true only for the current scenario.


2 comments:

  1. what is "bzr"? and how can I install it?

    ReplyDelete
  2. Its a distributed version control system. Try apt-get install bzr

    ReplyDelete