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 these paths to point to correct path
16 location=$HOME/situare/repository/situare/tests/
17 FILE=$HOME/situare/repository/situare/reports/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 echo "Building tests for $component/$unittest"
39 echo "Running tests for $component/$unittest"
40 ./$unittest -o testreport_$component.txt
41 echo "Cleaning $unittest"
48 #########################################################
49 # Second part: Extraction of results #
50 #########################################################
51 echo "Summarizing test results....."
52 for component in "${MODULES[@]}" #Loop through components
54 cd $location/$component
55 CASES=(`ls`) #List all test cases uner component directory
56 for unittests in "${CASES[@]}"
58 cd $location/$component/$unittests
59 echo "############# $component/$unittests ################" >> $FILE
60 grep Totals *.txt >> $FILE