-
Notifications
You must be signed in to change notification settings - Fork 3
/
Testing
240 lines (182 loc) · 13.3 KB
/
Testing
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
___________________________________________________________________________________________________________________________________________________
Dylan - Progress Page
User Story:
As a health-conscious user, I need to be able to see the progress of my daily targets and monthly record, to stay motivated.
Testing:
User Story Fulfillment:
- The last access date is saved in UserDefaults to be compared to the current date whenever the user accesses the app
- Daily Progress is reset at the beginning of a new day
- Before Daily Progress is reset, the day is given a rating which is sent to the progress page
- The Progress page can count the amount of good, okay, and bad days
- Progress is reset after a month
Test Patterns included:
Test Spy: Print statements to verify the expected outputs based on certain inputs for dates and date ratings.
Test Stub: Hard-coded in test cases for different execution paths based on different dates, ratings, and label counts.
Functional Testing:
To accomplish this user story, we created 5 functions:
daysBetween(): Calculates number of days between two dates. Tested by verifying output through print statements
updateLabels(): If the date has changed, it updates the progress page labels based on the rating of the last access date. Also resets the labels to zero
if the month has changed. Tested through feeding different dates, date rating, and label values as input.
dateChanged(): Checks if the date has changed by comparing the last access date and the current date. Tested through inputting different access dates.
progressWithIn(): Takes as input a macro goal and the progress towards that goal. It then calculates how close the progress is to the goal and returns
a range of which that progress is within the goal. Tested through different goal and progress values.
rateDay(): Rates the progress of one day based on the progressWithIn return values from all the macro progress.
Tested through different goal and progress values.
___________________________________________________________________________________________________________________________________________________
John - ProductRequest, WebScraping
WebScraping:
User Story:
As a user I would like to be able to see the catalog of items that the Store Safeway has.
Testing:
User Story Fulfillment:
The program gets a csv file containing the entire catalog of items from safeway. It does this by Web-Scraping all the food data out of their website
Test Patterns included:
Test Spy:
print statements to verify that the correct items were pulled and correct websites were being accessed, as well as a test .csv that collected all the items I used
Test Stub: Used a single page to pull the values, as well as dummy variables to verify correct push into csv
Functional Testing:
To accomplish this user story, created 4 functions
read_link(url):
Once the user gives the url, it is converted into a clickable link, by adding the HTTP//Safeway.com in order to access the page, it returns a fully accessible link.
Was tested with numerous individual pages on safeway’s website.
GetItemsFromPage(url):
As in all future functions for webscraping, it finds a specific div and class name in the page and saves all of those instances in a list.
This function is to read all links to the Item’s subpages
GetSubitemsFromPage(url):
This function is to go into the individual pages that have the name, and product information.
Tested by using a print statement and manually verified to make sure it connected to the right subpages
Get_Data_from_item_page(page):
This function intakes all the data and saves the correct containers, one with the product name, another with the product information. Then it searches for the correct information. Since there are only two possible ways that the table is formatted we added if statement to correctly pull the information. It then returns a .csv file with the information that was saved which is formated by two helper functions FomatInfo(String macro), CalorieInfo(String calorie)
The way This was tested was by using only one page, then by using five different pages, unfortunately there was no way of testing with custom information without myself creating a HTML document formatted in nearly the exact same way as the original page.
___________________________________________________________________________________________________________________________________________________
Roberto - ProductTableViewController, FoodSearchViewController
ProductTableViewController:
UserStory:
As a health conscious user, I want to search for a food product that fits my macros so that I know the variety I can choose from and eat the healthiest option available
Testing:
User Story Fulfillment:
Once a user has begun the search and transitioned to this page from the previous one, display a search bar and empty table of cells
Allow the user to enter a string and query our database (csv) for items containing that string
Read results from our database
Display the results onto the screen in a list format for the user
Allow the user to select an item and see its associated macronutrients
Once a selection has been made, send the selected items information to the FoodSearchViewController page
Test Patterns included:
Test Spy: print statements sent to the console to identify and verify values being stored and passed to the functions
Test Stub: created a list of indirect inputs to enter into the searchbar
Function testing:
To accomplish the user story, created 3 functions:
searchBarButtonClicked( searchBar: UISearchBar)
After a user has entered a string into the searchbar and clicked the search button, a product request is sent that returns a list of products. The searched
for items were based on a list of known working product searches.The products were then put into a second list to display for the user. Test spy console
statements were used to verify the contents of the returned list and to verify that their attributes were properly added as well. If attributes were not
added correctly (for ex: carb varlue were missing) then the test spy console statements were used to check each value as they were entered.
Override func tableview() // selection and de-selection
After the list was populated, the objects in the list were displayed for the user to see. Selection was also implemented to allow the user to view the
macronutrients of each item if they were selected by touching the item on screen. If the selection did not show the macronutrients, then, using console
statements, the object was checked to verify that it was the selected object and that it had its associated macro attributes. Next, the cell was checked
to ensure that it would properly expand to display the macro nutrients.
resultsToSearchPage()
After an item was selected and added to a list of the top 3 food products, this function sent the objects to the previous search page. If the previous page
did not receive the item, the function was checked to make sure that it was called appropriately, that it appended the objects to its list, and finally that
it actually stored the objects in the correct order.
___________________________________________________________________________________________________________________________________________________
FoodSearchViewController:
UserStory:
As a health conscious user, I want to search for a food product that fits my macros so that I know the variety I can choose from and eat the healthiest
option available
Testing:
User Story Fulfillment::
Allow a User to search for food items
Once an item has been selected, allow the user to see how it compares to other potential items
Save the description and values for the selected item
Add the item to their daily food list
Test Patterns included:
Test Spy: print statements sent to the console to identify and verify values being stored and passed to the functions
Test Stub: created a list of indirect inputs to enter into the search bar
Function testing:
To accomplish the user story, created 3 functions and one object list:
searchButtonPressed(sender: UIButton)
This function/button would send the user to the ProductTableViewController page. Testing was straightforward, only had to make sure that the app transitioned
to the correct page. Ran app, clicked the button and if it did not transition to the correct page, checked the xCode segue route and corrected it.
searchedFoodList: [MealProducts]
This was a list of objects that stored the values from the search list. The values were then displayed for the user to see. To test, a “test spy” was
implemented to display the values of the list objects to the console. If the List was not populating correctly, the ProductTableViewController page was
checked - since that was where the list obtained its values. If the list was correct
showBrandResults()
This function would take the values stored and display them on the screen for the user to see.To test, indirect inputs were used to create a list of objects
then the app was run to verify that their values were displaying and displayed correctly. If the values were not displaying, then the function was checked
to ensure that values were sent to the correct UILabel. If values were not displaying correctly (ex: protein should be 30g, but instead 25g was displayed)
then the code was checked and, if necessary, restructured to display the correct value from the correct source. Test spy print statements to the console
helped to verify that the correct source object was being used while the app display verified if the correct values were being displayed.
addToTarget()
This function would take the selected food item stored in the searchedFoodList and send it to the daily page where the food item would increment progress
and be listed in its meal section (breakfast, lunch, or dinner). Test spy console prints were used to verify that the correct meal section was selected and
then it was added to the list of foods on the daily page. If the item did not get sent properly (either it was in the wrong section or didn’t show up at all),
the function was checked to make sure that it activated when the button was clicked and the console prints were verified to work on all meal sections.
___________________________________________________________________________________________________________________________________________________
Sanyam - CustomViewController, SettingsViewController
Custom View Control
User Story: As a health-conscious user, I want to be able to calculate the Macronutrients based on personal goals and current weight so that I know exactly what my target daily intake should be.
Testing :
User Story Fulfillment :
Calculate macros
Update the progress with macros
Shows alert if macros exceeded
Update food list
Update user’s name
Test Patters included:
Test Spy: Have print statements
Tests Stubs: created random values to test it
Function Testing :
Functions created to accomplish user story:
macrosCalculated() // To calculate macros
incrementProgress(pros: pros) // Increment macros on the progress views page
caloriesLabelFunction() // update calories progress label
proteinLabelFunction() // update protein progress label
fatsLabelFunction() // update fats progress label
carbsLabelFunction() // update carbs progress label
DailyMaxValAlert() //show alert when macros exceed limit
___________________________________________________________________________________________________________________________________________________
Settings View Control
User Story: STORY 1: As a health-conscious user, I want to search for a food product that fits my macros so that I know the variety I can choose from and eat the healthiest option available
User story fulfillment - Be able to input values
Send values to update the Macros target
Be able to rest values
Be able to retain values after the closing of the app
Test Patters included:
Manual Testing
Function Testing :
Functions created to accomplish user story:
clearBarButtonPressed()// Resets all values
update SaveButton() // can only press save when all values are entered else wont be able to calculate properly
And the rest is to take values and save it
___________________________________________________________________________________________________________________________________________________
Vidisha - CustomizedViewCobtroller
Customized View Control
User Story: As a user, I want to be able to select brands and add to my daily diet.
User story fulfillment - Be able to input values
Be able to send those values to the Today tab
Test Patters included:
manual testing by seeing the results are getting updated
Tests Stubs: created random values to test it
Function Testing :
Functions created to accomplish user story:
defaultFoodNameChanged() // save food name
// save update values of macros and be able to send it to today tab
defaultCarbsChanged()
defaultFatsChanged()
defaultCalsChanged()
defaultProsChanged()
mealSegmentedControl()
updateCarbsValue()
CarbstextFieldDidChange()
updateFatsValue()
FatstextFieldDidChange()
updateCalsValue()
CalstextFieldDidChange()
updateProsValue()
ProstextFieldDidChange()
// save the values
saveButton()
___________________________________________________________________________________________________________________________________________________