Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,630 --> 00:00:05,310
If you write your tests first, then you'll be forced to write code that is easy to test at the same
2
00:00:05,310 --> 00:00:10,070
time, code that is easy to test is immune to bugs, and it tends to be more polished.
3
00:00:10,320 --> 00:00:15,990
So the first step of test driven development is to identify meaningful test cases from the requirements
4
00:00:16,470 --> 00:00:18,350
when the cart adds an item to its collection.
5
00:00:18,360 --> 00:00:21,890
We need to check if the cart contains the item that was just added.
6
00:00:22,350 --> 00:00:25,230
So test if the cart contains the item.
7
00:00:27,490 --> 00:00:28,360
After it's added.
8
00:00:31,740 --> 00:00:35,160
We also got to make sure the cart doesn't add an item that it already contains.
9
00:00:36,210 --> 00:00:37,590
Test if the cart.
10
00:00:41,290 --> 00:00:42,850
Scheps duplicate item.
11
00:00:47,580 --> 00:00:51,900
And now there's another requirement about removing an item, so we're going to test if the item.
12
00:00:54,970 --> 00:00:56,890
Gets removed after being sold.
13
00:01:02,760 --> 00:01:07,500
And the code to throw an exception, if the user tries to remove from an empty cart, so test for an
14
00:01:07,500 --> 00:01:08,850
illegal state exception.
15
00:01:11,340 --> 00:01:13,710
We're trying to remove from an empty cart.
16
00:01:19,010 --> 00:01:22,820
And for this requirement, we got a test of the subtotal as calculated correctly.
17
00:01:30,580 --> 00:01:32,830
Test if the tax is calculated correctly.
18
00:01:42,530 --> 00:01:43,610
Test for the total.
19
00:01:47,390 --> 00:01:51,860
And we're also going to test for an illegal state acceptant for trying to check out an empty cart.
20
00:02:08,550 --> 00:02:12,300
If every test passes, we can rest assured that our code doesn't have any bugs.
21
00:02:12,840 --> 00:02:13,190
All right.
22
00:02:13,200 --> 00:02:14,210
That is all for part one.
23
00:02:14,220 --> 00:02:17,860
We've identified every meaningful test case and now we can start unit testing.
24
00:02:18,240 --> 00:02:18,990
See you soon.
2228
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.