ERP 2.50:Automated Testing/Quick Start Guide
This is a quick start guide to automate integration tests on Openbravo ERP.
Contents |
Install Openbravo ERP
First of all, you should have a running Openbravo ERP context. Here you can find a guide with many ways to set up Openbravo ERP.
Integrated development environment
You can create your tests with any editor. However we recommend to use Eclipse IDE because we have developed the project thinking mainly on this IDE, and because it allows to debug our tests easily.
So, first you might want to install and configure Eclipse IDE.
Get the framework source code
Then you will need to get the code we have prepared to facilitate coding and execution of ERP tests.
The main repository is located at http://code.openbravo.com/tools/automation/pi-smoke/ and you can get a compressed file with the most recent code from here.
There are also other development branches, please contact Automation team in case of doubts.
If you are planning to contribute your code back to Openbravo's testing repository or you want to keep track of the changes in your code it would be better to clone the repository using mercurial. There's a Mercurial Manual for Openbravo Developers that you should read.
And if you are going to develop using Eclipse and you configured it following the instructions of the previous step, then you can just check out the code using the Mercurial plugin.
Understanding the code
Once you get the code, you might want to check the Packages Hierarchy to better understand how the code is organized.
Create the properties file
You will have to create the properties file that contain general parameters for all your tests.
You should use the the file OpenbravoERPTest.properties.template as a base. It is located in the config directory.
Here is an explanation of all the properties that you must set. You must make some of this properties to point to the Openbravo ERP context that you have set up for testing in the first step.
Automate test cases
Now, in order to automate your own test cases you should follow the steps in the document How to automate a test case:
- Define what you want to test
- Document the scenario and execute it manually
- Understand the design
- Read the documentation and implementation of main classes
- Look for code that you can reuse
- Code missing screen definitions
- Define the dependencies datasets
- Write the test controller
- Test your test
Execute the test
Finally, you will need to run the tests with some frequency. Ideally, before every commit.
You can run and debug tests from Eclipse. Or you can run them from command line (really useful to include in a script or in a cron job).
On a failure, an automatic screenshot is taken, see details here