View source | Discuss this page | Page history | Printable version   
Main Page
Upload file
What links here
Recent changes

PDF Books
Show collection (0 pages)
Collections help


Retail:Developers Guide/How-to/How to Install, Setup and Run Retail Automated Tests



The Retail Automated tests are are a set of JUnit test cases which use Selenium to execute actions on top of an Openbravo POS session to verify all areas of the application. These tests are executed as part of the Retail Continuous Integration as can be seen here.

Versions used in this guide: Java 11, Tomcat 8.5, PostgreSQL 10 and/or Oracle 11

Setup development environment

During this chapter, a detailed installation guide will be explained. If you are familiarized with software installation under Linux, you can jump directy here to have a more simplified view.

Since all the stack can run on Linux, Mac and Windows and there are several versions supported, there is not guarantee that all the following steps will work. Use it at your own risk.

All the code provided is intended to be run in a terminal.


Download and install Ubuntu 20.04 64-bit LTS Desktop.

You can obtain the ISO from here (64-bit PC (AMD64) desktop image).

In case there is Ubuntu 20.04.X (being X any minor revision number) instead of just 20.04, it is ok to download and install the most recent revision.


This is the supported browser, so its installation is mandatory

sudo apt install ./google-chrome-stable_current_amd64.deb

# If fails during the installation phase with missing required dependencies, run: "sudo apt install -f ..." instead to fix it.
rm google-chrome-stable_current_amd64.deb


This software is optional, but it is the recommended file editor.

sudo apt install vim
:set nofixendofline
sudo update-alternatives --config editor


This is the recommended database. Alternatively Oracle can be installed but in this chapter only PostgreSQL installation will be covered.

sudo sh -c "echo 'deb '$(cat /etc/lsb-release | grep DISTRIB_CODENAME | cut -d'=' -f2)'-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
wget --quiet -O - | sudo apt-key add -
sudo apt update
sudo apt install postgresql-10
sudo -u postgres psql -c "alter user postgres with password 'syspass';"
# Required at least for correct
# Config value with very bad name, this is not locks per transactions but sizes the
#   total number of possible locks see formula in postgresql.conf
max_locks_per_transaction = 128

# Make sure timezone config is localtime so pg follows system-timezone (as it did up to <9.2 also by default)
# Note: pg has auto-detect based on system timezone, but best to set fixed here to be sure it has value we want
# Note: sed assumes input is UTC or localtime but that was the case in all testing so far
log_timezone = 'localtime'
timezone = 'localtime'

# activate logging of checkpoints
log_checkpoints = on

# activate logging of of all waits > deadlock_timeout (1s by default)
log_lock_waits = on

# track runtime/calls of all pl/sql functions
track_functions = all

# activate logging of slow queries (>30s to balance usefulness versus log-volume)
log_min_duration_statement = 30000

# set locale for number formatting to en_US.UTF-8
lc_numeric = 'en_US.UTF-8'

# only edit this file

#log_min_duration_statement = 0
#checkpoint_timeout = 1h

# pg stat
#shared_preload_libraries = 'pg_stat_statements'

#pg_stat_statements.max = 10000
#pg_stat_statements.track = all
sudo /etc/init.d/postgresql restart


cd ~/Downloads
tar xf apache-tomcat-8.5.*.tar.gz
rm apache-tomcat-8.5.*.tar.gz
sudo mv apache-tomcat-8.5.* /opt/
cd /opt
sudo ln -s apache-tomcat-8.5.* apache-tomcat-8.5
sudo sh -c 'echo "export CATALINA_OPTS=\"-server -Djava.awt.headless=true -Xms512M -Xmx1024M\"" >> /etc/environment'
sudo sh -c 'echo "export CATALINA_HOME=/opt/apache-tomcat-8.5" >> /etc/environment'
sudo sh -c 'echo "export CATALINA_BASE=/opt/apache-tomcat-8.5" >> /etc/environment'


sudo apt-get install apache2 libapache2-mod-jk
JkMount /* ajp13_worker
jkMountCopy all
sudo sh -c 'echo "openbravo ALL = NOPASSWD: /etc/init.d/apache2" > /etc/sudoers.d/97-ob-apache'
# If you are not using openbravo user, change it in the previous command
sudo a2enmod ssl
sudo a2ensite default-ssl.conf
sudo /etc/init.d/apache2 restart


sudo apt install openjdk-11-jdk
sudo sh -c 'echo "JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64" >> /etc/environment'

Note: change only be effective after restart


sudo apt install git

Upload your ssh key to gitlab following these steps, if you don't have yet a ssh key you can follow this guide to create one.


sudo apt install ant
sudo sh -c 'echo "export ANT_OPTS=\"-Xmx1024M\"" >> /etc/environment'

Eclipse IDE

cd ~/Downloads
tar xf eclipse-jee-*.tar.gz
rm eclipse-jee-*.tar.gz
mv eclipse eclipse-2020-09 # set the version that you have download
sudo mv  eclipse-2020-09 /opt/
cd /opt
sudo ln -s eclipse-2020-09 eclipse
cd /usr/local/bin
sudo ln -s /opt/eclipse/eclipse eclipse


This software is optional, but it is the recommended shell. If you do not install it, you can just ignore the ".zsh" sections in the following chapters.

sudo apt-get install zsh
cd $HOME
git clone ~/.oh-my-zsh
git clone --depth=1 ~/.oh-my-zsh/custom/themes/powerlevel10k
  1. Double click on each one to open it
  2. Click on install
  1. Right click / preferences
  2. In profiles, on left menu, click on the '+' to add a new profile
  3. Name: zsh
  4. Click on checkbox custom font
  5. Select font mesloLGS NF regular
  6. Optional: probably you want to uncheck the terminal bell
  7. Move to command tab
  8. Click to check "run a custom command instead of my shell"
  9. Write in "custom command": zsh
  10. On the left menu, in zsh profile, click in the down arrow
  11. Select: set as default

mv Downloads/p10k.zsh .p10k.zsh
# optionally, later you can do your own config running: p10k configure (in a new terminal)
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"

# Your PATH Exports
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh

source $ZSH/

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

#setopt BANG_HIST                 # Treat the '!' character specially during expansion.
setopt EXTENDED_HISTORY          # Write the history file in the ":start:elapsed;command" format.
setopt INC_APPEND_HISTORY        # Write to the history file immediately, not when the shell exits.
#setopt SHARE_HISTORY             # Share history between all sessions.
#setopt HIST_EXPIRE_DUPS_FIRST    # Expire duplicate entries first when trimming history.
#setopt HIST_IGNORE_DUPS          # Don't record an entry that was just recorded again.
#setopt HIST_IGNORE_ALL_DUPS      # Delete old recorded entry if new entry is a duplicate.
setopt HIST_FIND_NO_DUPS         # Do not display a line previously found.
setopt HIST_IGNORE_SPACE         # Don't record an entry starting with a space.
setopt HIST_SAVE_NO_DUPS         # Don't write duplicate entries in the history file.
#setopt HIST_REDUCE_BLANKS        # Remove superfluous blanks before recording entry.
#setopt HIST_VERIFY               # Don't execute immediately upon history expansion.
#setopt HIST_BEEP                 # Beep when accessing nonexistent history.

Node and npm

sudo apt-get install -y curl
curl -sL | sudo -E bash -
sudo apt-get install -y nodejs

Migration from Mercurial to GIT

Remember: the repos in product can be used when you don't plan to do changes on it, they have automatic sync from mercurial repos, but you will never push to these repos.

The repos in project/retail can be used when you want to create development branches, they don't have autosync from mercurial repos.

It is very recommended to use zsh with some customizations to work with git, it adds many useful information in the prompt line.

To install zsh follow the zsh install guide.

git config --global pull.ff only

Manual guide

1. Create a new directory in your computer

2. Navigate to that directory

3. Download Eclipse IDE ( and copy it into that directory

4. Download Tomcat ( and copy it into that directory

5. Clone pi-mobile

 FIXME: hg clone

6. Clone the ERP

 FIXME: hg clone openbravo

7. Clone the retail repositories in the Navigate to the openbravo/modules directory. (from the ret-test-* repository list that can be found below):

 cd openbravo/modules
 FIXME: hg clone
 FIXME: hg clone
 FIXME: hg clone
 FIXME: hg clone
 FIXME: hg clone
 FIXME: hg clone
 FIXME: hg clone
 FIXME: hg clone

8. Execute ant.setup and configure the ERP

 cd openbravo
 ant setup

9. Execute to configure pi-mobile

 cd pi-mobile
 python3 ../openbravo

10. Run install.source

 cd openbravo
 ant install.source

11. Start the Eclipse that you downloaded in the directory

12. Start the ERP/tomcat. Verify that you can navigate to a terminal

13. Start selenium from the command line. Open a terminal and execute:

 cd pi-mobile/seleniumTools

14. Run a test

Repositories and continuous integration jobs

Currently there are 2 test repositories :

The pi-mobile repository is used as the main repository for the tests and is used for the main jobs, the ones included in the continuous integration process for Retail. These jobs include:

The same jobs can be found in the try server:

The pi-mobile-sandbox repository, on the other hand, is used for the ret-sandbox-* jobs. The sandbox repository works as a test repository for the tests' modifications, meaning that it is possible to push changes to the tests without affecting the continuous integration cycle. For developers, pi-mobile-sandbox also works as a time-saving strategy to execute the tests after pushing changes to retail modules, that is, sandbox jobs can be executed before the code passes continuous integration.

Bulbgraph.png   ret-test-* and ret-modules-* will not reflect code changes until previous integration steps have finished successfully.

Repositories used in the continuous integration servers




About the sampledata used:

The Retail Sampledata repository varies from the test jobs to the modules jobs. Ret-*-test-* jobs use the standard retail sampledata repository ( while ret-*-modules-* jobs use a different branch of the repo ( together with (

Bulbgraph.png   org.openbravo.retail.sampledata and are branches of the same module (they have the same AD_MODULE_ID) so they MUST NOT be used together.

Setting Up the Automated Test Environment

Assuming we will be working with the pi-mobile repository to execute the tests, the following steps must be followed:

Clone these repositories in your projects directory Do not place it inside an openbravo directory. The automation makes use of a running ERP, not its sources.

From this point there are 2 ways of configuring the automation context. The script is still not working for Oracle, so you should execute it and then manually fix the database references

1a. The scripted way: - Navigate to the root of the local pi-mobile - Execute the file pointing to the openbravo directory of the context that will be tested


 [openbravo@ManjaroPC pi-mobile]$ python3 /home/openbravo/clones/tip/openbravo
 *** tool to configure Retail automation context v0.3 ***
 copying .classpath.template » .classpath
 copying config/ » config/
 copying config/ » config/
 database = obtip
 new tomcat log path: /tmp/tip/tomcat.log
 last results path: /tmp/tip/
 *** end ***

1b. The Manual way:

- Rename/copy the .classpath.template file to .classpath

- Rename/copy config/ to config/

- Rename/copy config/ to config/

- verify that the config/ has the correct database credentials (bbdd.sid, ...). These credentials must match the values of the openbravo server database.

- In order to run the tests on a Java 7 machine:

Open the .classpath file and find the following line:

 <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>

Replace the line with:

 <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>

2. Add autodiscovering of the hamcrest imports. This will add intellisense entries when adding assertThat code

-. Add these favorite imports in Window » Preferences » Java » Editor » Content Assist » Favorites

Running Selenium

There are several ways of starting a Selenium server. It can be used locally (within the same machine as the Openbravo server) or on a different computer (remotely).

Local execution of Selenium.

Selenium can be run locally in two different ways. The easiest way is to change to the seleniumTools/ directory and run one of the standalone scripts. If the server is running but an exception is thrown every time a test is run, check if the exception mentions a missing chromedriver. If that’s the case, open the lib/test/ folder, copy the name of one of the chromedrivers there, edit the script used to start selenium and set the correct parameter.

A second option to start Selenium locally is to run ant selenium.start from the test repo root. The chromedriver and seleniumdriver versions used will be taken from the file.

Bulbgraph.png   In a modules environment it is required to remove the following file


Remote execution of Selenium

Bulbgraph.png   We need 2 test repos for this execution tipe; one on the openbravo server (for the test files) and one on the remote computer (for the selenium files).

In order to execute Selenium in a different computer, we need to use the and scripts.

On the remote computer (the one holding Selenium), open the nodes.json configuration file and change the host and hubHost values to

Launch hub.js

Launch nodes.js

Write down the IP of the selenium-holding computer to configure the test repo.

On the local computer (the one with the openbravo server), open the file and change the selenium.server property to the IP of the remote computer.

Open the file, find the following line:

 return openbravoBaseURLTemp.replace(localhostReferenceToChange, ip.getHostAddress());

And change it to

 return openbravoBaseURLTemp.replace(localhostReferenceToChange, "local_ip_as_seen_on_the_lan");

local_ip_as_seen_on_the_lan is the IP of the computer with the openbravo server.

Now when a test is executed the browser will run on the remote machine. In order to run a test, simply right click on it and select Debug As > JUnit Test.

After finishing the tests, remember to terminate the Selenium server (either Ctrl+C the process, or run ant selenium.stop if ant was used to start the server).

Local Offline Execution

Setup offline execution

Bulbgraph.png   This option is included starting from 3.0PR16Q3

First of all, you need to install and configure different components. You will need to install Apache:

 sudo apt-get install apache2 libapache2-mod-jk

Then you have to edit or create /etc/apache2/conf-available/openbravo-jk-mount.conf adding this content:

 JkMount /* ajp13_worker
 jkMountCopy all

This will redirect all petitions from Apache to Tomcat, to enable this configuration:

 sudo a2enconf openbravo-jk-mount.conf

Finally, to be able to start/stop Apache from the tests, you need to execute these instructions without typing the root’s password. To make it possible, you have to edit sudoers file in order to grant the access. It can be done by using:

 sudo su -
 echo "openbravo ALL = NOPASSWD: /etc/init.d/apache2" > /etc/sudoers.d/97-ob-apache
 #Note: this command works for openbravo user, if you have a different user, replace it in previous line.

Now you can start/stop Apache manually through:

 sudo /etc/init.d/apache2 {start | stop}

Note: It should not ask for password.

Configuration and how to use offline

Note: If using the scripts no needed to do this part

After completing all these steps, you only have to edit the and remove the port from openbravo.url:

 # Openbravo server properties

All the test using offline features need to be included in the class AllowedErrorsHelper inside the method getTestsAllowedToHaveJavascriptErrors and the method getTestsAllowedToHaveTomcatErrors.

In the tests you can use these methods to go online and offline:


Note: this methods are defined in WebPOSTerminalHelper so should be available in all terminals.

Trick to test quick updates

Prerequisite to have configured the offline execution with apache.

To move quickly between two workspaces, for example when testing the update from one version to the other.

A trick could be create a script to change the port that uses mod-jk to connect apache to tomcat, for these needed to do these steps:

alias s1='sudo sed -i /etc/libapache2-mod-jk/ -e '\s/8109/8009/'\ && sudo /etc/init.d/apache2 restart'
alias s2='sudo sed -i /etc/libapache2-mod-jk/ -e '\s/8009/8109/'\ && sudo /etc/init.d/apache2 restart'

With this you can switch to workspace using these commands:

s1  // configure apache to use the first tomcat
s2  // configure apache to use the second tomcat

The application will be allways available at http://localhost/openbravo (no need to specify port, it will use default one :80 in which apache is listening)

Test Folder Structure

The tests are divided into two main subgroups. Those tests belonging to the package (“pack” tests) are the tests being run on the ret-*-test-* jobs, while the tests belonging to the package are the ones executed on ret-*-modules-* jobs.

Adding new tests to the “pack” tests

In order to add a new test to the pack tests, pick the most fitting area (returns, cashup, sales,...) and create a new java file there. Find a test of the same area and copy&paste it for a quick start. As long as the new test is inside an existing category, there is a mechanism that will automatically add that test to the respective suite when the suite is executed.

Adding a new test to the "modules" tests

The modules test are organized by module. Each module has its own suite. Unlike the pack tests, there isn’t a mechanism to add all the tests of a module into the suite; this process needs to be done manually. So for every new test added, it must be added to the corresponding suite manually.

Creating a new test

As already explained, the basic flow to create a test is copy&paste an existing similar test, and, using that as a base, add our test actions. This is done to ensure that the correct test class is extended: pack tests extend WebPOSTerminalHelper, while modules tests extend WebPOSExtModulesTerminalHelper (if they are POS tests) or other different terminals (procurement, mobile warehouse).

The holds a mapping between the POS elements (buttons, labels, popups, messages, ...) and a unique name to be used within the tests. Each POS element is identified by a unique idtest[*]. This idtest is obtained on the browser console, using the TestRegistry javascript object. If we open the browser console and execute TestRegistry.appendIdTestToDOM() each element currently existing on the POS will be assigned an idtest property (if applicable). This idtest can be used on the TestId java class to identify the element.

[*]Note that due to some TestRegistry limitations, some elements can’t be assigned a unique idtest and therefore cannot be directly used from the tests.

Using a POS element in our test

Firstly we go to the POS, open the browser console and recover the idtest property of the element we want to use.

Then we go to the TestId class and look for our idtest. If it exists, we can al ready use the TestId.OUR_ELEMENT_NAME. If not, we create it.

Always try to create new TestIds near related TestIds. The syntax to create new TestId elements is: OUR_ELEMENT_NAME(“idtest”, [EnyoKind]).

EnyoKind is a helper class used to identify special elements (buttons, product rows,...). Go to the EnyoKind class to check all the available options.

Fixing an Unstable test

There are some tests that fails randomly and they are marked as "unstable" in the Test Status sheet(Google Spreadsheet). Follow these steps to fix an unstable test:

For any suggestion/help go directly to retail team.

Actions that can be performed on TestId elements

Currently tap, write, verify and get operations are supported.

Finally, the TestRegistry can also be used to get the enyoObject of an element on the browser console: TestRegistry.registry(‘idtest’).enyoObject

High volume automated test

Starting from RR15Q4, to support high volumes of products, customers and tickets, Openbravo Commerce allows you to work remotely with master data from the WebPOS client. The high volume master data is then not loaded into the WebPOS client database but accesses when needed on a server. The server can be a locally in-store server or a server available in the cloud.

To run a test in remote or high volume mode it is necessary to add the following annotation in the java class test:

 public class HighVolumeTest extends WebPOSTerminalHelper {
 @TestClassAnnotations(isHighVolumeCompatible = true)

When a test is running in high volume mode there is a method called "verifyHgvolTime" which checks that a specific action takes no more than some specific time, and the test fails if it takes too long. "verifyHgvolTime" function is called inside each "tap" action.

Hybrid remote automated test

Starting from RR18Q4, tests can activate some of high volumes preference to automate some scenarios which are not exactly a "pure" high volumes test.

To run a test with hybrid remote configuration it is necessary to implement in each java test class:

The preference defined for the test are set after the first login and are unset after the end of the test. If the testClassAnnotation is present but the activateRemoteModels method is not overrided or the array of remote model is null or is an empty array, the test will fail and will not be executed.

Other important topics to consider

The file defines several values used all around the test project, such as timeouts or retry values.

Sometimes a test will fail because certain element hasn’t reached the required state. In this cases, increasing the WAIT_DEFAULT_RETRIES might work. Other interesting values to tweak might be:

Although the tests are prepared to be run with the application in development status (there is a test verifying that) they can be executed with the application in production (no modules in development).

If the tests fail because a javascript error regarding the Synchronization Helper and the dropTables process, it means that the dropTables process is taking more than 8 seconds, which is not necessarily wrong. Open the ob-synchronization.js file (in the module), find the following lines:

 OB.UTIL.Debug.execute(function () {
   // the timeout is forced active while in development to catch unbalanced calls and/or adjust the timeoutThreshold
   timeoutThreshold = 8000;
   isTimeoutThresholdActivated = true;

and increase the timeoutThreshold value. Increasing this value will reduce the amount of “false failures” and will only slow the application in case of a real error (which should never happen anyway).

Authentication Managers and the tests

The authentication manager feature is not compatible with the tests. Firstly, it might try to login with wrong credentials (e.g. wrong POS organization). Besides, the first step of the tests is to automate the login, so they will fail if the login has already been done.

Throttle and the tests

After throttle changes random tests fail in try-retail, not able to fix all of them, we opted to disable the throttle in all ci servers.

This is just a workaround and plan is to enable again as soon as possible.

For the moment, to make a try-retail run with the throttle enabled is needed to use an extra param ACTIVATE_THROTTLE=true in the push a try-retail.

For more details this is the issue:



Setup Mac specific

Bash completion in mac:

# Install bash-completion via Homebrew
brew install bash-completion

# Add to the ~/.bash_profile these lines:
if [ -f $(brew --prefix)/etc/bash_completion ]; then
   . $(brew --prefix)/etc/bash_completion


You need to do the setup of offline execution with apache

Clone and setup of the scripts

git clone
cd retail_scripts


cp devtools.config.template devtools.config
# edit devtools.config and set your prefered location of eclipse workspaces and pristines, you can left the defaults if fits for you

Make scripts available in the path and enable autocompletion:


Add to the .zshrc (Replace the bold path with the path in which you have cloned the retail_scripts repo)

export PATH=$PATH:/home/openbravo/retail_scripts

autoload bashcompinit
source /home/openbravo/retail_scripts/dt-completion

Note: after add to the path needs to open a new terminal so the commands are available.

If you don't do this Ubuntu will suggest to install ditrack, Never install ditrack it will overwrite the dt command.

* Only for mac
# Add to your .bashrc or .zshrc this: (Replace the bold path with the path in which you have cloned the retail_scripts repo)
export DT_SCRIPTS_FOLDER=/home/openbravo/retail_scripts

FIXME: Check if the following still aplies Optionally you can enable the commit hook to check jslint, jsbeautifier, license year and test author

#Add the commit hook HG (Optional):

Configuration dev_tools

git clone
export PATH=$PATH:$HOME/dev_tools  # replace the '$HOME/' with the path in which you have clone the repo

git hook

#Add the commit hook GIT (Optional):
folder_dt=$(which dt | sed 's#/dt##')
echo -e "\n\nUsing as dev_scripts folder: $folder_dt  <- Check that is correct"
git config --global core.hooksPath "${folder_dt}/githooks"

Migration dev-scripts repo to git

Repository of dev-scripts has been migrated to git, from:


In order to migrate:

  1. Locate your current local clone of dev-scripts
    • which dt, can help you
  2. Clone git repository:
  3. Copy these files from old repo to new repo:
    • devtools.config
    • eclipse.tgz
  4. Edit your:
      • .bashrc
      • .zshrc
    • Change the paths from old repo to new repo, should be something like this:
    • From:
      • export PATH=$PATH:/home/openbravo/dev-scripts
    • To:
      • export PATH=$PATH:/home/openbravo/retail_scripts
  5. The changes will be effective only in new terminals, already opened ones will not be affected with the change

Make eclipse available in the path

The scripts needs that "eclipse" executable is on the path.

If you followed this chapter you can skip the following example.

This is an EXAMPLE, don't do copy paste !!!

# For example if you have installed Eclipse IDE in $HOME/eclipses/eclipse-2019-09
cd $HOME/eclipses/
ln -s eclipse-2019-09 eclipse   # you need to update this symlink every time you download a new eclipse version
cd /urs/local/bin
ln -s $HOME/eclipses/eclipse/eclipse eclipse

If you have done that correctly, now this command should open eclipse:


Create eclipse workspace with the retail pack

 dt pack-setup-workspace name: i33000  #i33000 is the name you want for this particular workspace

Note: first run will guide you to how to create the template of eclipse that will be used in next workspaces

Note2: always when creating a new eclipse workspace with the script needs to delete the trl, wad and core projects and re-import them again.

Workspace with the retail pack and the external modules

 dt modules-setup-workspace name: i41000_with_modules

Workspace of modules linked to a pack workspace

 dt pack-setup-workspace name: i2300
 dt modules-setup-workspace link-to-pack: i2300    # same name used for the pack

This creates a normal pack workspace, and in the modules workspace create links for:

The name of the modules workspace in this example will be i2300-modules.

So changes done in the pack in any of the workspaces is directly done in the other.

Useful for:

Known issue:

Workspace of backports

dt pack-setup-workspace name: 20q3 --context-definition: retail/try-retail-20Q3

If needed also modules:

dt modules-setup-workspace name: 20q3 --context-definition: retail/try-retail-20Q3

Or if you want linked to the pack workspace:

dt modules-setup-workspace link-to-pack: 20q3 --context-definition: retail/try-retail-20Q3


gitr, gitp and gitb

gitp and gitr are equal than hgp and hgr.

bitb is to execute the same git command in all the git repos that is using the branch specified.

For example:

gitb  projectA status

It will execute git status in all git repos of the workspace that the current branch is projectA.

If you want to list the last commits of all the repos that you are using in your branch:

gitb projectA --no-pager log -1 --oneline

# or with author and antiquity
gitb projectA --no-pager log -1 --pretty='format:%C(auto)%h%d %s %C(magenta dim)%an %ar'

Add new modules to the workspace

dt add-new-modules-to-workspace

Note: can be used with the option --context-definition to fix origins and branches

Push to try-retail

Setup: Needed to have configured the dev_tools and have them added in the path.

In openbravo folder: --retail --desc push-description

For info about the options: --help

Personal forks

Important: To send from a personal forks to try-retail you need to give 'reporter' access to @OBBuildsReadOnly user to your personal fork.

Redistribute suites

When the time that takes each job of try-retail is unbalanced there is script that redistribute the suites along the jobs:

dt redistribute-suites ret-qa-init-url:
# Replace XXXXX with latest ret-qa-init execution that is fine as reference of execution times

Update eclipse template

The scripts has a template of eclipse configuration in the folder of the scripts.

This template includes the java formater, the projects imported, the tomcat servers, the opened files, etc.

If over time needs to be updated, for example a change in the formater or tomcat, follow these steps:

tar czf eclipse.tgz Servers/ RemoteSystemsTempFiles/ .metadata/
mv eclipse.tgz $(which dt | sed 's/dt$//')

Visual Code

The scripts of setup workspace will start vscode pointing to the just created workspace

Needed VSCode Extensions

Recommended shortcuts

Example settings.json

   // js format on save
   "[javascript]": {
       "editor.formatOnSave": true,
       "editor.defaultFormatter": "esbenp.prettier-vscode"
   "[javascriptreact]": {
       "editor.formatOnSave": true,
       "editor.defaultFormatter": "esbenp.prettier-vscode"
   "[css]": {
       "editor.formatOnSave": true,
       "editor.defaultFormatter": "esbenp.prettier-vscode"
   "prettier.requireConfig": true,   

   // Copy edited files from modules to webContent and from webContent to modules
   "emeraldwalk.runonsave": {
       "commands": [
               "match": "WebContent/web/(?!org.openbravo.userinterface.smartclient||",
               "cmd": "dir=$( echo ${file} | sed -r 's#.*WebContent/web/([^/]+)/.*#\\1#') && file_mod=$(echo ${file} | sed -r 's#WebContent/web/'$dir'/#modules/'$dir'/web/'$dir'/#' ) && cp ${file} $file_mod"
               "match": "modules/(?!org.openbravo.userinterface.smartclient||",
               "cmd": "dir=$( echo ${file} | sed -r 's#.*modules/([^/]+)/.*#\\1#') && file_mod=$(echo ${file} | sed -r 's#modules/'$dir'/web/'$dir'/#WebContent/web/'$dir'/#' ) && cp ${file} $file_mod"

   // default vscode config
   "editor.suggestSelection": "first",
   "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",

   // exclude in search window the generated js files (i.e. ab7bbbd81f40d14b3b44c3241ec26a7b.js)
   "files.exclude": {
       "**/WebContent": true,
       "**/WebContent/web/js/gen": true

   // ignore gitignore for allow search in external modules
   // better to add the needed repo to the folder workspace
   // "search.useIgnoreFiles": false,

Note: eslint don't need any especial config and should work directly, only needed to do a npm install in the openbravo source path (this is already done by dt setup workspace scripts

Connect to pg db with Visual Code

You need to install the extension: ms-ossdata.vscode-postgresql

The script to setup the workspace will configure in the workspace the info of the db connection.

To execute a query:

  1. Ctrl + Shift + p
  2. Select: Postgresql : New query
  3. Choose the connection of the workspace jsut created: Example if workspace name is 33000-issue the db will be: db_33000_issue
  4. Write the query in the new tab that was created
  5. to execute : 'Ctrl' + 'm' and after without release the 'Ctrl' press the 'r'


Optionally you can install the jest extension for vscode: orta.vscode-jest Also for only execute one test, you can install this extension: firsttris.vscode-jest-runner

New workspaces

New setups will have it already configured

Old workspaces

ONLY for old workspaces:

	"folders": [
			"name": "mobile.core",
			"path": "openbravo/modules/"
			"name": "retail.posterminal",
			"path": "openbravo/modules/org.openbravo.retail.posterminal"
			"name": "retail.pack",
			"path": "openbravo/modules/org.openbravo.retail.pack"
			"name": "retail.config",
			"path": "openbravo/modules/org.openbravo.retail.config"
			"name": "retail.discounts",
			"path": "openbravo/modules/org.openbravo.retail.discounts"
			"name": "retail.poshwmanager",
			"path": "openbravo/modules/org.openbravo.retail.poshwmanager"
			"name": "retail.returns",
			"path": "openbravo/modules/org.openbravo.retail.returns"
			"name": "retail.sampledata",
			"path": "openbravo/modules/org.openbravo.retail.sampledata"
			"name": "openbravo",
			"path": "openbravo"
	"settings": {
		"pgsql.connections": [
				"host": "localhost",
				"dbname": "db_test",
				"user": "tad",
				"password": "tad",
				"emptyPasswordInput": false,
				"port": "5432",
				"profileName": "db_test"
		"jest.disabledWorkspaceFolders": [
		"jestrunner.jestPath": "${workspaceFolder:openbravo}/node_modules/jest/bin/jest.js"
	"launch": {
		"version": "0.2.0",
		"configurations": [
				"type": "node",
				"request": "launch",
				"name": "vscode-jest-tests",
				"skipFiles": [
				"program": "${workspaceFolder}/node_modules/jest/bin/jest.js",
				"cwd": "${workspaceFolder}",
				"args": [
				"console": "integratedTerminal",
				"internalConsoleOptions": "neverOpen",
				"trace": "all",
				"disableOptimisticBPs": true

Howto add a new module to the Retail Integration

First: create a new json copy of the try-retail one, plus your new module and push to try-retail.

After test it, for put in production it is needed to update 3 jsons:

Ensure that each json format is correct after edit, passing a json formater.


How to add a new junit to retail

If it is a junit for the pack can be executed in try-retail, but if it needs the external modules, for the moment can not be executed in try-retail and can be only executed in mod-retail.

To add a junit suite to mod-retail:

Check list of actions on release package

Add new tables to sample data

When a new feature is developed, a common requirement while developing a set of automatic tests is to create new sample data for tables added by the new feature.

Here you can find the steps required to add new tables to the sample data.

Logged as system administrator:

  1. Open "Module" window and mark module "Core" as "In development"
  2. Open Dataset Window and search the dataset by "Client definition"
  3. Open it in form view and change the value of the property "Data Access Level" from "System Only" to "Client/organization"
  4. Having "Client definition" selected move to the tab "Table"
  5. Add new registry with the new table
    1. Remember to set the value of the "Module" property with the module which is owner of that table
    2. Property "HQL/SQL Where clause" should have the following value ""
    3. In general, all the columns of the table will be added to the sample data so we will check the property "Include All Columns". In the strange case that you don't want to include all the columns in the sample data then this check will be unmarked and columns should be specified in "Column" child tab
  6. Repeat step 5 until you have added all of your tables.
  7. Return to the header "Client definition" and revert the change done in step 3
  8. Return to "Modules" window and revert the change done in step 1
  9. Stop tomcat
  10. Finally, Execute
ant export.database

Once executed, check changes in your module's file "src-db/database/sourcedata/AD_DATASET_TABLE.xml" and push your changes

Now you can create new data in the new tables and then execute "export" commands which are explained below.

Export retail sampledata

ant -Dclient="The White Valley Group" -Dmodule=org.openbravo.retail.sampledata
ant -Dclient="The White Valley Group"
ant -Dclient="Retail Test" -Dmodule=org.openbravo.retail.testsampledata

Setup SSL

For retail is mandatory to use always ssl, only exception is localhost (or 127.*.*.*)

For testing is posible to use the self signed certificate created by apache on install, to do that:

first step, do the apache setup
sudo a2enmod ssl
sudo a2ensite default-ssl.conf
sudo /etc/init.d/apache2 restart

The URL for access with ssl: https://ip/... (note that is not needed to specify a port)

Retrieved from ",_Setup_and_Run_Retail_Automated_Tests"

This page has been accessed 14,680 times. This page was last modified on 2 November 2020, at 11:28. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.