ERP 2.50:Automated Testing/Eclipse
Installation and setup of Eclipse IDE
Openbravo ERP's testing code is ready to work with Eclipse's IDE projects schema, just like the ERP source code.
Please read Installation and setup of Eclipse IDE, a step-by-step guide to install and setup Eclipse Integrated Development Environment (IDE) for Openbravo ERP development.
At this moment you must have Eclipse IDE 3.5 working. In addition, you should have imported the preferences file.
Create a New Java Project
First, you have to clone the repository in the workspace folder with the standard Mercurial command:
user@localhost:/eclipse$ hg clone https://code.openbravo.com/tools/automation/pi-smoke workspace/pi-smoke
Next step is to create a .classpath file by copying the .classpath.template file in the same directory. That will let Eclipse to find the location of all the required stuff.
Then, using Eclipse, start a new workspace. Then, use the File >> Import and select the "Existing project into workspace" and point the "Select root directory:" field to where the new mercurial clone is, the pi-smoke folder. Note that doing it this way, any push, pull and update will require you to perform the proper commands via command line.
Debugging tests with Eclipse
Eclipse has powerful debugging capabilities that we can use while writing tests or looking for errors in them.
The first thing that has to be done in order to debug a test is to set a breakpoint before the section of code that is going to be checked.
To do this, place the cursor on the line and go to menu Run -> Toggle Breakpoint.
You can add as many breakpoints as necessary; and the execution will stop before executing them.
Now, to execute the test on debug mode, select it's java file and go to menu Run -> Debug As -> Junit test.