3 ##########################################################
4 # This script is executed from /scripts directory #
5 # in situare project folder #
6 ##########################################################
8 echo "This is the master script for building and executing all automatic unit test."
9 echo "As a final step, it creates summary report from all tests executed."
10 ##########################################################
11 #Environment settings #
12 ##########################################################
13 #Store all directory names to a list
14 MODULES=(`ls ../tests/`)
15 #Modify this path to point to correct path
16 location=$HOME/situare/repository/situare/tests/
17 FILE=$HOME/situare/repository/situare/scripts/tests_summary.txt
18 if [ ! -e $FILE ]; then
19 touch tests_summary.txt
20 echo "##########################################" >> tests_summary.txt
21 echo "# Summary of unit tests executed #" >> tests_summary.txt
22 echo "# Date: `date` #" >> tests_summary.txt
23 echo "# User: `whoami` #" >> tests_summary.txt
24 echo "##########################################" >> tests_summary.txt
27 ##########################################################
28 #First part: Execution of all tests #
29 ##########################################################
30 for component in "${MODULES[@]}" #Loop through components
32 cd $location/$component
33 CASES=(`ls`) #List all test cases uner component directory
34 for unittest in "${CASES[@]}"
36 cd $location/$component/$unittest
37 if [ $component = "testMap" ]; then
40 qmake -project "CONFIG+=qtestlib"
41 echo "Creating make file for $component/$unittest"
44 echo "Building tests for $component/$unittest"
46 echo "Running tests for $component/$unittest"
47 ./$unittest -o testreport_$component.txt
48 echo "Cleaning $unittest"
55 #########################################################
56 # Second part: Extraction of results #
57 #########################################################
58 echo "Summarizing test results....."
59 for component in "${MODULES[@]}" #Loop through components
61 cd $location/$component
62 CASES=(`ls`) #List all test cases uner component directory
63 for unittests in "${CASES[@]}"
65 cd $location/$component/$unittests
66 echo "############# $component/$unittests ################" >> $FILE
67 grep Totals *.txt >> $FILE