Koha Test Wiki MW Canasta on Koha Portainer

Test major Koha Wiki changes or bug fixes here without fear of breaking the production wiki.

For the current Koha Wiki, visit https://wiki.koha-community.org .

QA Test Tools

From Koha Test Wiki MW Canasta on Koha Portainer
Jump to navigation Jump to search

Introduction

The QA Test Tools are intended for use by developers before submitting patches, testers and of course the QA team. They will run a series of tests on a given range of commits and output the results with hints on how to fix the problems. Failing the QA Test Tools will usually result in setting the bug to Failed QA until fixed by the developer.

Use with a KohaDevBox

When working with a KohaDevBox installation, the QA Test Tools will already be set up:

 vagrant ssh
 sudo koha-shell kohadev
 qa -c 2 -v 2

-c is for the number of commits to run the tests on and can be left out if you are only testing 1 bug (it will default to looking at bug numbers in the commit messages and work backwards until it finds a change)

Use with a git installation

The following instructions assumes a git installation of Koha with koha-deps and koha-perldeps installed and are generally savvy enough to recognize that the instructions are only for a guideline, and not necessarily intended to be cut-and-paste mindlessly. However, boxes have been placed around things you may wish to cut-and-paste. And if there is prompting, the boxes are split apart.

Get the source

cd
git clone https://gitlab.com/koha-community/qa-test-tools.git
cd qa-test-tools

Configure dependencies

sudo apt-get install libfile-chdir-perl libgit-repository-perl liblist-compare-perl \
libmoo-perl libperl-critic-perl libsmart-comments-perl dh-make-perl libtest-perl-critic-progressive-perl cpanminus

And to be on the safe side, run the perl-deps file through cpanm.

sudo cat perl-deps | cpanm

Also, you must read the README file in your qa-test-tools git directory. This is where up-to-date information about the tool will be available.

Setup configuration files

ln -s ~/qa-test-tools/perlcriticrc ~/.perlcriticrc
mkdir ~/bin
ln -s ~/qa-test-tools/koha-qa.pl ~/bin/koha-qa.pl

Next, set up PERL5LIB to include /home/{your user name}/qa-test-tools (remember the delimiter between items is a colon). This can be done in /etc/environment or your .bashrc file (remember to put export in front for the .bashrc). You want it in the same place as you did the configuration for Koha's required PERL5LIB.

Logout and log in for the environment variables to take effect.

Test it

cd ~/qa-test-tools
prove -v t/Perl.t

This hopefully will not fail. If it does, resolve the problems.

Change into the directory where Koha was cloned for your git installation.

koha-qa.pl -v 2 -c 1

Hopefully it will run and give pretty PASSes or FAILs. Worst case scenario a dependency was missed. If so, find it, install it, and rerun the koha-qa.pl script.

Documentation

Type koha-qa.pl without any options to get a list of available options, or

perldoc ~/qa-test-tools/koha-qa.pl