TestLink is a free and open source web based test management system that facilitates software quality assurance. It is developed and maintained by teamtest and it is written in PHP. TestLink offers support for test cases, test suites, test plans, test projects and user management, as well as various reports and statistics. Some of its features are listed below:
- user roles and management
- test plans
- grouping of test cases in test specifications
- bug tracking system integration
- integration with other software using a provided API
- customization of the user interface using Smarty templates
- reports, charts and monitors
- support for testing different builds of the software
Prerequisites
You’ll need a centos 7 server and root privileges to install TestLink. You can switch from non root user to root user using sudo -i
command.
Updating System
Before going through the installation process it is highly recommended to update your system and upgrade all available packages run the command below and it’ll do the job for you.
yum -y update
Installing Apache Web Server
Once the system is updated, you can install the dependencies required. To install TestLink you will need to install the Apache web server along with MaraiDB and PHP with a few extensions.
Run the following command to install the Apache web server.
yum -y install httpd
Now you can start Apache and enable it to start at boot time, using the following commands.
systemctl start httpd.service systemctl enable httpd.service
You can check the status of Apache web server using the following command.systemctl status httpd
You should see following output:
[root@Sajid ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2017-02-08 14:46:03 UTC; 22s ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 10743 (httpd)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
CGroup: /system.slice/httpd.service
├─10743 /usr/sbin/httpd -DFOREGROUND
├─10744 /usr/sbin/httpd -DFOREGROUND
├─10745 /usr/sbin/httpd -DFOREGROUND
├─10746 /usr/sbin/httpd -DFOREGROUND
├─10747 /usr/sbin/httpd -DFOREGROUND
└─10748 /usr/sbin/httpd -DFOREGROUND
Feb 08 14:46:03 ip-172-31-22-142 systemd[1]: Starting The Apache HTTP Server...
Feb 08 14:46:03 ip-172-31-22-142 systemd[1]: Started The Apache HTTP Server.
We will need to install MariaDB for database purposes for TestLink. MariaDB 5.5 is shipped in the default CentOS 7 repository, so just run this command to install MariaDB.
yum -y install mariadb-server
Now you’ll have to start the MariaDB service and enable it to start at the boot time like we have done before for apache server, to do so please run following command.
systemctl start mariadb.service systemctl enable mariadb.service
You can check status of mariaDB using this below given command and you should see following output.
systemctl status mariadb.service
[root@Sajid ~]# systemctl status mariadb.service
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2017-02-08 14:47:40 UTC; 22s ago
Main PID: 18035 (mysqld_safe)
CGroup: /system.slice/mariadb.service
├─18035 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
└─18192 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/ma...
Feb 08 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir[17956]: The latest information about MariaDB is available at http://mariadb.org/.
Feb 08 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir[17956]: You can find additional information about the MySQL part at:
Feb 08 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir[17956]: http://dev.mysql.com
Feb 08 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir[17956]: Support MariaDB development by buying support/new features from MariaDB
Feb 08 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir[17956]: Corporation Ab. You can contact us about this at sales@mariadb.com.
Feb 08 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir[17956]: Alternatively consider joining our community based development effort:
Feb 08 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir[17956]: http://mariadb.com/kb/en/contributing-to-the-mariadb-project/
Feb 08 14:47:39 ip-172-31-22-142 mysqld_safe[18035]: 170208 14:47:39 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Feb 08 14:47:39 ip-172-31-22-142 mysqld_safe[18035]: 170208 14:47:39 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Feb 08 14:47:40 ip-172-31-22-142 systemd[1]: Started MariaDB database server.
We recommend you make sure that this installation is secure and to do so run following command.
mysql_secure_installation
You’ll be asked to provide root password so enter appropriate password and answer yes to all questions by pressing Y.
Now you’ll have to create a database for TestLink so please follow the instructions.
mysql -u root -p
You’ll be asked to enter password so simply enter a password and now execute the following queries to create a new database.
CREATE DATABASE testlink_data;
The above query will create a database named testlink_data. For the database you can use any name you prefer in the place of testlink_data. Make sure that you use semicolon at the end of each query as a query always ends with a semicolon. Once the database is created you can create a new user and grant the required permissions to the user for the database.
CREATE USER 'testlink_user'@'localhost' IDENTIFIED BY 'StrongPassword';
The above query will create a user with username testlink_user. You can use any preferred username instead of testlink_user. Replace StrongPassword with a strong password.
Now provide the appropriate privileges to your database user over the database you have created. Run the following query to do so.
GRANT ALL PRIVILEGES ON testlink_data.* TO 'testlink_user'@'localhost';
Now run the following query to immediately apply the changes on the database privileges.
FLUSH PRIVILEGES;
Now you can exit from MariaDB prompt using following command.
exit
.
We will have to install PHP. To do so run following commands as shown below.
cd
yum -y install epel-release
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum install mod_php71w php71w-mysqlnd php71w-common php71w-gd php71w-ldap php71w-cli php71w-mcrypt php71w-xml -y
Next we will have to change some PHP settings to fulfill TestLink requirements so please run below commands.
cp /etc/php.ini /etc/php.ini.bak
sed -i "s/session.gc_maxlifetime = 1440/session.gc_maxlifetime = 2880/" /etc/php.ini
sed -i "s/max_execution_time = 30/max_execution_time = 120/" /etc/php.ini
Next you’ll have to restart your apache web server to load new components that we just configured and use following command to restart apache web server.
systemctl restart httpd.service
Installing TestLink
Once we have installed all required dependencies now we are ready to install TestLink on centos server so first download the latest stable release of TestLink from TestLink GitHub repository and unzip the archive file to the web root directory. Run the following commands, it will do the job for you.wget https://github.com/TestLinkOpenSourceTRMS/testlink-code/archive/1.9.16.tar.gz
tar -zxvf 1.9.16.tar.gz -C /var/www/html
chown -R apache:apache /var/www/html/testlink-code-1.9.16
Next, you’ll have to create a custom configuration file for TestLink, you can do so using this command.
cp /var/www/html/testlink-code-1.9.16/custom_config.inc.php.example /var/www/html/testlink-code-1.9.16/custom_config.inc.php
Next, we will have to edit custom configuration file using any text editor here we are using nano text editor you can also install it using yum -y install nano
nano /var/www/html/testlink-code-1.9.16/custom_config.inc.php
Find these following lines in file:
// $tlCfg->log_path = '/var/testlink-ga-testlink-code/logs/'; /* unix example */
// $g_repositoryPath = '/var/testlink-ga-testlink-code/upload_area/'; /* unix example */
Now replace them with these lines then save the file and exit from text editor.
$tlCfg->log_path = '/var/www/html/testlink-code-1.9.16/logs/';
$g_repositoryPath = '/var/www/html/testlink-code-1.9.16/upload_area/';
Creating a Virtual Host
You’ll need to create a virtual host for TestLink to finish the installation process. You can use any text editor for creating virtual host here we are using nano text editor. Run following command to create a virtual host configuration file.nano /etc/httpd/conf.d/testlink.conf
Add below given content to the configuration file and replace server admin and name with your own.
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/testlink-code-1.9.16/
ServerName testlink.example.com
ServerAlias www.testlink.example.com
<Directory /var/www/html/testlink-code-1.9.16/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/httpd/testlink.example.com-error_log
CustomLog /var/log/httpd/testlink.example.com-access_log common
</VirtualHost>
Save the file and exit from the text editor, finally restart your apache web server to apply all the changes.
systemctl restart httpd
Next you’ll have to modify firewall rules and if in case you don’t have firewalld services installed on your server then you can install it using yum -y install firewalld
and you can start it using systemctl start firewalld
Next run these below given command to modify the firewalld rules.
firewall-cmd --zone=public --permanent --add-service=http
firewall-cmd --reload
Web Access
Open up your favorite web browser and visit http://yourserverIP to finish this installation. Accept the license and terms and conditions to the continue with installation process.
On the database setup page provide following database information and click on Process TestLink Setup button.
Database Type: MySQL/MariaDB (5.6+ / 10.+)
Database host: localhost
Database name: testlink_data
Table prefix: <LEAVE IT EMPTY>
Database admin login: root
Database admin password: <your-MariaDB-root-password>
TestLink DB login: testlink_user
TestLink DB password: yourpassword
Next you’ll see a log in page so use admin as both username and password for logging in to the admin dashboard.