Release Management/Run smoke tests locally
Contents |
Previous steps
Prerequisites
This guide assumes that Eclipse IDE is set up and that an Openbravo installation has been made. If not, please refer to How to setup Eclipse IDE page.
Firefox
The Firefox version required to run the tests depends on the release version of the ERP. Please check it in the System Requirements page. Older versions will not work properly with the Selenium library for a given release.
Branch clone
Make a GIT clone of the following branch to obtain the code of the tests: https://gitlab.com/openbravo/ci/backoffice-test/-/tree/master
Go to 'pi-smoke/config/' and execute 'setupPiSmoke.sh' script with the following order: 'sh setupPiSmoke.sh'. It will create the following files:
- 'pi-smoke/config/log4j.properties'.
- 'pi-smoke/.classpath'.
- 'pi-smoke/config/OpenbravoERPTest.properties'.
Now, go to 'pi-smoke/config/OpenbravoERPTest.properties' and set your configuration.
NOTE: 'selenium.browserPath' attribute is not used and the selenium test will open the Firefox just by running 'firefox' in bash, so you must ensure that once the process do this call, it opens the recommended firefox.
You can do it, for example, in Linux by modifying the path like
export PATH="the_recommended_firefox_location/firefox:$PATH"
Extra files
Although they can be not necessary at the beginning, later you can need the following two files located inside the "pi-smoke/testfiles" directory to guarantee the correct behaviour of some tests (e.g. to activate the professional instance):
- SystemKey.txt (with a valid license code)
- org.openbravo.idl-X.X.X.obx
Previous ant commands
These commands are useful to start with a clean environment if tests are to be run with ant:
ant compile ant scenario.clean ant registration.disable ant clean
Run tests using ant
You can also run tests using Eclipse instead of this other 'ant' way. It is explained later, you can check it here: [[1]].
To know which are the available tests and their 'ant' command you can go to http://ci.openbravo.com/ and select any test. Then, in the 'Steps' section you will see the ant command/commands of this particular test
NOTE: If Selenium server is hanged due to a bad execution of any test, you can force the process to stop by executing the following command:
ps xu | grep selenium | grep -v grep | awk '{ print $2 }' | xargs kill -9
Run tests using Eclipse
Configure the pi-smoke project in eclipse:
- Deselect the "Project" -> "Build automatically"
- "File" -> "Import" -> "General" -> "Existing Projects into Workspace"
- In the "Select root directory" input enter the path where you have the pi-smoke clone. Then press "Finish" button
- "Project" -> "Build All" to compile the sources
Both tests and suites can be executed by selecting the desired java file in the "Project Explorer" section and clicking on "Run" (or right mouse click) -> "Run As" (or "Debug As" if you plan to debug code) -> "JUnit Test".
Be aware that most of the automated tests will use "QAAdmin" user (deactivated by default). To have that user activated in your context, you can easily do it running "ActivateQAAdminUserWithClosure.java" test, which will have that user activated.
In case you are having problems with test.registry, remember it is required to have test.environment=true inside Openbravo.properties file from your Openbravo context.
It is no longer required, but, in case you want to run the Selenium server manually in a terminal, go to "pi-smoke/lib" directory and execute:
java -jar selenium-server-standalone-X.XX.X.jar
where X.XX.X is the version of the current existing Selenium server library. (Run the Selenium server manually is not mandatory, it will be launched when a test is run through Eclipse)