← Back to team overview

openerp-dev team mailing list archive

B-q-i: Running local tests of OpenERP.

 

Some of you may already know that there is a "base_quality_interrogation.py" 
script that consists the heart of what our OpenERP buildbot tests. Some of you 
may not know that.

Well, let me give you a little background: What you see in the buildbot pages 
(test.openobject.com) is the results of an automated running of the b-q-i 
(shorthand for "base_quality_interrogation") against each of your commits.

What very little of you know, is the fact that b-q-i was designed to run 
locally, too. That is, you can use that script to manually test your working 
branch, in order to recreate a bug or so!

A few days ago, I had enhanced that script, so that it would be even easier[1] 
for you to use on your own.

One simple statement: the 'b-q-i' is autonomous. That means, it is just *one* 
python file, which contains all the code. No dependencies but the core python 
modules[2]. It is even self-explanatory with help texts and messages.

What it does, in principle?
The idea is that b-q-i "knows" the OpenERP server and how to use it. It can 
start the server, pass it all the right parameters, and then issue some 
trivial commands for installing modules, upgrade them and finally run the 
'fields_view_get' function to test the models. 
b-q-i has a modular internal structure, so that we can add more tests in the 
future[3].
b-q-i has a server-output parser, so that it will scan the server's logs and 
report additional information on the troubles it recognizes. In our jargon, 
this is called "blame information" of the b-q-i. What you see in buildbot's 
result pages is those blames.
b-q-i will store the logs of *both* the server and itself (the commands it 
sends) so that we can inspect what happened. 

How to use it:
just download the b-q-i from Launchpad, git or anybody that has the latest 
version. You _don't_ need to do a bzr checkout or anything; you only need to 
get that single file!

http://git.hellug.gr/?p=xrg/openerp-
buildbot;a=blob;f=openerp_buildbot_slave/base_quality_interrogation.py;h=894bb46b614115bdd54e37a170049e8f4965aae6;hb=HEAD

http://bazaar.launchpad.net/~openerp-dev/openerp-
buildbot/v2.5/annotate/head:/openerp_buildbot_slave/base_quality_interrogation.py

My advice is to put the file at some place in your /home and then symlink it as 
~/bin/bqi.py (assuming that ~/bin/ is in your PATH). That way, whenever you 
will run "bqi.py" from your console, from any path, it will run the script. 

Then, you will need to configure it. The b-q-i can read a user-specific 
configuration file, located at ~/.openerp-bqirc , so that you only write it 
once, and then just perform minor changes whenever you want to tweak some 
tests.
I attach you a sample configuration file, that you could adapt to your needs.
Remember that you can have different "setups" of tests, in the .openerp-bqirc's 
config sections. Then, you would call the script like:
	bqi.py -s test-one-module -m sale_layout            # for that module

Then, you may explore it's command-line arguments, so that you run your tests 
according to the bugs you are trying to fix.

Remember, the b-q-i does /use/ whatever server[4] or addons you are trying to 
test, but will _not_ modify your code, or require special versions!

Enjoy! And please send your feedback. I'd be happy to put more features into 
b-q-i, as long as these make our life easier and kill more bugs.

[1] previously, I had been running that, here, through a bash-script. I 
thought that was already messy.
[2] It will never ask you to install a kvm to run qemu to run an Android 
Emulator, where you will run Java and inside it a Ruby emulator of python..
[3] the language-install step is now broken, because it used the old wizard, 
before the osv_memory one. But we will fix that.
[4] It works for v6.0.x trunk, many commits along (not some special commit, 
that is), and my "pg84" branch, transparently. If you think you have some 
special feature at your server's branch, we can adapt b-q-i to respect that, 
too (there is a flag for such a case).

-- 
Say NO to spam and viruses. Stop using Microsoft Windows!
; Settings for the base_quality_interrogation script
; *All* the settings here correspond to the command-line
; options. The names are the ones of "optparse" code.

[general]
; This is the section that will always load. We want all our
; tests to follow these rules:
port = 8169
ftp_port=8923
mach_log = openerp-test.log
; Have a machine-format log to a "openerp-test.log" file in the
; directory we run the bqi from.
txt_log = stdout
; Also display all logs, bare, to the console. Strongly advised.
; You could use "stderr", too.
; xml_log = foobar.log.xml
; Yes there is an option of xml logging, but only useful if you
; ever build a parser for them. "mach_log" is a good alternative.
inter_history = ~/.openerp_bqi_history
console_color = True
; Use color when logging to the console.
console_nodebug = True
; Hide debug-level from console, but still write them to log file.
default_section = official

[official]
db_name= test_bqi_off
server_series=v600
; series can flag different server branches, v600 or pg84 so far.
homedir=~/build/openerp-official/
; Will shortcut that dir in the logs. Won't affect the tests.
mach_log = test-bqi-off.log
; We override the general setting for the log

;addons_path=~/build/openerp-official/addons
;root_path=~/build/openerp-official/server/bin/
;; Please adapt these!

[foobar-branch]
db_name= test_bqi_foobar
server_series=v600
homedir=~/stage/repos/openerp/foobar/
mach_log = ~/logs/test-bqi-foobar.log
addons_path=%(homedir)s/addons
;root_path=~/build/openerp-official/server/bin/


[test-start]
; just a description of a test
commands = start-server
dry_run = False

[full-test]
all_modules = True
commands = -drop-db create-db install-module -- fields-view-get

[test-one-module]
commands = -drop-db create-db install-module -- fields-view-get

[full-official]
include = official full-test

[official-knowledge]
include = official test-one-module
dry_run = False
modules = document caldav crm_caldav project_caldav document_ftp document_webdav