-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtesting.txt
More file actions
206 lines (170 loc) · 8.9 KB
/
Copy pathtesting.txt
File metadata and controls
206 lines (170 loc) · 8.9 KB
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
Overall Testing
Overall testing encompasses various types of testing to ensure that the website is functioning as intended. Here are some key types of overall testing you should consider:
Functional Testing:
Objective: Verify that all features of the website work as expected.
Methods:
Manual Testing: Test each functionality (e.g., user registration, product search, cart operations) manually.
Automated Testing: Use testing frameworks like Selenium, Cypress, or TestCafe to automate functional tests.
Regression Testing:
Objective: Ensure that new code changes do not break existing functionality.
Methods:
After each update or new feature addition, run a suite of regression tests to verify that existing functionalities still work.
Performance Testing:
Objective: Assess the website's performance under various conditions.
Methods:
Load Testing: Use tools like JMeter, LoadRunner, or Gatling to simulate multiple users and measure response times.
Stress Testing: Push the website beyond normal operational limits to see how it behaves under extreme conditions.
Security Testing:
Objective: Identify vulnerabilities and ensure data protection.
Methods:
Perform penetration testing to identify vulnerabilities (e.g., SQL injection, XSS).
Use automated tools like OWASP ZAP or Burp Suite for security scanning.
Cross-Browser and Cross-Device Testing:
Objective: Ensure compatibility across different browsers and devices.
Methods:
Test the website on various browsers (Chrome, Firefox, Safari, Edge) and devices (desktop, tablet, mobile) to ensure consistent behavior.
API Testing:
Objective: Verify the functionality and performance of APIs used by the e-commerce site.
Methods:
Use tools like Postman or Insomnia to test API endpoints for expected responses and error handling.
Usability Testing
Usability testing focuses on evaluating the user experience of the website. Here are steps to conduct usability testing effectively:
Define Objectives:
Determine what aspects of usability you want to test (e.g., ease of navigation, clarity of information, overall satisfaction).
Select Participants:
Choose a representative sample of users who match your target audience. Aim for a diverse group to get varied feedback.
Create Scenarios and Tasks:
Develop realistic scenarios that users might encounter (e.g., finding a product, completing a purchase).
Define specific tasks for users to complete during the testing session.
Conduct Testing Sessions:
Moderated Testing: Facilitate sessions where a moderator observes users as they interact with the website. Ask them to think aloud to understand their thought process.
Unmoderated Testing: Use platforms like UserTesting or Lookback to conduct tests remotely, allowing users to complete tasks at their convenience.
Gather Feedback:
Collect qualitative and quantitative data from users, including:
Observations of user behavior (e.g., where they struggle, how long tasks take).
User satisfaction ratings (e.g., using post-test surveys).
Direct feedback on specific features or overall experience.
Analyze Results:
Identify common issues and pain points based on user feedback.
Prioritize usability issues based on severity and frequency.
Iterate and Improve:
Use the findings to make informed design decisions and improvements.
Conduct follow-up tests after implementing changes to assess their impact.
class PaymentView(View):
def get(self, *args, **kwargs):
order = Order.objects.get(user=self.request.user, ordered=False)
if order.billing_address:
context = {
'order': order,
'DISPLAY_COUPON_FORM': False,
'STRIPE_CUSTOMER_ID' : settings.STRIPE_CUSTOMER_ID
}
userprofile = self.request.user.userprofile
if userprofile.one_click_purchasing:
# fetch the users card list
cards = stripe.Customer.list_sources(
userprofile.stripe_customer_id,
limit=3,
object='card'
)
card_list = cards['data']
if len(card_list) > 0:
# update the context with the default card
context.update({
'card': card_list[0]
})
return render(self.request, "payment.html", context)
else:
messages.warning(
self.request, "You have not added a billing address")
return redirect("core:checkout")
def post(self, *args, **kwargs):
order = Order.objects.get(user=self.request.user, ordered=False)
form = PaymentForm(self.request.POST)
userprofile = UserProfile.objects.get(user=self.request.user)
if form.is_valid():
token = form.cleaned_data.get('stripeToken')
save = form.cleaned_data.get('save')
use_default = form.cleaned_data.get('use_default')
if save:
if userprofile.stripe_customer_id != '' and userprofile.stripe_customer_id is not None:
customer = stripe.Customer.retrieve(
userprofile.stripe_customer_id)
customer.sources.create(source=token)
else:
customer = stripe.Customer.create(
email=self.request.user.email,
)
customer.sources.create(source=token)
userprofile.stripe_customer_id = customer['id']
userprofile.one_click_purchasing = True
userprofile.save()
amount = int(order.get_total() * 100)
try:
if use_default or save:
# charge the customer because we cannot charge the token more than once
charge = stripe.Charge.create(
amount=amount, # cents
currency="usd",
customer=userprofile.stripe_customer_id
)
else:
# charge once off on the token
charge = stripe.Charge.create(
amount=amount, # cents
currency="usd",
source=token
)
# create the payment
payment = Payment()
payment.stripe_charge_id = charge['id']
payment.user = self.request.user
payment.amount = order.get_total()
payment.save()
# assign the payment to the order
order_items = order.items.all()
order_items.update(ordered=True)
for item in order_items:
item.save()
order.ordered = True
order.payment = payment
order.ref_code = create_ref_code()
order.save()
messages.success(self.request, "Your order was successful!")
return redirect("/")
except stripe.error.CardError as e:
body = e.json_body
err = body.get('error', {})
messages.warning(self.request, f"{err.get('message')}")
return redirect("/")
except stripe.error.RateLimitError as e:
# Too many requests made to the API too quickly
messages.warning(self.request, "Rate limit error")
return redirect("/")
except stripe.error.InvalidRequestError as e:
# Invalid parameters were supplied to Stripe's API
print(e)
messages.warning(self.request, "Invalid parameters")
return redirect("/")
except stripe.error.AuthenticationError as e:
# Authentication with Stripe's API failed
# (maybe you changed API keys recently)
messages.warning(self.request, "Not authenticated")
return redirect("/")
except stripe.error.APIConnectionError as e:
# Network communication with Stripe failed
messages.warning(self.request, "Network error")
return redirect("/")
except stripe.error.StripeError as e:
# Display a very generic error to the user, and maybe send
# yourself an email
messages.warning(
self.request, "Something went wrong. You were not charged. Please try again.")
return redirect("/")
except Exception as e:
# send an email to ourselves
messages.warning(
self.request, "A serious error occurred. We have been notifed.")
return redirect("/")
messages.warning(self.request, "Invalid data received")
return redirect("/payment/stripe/")