Thus far, for us it's been testing individual functions. Later in the term we'll talk about unit testing of classes.
至今为止,我们用到单元测试的地方,就是测试每个单独的方法,在后面我们会讲到类的单元测试。
And I end up going back and doing unit testing anyway, to try and figure out why it doesn't work. So over the years, I've just convinced myself I might as well start where I'm going to end up.
第一次从来不会正常运行,因此无论如何我还要回头去做单元测试,找找哪儿出错了,因此经过这么多年,我已经说服自己既然一定要做单元测试,那么还是一开始就做最好了。
There's unit testing, where we validate each piece of the program independently.
一种是单元测试,也就是,分别验证程序中的每一个独立部分。
Because usually it doesn't work. And so one of the things that I think is very important is to always begin by testing each unit.
因此我认为非常重要的一件事情,就是开始测试的时候先对,每个独立单元进行测试。
Let's check it out. I've written a little bit of a test script here, so if we test cell sort, and I've written this so that it's going to print out what the list is at the end of each round, OK.
我们来检查检查,我写了一个小测试脚本,我写这个脚本来测试单元排序,它能够打印出每一轮结束后,链表的是什么样子的。
So here's my unit test procedure.
所以这就是我的单元测试流程。
Because it will be easier to unit test.
因为这样做单元测试比较容易。
应用推荐