Before reading this please read my blog post on OERPScenario . Now go to our OERPScenario folder that we have downloaded from bazaar, there is a folder named features. All the user defined test cases are written in a folder inside this folder. I want to create a new scenarios for testing products, so I create a directory called product inside features. Inside the product directory a file called product.feature is created. We have to write our scenarios in this file.
In writing the scenario we are following the Gherkin Syntax. Gherkin is the language that Cucumber and OERPScenario can understand. The source files have *.feature extension. Gherkin is a line-oriented language that uses indentation to define structure. Most lines start with a keyword.
For writing the scenario I'm creating a file called product.feature inside the folder product. In writing the scenario first write <Feature:> explaining about the scenario. Then our scenario <Scenario:>.Statements following the scenario must start with any of the keyword 'Given', 'When', 'Then' or 'And'. 'And' can be used for extending 'Given' , 'When' and 'Then'.The following figure will give an idea about each keyword.
Before writing the feature, tags are given and this tag can be used for testing the scenarios under this feature. We can also specify tags for each scenario and by using this tags we can test the scenario that come under this tag. The statements written between Feature and Scenario are omitted by the cucumber. So we don't need to concentrate much on it. After writing the scenarios we can run the scenarios. But before running the scenario we have to compile the whole OERPScenario folder using the command rake compile.This is just for testing the connection between openERP server and OERPScenario. If this fails then everything fails(I think so).
When I was testing I found that the scenario written inside the file _init.rb in feature>_basic>step_definions did not satisfy the conditions written inside the _init.feature file in feature>_basic. So I changed the code . Figure of the changed code is given below
After all the changes are made, we can compile it using command rake compile. If we get all test scenarios printed in green color then we can proceed. If we get it in red color then an error is present in it.
Now we can run our scenario.
By running this the test cases that needed for testing product are automatically generated by the cucumber. Copy these test cases and paste them to a ruby file (say product_steps.rb) created inside a directory called "step_definition" inside product.
//not completed