Installation
To install mysql-unit
all that is needed - is to run installation script from Install
folder for your operation system. You will be prompted to enter database, user name and password. Note, that in order to successfully finish the installation, entered user must have enough permissions to execute installation scripts.
Installation for Linux OS
The corresponding install script is called install.sh
and is located in Linux
subfolder for installers
user@host:/path/mysql-unit/5.6/Install/Linux$ ./install.sh Checking 'mysql' CLI .. ok Enter database, to which mysql-unit will be installed: test Enter user name, which will execute install scripts: tester Enter password for tester :
Here, of course, /path
will be full path to your installation folder for mysql-unit
Installation for Windows
The corresponding install script is called install.bat
and is located in Windows
subfolder for installers. Note, that Windows installer is a batch file, which means, you will need to execute it from command line.
c:\path\mysql-unit\5.6\Install\Windows>install.bat Checking 'mysql' CLI .. ok Enter database, to which mysql-unit will be installed: test Enter user name, which will execute install scripts: tester Enter password for tester: ******************************** Checking tester generic access .. ok
Important note: your mysql
CLI executable must present in system PATH
variable, otherwise installation will fail. Normally, after installation of MySQL you will be prompted to add the binary to system PATH (so, confirm the option). But if somehow your mysql executable is missing in system path, check the corresponding articles of how to add it there.
Additional notes & requirements
Below is a list of SQL permissions that will be required for chosen database:
- SELECT (for each particular entity)
- CREATE ROUTINE
- CREATE
Also, current version of mysql-unit supports only MySQL 5.6 or above. It won't be checked at start of the installation, but when it will proceed till 5.6-specific SQL commands, installation will fail, if your server version doesn't support them.
Custom Setup
You may wish to install only certain procedure or function. Normally, that will occur if you'll add your own test items and do not want to re-install whole bunch of scripts for framework. All functions and procedures should be stored in .sql
files inside Invoke
folder. Then, simply run your file normally with mysql CLI:
user@host:/path/mysql-unit/5.6$ mysql -utester -p test < Invoke/DDL/custom_check.sql
Sample above will install CUSTOM_CHECK
procedure/function to the system. Here it is assumed that you've named your .sql
file with same name as procedure/function, which is inside it. This is a good practice and it's strongly recommended to follow this naming rule.