Merge pull request #12024 from yashodha/price_custom_search
[civicrm-core.git] / tools / bin / scripts / runTest.sh
CommitLineData
6a488035
TO
1#!/bin/sh
2# Script for Running all the Tests one after other
3
4# Where are we called from?
5P=`dirname $0`
6
7# Current dir
8ORIGPWD=`pwd`
9
10# File for Storing Log Of UnitTest.
11logUT=UnitTestResult
12logSRT=SeleniumTestResult
13
14###########################################################
15##
16## Create log for the tests
17##
18###########################################################
19
20# Method to Create Log Folder if it does not Exists.
21create_log()
22{
23 cd $ORIGPWD/../test/
03b8a54d 24
25 PATH4LOG=`pwd`
26
27 if [ ! -d "Result" ] ; then
28 mkdir Result
6a488035
TO
29 fi
30}
31
32###########################################################
33##
34## Following methods are used to run the different tests
35##
36###########################################################
37
38# Method to Run Unit Tests.
39run_UnitTest()
40{
41 cd $ORIGPWD/../test
42 # Running Unit Tests
43 php UnitTests.php > $PATH4LOG/Result/$logUT
44}
45
46# Method to Run Selenium Ruby Tests.
47run_seleniumTest()
48{
49 sub_menu
50 echo "Enter Your Option: "
51 read choice
31037a42 52
6a488035
TO
53 cd $ORIGPWD/../test/selenium-ruby/CRM
54 # Running Selenium (ruby) Tests
55 ruby ruby_unit_tests.rb $choice
56}
57
58# Method to Run Stress Test.
59run_stressTest()
60{
61 cd $ORIGPWD/
62 # running stress test
63 ./runStressTest.sh
64}
65
66###########################################################
67##
68## Menu system for different purpos
69##
70###########################################################
71
72main_menu()
73{
74 clear
75 echo
76 echo " *********************** Select Method for Test *********************** "
03b8a54d 77 echo
6a488035
TO
78 echo "Options available: "
79 echo " UT - Carry out Unit Tests"
80 echo " ST - Carry out Stress Tests"
81 echo " SRT - Carry out Selenium (Ruby) Tests"
82 echo " All - Carry out all the above mentioned Tests i.e. Unit Tests, Stress Test, Selenium Test"
83 echo
84 echo
85}
86
87sub_menu()
88{
89 clear
03b8a54d 90
6a488035
TO
91 echo
92 echo " *********************** Select the Option *********************** "
03b8a54d 93 echo
6a488035
TO
94 echo "Options available: "
95 echo " 1 : Contact Individual"
96 echo " 2 : Contact Household"
97 echo " 3 : Contact Organization"
98 echo " 4 : New Group"
99 echo " 5 : Manage Group"
100 echo " 6 : Administer - Configuration Section"
101 echo " 7 : Administer - Configuration Custom Data"
102 echo " 8 : Administer - Configuration Profile"
103 echo " 9 : Administer - Setup Section"
104 echo " 10 : Administer - CiviContribute"
105 echo " 11 : Administer - CiviMember"
106 echo " 12 : Administer - CiviEvent"
107 echo " 13 : Find Contact - Basic Search"
108 echo " 14 : Advanced Search"
109 echo " 15 : Search Builder"
110 echo " 16 : Import - Contacts"
111 echo " 17 : Import - Activity History"
112 echo " 18 : CiviContribute - Find Contribution"
113 echo " 19 : CiviContribute - Import Contribution"
114 echo " 20 : CiviMember - Find Memberships"
115 echo " 21 : CiviMember - Import Memberships"
116 echo " 22 : CiviMail"
117 echo " 23 : CiviEvent"
118}
119
120###########################################################
121##
122## Main execution method.
123##
124## All test scripts will run usnig this method
125##
126###########################################################
127
128run_option()
129{
130 # Following Case Structure is used for Executing Menuing System.
131 case $1 in
132 # Unit Tests
03b8a54d 133 "UT" | "ut" | "Ut")
134 echo "Running Unit Tests"; echo;
135 run_UnitTest
136 echo "Unit Tests Successfully Completed. Log stored in the File : " $PATH4LOG/Result/$logUT; echo;
137 echo " **************************************************************************** ";
138 ;;
31037a42 139
6a488035 140 # Stress Tests
03b8a54d 141 "ST" | "st" | "St")
142 echo "Running Stress Tests"; echo;
143 run_stressTest
144 echo "Stress Tests Successfully Completed."; echo;
145 echo " **************************************************************************** ";
146 ;;
31037a42 147
6a488035 148 # Selenium (Ruby) Tests
03b8a54d 149 "SRT" | "srt" | "Srt")
150 echo "Running Selenium (Ruby) Tests"; echo;
151 run_seleniumTest
152 #echo "Selenium (Ruby) Testing Successfully Completed. Log stored in the File : " $PATH4LOG/Result/$logSRT; echo;
153 echo " **************************************************************************** ";
154 ;;
155
156 # All the Tests will be Executed one after other
157 "All" | "all" )
158 echo "Running all three Tests i.e. Unit Tests, Web Tests, maxQ Tests, Stress Test and Selenium(Ruby) Tests"; echo;
159 echo "Running Unit Tests"; echo;
160 run_UnitTest
161 echo "Unit Tests Successfully Completed. Log stored in the File : " $PATH4LOG/Result/$logUT; echo;
162 echo "Running Stress Tests"; echo;
163 run_stressTest
164 echo "Stress Tests Successfully Completed."; echo;
165 echo " **************************************************************************** ";
166 echo "Running Selenium (ruby) Tests"; echo;
167 run_seleniumTest
168 #echo "Selenium (Ruby) Testing Successfully Completed. Log stored in the File : " $PATH4LOG/Result/$logSRT; echo;
169 echo " **************************************************************************** ";
170 ;;
171 *)
172 echo "You have entered Invalid Option."; echo;
173 exit
174 ;;
6a488035
TO
175 esac
176}
177
178###########################################################
179##
180## Start of the script.
181##
182###########################################################
183
184start()
185{
186create_log
187
188main_menu
189echo "Enter Your Option: "
190read option
191run_option $option
192echo;
193
194}
195
196###########################################################
197##
198## Call to start of the script
199##
200###########################################################
201
202start