+#!/bin/bash
+
+##########################################################
+# This script is executed from /scripts directory #
+# in situare project folder #
+##########################################################
+clear
+echo "This is the master script for building and executing all automatic unit test."
+echo "As a final step, it creates summary report from all tests executed."
+##########################################################
+#Environment settings #
+##########################################################
+#Store all directory names to a list
+MODULES=(`ls ../tests/`)
+#Modify this path to point to correct path
+location=$HOME/situare/repository/situare/tests/
+FILE=$HOME/situare/repository/situare/scripts/tests_summary.txt
+if [ ! -e $FILE ]; then
+ touch tests_summary.txt
+ echo "##########################################" >> tests_summary.txt
+ echo "# Summary of unit tests executed #" >> tests_summary.txt
+ echo "# Date: `date` #" >> tests_summary.txt
+ echo "# User: `whoami` #" >> tests_summary.txt
+ echo "##########################################" >> tests_summary.txt
+fi
+##########################################################
+#First part: Execution of all tests #
+##########################################################
+for component in "${MODULES[@]}"
+do
+ echo "Creating Qt project file for $component"
+ cd $location/$component
+ qmake -project "CONFIG+=qtestlib"
+ echo "Creating make file for $component"
+ qmake
+ echo "Building tests for $component"
+ make
+ echo "Running tests for $component"
+ ./$component -o testreport_$component.txt
+ echo "Cleaning $component"
+ make clean
+ rm Makefile
+ rm $component
+done
+
+#########################################################
+# Second part: Extraction of results #
+#########################################################
+echo "Summarizing test results....."
+for component in "${MODULES[@]}"
+do
+ cd $location/$component
+ echo "############# $component ################" >> $FILE
+ grep Totals *.txt >> $FILE
+done
+exit 0